Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> #include <math.h> int main(int argc, const char * argv[]) { int n; scanf("%d", &n); int game[n][3]; int result[n][3]; int i, j, k; for (i = 0; i < n; i++) { for (j = 0; j < 3; j++) { scanf("%d", & game[i][j]); result[i][j] = game[i][j]; } } for (j = 0; j < 3; j++) { for (i = 0; i < n; i++) { for (k = 0; k < n; k++) { if (k != i) { if (game[i][j] == game[k][j]) { result[i][j] = 0; } } } } } for (i = 0; i < n; i++) { int sum = 0; for (j = 0; j < 3; j++) { sum += result[i][j]; } printf("%d\n", sum); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181609/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181609/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(i32 noundef %argc, ptr nocapture noundef readnone %argv) 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 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca [3 x i32], i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = zext i32 %3 to i64 %vla1 = alloca [3 x i32], i64 %4, align 16 %cmp99 = icmp sgt i32 %3, 0 br i1 %cmp99, label %for.cond2.preheader, label %for.end69 for.cond2.preheader: ; preds = %entry, %for.cond2.preheader %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond2.preheader ], [ 0, %entry ] %arrayidx6 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 0 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6) %5 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %arrayidx15 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv, i64 0 store i32 %5, ptr %arrayidx15, align 4, !tbaa !5 %arrayidx6.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 1 %call7.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.1) %6 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5 %arrayidx15.1 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv, i64 1 store i32 %6, ptr %arrayidx15.1, align 4, !tbaa !5 %arrayidx6.2 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 2 %call7.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.2) %7 = load i32, ptr %arrayidx6.2, align 4, !tbaa !5 %arrayidx15.2 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv, i64 2 store i32 %7, ptr %arrayidx15.2, align 4, !tbaa !5 %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.cond2.preheader, label %for.cond19.preheader, !llvm.loop !9 for.cond19.preheader: ; preds = %for.cond2.preheader %cmp23103 = icmp sgt i32 %8, 0 br i1 %cmp23103, label %for.cond22.preheader.us.preheader, label %for.end69 for.cond22.preheader.us.preheader: ; preds = %for.cond19.preheader %wide.trip.count120 = zext i32 %8 to i64 %10 = add nsw i64 %wide.trip.count120, -1 %xtraiter = and i64 %wide.trip.count120, 1 %11 = icmp eq i64 %10, 0 %unroll_iter = and i64 %wide.trip.count120, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond25.preheader.us.us for.cond25.preheader.us.us: ; preds = %for.cond25.for.inc47_crit_edge.us.us, %for.cond22.preheader.us.preheader %indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.cond25.for.inc47_crit_edge.us.us ], [ 0, %for.cond22.preheader.us.preheader ] %arrayidx32.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv117, i64 0 %arrayidx42.us.us = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv117, i64 0 br i1 %11, label %for.cond25.for.inc47_crit_edge.us.us.unr-lcssa, label %for.body27.us.us for.body27.us.us: ; preds = %for.cond25.preheader.us.us, %for.inc44.us.us.1145 %indvars.iv114 = phi i64 [ %indvars.iv.next115.1144, %for.inc44.us.us.1145 ], [ 0, %for.cond25.preheader.us.us ] %niter = phi i64 [ %niter.next.1, %for.inc44.us.us.1145 ], [ 0, %for.cond25.preheader.us.us ] %cmp28.not.us.us = icmp eq i64 %indvars.iv114, %indvars.iv117 br i1 %cmp28.not.us.us, label %for.inc44.us.us, label %if.then.us.us if.then.us.us: ; preds = %for.body27.us.us %12 = load i32, ptr %arrayidx32.us.us, align 4, !tbaa !5 %arrayidx36.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114, i64 0 %13 = load i32, ptr %arrayidx36.us.us, align 8, !tbaa !5 %cmp37.us.us = icmp eq i32 %12, %13 br i1 %cmp37.us.us, label %if.then38.us.us, label %for.inc44.us.us if.then38.us.us: ; preds = %if.then.us.us store i32 0, ptr %arrayidx42.us.us, align 4, !tbaa !5 br label %for.inc44.us.us for.inc44.us.us: ; preds = %if.then38.us.us, %if.then.us.us, %for.body27.us.us %indvars.iv.next115 = or i64 %indvars.iv114, 1 %cmp28.not.us.us.1138 = icmp eq i64 %indvars.iv.next115, %indvars.iv117 br i1 %cmp28.not.us.us.1138, label %for.inc44.us.us.1145, label %if.then.us.us.1142 if.then.us.us.1142: ; preds = %for.inc44.us.us %14 = load i32, ptr %arrayidx32.us.us, align 4, !tbaa !5 %arrayidx36.us.us.1140 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next115, i64 0 %15 = load i32, ptr %arrayidx36.us.us.1140, align 4, !tbaa !5 %cmp37.us.us.1141 = icmp eq i32 %14, %15 br i1 %cmp37.us.us.1141, label %if.then38.us.us.1143, label %for.inc44.us.us.1145 if.then38.us.us.1143: ; preds = %if.then.us.us.1142 store i32 0, ptr %arrayidx42.us.us, align 4, !tbaa !5 br label %for.inc44.us.us.1145 for.inc44.us.us.1145: ; preds = %if.then38.us.us.1143, %if.then.us.us.1142, %for.inc44.us.us %indvars.iv.next115.1144 = add nuw nsw i64 %indvars.iv114, 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.cond25.for.inc47_crit_edge.us.us.unr-lcssa, label %for.body27.us.us, !llvm.loop !11 for.cond25.for.inc47_crit_edge.us.us.unr-lcssa: ; preds = %for.inc44.us.us.1145, %for.cond25.preheader.us.us %indvars.iv114.unr = phi i64 [ 0, %for.cond25.preheader.us.us ], [ %indvars.iv.next115.1144, %for.inc44.us.us.1145 ] %cmp28.not.us.us.epil = icmp eq i64 %indvars.iv114.unr, %indvars.iv117 %or.cond = select i1 %lcmp.mod.not, i1 true, i1 %cmp28.not.us.us.epil br i1 %or.cond, label %for.cond25.for.inc47_crit_edge.us.us, label %if.then.us.us.epil if.then.us.us.epil: ; preds = %for.cond25.for.inc47_crit_edge.us.us.unr-lcssa %16 = load i32, ptr %arrayidx32.us.us, align 4, !tbaa !5 %arrayidx36.us.us.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114.unr, i64 0 %17 = load i32, ptr %arrayidx36.us.us.epil, align 4, !tbaa !5 %cmp37.us.us.epil = icmp eq i32 %16, %17 br i1 %cmp37.us.us.epil, label %if.then38.us.us.epil, label %for.cond25.for.inc47_crit_edge.us.us if.then38.us.us.epil: ; preds = %if.then.us.us.epil store i32 0, ptr %arrayidx42.us.us, align 4, !tbaa !5 br label %for.cond25.for.inc47_crit_edge.us.us for.cond25.for.inc47_crit_edge.us.us: ; preds = %if.then.us.us.epil, %if.then38.us.us.epil, %for.cond25.for.inc47_crit_edge.us.us.unr-lcssa %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120 br i1 %exitcond121.not, label %for.cond25.preheader.us.us.1.preheader, label %for.cond25.preheader.us.us, !llvm.loop !12 for.cond25.preheader.us.us.1.preheader: ; preds = %for.cond25.for.inc47_crit_edge.us.us %xtraiter146 = and i64 %wide.trip.count120, 1 %18 = icmp eq i64 %10, 0 %unroll_iter148 = and i64 %wide.trip.count120, 4294967294 %lcmp.mod147.not = icmp eq i64 %xtraiter146, 0 br label %for.cond25.preheader.us.us.1 for.cond25.preheader.us.us.1: ; preds = %for.cond25.preheader.us.us.1.preheader, %for.cond25.for.inc47_crit_edge.us.us.1 %indvars.iv117.1 = phi i64 [ %indvars.iv.next118.1, %for.cond25.for.inc47_crit_edge.us.us.1 ], [ 0, %for.cond25.preheader.us.us.1.preheader ] %arrayidx32.us.us.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv117.1, i64 1 %arrayidx42.us.us.1 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv117.1, i64 1 br i1 %18, label %for.cond25.for.inc47_crit_edge.us.us.1.unr-lcssa, label %for.body27.us.us.1 for.body27.us.us.1: ; preds = %for.cond25.preheader.us.us.1, %for.inc44.us.us.1.1 %indvars.iv114.1 = phi i64 [ %indvars.iv.next115.1.1, %for.inc44.us.us.1.1 ], [ 0, %for.cond25.preheader.us.us.1 ] %niter149 = phi i64 [ %niter149.next.1, %for.inc44.us.us.1.1 ], [ 0, %for.cond25.preheader.us.us.1 ] %cmp28.not.us.us.1 = icmp eq i64 %indvars.iv114.1, %indvars.iv117.1 br i1 %cmp28.not.us.us.1, label %for.inc44.us.us.1, label %if.then.us.us.1 if.then.us.us.1: ; preds = %for.body27.us.us.1 %19 = load i32, ptr %arrayidx32.us.us.1, align 4, !tbaa !5 %arrayidx36.us.us.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114.1, i64 1 %20 = load i32, ptr %arrayidx36.us.us.1, align 4, !tbaa !5 %cmp37.us.us.1 = icmp eq i32 %19, %20 br i1 %cmp37.us.us.1, label %if.then38.us.us.1, label %for.inc44.us.us.1 if.then38.us.us.1: ; preds = %if.then.us.us.1 store i32 0, ptr %arrayidx42.us.us.1, align 4, !tbaa !5 br label %for.inc44.us.us.1 for.inc44.us.us.1: ; preds = %if.then38.us.us.1, %if.then.us.us.1, %for.body27.us.us.1 %indvars.iv.next115.1 = or i64 %indvars.iv114.1, 1 %cmp28.not.us.us.1.1 = icmp eq i64 %indvars.iv.next115.1, %indvars.iv117.1 br i1 %cmp28.not.us.us.1.1, label %for.inc44.us.us.1.1, label %if.then.us.us.1.1 if.then.us.us.1.1: ; preds = %for.inc44.us.us.1 %21 = load i32, ptr %arrayidx32.us.us.1, align 4, !tbaa !5 %arrayidx36.us.us.1.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next115.1, i64 1 %22 = load i32, ptr %arrayidx36.us.us.1.1, align 8, !tbaa !5 %cmp37.us.us.1.1 = icmp eq i32 %21, %22 br i1 %cmp37.us.us.1.1, label %if.then38.us.us.1.1, label %for.inc44.us.us.1.1 if.then38.us.us.1.1: ; preds = %if.then.us.us.1.1 store i32 0, ptr %arrayidx42.us.us.1, align 4, !tbaa !5 br label %for.inc44.us.us.1.1 for.inc44.us.us.1.1: ; preds = %if.then38.us.us.1.1, %if.then.us.us.1.1, %for.inc44.us.us.1 %indvars.iv.next115.1.1 = add nuw nsw i64 %indvars.iv114.1, 2 %niter149.next.1 = add i64 %niter149, 2 %niter149.ncmp.1 = icmp eq i64 %niter149.next.1, %unroll_iter148 br i1 %niter149.ncmp.1, label %for.cond25.for.inc47_crit_edge.us.us.1.unr-lcssa, label %for.body27.us.us.1, !llvm.loop !11 for.cond25.for.inc47_crit_edge.us.us.1.unr-lcssa: ; preds = %for.inc44.us.us.1.1, %for.cond25.preheader.us.us.1 %indvars.iv114.1.unr = phi i64 [ 0, %for.cond25.preheader.us.us.1 ], [ %indvars.iv.next115.1.1, %for.inc44.us.us.1.1 ] %cmp28.not.us.us.1.epil = icmp eq i64 %indvars.iv114.1.unr, %indvars.iv117.1 %or.cond154 = select i1 %lcmp.mod147.not, i1 true, i1 %cmp28.not.us.us.1.epil br i1 %or.cond154, label %for.cond25.for.inc47_crit_edge.us.us.1, label %if.then.us.us.1.epil if.then.us.us.1.epil: ; preds = %for.cond25.for.inc47_crit_edge.us.us.1.unr-lcssa %23 = load i32, ptr %arrayidx32.us.us.1, align 4, !tbaa !5 %arrayidx36.us.us.1.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114.1.unr, i64 1 %24 = load i32, ptr %arrayidx36.us.us.1.epil, align 4, !tbaa !5 %cmp37.us.us.1.epil = icmp eq i32 %23, %24 br i1 %cmp37.us.us.1.epil, label %if.then38.us.us.1.epil, label %for.cond25.for.inc47_crit_edge.us.us.1 if.then38.us.us.1.epil: ; preds = %if.then.us.us.1.epil store i32 0, ptr %arrayidx42.us.us.1, align 4, !tbaa !5 br label %for.cond25.for.inc47_crit_edge.us.us.1 for.cond25.for.inc47_crit_edge.us.us.1: ; preds = %if.then.us.us.1.epil, %if.then38.us.us.1.epil, %for.cond25.for.inc47_crit_edge.us.us.1.unr-lcssa %indvars.iv.next118.1 = add nuw nsw i64 %indvars.iv117.1, 1 %exitcond121.1.not = icmp eq i64 %indvars.iv.next118.1, %wide.trip.count120 br i1 %exitcond121.1.not, label %for.cond25.preheader.us.us.2.preheader, label %for.cond25.preheader.us.us.1, !llvm.loop !12 for.cond25.preheader.us.us.2.preheader: ; preds = %for.cond25.for.inc47_crit_edge.us.us.1 %xtraiter150 = and i64 %wide.trip.count120, 1 %25 = icmp eq i64 %10, 0 %unroll_iter152 = and i64 %wide.trip.count120, 4294967294 %lcmp.mod151.not = icmp eq i64 %xtraiter150, 0 br label %for.cond25.preheader.us.us.2 for.cond25.preheader.us.us.2: ; preds = %for.cond25.preheader.us.us.2.preheader, %for.cond25.for.inc47_crit_edge.us.us.2 %indvars.iv117.2 = phi i64 [ %indvars.iv.next118.2, %for.cond25.for.inc47_crit_edge.us.us.2 ], [ 0, %for.cond25.preheader.us.us.2.preheader ] %arrayidx32.us.us.2 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv117.2, i64 2 %arrayidx42.us.us.2 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv117.2, i64 2 br i1 %25, label %for.cond25.for.inc47_crit_edge.us.us.2.unr-lcssa, label %for.body27.us.us.2 for.body27.us.us.2: ; preds = %for.cond25.preheader.us.us.2, %for.inc44.us.us.2.1 %indvars.iv114.2 = phi i64 [ %indvars.iv.next115.2.1, %for.inc44.us.us.2.1 ], [ 0, %for.cond25.preheader.us.us.2 ] %niter153 = phi i64 [ %niter153.next.1, %for.inc44.us.us.2.1 ], [ 0, %for.cond25.preheader.us.us.2 ] %cmp28.not.us.us.2 = icmp eq i64 %indvars.iv114.2, %indvars.iv117.2 br i1 %cmp28.not.us.us.2, label %for.inc44.us.us.2, label %if.then.us.us.2 if.then.us.us.2: ; preds = %for.body27.us.us.2 %26 = load i32, ptr %arrayidx32.us.us.2, align 4, !tbaa !5 %arrayidx36.us.us.2 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114.2, i64 2 %27 = load i32, ptr %arrayidx36.us.us.2, align 8, !tbaa !5 %cmp37.us.us.2 = icmp eq i32 %26, %27 br i1 %cmp37.us.us.2, label %if.then38.us.us.2, label %for.inc44.us.us.2 if.then38.us.us.2: ; preds = %if.then.us.us.2 store i32 0, ptr %arrayidx42.us.us.2, align 4, !tbaa !5 br label %for.inc44.us.us.2 for.inc44.us.us.2: ; preds = %if.then38.us.us.2, %if.then.us.us.2, %for.body27.us.us.2 %indvars.iv.next115.2 = or i64 %indvars.iv114.2, 1 %cmp28.not.us.us.2.1 = icmp eq i64 %indvars.iv.next115.2, %indvars.iv117.2 br i1 %cmp28.not.us.us.2.1, label %for.inc44.us.us.2.1, label %if.then.us.us.2.1 if.then.us.us.2.1: ; preds = %for.inc44.us.us.2 %28 = load i32, ptr %arrayidx32.us.us.2, align 4, !tbaa !5 %arrayidx36.us.us.2.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next115.2, i64 2 %29 = load i32, ptr %arrayidx36.us.us.2.1, align 4, !tbaa !5 %cmp37.us.us.2.1 = icmp eq i32 %28, %29 br i1 %cmp37.us.us.2.1, label %if.then38.us.us.2.1, label %for.inc44.us.us.2.1 if.then38.us.us.2.1: ; preds = %if.then.us.us.2.1 store i32 0, ptr %arrayidx42.us.us.2, align 4, !tbaa !5 br label %for.inc44.us.us.2.1 for.inc44.us.us.2.1: ; preds = %if.then38.us.us.2.1, %if.then.us.us.2.1, %for.inc44.us.us.2 %indvars.iv.next115.2.1 = add nuw nsw i64 %indvars.iv114.2, 2 %niter153.next.1 = add i64 %niter153, 2 %niter153.ncmp.1 = icmp eq i64 %niter153.next.1, %unroll_iter152 br i1 %niter153.ncmp.1, label %for.cond25.for.inc47_crit_edge.us.us.2.unr-lcssa, label %for.body27.us.us.2, !llvm.loop !11 for.cond25.for.inc47_crit_edge.us.us.2.unr-lcssa: ; preds = %for.inc44.us.us.2.1, %for.cond25.preheader.us.us.2 %indvars.iv114.2.unr = phi i64 [ 0, %for.cond25.preheader.us.us.2 ], [ %indvars.iv.next115.2.1, %for.inc44.us.us.2.1 ] %cmp28.not.us.us.2.epil = icmp eq i64 %indvars.iv114.2.unr, %indvars.iv117.2 %or.cond155 = select i1 %lcmp.mod151.not, i1 true, i1 %cmp28.not.us.us.2.epil br i1 %or.cond155, label %for.cond25.for.inc47_crit_edge.us.us.2, label %if.then.us.us.2.epil if.then.us.us.2.epil: ; preds = %for.cond25.for.inc47_crit_edge.us.us.2.unr-lcssa %30 = load i32, ptr %arrayidx32.us.us.2, align 4, !tbaa !5 %arrayidx36.us.us.2.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv114.2.unr, i64 2 %31 = load i32, ptr %arrayidx36.us.us.2.epil, align 4, !tbaa !5 %cmp37.us.us.2.epil = icmp eq i32 %30, %31 br i1 %cmp37.us.us.2.epil, label %if.then38.us.us.2.epil, label %for.cond25.for.inc47_crit_edge.us.us.2 if.then38.us.us.2.epil: ; preds = %if.then.us.us.2.epil store i32 0, ptr %arrayidx42.us.us.2, align 4, !tbaa !5 br label %for.cond25.for.inc47_crit_edge.us.us.2 for.cond25.for.inc47_crit_edge.us.us.2: ; preds = %if.then.us.us.2.epil, %if.then38.us.us.2.epil, %for.cond25.for.inc47_crit_edge.us.us.2.unr-lcssa %indvars.iv.next118.2 = add nuw nsw i64 %indvars.iv117.2, 1 %exitcond121.2.not = icmp eq i64 %indvars.iv.next118.2, %wide.trip.count120 br i1 %exitcond121.2.not, label %for.cond53.preheader, label %for.cond25.preheader.us.us.2, !llvm.loop !12 for.cond53.preheader: ; preds = %for.cond25.for.inc47_crit_edge.us.us.2 br i1 %cmp23103, label %for.cond56.preheader, label %for.end69 for.cond56.preheader: ; preds = %for.cond53.preheader, %for.cond56.preheader %indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.cond56.preheader ], [ 0, %for.cond53.preheader ] %arrayidx62 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv130, i64 0 %32 = load i32, ptr %arrayidx62, align 4, !tbaa !5 %arrayidx62.1 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv130, i64 1 %33 = load i32, ptr %arrayidx62.1, align 4, !tbaa !5 %add.1 = add nsw i32 %33, %32 %arrayidx62.2 = getelementptr inbounds [3 x i32], ptr %vla1, i64 %indvars.iv130, i64 2 %34 = load i32, ptr %arrayidx62.2, align 4, !tbaa !5 %add.2 = add nsw i32 %34, %add.1 %call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.2) %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %35 = load i32, ptr %n, align 4, !tbaa !5 %36 = sext i32 %35 to i64 %cmp54 = icmp slt i64 %indvars.iv.next131, %36 br i1 %cmp54, label %for.cond56.preheader, label %for.end69, !llvm.loop !13 for.end69: ; preds = %for.cond56.preheader, %entry, %for.cond19.preheader, %for.cond53.preheader call void @llvm.stackrestore.p0(ptr %2) 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} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <time.h> typedef long long ll; typedef long double ld; #define INF (1LL<<60) #define MOD1 1000000007 /*swap 交換*/ void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;} /*2つのうち大きい数を返す*/ ll max2(ll a,ll b){return a>=b?a:b;} /*2つのうち小さい数を返す*/ ll min2(ll a,ll b){return a>=b?b:a;} /*絶対値*/ ll ABS(ll a){return a>=0?a:(-a);} typedef struct{ ll aa; ll bb; }frequent; // 小大 int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;} /*[a]+1 ガウス+1*/ ll p_gauss(ld a){ll b=a;return a==b?b:p_gauss(b+1);} int main(void){ ll n,k,i,ans=0,one; scanf("%lld%lld",&n,&k); ll a[n]; for(i=0;i<n;i++){ scanf("%lld",&a[i]); if(a[i]==1) one=i+1; } ans=p_gauss((ld) (n-1)/(k-1)) ; printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181667/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181667/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 [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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %b, align 8, !tbaa !5 %1 = load i64, ptr %a, align 8, !tbaa !5 store i64 %1, ptr %b, align 8, !tbaa !5 store i64 %0, ptr %a, align 8, !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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true) ret i64 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %sub = sub nsw i64 %0, %1 %conv = trunc i64 %sub to i32 ret i32 %conv } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @p_gauss(x86_fp80 noundef %a) local_unnamed_addr #4 { entry: %conv7 = fptosi x86_fp80 %a to i64 %conv18 = sitofp i64 %conv7 to x86_fp80 %cmp9 = fcmp une x86_fp80 %conv18, %a %0 = zext i1 %cmp9 to i64 %conv.lcssa = add nsw i64 %conv7, %0 ret i64 %conv.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #5 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i64, i64 %0, align 16 %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp12 = icmp sgt i64 %2, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.013 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.013 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.013, 1 %3 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %.lcssa = phi i64 [ %2, %entry ], [ %3, %for.body ] %sub = add nsw i64 %.lcssa, -1 %conv = sitofp i64 %sub to x86_fp80 %4 = load i64, ptr %k, align 8, !tbaa !5 %sub4 = add nsw i64 %4, -1 %conv5 = sitofp i64 %sub4 to x86_fp80 %div = fdiv x86_fp80 %conv, %conv5 %conv7.i = fptosi x86_fp80 %div to i64 %conv18.i = sitofp i64 %conv7.i to x86_fp80 %cmp9.i = fcmp une x86_fp80 %div, %conv18.i %5 = zext i1 %cmp9.i to i64 %conv.lcssa.i = add nsw i64 %5, %conv7.i %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %conv.lcssa.i) call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #9 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #7 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #7 ; 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.smin.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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { 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 #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 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 #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main() { int t; int a,b,c,d,k,x,y; scanf("%d",&t); while(t--) { scanf("%d %d %d %d %d",&a,&b,&c,&d,&k); //x=a/c; //y=b/d; if(a%c) x=a/c+1; else x=a/c; if(b%d) y=b/d+1; else y=b/d; if(x+y>k) printf("-1\n"); else printf("%d %d\n",x,y); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18171/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18171/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 [15 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 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 %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 %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 %tobool2.not = icmp ne i32 %rem, 0 %div3 = sdiv i32 %1, %2 %add = zext i1 %tobool2.not to i32 %x.0 = add nsw i32 %div3, %add %3 = load i32, ptr %b, align 4, !tbaa !5 %4 = load i32, ptr %d, align 4, !tbaa !5 %rem4 = srem i32 %3, %4 %tobool5.not = icmp ne i32 %rem4, 0 %div10 = sdiv i32 %3, %4 %add8 = zext i1 %tobool5.not to i32 %y.0 = add nsw i32 %div10, %add8 %add12 = add nsw i32 %y.0, %x.0 %5 = load i32, ptr %k, align 4, !tbaa !5 %cmp = icmp sgt i32 %add12, %5 br i1 %cmp, 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 %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 %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 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(void){ int N,K; scanf("%d %d",&N,&K); int A[N]; int i,ans; for(i=0;i<N;i++){ scanf("%d",&A[i]); } ans = (int)(ceil((double)(N-1)/(K-1))); printf("%d",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181760/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181760/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 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5 %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 %cmp8 = icmp sgt i32 %3, 0 br i1 %cmp8, label %for.body, label %for.end 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 %4 = load i32, ptr %N, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %.lcssa = phi i32 [ %3, %entry ], [ %4, %for.body ] %sub = add nsw i32 %.lcssa, -1 %conv = sitofp i32 %sub to double %6 = load i32, ptr %K, align 4, !tbaa !5 %sub2 = add nsw i32 %6, -1 %conv3 = sitofp i32 %sub2 to double %div = fdiv double %conv, %conv3 %7 = call double @llvm.ceil.f64(double %div) %conv4 = fptosi double %7 to i32 %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv4) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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 willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.ceil.f64(double) #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 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"}
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <stdint.h> #include <string.h> #include <wchar.h> #define MIN(a, b) (a < b ? a : b) #define MAX(a, b) (a > b ? a : b) static uint32_t A[100000]; int main(void) { uint32_t N, K; scanf("%"PRIu32"\n%"PRIu32"\n", &N, &K); for (uint32_t idx = 0; idx < N - 1; idx++) { scanf("%"PRIu32"\n", &(A[idx])); } scanf("%"PRIu32, &(A[N - 1])); printf("%"PRIu32, 1 + (N == K ? 0 : (N - 2)/(K - 1))); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181803/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181803/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"%u\0A%u\0A\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%u\0A\00", align 1 @A = internal global [100000 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [3 x i8] c"%u\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) #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 %cmp14.not = icmp eq i32 %0, 1 br i1 %cmp14.not, label %for.cond.cleanup, label %for.body for.cond.cleanup.loopexit: ; preds = %for.body %1 = zext i32 %sub to i64 br label %for.cond.cleanup for.cond.cleanup: ; preds = %entry, %for.cond.cleanup.loopexit %sub.lcssa = phi i64 [ %1, %for.cond.cleanup.loopexit ], [ 0, %entry ] %arrayidx4 = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %sub.lcssa %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx4) %2 = load i32, ptr %N, align 4, !tbaa !5 %3 = load i32, ptr %K, align 4, !tbaa !5 %cmp6 = icmp eq i32 %2, %3 br i1 %cmp6, label %cond.end, label %cond.false 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 %4 = load i32, ptr %N, align 4, !tbaa !5 %sub = add i32 %4, -1 %5 = zext i32 %sub to i64 %cmp = icmp ult i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9 cond.false: ; preds = %for.cond.cleanup %sub7 = add i32 %2, -2 %sub8 = add i32 %3, -1 %div = udiv i32 %sub7, %sub8 %6 = add i32 %div, 1 br label %cond.end cond.end: ; preds = %for.cond.cleanup, %cond.false %cond = phi i32 [ %6, %cond.false ], [ 1, %for.cond.cleanup ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cond) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(){ int n,max,mi,k,d; while(scanf("%d %d",&n,&max),n||max){ int b[150]={0}; while(n--){ scanf("%d",&k); while(k--){ scanf("%d",&d); b[d]++; } } max--; for(n=mi=0;n<101;n++){ if(max<b[n])max=b[mi=n]; } printf("%d\n",mi); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181847/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181847/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 %max = alloca i32, align 4 %k = alloca i32, align 4 %d = alloca i32, align 4 %b = alloca [150 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 %max) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %max) %0 = load i32, ptr %n, align 4, !tbaa !5 %tobool29 = icmp ne i32 %0, 0 %1 = load i32, ptr %max, align 4 %tobool130 = icmp ne i32 %1, 0 %2 = select i1 %tobool29, i1 true, i1 %tobool130 br i1 %2, label %while.body, label %while.end20 while.body: ; preds = %entry, %for.end %3 = phi i32 [ %25, %for.end ], [ %1, %entry ] %4 = phi i32 [ %24, %for.end ], [ %0, %entry ] call void @llvm.lifetime.start.p0(i64 600, ptr nonnull %b) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600) %b, i8 0, i64 600, i1 false) %dec24 = add nsw i32 %4, -1 store i32 %dec24, ptr %n, align 4, !tbaa !5 %tobool3.not25 = icmp eq i32 %4, 0 br i1 %tobool3.not25, label %while.end11, label %while.body4 while.cond2.loopexit: ; preds = %while.body9, %while.body4 %5 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %5, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool3.not = icmp eq i32 %5, 0 br i1 %tobool3.not, label %while.end11.loopexit, label %while.body4, !llvm.loop !9 while.body4: ; preds = %while.body, %while.cond2.loopexit %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k) %6 = load i32, ptr %k, align 4, !tbaa !5 %dec722 = add nsw i32 %6, -1 store i32 %dec722, ptr %k, align 4, !tbaa !5 %tobool8.not23 = icmp eq i32 %6, 0 br i1 %tobool8.not23, label %while.cond2.loopexit, label %while.body9 while.body9: ; preds = %while.body4, %while.body9 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d) %7 = load i32, ptr %d, align 4, !tbaa !5 %idxprom = sext i32 %7 to i64 %arrayidx = getelementptr inbounds [150 x i32], ptr %b, i64 0, i64 %idxprom %8 = load i32, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %8, 1 store i32 %inc, ptr %arrayidx, align 4, !tbaa !5 %9 = load i32, ptr %k, align 4, !tbaa !5 %dec7 = add nsw i32 %9, -1 store i32 %dec7, ptr %k, align 4, !tbaa !5 %tobool8.not = icmp eq i32 %9, 0 br i1 %tobool8.not, label %while.cond2.loopexit, label %while.body9, !llvm.loop !11 while.end11.loopexit: ; preds = %while.cond2.loopexit %.pre = load i32, ptr %max, align 4, !tbaa !5 br label %while.end11 while.end11: ; preds = %while.end11.loopexit, %while.body %10 = phi i32 [ %.pre, %while.end11.loopexit ], [ %3, %while.body ] %dec12 = add nsw i32 %10, -1 store i32 %dec12, ptr %max, align 4, !tbaa !5 br label %for.body for.body: ; preds = %for.inc.3, %while.end11 %indvars.iv = phi i64 [ 0, %while.end11 ], [ %indvars.iv.next.3, %for.inc.3 ] %mi.027 = phi i32 [ 0, %while.end11 ], [ %mi.1.3, %for.inc.3 ] %11 = phi i32 [ %dec12, %while.end11 ], [ %23, %for.inc.3 ] %arrayidx14 = getelementptr inbounds [150 x i32], ptr %b, i64 0, i64 %indvars.iv %12 = load i32, ptr %arrayidx14, align 16, !tbaa !5 %cmp15 = icmp slt i32 %11, %12 br i1 %cmp15, label %if.then, label %for.inc if.then: ; preds = %for.body store i32 %12, ptr %max, align 4, !tbaa !5 %13 = trunc i64 %indvars.iv to i32 br label %for.inc for.inc: ; preds = %for.body, %if.then %14 = phi i32 [ %12, %if.then ], [ %11, %for.body ] %mi.1 = phi i32 [ %13, %if.then ], [ %mi.027, %for.body ] %indvars.iv.next = or i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 101 br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !12 for.body.1: ; preds = %for.inc %arrayidx14.1 = getelementptr inbounds [150 x i32], ptr %b, i64 0, i64 %indvars.iv.next %15 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5 %cmp15.1 = icmp slt i32 %14, %15 br i1 %cmp15.1, label %if.then.1, label %for.inc.1 if.then.1: ; preds = %for.body.1 store i32 %15, ptr %max, align 4, !tbaa !5 %16 = trunc i64 %indvars.iv.next to i32 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.body.1 %17 = phi i32 [ %15, %if.then.1 ], [ %14, %for.body.1 ] %mi.1.1 = phi i32 [ %16, %if.then.1 ], [ %mi.1, %for.body.1 ] %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx14.2 = getelementptr inbounds [150 x i32], ptr %b, i64 0, i64 %indvars.iv.next.1 %18 = load i32, ptr %arrayidx14.2, align 8, !tbaa !5 %cmp15.2 = icmp slt i32 %17, %18 br i1 %cmp15.2, label %if.then.2, label %for.inc.2 if.then.2: ; preds = %for.inc.1 store i32 %18, ptr %max, align 4, !tbaa !5 %19 = trunc i64 %indvars.iv.next.1 to i32 br label %for.inc.2 for.inc.2: ; preds = %if.then.2, %for.inc.1 %20 = phi i32 [ %18, %if.then.2 ], [ %17, %for.inc.1 ] %mi.1.2 = phi i32 [ %19, %if.then.2 ], [ %mi.1.1, %for.inc.1 ] %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx14.3 = getelementptr inbounds [150 x i32], ptr %b, i64 0, i64 %indvars.iv.next.2 %21 = load i32, ptr %arrayidx14.3, align 4, !tbaa !5 %cmp15.3 = icmp slt i32 %20, %21 br i1 %cmp15.3, label %if.then.3, label %for.inc.3 if.then.3: ; preds = %for.inc.2 store i32 %21, ptr %max, align 4, !tbaa !5 %22 = trunc i64 %indvars.iv.next.2 to i32 br label %for.inc.3 for.inc.3: ; preds = %if.then.3, %for.inc.2 %23 = phi i32 [ %21, %if.then.3 ], [ %20, %for.inc.2 ] %mi.1.3 = phi i32 [ %22, %if.then.3 ], [ %mi.1.2, %for.inc.2 ] %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 br label %for.body for.end: ; preds = %for.inc store i32 101, ptr %n, align 4, !tbaa !5 %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mi.1) call void @llvm.lifetime.end.p0(i64 600, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %max) %24 = load i32, ptr %n, align 4, !tbaa !5 %tobool = icmp ne i32 %24, 0 %25 = load i32, ptr %max, align 4 %tobool1 = icmp ne i32 %25, 0 %26 = select i1 %tobool, i1 true, i1 %tobool1 br i1 %26, label %while.body, label %while.end20, !llvm.loop !13 while.end20: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %max) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree 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 @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 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 = !{!"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> #define MAX 30 int ans,x,y; int t[MAX][MAX],size[MAX]; int flg[MAX]; int isDomSet(void){ int i,j; for(i=0;i<x;i++){ if(!flg[i]){ for(j=0;j<size[i];j++) if(flg[t[i][j]]) break; if(j == size[i]) return 0; } } return 1; } void solve(int idx,int cost){ if(idx == x){ if(ans > cost && isDomSet()) ans = cost; return; } flg[idx] = 0; solve(idx+1,cost); flg[idx] = 1; solve(idx+1,cost+1); } int main(void){ int i,from,to; while(scanf("%d%d",&x,&y) && (x||y)){ memset(t,0,sizeof(t)); memset(size,0,sizeof(size)); for(i=0;i<y;i++){ scanf("%d%d",&from,&to); t[from][size[from]++] = to; t[to][size[to]++]= from; } ans = x; solve(0,0); printf("%d\n",ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181890/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181890/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @x = dso_local global i32 0, align 4 @flg = dso_local local_unnamed_addr global [30 x i32] zeroinitializer, align 16 @size = dso_local local_unnamed_addr global [30 x i32] zeroinitializer, align 16 @t = dso_local local_unnamed_addr global [30 x [30 x i32]] zeroinitializer, align 16 @ans = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @y = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @isDomSet() local_unnamed_addr #0 { entry: %0 = load i32, ptr @x, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body.preheader, label %cleanup for.body.preheader: ; preds = %entry %wide.trip.count45 = zext i32 %0 to i64 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc20 %indvars.iv42 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next43, %for.inc20 ] %arrayidx = getelementptr inbounds [30 x i32], ptr @flg, i64 0, i64 %indvars.iv42 %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %tobool.not = icmp eq i32 %1, 0 br i1 %tobool.not, label %for.cond1.preheader, label %for.inc20 for.cond1.preheader: ; preds = %for.body %arrayidx3 = getelementptr inbounds [30 x i32], ptr @size, i64 0, i64 %indvars.iv42 %2 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp432 = icmp sgt i32 %2, 0 br i1 %cmp432, label %for.body5.preheader, label %for.end for.body5.preheader: ; preds = %for.cond1.preheader %wide.trip.count = zext i32 %2 to i64 br label %for.body5 for.body5: ; preds = %for.body5.preheader, %for.inc %indvars.iv = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next, %for.inc ] %arrayidx9 = getelementptr inbounds [30 x [30 x i32]], ptr @t, i64 0, i64 %indvars.iv42, i64 %indvars.iv %3 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %idxprom10 = sext i32 %3 to i64 %arrayidx11 = getelementptr inbounds [30 x i32], ptr @flg, i64 0, i64 %idxprom10 %4 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %tobool12.not = icmp eq i32 %4, 0 br i1 %tobool12.not, label %for.inc, label %for.end.loopexit for.inc: ; preds = %for.body5 %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 %cleanup, label %for.body5, !llvm.loop !9 for.end.loopexit: ; preds = %for.body5 %5 = trunc i64 %indvars.iv to i32 br label %for.end for.end: ; preds = %for.end.loopexit, %for.cond1.preheader %j.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %5, %for.end.loopexit ] %cmp16 = icmp eq i32 %j.0.lcssa, %2 br i1 %cmp16, label %cleanup, label %for.inc20 for.inc20: ; preds = %for.body, %for.end %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 %exitcond46.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count45 br i1 %exitcond46.not, label %cleanup, label %for.body, !llvm.loop !11 cleanup: ; preds = %for.end, %for.inc20, %for.inc, %entry %retval.0 = phi i32 [ 1, %entry ], [ 0, %for.inc ], [ 1, %for.inc20 ], [ 0, %for.end ] 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: 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, argmem: none, inaccessiblemem: none) uwtable define dso_local void @solve(i32 noundef %idx, i32 noundef %cost) local_unnamed_addr #2 { entry: %0 = load i32, ptr @x, align 4, !tbaa !5 %cmp19 = icmp eq i32 %0, %idx br i1 %cmp19, label %if.then, label %if.end3.preheader if.end3.preheader: ; preds = %entry %1 = sext i32 %idx to i64 br label %if.end3 if.then: ; preds = %if.end3, %entry %cost.tr.lcssa = phi i32 [ %cost, %entry ], [ %add7, %if.end3 ] %.lcssa = phi i32 [ %idx, %entry ], [ %8, %if.end3 ] %2 = load i32, ptr @ans, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %2, %cost.tr.lcssa br i1 %cmp1, label %land.lhs.true, label %return land.lhs.true: ; preds = %if.then %cmp37.i = icmp sgt i32 %.lcssa, 0 br i1 %cmp37.i, label %for.body.preheader.i, label %if.then2 for.body.preheader.i: ; preds = %land.lhs.true %wide.trip.count45.i = zext i32 %.lcssa to i64 br label %for.body.i for.body.i: ; preds = %for.inc20.i, %for.body.preheader.i %indvars.iv42.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next43.i, %for.inc20.i ] %arrayidx.i = getelementptr inbounds [30 x i32], ptr @flg, i64 0, i64 %indvars.iv42.i %3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %tobool.not.i = icmp eq i32 %3, 0 br i1 %tobool.not.i, label %for.cond1.preheader.i, label %for.inc20.i for.cond1.preheader.i: ; preds = %for.body.i %arrayidx3.i = getelementptr inbounds [30 x i32], ptr @size, i64 0, i64 %indvars.iv42.i %4 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5 %cmp432.i = icmp sgt i32 %4, 0 br i1 %cmp432.i, label %for.body5.preheader.i, label %for.end.i for.body5.preheader.i: ; preds = %for.cond1.preheader.i %wide.trip.count.i = zext i32 %4 to i64 br label %for.body5.i for.body5.i: ; preds = %for.inc.i, %for.body5.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body5.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %arrayidx9.i = getelementptr inbounds [30 x [30 x i32]], ptr @t, i64 0, i64 %indvars.iv42.i, i64 %indvars.iv.i %5 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5 %idxprom10.i = sext i32 %5 to i64 %arrayidx11.i = getelementptr inbounds [30 x i32], ptr @flg, i64 0, i64 %idxprom10.i %6 = load i32, ptr %arrayidx11.i, align 4, !tbaa !5 %tobool12.not.i = icmp eq i32 %6, 0 br i1 %tobool12.not.i, label %for.inc.i, label %for.end.loopexit.i for.inc.i: ; preds = %for.body5.i %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 %return, label %for.body5.i, !llvm.loop !9 for.end.loopexit.i: ; preds = %for.body5.i %7 = trunc i64 %indvars.iv.i to i32 br label %for.end.i for.end.i: ; preds = %for.end.loopexit.i, %for.cond1.preheader.i %j.0.lcssa.i = phi i32 [ 0, %for.cond1.preheader.i ], [ %7, %for.end.loopexit.i ] %cmp16.i = icmp eq i32 %j.0.lcssa.i, %4 br i1 %cmp16.i, label %return, label %for.inc20.i for.inc20.i: ; preds = %for.end.i, %for.body.i %indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, 1 %exitcond46.not.i = icmp eq i64 %indvars.iv.next43.i, %wide.trip.count45.i br i1 %exitcond46.not.i, label %if.then2, label %for.body.i, !llvm.loop !11 if.then2: ; preds = %for.inc20.i, %land.lhs.true store i32 %cost.tr.lcssa, ptr @ans, align 4, !tbaa !5 br label %return if.end3: ; preds = %if.end3.preheader, %if.end3 %indvars.iv = phi i64 [ %1, %if.end3.preheader ], [ %indvars.iv.next, %if.end3 ] %cost.tr21 = phi i32 [ %cost, %if.end3.preheader ], [ %add7, %if.end3 ] %arrayidx = getelementptr inbounds [30 x i32], ptr @flg, i64 0, i64 %indvars.iv store i32 0, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add i64 %indvars.iv, 1 %8 = trunc i64 %indvars.iv.next to i32 tail call void @solve(i32 noundef %8, i32 noundef %cost.tr21) store i32 1, ptr %arrayidx, align 4, !tbaa !5 %add7 = add nsw i32 %cost.tr21, 1 %9 = load i32, ptr @x, align 4, !tbaa !5 %cmp = icmp eq i32 %9, %8 br i1 %cmp, label %if.then, label %if.end3 return: ; preds = %for.end.i, %for.inc.i, %if.then, %if.then2 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %from = alloca i32, align 4 %to = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %from) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %to) #6 %call20 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y) %tobool.not21 = icmp eq i32 %call20, 0 br i1 %tobool.not21, label %while.end, label %land.rhs land.rhs: ; preds = %entry, %for.end %0 = load i32, ptr @x, align 4, !tbaa !5 %tobool1 = icmp ne i32 %0, 0 %1 = load i32, ptr @y, align 4 %tobool2 = icmp ne i32 %1, 0 %2 = select i1 %tobool1, i1 true, i1 %tobool2 br i1 %2, label %while.body, label %while.end while.body: ; preds = %land.rhs call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3600) @t, i8 0, i64 3600, i1 false) call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) @size, i8 0, i64 120, i1 false) %cmp18 = icmp sgt i32 %1, 0 br i1 %cmp18, label %for.body, label %for.end for.body: ; preds = %while.body, %for.body %i.019 = phi i32 [ %inc15, %for.body ], [ 0, %while.body ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %from, ptr noundef nonnull %to) %3 = load i32, ptr %to, align 4, !tbaa !5 %4 = load i32, ptr %from, align 4, !tbaa !5 %idxprom = sext i32 %4 to i64 %arrayidx5 = getelementptr inbounds [30 x i32], ptr @size, i64 0, i64 %idxprom %5 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %inc = add nsw i32 %5, 1 store i32 %inc, ptr %arrayidx5, align 4, !tbaa !5 %idxprom6 = sext i32 %5 to i64 %arrayidx7 = getelementptr inbounds [30 x [30 x i32]], ptr @t, i64 0, i64 %idxprom, i64 %idxprom6 store i32 %3, ptr %arrayidx7, align 4, !tbaa !5 %idxprom8 = sext i32 %3 to i64 %arrayidx11 = getelementptr inbounds [30 x i32], ptr @size, i64 0, i64 %idxprom8 %6 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %inc12 = add nsw i32 %6, 1 store i32 %inc12, ptr %arrayidx11, align 4, !tbaa !5 %idxprom13 = sext i32 %6 to i64 %arrayidx14 = getelementptr inbounds [30 x [30 x i32]], ptr @t, i64 0, i64 %idxprom8, i64 %idxprom13 store i32 %4, ptr %arrayidx14, align 4, !tbaa !5 %inc15 = add nuw nsw i32 %i.019, 1 %7 = load i32, ptr @y, align 4, !tbaa !5 %cmp = icmp slt i32 %inc15, %7 br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !12 for.end.loopexit: ; preds = %for.body %.pre = load i32, ptr @x, align 4, !tbaa !5 br label %for.end for.end: ; preds = %for.end.loopexit, %while.body %8 = phi i32 [ %.pre, %for.end.loopexit ], [ %0, %while.body ] store i32 %8, ptr @ans, align 4, !tbaa !5 call void @solve(i32 noundef 0, i32 noundef 0) %9 = load i32, ptr @ans, align 4, !tbaa !5 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y) %tobool.not = icmp eq i32 %call, 0 br i1 %tobool.not, label %while.end, label %land.rhs, !llvm.loop !13 while.end: ; preds = %land.rhs, %for.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %to) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %from) #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 nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 attributes #0 = { nofree norecurse 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 = { 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 #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 nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> char a[1000001]; int main(void) { int n; int i, j; int cnt; a[0] = a[1] = 1; for (i = 2; i * i <= 1000000; i++){ for (j = i * i; j <= 1000000; j += i){ a[j] = 1; } } while (scanf("%d", &n) != EOF){ cnt = 0; for (i = 2; i <= n; i++){ if (a[i] == 0){ cnt++; } } printf("%d\n", cnt); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181933/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181933/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @a = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 store i8 1, ptr getelementptr inbounds ([1000001 x i8], ptr @a, i64 0, i64 1), align 1, !tbaa !5 store i8 1, ptr @a, align 16, !tbaa !5 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.inc5.1, %entry %indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next.1, %for.inc5.1 ] %mul33 = phi i64 [ 4, %entry ], [ %mul.1, %for.inc5.1 ] %0 = and i64 %mul33, 4294967295 br label %for.body4 while.cond.preheader: ; preds = %for.inc5 %call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp7.not38 = icmp eq i32 %call37, -1 br i1 %cmp7.not38, label %while.end, label %for.cond8.preheader for.body4: ; preds = %for.cond2.preheader, %for.body4 %indvars.iv39 = phi i64 [ %0, %for.cond2.preheader ], [ %indvars.iv.next40, %for.body4 ] %arrayidx = getelementptr inbounds [1000001 x i8], ptr @a, i64 0, i64 %indvars.iv39 store i8 1, ptr %arrayidx, align 1, !tbaa !5 %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, %indvars.iv %cmp3 = icmp ult i64 %indvars.iv.next40, 1000001 br i1 %cmp3, label %for.body4, label %for.inc5, !llvm.loop !8 for.inc5: ; preds = %for.body4 %indvars.iv.next = or i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 1001 br i1 %exitcond.not, label %while.cond.preheader, label %for.cond2.preheader.1, !llvm.loop !10 for.cond2.preheader.1: ; preds = %for.inc5 %mul = mul i64 %indvars.iv.next, %indvars.iv.next %1 = and i64 %mul, 4294967295 br label %for.body4.1 for.body4.1: ; preds = %for.body4.1, %for.cond2.preheader.1 %indvars.iv39.1 = phi i64 [ %1, %for.cond2.preheader.1 ], [ %indvars.iv.next40.1, %for.body4.1 ] %arrayidx.1 = getelementptr inbounds [1000001 x i8], ptr @a, i64 0, i64 %indvars.iv39.1 store i8 1, ptr %arrayidx.1, align 1, !tbaa !5 %indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39.1, %indvars.iv.next %cmp3.1 = icmp ult i64 %indvars.iv.next40.1, 1000001 br i1 %cmp3.1, label %for.body4.1, label %for.inc5.1, !llvm.loop !8 for.inc5.1: ; preds = %for.body4.1 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul.1 = mul i64 %indvars.iv.next.1, %indvars.iv.next.1 br label %for.cond2.preheader for.cond8.preheader: ; preds = %while.cond.preheader, %for.end18 %2 = load i32, ptr %n, align 4, !tbaa !11 %cmp9.not34 = icmp slt i32 %2, 2 br i1 %cmp9.not34, label %for.end18, label %for.body10.preheader for.body10.preheader: ; preds = %for.cond8.preheader %3 = add nuw i32 %2, 1 %wide.trip.count = zext i32 %3 to i64 %4 = add nsw i64 %wide.trip.count, -2 %min.iters.check = icmp ult i64 %4, 8 br i1 %min.iters.check, label %for.body10.preheader50, label %vector.ph vector.ph: ; preds = %for.body10.preheader %n.vec = and i64 %4, -8 %ind.end = or i64 %n.vec, 2 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 ], [ %11, %vector.body ] %vec.phi48 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %offset.idx = or i64 %index, 2 %5 = getelementptr inbounds [1000001 x i8], ptr @a, i64 0, i64 %offset.idx %wide.load = load <4 x i8>, ptr %5, align 2, !tbaa !5 %6 = getelementptr inbounds i8, ptr %5, i64 4 %wide.load49 = load <4 x i8>, ptr %6, align 2, !tbaa !5 %7 = icmp eq <4 x i8> %wide.load, zeroinitializer %8 = icmp eq <4 x i8> %wide.load49, zeroinitializer %9 = zext <4 x i1> %7 to <4 x i32> %10 = zext <4 x i1> %8 to <4 x i32> %11 = add <4 x i32> %vec.phi, %9 %12 = add <4 x i32> %vec.phi48, %10 %index.next = add nuw i64 %index, 8 %13 = icmp eq i64 %index.next, %n.vec br i1 %13, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %12, %11 %14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end18, label %for.body10.preheader50 for.body10.preheader50: ; preds = %for.body10.preheader, %middle.block %indvars.iv43.ph = phi i64 [ 2, %for.body10.preheader ], [ %ind.end, %middle.block ] %cnt.036.ph = phi i32 [ 0, %for.body10.preheader ], [ %14, %middle.block ] br label %for.body10 for.body10: ; preds = %for.body10.preheader50, %for.body10 %indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body10 ], [ %indvars.iv43.ph, %for.body10.preheader50 ] %cnt.036 = phi i32 [ %spec.select, %for.body10 ], [ %cnt.036.ph, %for.body10.preheader50 ] %arrayidx12 = getelementptr inbounds [1000001 x i8], ptr @a, i64 0, i64 %indvars.iv43 %15 = load i8, ptr %arrayidx12, align 1, !tbaa !5 %cmp13 = icmp eq i8 %15, 0 %inc15 = zext i1 %cmp13 to i32 %spec.select = add nuw nsw i32 %cnt.036, %inc15 %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count br i1 %exitcond47.not, label %for.end18, label %for.body10, !llvm.loop !16 for.end18: ; preds = %for.body10, %middle.block, %for.cond8.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond8.preheader ], [ %14, %middle.block ], [ %spec.select, %for.body10 ] %call19 = 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) %cmp7.not = icmp eq i32 %call, -1 br i1 %cmp7.not, label %while.end, label %for.cond8.preheader, !llvm.loop !17 while.end: ; preds = %for.end18, %while.cond.preheader 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 = !{!"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 N 1000000 #define M N/2+1 int main(void){ int i = 1,k; int n; int primeTable[N] = {0}; primeTable[0] = 1; primeTable[1] = 1; k = 2; /* 2の倍数 */ while(2*k < N){ primeTable[2*k] = 1; k++; } /* 3以上の倍数 */ for( i = 3 ; i < M ; i=i+2){ k = 2; while(i*k < N){ primeTable[i*k] = 1; k++; } } while(scanf("%d", &n) != EOF){ int count = 0; for(i = 2 ; i <= n ; i++){ if(primeTable[i] == 0) count++; } printf("%d\n", count); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181977/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181977/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 %primeTable = alloca [1000000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %primeTable) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000000) %primeTable, i8 0, i64 4000000, i1 false) %arrayidx1 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body, %entry %indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next.5, %while.body ] %0 = shl nuw nsw i64 %indvars.iv, 1 %arrayidx3 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %0 store i32 1, ptr %arrayidx3, align 16, !tbaa !5 %indvars.iv.next = shl nuw i64 %indvars.iv, 1 %1 = or i64 %indvars.iv.next, 2 %arrayidx3.1 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %1 store i32 1, ptr %arrayidx3.1, align 8, !tbaa !5 %indvars.iv.next.1 = shl nuw i64 %indvars.iv, 1 %2 = add i64 %indvars.iv.next.1, 4 %arrayidx3.2 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %2 store i32 1, ptr %arrayidx3.2, align 16, !tbaa !5 %indvars.iv.next.2 = shl nuw i64 %indvars.iv, 1 %3 = add i64 %indvars.iv.next.2, 6 %arrayidx3.3 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %3 store i32 1, ptr %arrayidx3.3, align 8, !tbaa !5 %indvars.iv.next.3 = shl nuw i64 %indvars.iv, 1 %4 = add i64 %indvars.iv.next.3, 8 %arrayidx3.4 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %4 store i32 1, ptr %arrayidx3.4, align 16, !tbaa !5 %indvars.iv.next.4 = shl nuw i64 %indvars.iv, 1 %5 = add i64 %indvars.iv.next.4, 10 %arrayidx3.5 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %5 store i32 1, ptr %arrayidx3.5, align 8, !tbaa !5 %indvars.iv.next.5 = add nuw nsw i64 %indvars.iv, 6 %exitcond.not.5 = icmp eq i64 %indvars.iv.next.5, 500000 br i1 %exitcond.not.5, label %while.body8.preheader, label %while.body, !llvm.loop !9 while.body8.preheader: ; preds = %while.body, %for.inc.1 %indvars.iv56 = phi i64 [ %indvars.iv.next57.1, %for.inc.1 ], [ 3, %while.body ] %indvars.iv54 = phi i64 [ %indvars.iv.next55.1, %for.inc.1 ], [ 6, %while.body ] br label %while.body8 while.cond14.preheader: ; preds = %for.inc %call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp15.not51 = icmp eq i32 %call50, -1 br i1 %cmp15.not51, label %while.end28, label %for.cond17.preheader while.body8: ; preds = %while.body8.preheader, %while.body8 %indvars.iv60 = phi i64 [ 2, %while.body8.preheader ], [ %indvars.iv.next61, %while.body8 ] %indvars.iv58 = phi i64 [ %indvars.iv54, %while.body8.preheader ], [ %indvars.iv.next59, %while.body8 ] %arrayidx11 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %indvars.iv58 store i32 1, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1 %6 = mul nuw nsw i64 %indvars.iv.next61, %indvars.iv56 %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, %indvars.iv56 %cmp7 = icmp ult i64 %6, 1000000 br i1 %cmp7, label %while.body8, label %for.inc, !llvm.loop !11 for.inc: ; preds = %while.body8 %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 2 %cmp4 = icmp ult i64 %indvars.iv56, 499999 br i1 %cmp4, label %while.body8.preheader.1, label %while.cond14.preheader, !llvm.loop !12 while.body8.preheader.1: ; preds = %for.inc %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 4 br label %while.body8.1 while.body8.1: ; preds = %while.body8.1, %while.body8.preheader.1 %indvars.iv60.1 = phi i64 [ 2, %while.body8.preheader.1 ], [ %indvars.iv.next61.1, %while.body8.1 ] %indvars.iv58.1 = phi i64 [ %indvars.iv.next55, %while.body8.preheader.1 ], [ %indvars.iv.next59.1, %while.body8.1 ] %arrayidx11.1 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %indvars.iv58.1 store i32 1, ptr %arrayidx11.1, align 4, !tbaa !5 %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60.1, 1 %7 = mul nuw nsw i64 %indvars.iv.next61.1, %indvars.iv.next57 %indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58.1, %indvars.iv.next57 %cmp7.1 = icmp ult i64 %7, 1000000 br i1 %cmp7.1, label %while.body8.1, label %for.inc.1, !llvm.loop !11 for.inc.1: ; preds = %while.body8.1 %indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 4 %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 8 br label %while.body8.preheader for.cond17.preheader: ; preds = %while.cond14.preheader, %for.end26 %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.not47 = icmp slt i32 %8, 2 br i1 %cmp18.not47, label %for.end26, label %for.body19.preheader for.body19.preheader: ; preds = %for.cond17.preheader %9 = add nuw i32 %8, 1 %wide.trip.count = zext i32 %9 to i64 %10 = add nsw i64 %wide.trip.count, -2 %min.iters.check = icmp ult i64 %10, 8 br i1 %min.iters.check, label %for.body19.preheader73, label %vector.ph vector.ph: ; preds = %for.body19.preheader %n.vec = and i64 %10, -8 %ind.end = or i64 %n.vec, 2 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 ], [ %17, %vector.body ] %vec.phi71 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ] %offset.idx = or i64 %index, 2 %11 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %11, align 8, !tbaa !5 %12 = getelementptr inbounds i32, ptr %11, i64 4 %wide.load72 = load <4 x i32>, ptr %12, align 8, !tbaa !5 %13 = icmp eq <4 x i32> %wide.load, zeroinitializer %14 = icmp eq <4 x i32> %wide.load72, zeroinitializer %15 = zext <4 x i1> %13 to <4 x i32> %16 = zext <4 x i1> %14 to <4 x i32> %17 = add <4 x i32> %vec.phi, %15 %18 = add <4 x i32> %vec.phi71, %16 %index.next = add nuw i64 %index, 8 %19 = icmp eq i64 %index.next, %n.vec br i1 %19, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %18, %17 %20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %10, %n.vec br i1 %cmp.n, label %for.end26, label %for.body19.preheader73 for.body19.preheader73: ; preds = %for.body19.preheader, %middle.block %indvars.iv67.ph = phi i64 [ 2, %for.body19.preheader ], [ %ind.end, %middle.block ] %count.049.ph = phi i32 [ 0, %for.body19.preheader ], [ %20, %middle.block ] br label %for.body19 for.body19: ; preds = %for.body19.preheader73, %for.body19 %indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.body19 ], [ %indvars.iv67.ph, %for.body19.preheader73 ] %count.049 = phi i32 [ %spec.select, %for.body19 ], [ %count.049.ph, %for.body19.preheader73 ] %arrayidx21 = getelementptr inbounds [1000000 x i32], ptr %primeTable, i64 0, i64 %indvars.iv67 %21 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %cmp22 = icmp eq i32 %21, 0 %inc23 = zext i1 %cmp22 to i32 %spec.select = add nuw nsw i32 %count.049, %inc23 %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %exitcond70.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count br i1 %exitcond70.not, label %for.end26, label %for.body19, !llvm.loop !16 for.end26: ; preds = %for.body19, %middle.block, %for.cond17.preheader %count.0.lcssa = phi i32 [ 0, %for.cond17.preheader ], [ %20, %middle.block ], [ %spec.select, %for.body19 ] %call27 = 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) %cmp15.not = icmp eq i32 %call, -1 br i1 %cmp15.not, label %while.end28, label %for.cond17.preheader, !llvm.loop !17 while.end28: ; preds = %for.end26, %while.cond14.preheader call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %primeTable) #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 = distinct !{!12, !10} !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}
#include<stdio.h> int main(){ int i,k,x; const int n=999999; int prime[n+1]; for(i=2;i<=n;i++){ prime[i]=1; } for(i=2;i*i<=n;i++){ if(prime[i]){ for(k=2*i;k<=n;k+=i){ prime[k]=0; } } } prime[0]=0; prime[1]=0; int count=0; while(scanf("%d",&x)!=EOF){ count++; int cnt=0; for(i=x;i>0;i--){ if(prime[i]==1){ cnt++; } } printf("%d\n",cnt); if(count==31) break; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182019/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182019/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: %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5 %0 = tail call ptr @llvm.stacksave.p0() %vla57 = alloca [1000000 x i32], align 16 br label %vector.body vector.body: ; preds = %vector.body.3, %entry %index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.3 ] %offset.idx = or i64 %index, 2 %1 = getelementptr inbounds i32, ptr %vla57, i64 %offset.idx store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !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 8, !tbaa !5 %offset.idx.1 = or i64 %index, 10 %3 = getelementptr inbounds i32, ptr %vla57, i64 %offset.idx.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 8, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !tbaa !5 %offset.idx.2 = or i64 %index, 18 %5 = getelementptr inbounds i32, ptr %vla57, i64 %offset.idx.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 8, !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 8, !tbaa !5 %7 = icmp eq i64 %index, 999968 br i1 %7, label %for.body, label %vector.body.3, !llvm.loop !9 vector.body.3: ; preds = %vector.body %offset.idx.3 = or i64 %index, 26 %8 = getelementptr inbounds i32, ptr %vla57, i64 %offset.idx.3 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 8, !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 8, !tbaa !5 %index.next.3 = add nuw nsw i64 %index, 32 br label %vector.body for.body: ; preds = %vector.body %arrayidx = getelementptr inbounds i32, ptr %vla57, i64 999994 store i32 1, ptr %arrayidx, align 8, !tbaa !5 %arrayidx.1 = getelementptr inbounds i32, ptr %vla57, i64 999995 store i32 1, ptr %arrayidx.1, align 4, !tbaa !5 %arrayidx.2 = getelementptr inbounds i32, ptr %vla57, i64 999996 store i32 1, ptr %arrayidx.2, align 16, !tbaa !5 %arrayidx.3 = getelementptr inbounds i32, ptr %vla57, i64 999997 store i32 1, ptr %arrayidx.3, align 4, !tbaa !5 %arrayidx.4 = getelementptr inbounds i32, ptr %vla57, i64 999998 store i32 1, ptr %arrayidx.4, align 8, !tbaa !5 %arrayidx.5 = getelementptr inbounds i32, ptr %vla57, i64 999999 store i32 1, ptr %arrayidx.5, align 4, !tbaa !5 br label %for.body3 for.body3: ; preds = %for.inc14.1, %for.body %indvars.iv68 = phi i64 [ 2, %for.body ], [ %indvars.iv.next69.1, %for.inc14.1 ] %indvars.iv66 = phi i64 [ 4, %for.body ], [ %indvars.iv.next67.1, %for.inc14.1 ] %arrayidx5 = getelementptr inbounds i32, ptr %vla57, i64 %indvars.iv68 %10 = load i32, ptr %arrayidx5, align 8, !tbaa !5 %tobool.not.not = icmp eq i32 %10, 0 br i1 %tobool.not.not, label %for.inc14, label %for.body9 for.body9: ; preds = %for.body3, %for.body9 %indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body9 ], [ %indvars.iv66, %for.body3 ] %arrayidx11 = getelementptr inbounds i32, ptr %vla57, i64 %indvars.iv70 store i32 0, ptr %arrayidx11, align 8, !tbaa !5 %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, %indvars.iv68 %cmp8 = icmp ult i64 %indvars.iv.next71, 1000000 br i1 %cmp8, label %for.body9, label %for.inc14, !llvm.loop !13 for.inc14: ; preds = %for.body9, %for.body3 %indvars.iv.next69 = or i64 %indvars.iv68, 1 %arrayidx5.1 = getelementptr inbounds i32, ptr %vla57, i64 %indvars.iv.next69 %11 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5 %tobool.not.not.1 = icmp eq i32 %11, 0 br i1 %tobool.not.not.1, label %for.inc14.1, label %for.body9.preheader.1 for.body9.preheader.1: ; preds = %for.inc14 %indvars.iv.next67 = or i64 %indvars.iv66, 2 br label %for.body9.1 for.body9.1: ; preds = %for.body9.1, %for.body9.preheader.1 %indvars.iv70.1 = phi i64 [ %indvars.iv.next71.1, %for.body9.1 ], [ %indvars.iv.next67, %for.body9.preheader.1 ] %arrayidx11.1 = getelementptr inbounds i32, ptr %vla57, i64 %indvars.iv70.1 store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5 %indvars.iv.next71.1 = add nuw nsw i64 %indvars.iv70.1, %indvars.iv.next69 %cmp8.1 = icmp ult i64 %indvars.iv.next71.1, 1000000 br i1 %cmp8.1, label %for.body9.1, label %for.inc14.1, !llvm.loop !13 for.inc14.1: ; preds = %for.body9.1, %for.inc14 %indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2 %indvars.iv.next67.1 = add nuw nsw i64 %indvars.iv66, 4 %exitcond74.not.1 = icmp eq i64 %indvars.iv.next69.1, 1000 br i1 %exitcond74.not.1, label %for.end16, label %for.body3, !llvm.loop !14 for.end16: ; preds = %for.inc14.1 store i32 0, ptr %vla57, align 16, !tbaa !5 %arrayidx18 = getelementptr inbounds i32, ptr %vla57, i64 1 store i32 0, ptr %arrayidx18, align 4, !tbaa !5 br label %while.cond while.cond: ; preds = %for.end31, %for.end16 %count.0 = phi i32 [ 0, %for.end16 ], [ %inc20, %for.end31 ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %cmp19.not = icmp eq i32 %call, -1 br i1 %cmp19.not, label %while.end, label %while.body while.body: ; preds = %while.cond %inc20 = add nuw nsw i32 %count.0, 1 %12 = load i32, ptr %x, align 4, !tbaa !5 %cmp2262 = icmp sgt i32 %12, 0 br i1 %cmp2262, label %for.body23.preheader, label %for.end31 for.body23.preheader: ; preds = %while.body %13 = zext i32 %12 to i64 %min.iters.check = icmp ult i32 %12, 8 br i1 %min.iters.check, label %for.body23.preheader89, label %vector.ph80 vector.ph80: ; preds = %for.body23.preheader %n.vec = and i64 %13, 4294967288 %ind.end = and i64 %13, 7 br label %vector.body82 vector.body82: ; preds = %vector.body82, %vector.ph80 %index83 = phi i64 [ 0, %vector.ph80 ], [ %index.next88, %vector.body82 ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph80 ], [ %21, %vector.body82 ] %vec.phi84 = phi <4 x i32> [ zeroinitializer, %vector.ph80 ], [ %22, %vector.body82 ] %offset.idx85 = sub i64 %13, %index83 %14 = getelementptr inbounds i32, ptr %vla57, i64 %offset.idx85 %15 = getelementptr inbounds i32, ptr %14, i64 -3 %wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !5 %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %16 = getelementptr inbounds i32, ptr %14, i64 -7 %wide.load86 = load <4 x i32>, ptr %16, align 4, !tbaa !5 %reverse87 = shufflevector <4 x i32> %wide.load86, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %17 = icmp eq <4 x i32> %reverse, <i32 1, i32 1, i32 1, i32 1> %18 = icmp eq <4 x i32> %reverse87, <i32 1, i32 1, i32 1, i32 1> %19 = zext <4 x i1> %17 to <4 x i32> %20 = zext <4 x i1> %18 to <4 x i32> %21 = add <4 x i32> %vec.phi, %19 %22 = add <4 x i32> %vec.phi84, %20 %index.next88 = add nuw i64 %index83, 8 %23 = icmp eq i64 %index.next88, %n.vec br i1 %23, label %middle.block78, label %vector.body82, !llvm.loop !15 middle.block78: ; preds = %vector.body82 %bin.rdx = add <4 x i32> %22, %21 %24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %13 br i1 %cmp.n, label %for.end31, label %for.body23.preheader89 for.body23.preheader89: ; preds = %for.body23.preheader, %middle.block78 %indvars.iv75.ph = phi i64 [ %13, %for.body23.preheader ], [ %ind.end, %middle.block78 ] %cnt.064.ph = phi i32 [ 0, %for.body23.preheader ], [ %24, %middle.block78 ] br label %for.body23 for.body23: ; preds = %for.body23.preheader89, %for.body23 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body23 ], [ %indvars.iv75.ph, %for.body23.preheader89 ] %cnt.064 = phi i32 [ %spec.select, %for.body23 ], [ %cnt.064.ph, %for.body23.preheader89 ] %arrayidx25 = getelementptr inbounds i32, ptr %vla57, i64 %indvars.iv75 %25 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %cmp26 = icmp eq i32 %25, 1 %inc28 = zext i1 %cmp26 to i32 %spec.select = add nuw nsw i32 %cnt.064, %inc28 %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1 %cmp22 = icmp ugt i64 %indvars.iv75, 1 br i1 %cmp22, label %for.body23, label %for.end31, !llvm.loop !16 for.end31: ; preds = %for.body23, %middle.block78, %while.body %cnt.0.lcssa = phi i32 [ 0, %while.body ], [ %24, %middle.block78 ], [ %spec.select, %for.body23 ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) %cmp33 = icmp eq i32 %inc20, 31 br i1 %cmp33, label %while.end, label %while.cond while.end: ; preds = %for.end31, %while.cond call void @llvm.stackrestore.p0(ptr %0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #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: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #2 ; 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 nosync nounwind willreturn } 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} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10, !11, !12} !16 = distinct !{!16, !10, !12, !11}
#include <stdio.h> int main(void){ int T; long long N, B, x, y; scanf("%d", &T); while(T--){ scanf("%lld %lld %lld %lld", &N, &B, &x, &y); long long a=0; long long res=0; for(int i=1; i<=N; ++i){ if(a+x<=B){ a+=x; res+=a; } else{ a-=y; res+=a; } } printf("%lld\n", res); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18207/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18207/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 [20 x i8] c"%lld %lld %lld %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 %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) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3 %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, %for.cond.cleanup %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N, ptr noundef nonnull %B, ptr noundef nonnull %x, ptr noundef nonnull %y) %1 = load i64, ptr %N, align 8, !tbaa !9 %cmp.not16 = icmp slt i64 %1, 1 br i1 %cmp.not16, label %for.cond.cleanup, label %for.body.lr.ph for.body.lr.ph: ; preds = %while.body %2 = load i64, ptr %x, align 8, !tbaa !9 %3 = load i64, ptr %B, align 8, !tbaa !9 %4 = load i64, ptr %y, align 8 %xtraiter = and i64 %1, 3 %5 = icmp ult i64 %1, 4 br i1 %5, 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 %1, -4 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %res.1.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %res.1.3, %for.body ] %res.018.unr = phi i64 [ 0, %for.body.lr.ph ], [ %res.1.3, %for.body ] %a.017.unr = phi i64 [ 0, %for.body.lr.ph ], [ %a.1.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 %res.018.epil = phi i64 [ %res.1.epil, %for.body.epil ], [ %res.018.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %a.017.epil = phi i64 [ %a.1.epil, %for.body.epil ], [ %a.017.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 %2, %a.017.epil %cmp3.not.epil = icmp sgt i64 %add.epil, %3 %sub.epil = sub nsw i64 %a.017.epil, %4 %a.1.epil = select i1 %cmp3.not.epil, i64 %sub.epil, i64 %add.epil %res.1.epil = add nsw i64 %a.1.epil, %res.018.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 %res.0.lcssa = phi i64 [ 0, %while.body ], [ %res.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %res.1.epil, %for.body.epil ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %res.0.lcssa) %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 !13 for.body: ; preds = %for.body, %for.body.lr.ph.new %res.018 = phi i64 [ 0, %for.body.lr.ph.new ], [ %res.1.3, %for.body ] %a.017 = phi i64 [ 0, %for.body.lr.ph.new ], [ %a.1.3, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ] %add = add nsw i64 %2, %a.017 %cmp3.not = icmp sgt i64 %add, %3 %sub = sub nsw i64 %a.017, %4 %a.1 = select i1 %cmp3.not, i64 %sub, i64 %add %res.1 = add nsw i64 %a.1, %res.018 %add.1 = add nsw i64 %2, %a.1 %cmp3.not.1 = icmp sgt i64 %add.1, %3 %sub.1 = sub nsw i64 %a.1, %4 %a.1.1 = select i1 %cmp3.not.1, i64 %sub.1, i64 %add.1 %res.1.1 = add nsw i64 %a.1.1, %res.1 %add.2 = add nsw i64 %2, %a.1.1 %cmp3.not.2 = icmp sgt i64 %add.2, %3 %sub.2 = sub nsw i64 %a.1.1, %4 %a.1.2 = select i1 %cmp3.not.2, i64 %sub.2, i64 %add.2 %res.1.2 = add nsw i64 %a.1.2, %res.1.1 %add.3 = add nsw i64 %2, %a.1.2 %cmp3.not.3 = icmp sgt i64 %add.3, %3 %sub.3 = sub nsw i64 %a.1.2, %4 %a.1.3 = select i1 %cmp3.not.3, i64 %sub.3, i64 %add.3 %res.1.3 = add nsw i64 %a.1.3, %res.1.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 8, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"long 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> #include <math.h> int main(void){ int n; int prm[1000]; int cnt; int jdg; int ans; int num; int i; int j; double k; int key; while( scanf("%d", &n ) != EOF ){ k = sqrt( n ); key = k + 1; ans = 1; if( n == 1 ) ans = 0; prm[0] = 2; for( i = 1; i < 200; i++ ){ prm[i] = 0; } for( j = 3; j <= key; j+=2 ){ jdg = 0; for( i = 0; prm[i]; i++ ){ num = i + 1; if( !(j % prm[i]) ){ jdg++; break; } } if( !jdg ){ ans++; prm[num] = j; } } int a; for(j = 0; j < n-key; j++){ a = 1; for( i = 0; prm[i]; i++ ){ if( !((j+key+1)%prm[i]) ) { a = 0; break; } } if( a ) ans++; } printf("%d\n", ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182112/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182112/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 %prm = alloca [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %prm) #5 %call107 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not108 = icmp eq i32 %call107, -1 br i1 %cmp.not108, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %entry %scevgep = getelementptr inbounds i8, ptr %prm, i64 4 br label %while.body while.body: ; preds = %while.body.preheader, %for.end61 %num.0109 = phi i32 [ %num.1.lcssa, %for.end61 ], [ undef, %while.body.preheader ] %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sitofp i32 %0 to double %call1 = call double @sqrt(double noundef %conv) #5 %add = fadd double %call1, 1.000000e+00 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp3 = icmp ne i32 %1, 1 store i32 2, ptr %prm, align 16, !tbaa !5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(796) %scevgep, i8 0, i64 796, i1 false), !tbaa !5 %conv2 = fptosi double %add to i32 %spec.store.select = zext i1 %cmp3 to i32 %cmp9.not91 = icmp slt i32 %conv2, 3 br i1 %cmp9.not91, label %for.cond35.preheader, label %for.cond12.preheader for.cond35.preheader: ; preds = %for.inc32, %while.body %num.1.lcssa = phi i32 [ %num.0109, %while.body ], [ %num.386, %for.inc32 ] %ans.0.lcssa = phi i32 [ %spec.store.select, %while.body ], [ %ans.1, %for.inc32 ] %sub = sub nsw i32 %1, %conv2 %cmp36103 = icmp sgt i32 %sub, 0 br i1 %cmp36103, label %for.cond39.preheader.lr.ph, label %for.end61 for.cond39.preheader.lr.ph: ; preds = %for.cond35.preheader %add44 = add nsw i32 %conv2, 1 %2 = load i32, ptr %prm, align 16, !tbaa !5 %tobool42.not.not98 = icmp eq i32 %2, 0 br i1 %tobool42.not.not98, label %for.cond39.preheader.us.preheader, label %for.cond39.preheader for.cond39.preheader.us.preheader: ; preds = %for.cond39.preheader.lr.ph %3 = add i32 %ans.0.lcssa, %1 %4 = sub i32 %3, %conv2 br label %for.end61 for.cond12.preheader: ; preds = %while.body, %for.inc32 %ans.095 = phi i32 [ %ans.1, %for.inc32 ], [ %spec.store.select, %while.body ] %j.093 = phi i32 [ %add33, %for.inc32 ], [ 3, %while.body ] %num.192 = phi i32 [ %num.386, %for.inc32 ], [ %num.0109, %while.body ] %5 = load i32, ptr %prm, align 16, !tbaa !5 %tobool.not89 = icmp eq i32 %5, 0 br i1 %tobool.not89, label %if.then27, label %for.body15 for.cond12: ; preds = %for.body15 %arrayidx14 = getelementptr inbounds [1000 x i32], ptr %prm, i64 0, i64 %indvars.iv.next %6 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %if.then27.loopexit, label %for.body15, !llvm.loop !9 for.body15: ; preds = %for.cond12.preheader, %for.cond12 %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond12 ], [ 0, %for.cond12.preheader ] %7 = phi i32 [ %6, %for.cond12 ], [ %5, %for.cond12.preheader ] %indvars.iv.next = add nuw i64 %indvars.iv, 1 %rem = srem i32 %j.093, %7 %tobool19.not = icmp eq i32 %rem, 0 br i1 %tobool19.not, label %for.inc32.loopexit, label %for.cond12, !llvm.loop !9 if.then27.loopexit: ; preds = %for.cond12 %8 = trunc i64 %indvars.iv.next to i32 br label %if.then27 if.then27: ; preds = %if.then27.loopexit, %for.cond12.preheader %num.2.lcssa = phi i32 [ %num.192, %for.cond12.preheader ], [ %8, %if.then27.loopexit ] %inc28 = add nsw i32 %ans.095, 1 %idxprom29 = sext i32 %num.2.lcssa to i64 %arrayidx30 = getelementptr inbounds [1000 x i32], ptr %prm, i64 0, i64 %idxprom29 store i32 %j.093, ptr %arrayidx30, align 4, !tbaa !5 br label %for.inc32 for.inc32.loopexit: ; preds = %for.body15 %9 = trunc i64 %indvars.iv.next to i32 br label %for.inc32 for.inc32: ; preds = %for.inc32.loopexit, %if.then27 %num.386 = phi i32 [ %num.2.lcssa, %if.then27 ], [ %9, %for.inc32.loopexit ] %ans.1 = phi i32 [ %inc28, %if.then27 ], [ %ans.095, %for.inc32.loopexit ] %add33 = add nuw nsw i32 %j.093, 2 %cmp9.not = icmp sgt i32 %add33, %conv2 br i1 %cmp9.not, label %for.cond35.preheader, label %for.cond12.preheader, !llvm.loop !11 for.cond39.preheader: ; preds = %for.cond39.preheader.lr.ph, %for.end54 %ans.2105 = phi i32 [ %spec.select, %for.end54 ], [ %ans.0.lcssa, %for.cond39.preheader.lr.ph ] %j.1104 = phi i32 [ %inc60, %for.end54 ], [ 0, %for.cond39.preheader.lr.ph ] %add45 = add i32 %add44, %j.1104 br label %for.body43 for.cond39: ; preds = %for.body43 %indvars.iv.next115 = add nuw i64 %indvars.iv114, 1 %arrayidx41 = getelementptr inbounds [1000 x i32], ptr %prm, i64 0, i64 %indvars.iv.next115 %10 = load i32, ptr %arrayidx41, align 4, !tbaa !5 %tobool42.not.not = icmp eq i32 %10, 0 br i1 %tobool42.not.not, label %for.end54, label %for.body43, !llvm.loop !12 for.body43: ; preds = %for.cond39.preheader, %for.cond39 %indvars.iv114 = phi i64 [ 0, %for.cond39.preheader ], [ %indvars.iv.next115, %for.cond39 ] %11 = phi i32 [ %2, %for.cond39.preheader ], [ %10, %for.cond39 ] %rem48 = srem i32 %add45, %11 %tobool49.not = icmp ne i32 %rem48, 0 br i1 %tobool49.not, label %for.cond39, label %for.end54 for.end54: ; preds = %for.cond39, %for.body43 %inc57 = zext i1 %tobool49.not to i32 %spec.select = add nsw i32 %ans.2105, %inc57 %inc60 = add nuw nsw i32 %j.1104, 1 %exitcond.not = icmp eq i32 %inc60, %sub br i1 %exitcond.not, label %for.end61, label %for.cond39.preheader, !llvm.loop !13 for.end61: ; preds = %for.end54, %for.cond39.preheader.us.preheader, %for.cond35.preheader %ans.2.lcssa = phi i32 [ %ans.0.lcssa, %for.cond35.preheader ], [ %4, %for.cond39.preheader.us.preheader ], [ %spec.select, %for.end54 ] %call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.2.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.end, label %while.body, !llvm.loop !14 while.end: ; preds = %for.end61, %entry call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %prm) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree 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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree 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} !14 = distinct !{!14, !10}
#include<stdio.h> #define MAX_V 1000000 int prime[MAX_V + 1]; int sum[MAX_V + 1]; int main(){ int n, i, k; prime[0]=prime[1]=0; for(i = 2;i <= MAX_V;i++){ prime[i] = 1; } for(i=2;i*i<=MAX_V;i++){ if(prime[i]){ for(k = 2*i;k <= MAX_V;k += i){ prime[k] = 0; } } } sum[0] = 0; for(i = 0;i < MAX_V;i++){ sum[i+1] = sum[i]+prime[i+1]; } while(scanf("%d", &n) == 1){ printf("%d\n", sum[n]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182156/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182156/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 [1000001 x i32] zeroinitializer, align 16 @sum = dso_local local_unnamed_addr global [1000001 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 store i32 0, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @prime, align 16, !tbaa !5 br label %vector.body vector.body: ; preds = %vector.body.3, %entry %index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.3 ] %offset.idx = or i64 %index, 2 %0 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8, !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 8, !tbaa !5 %offset.idx.1 = or i64 %index, 10 %2 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 8, !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 8, !tbaa !5 %offset.idx.2 = or i64 %index, 18 %4 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !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 8, !tbaa !5 %6 = icmp eq i64 %index, 999968 br i1 %6, label %for.body, label %vector.body.3, !llvm.loop !9 vector.body.3: ; preds = %vector.body %offset.idx.3 = or i64 %index, 26 %7 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.3 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 8, !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 8, !tbaa !5 %index.next.3 = add nuw nsw i64 %index, 32 br label %vector.body for.body: ; preds = %vector.body store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999994), align 8, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999995), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999996), align 16, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999997), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999998), align 8, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999999), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1000000), align 16, !tbaa !5 br label %for.body3 for.body3: ; preds = %for.body, %for.inc14 %indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.inc14 ], [ 2, %for.body ] %indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.inc14 ], [ 4, %for.body ] %arrayidx5 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv61 %9 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %tobool.not.not = icmp eq i32 %9, 0 br i1 %tobool.not.not, label %for.inc14, label %for.body9 for.body9: ; preds = %for.body3, %for.body9 %indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.body9 ], [ %indvars.iv59, %for.body3 ] %arrayidx11 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv63 store i32 0, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, %indvars.iv61 %cmp8 = icmp ult i64 %indvars.iv.next64, 1000001 br i1 %cmp8, label %for.body9, label %for.inc14, !llvm.loop !13 for.inc14: ; preds = %for.body9, %for.body3 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 2 %exitcond67.not = icmp eq i64 %indvars.iv.next62, 1001 br i1 %exitcond67.not, label %for.end16, label %for.body3, !llvm.loop !14 for.end16: ; preds = %for.inc14 store i32 0, ptr @sum, align 16, !tbaa !5 br label %for.body19 while.cond.preheader: ; preds = %for.body19 %call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp3257 = icmp eq i32 %call56, 1 br i1 %cmp3257, label %while.body, label %while.end for.body19: ; preds = %for.body19, %for.end16 %10 = phi i32 [ 0, %for.end16 ], [ %add25.1, %for.body19 ] %indvars.iv68 = phi i64 [ 0, %for.end16 ], [ %indvars.iv.next69.1, %for.body19 ] %indvars.iv.next69 = or i64 %indvars.iv68, 1 %arrayidx24 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv.next69 %11 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %add25 = add nsw i32 %11, %10 %arrayidx28 = getelementptr inbounds [1000001 x i32], ptr @sum, i64 0, i64 %indvars.iv.next69 store i32 %add25, ptr %arrayidx28, align 4, !tbaa !5 %indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2 %arrayidx24.1 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv.next69.1 %12 = load i32, ptr %arrayidx24.1, align 8, !tbaa !5 %add25.1 = add nsw i32 %12, %add25 %arrayidx28.1 = getelementptr inbounds [1000001 x i32], ptr @sum, i64 0, i64 %indvars.iv.next69.1 store i32 %add25.1, ptr %arrayidx28.1, align 8, !tbaa !5 %exitcond71.not.1 = icmp eq i64 %indvars.iv.next69.1, 1000000 br i1 %exitcond71.not.1, label %while.cond.preheader, label %for.body19, !llvm.loop !15 while.body: ; preds = %while.cond.preheader, %while.body %13 = load i32, ptr %n, align 4, !tbaa !5 %idxprom33 = sext i32 %13 to i64 %arrayidx34 = getelementptr inbounds [1000001 x i32], ptr @sum, i64 0, i64 %idxprom33 %14 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp32 = icmp eq i32 %call, 1 br i1 %cmp32, label %while.body, label %while.end, !llvm.loop !16 while.end: ; preds = %while.body, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @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> int IsPrime(int n){ int i; if(n==1) return 0; if(n==2)return 1; else if(n%2==0)return 0; for(i=3;i*i<=n;i+=2)if(n%i==0)return 0; return 1; } int main(void){ int n , i , count; int dp[1000000] = {0}; for(i=1;i<1000000;i++) if(IsPrime(i)) dp[i] = 1; while(scanf("%d" , &n)!=EOF){ count = 0; for(i=1;i<=n;i++)if(dp[i]==1)count++; printf("%d\n" , count); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182228/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182228/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 @IsPrime(i32 noundef %n) local_unnamed_addr #0 { entry: switch i32 %n, label %if.else [ i32 1, label %cleanup i32 2, label %if.then2 ] if.then2: ; preds = %entry br label %cleanup if.else: ; preds = %entry %0 = and i32 %n, 1 %cmp3 = icmp eq i32 %0, 0 br i1 %cmp3, label %cleanup, label %for.cond.preheader for.cond.preheader: ; preds = %if.else %cmp7.not19 = icmp slt i32 %n, 9 br i1 %cmp7.not19, label %cleanup, label %for.body for.cond: ; preds = %for.body %add = add nuw nsw i32 %i.020, 2 %mul = mul nsw i32 %add, %add %cmp7.not = icmp sgt i32 %mul, %n br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5 for.body: ; preds = %for.cond.preheader, %for.cond %i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ] %rem8 = srem i32 %n, %i.020 %cmp9 = icmp eq i32 %rem8, 0 br i1 %cmp9, label %cleanup, label %for.cond cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.else, %entry, %if.then2 %retval.0 = phi i32 [ 1, %if.then2 ], [ 0, %entry ], [ 0, %if.else ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ] 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: 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 %dp = alloca [1000000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %dp) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000000) %dp, i8 0, i64 4000000, i1 false) br label %for.body while.cond.preheader: ; preds = %for.inc %call129 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp2.not30 = icmp eq i32 %call129, -1 br i1 %cmp2.not30, label %while.end, label %for.cond3.preheader for.body: ; preds = %entry, %for.inc %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.inc ] %0 = trunc i64 %indvars.iv to i32 switch i32 %0, label %if.else.i [ i32 1, label %for.inc i32 2, label %if.then ] if.else.i: ; preds = %for.body %1 = and i32 %0, 1 %cmp3.i = icmp eq i32 %1, 0 br i1 %cmp3.i, label %for.inc, label %for.cond.preheader.i for.cond.preheader.i: ; preds = %if.else.i %cmp7.not19.i = icmp ult i64 %indvars.iv, 9 br i1 %cmp7.not19.i, label %if.then, label %for.body.i for.cond.i: ; preds = %for.body.i %add.i = add nuw nsw i32 %i.020.i, 2 %mul.i = mul nsw i32 %add.i, %add.i %2 = zext i32 %mul.i to i64 %cmp7.not.i = icmp ult i64 %indvars.iv, %2 br i1 %cmp7.not.i, label %if.then, label %for.body.i, !llvm.loop !5 for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i %i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ] %rem8.i = urem i32 %0, %i.020.i %cmp9.i = icmp eq i32 %rem8.i, 0 br i1 %cmp9.i, label %for.inc, label %for.cond.i if.then: ; preds = %for.cond.i, %for.body, %for.cond.preheader.i %arrayidx = getelementptr inbounds [1000000 x i32], ptr %dp, i64 0, i64 %indvars.iv store i32 1, ptr %arrayidx, align 4, !tbaa !7 br label %for.inc for.inc: ; preds = %for.body.i, %if.else.i, %for.body, %if.then %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 1000000 br i1 %exitcond.not, label %while.cond.preheader, label %for.body, !llvm.loop !11 for.cond3.preheader: ; preds = %while.cond.preheader, %for.end14 %3 = load i32, ptr %n, align 4, !tbaa !7 %cmp4.not26 = icmp slt i32 %3, 1 br i1 %cmp4.not26, label %for.end14, label %for.body5.preheader for.body5.preheader: ; preds = %for.cond3.preheader %4 = add nuw i32 %3, 1 %wide.trip.count = zext i32 %4 to i64 %5 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %3, 8 br i1 %min.iters.check, label %for.body5.preheader38, label %vector.ph vector.ph: ; preds = %for.body5.preheader %n.vec = and i64 %5, -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 ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %vec.phi36 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ] %offset.idx = or i64 %index, 1 %6 = getelementptr inbounds [1000000 x i32], ptr %dp, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %6, align 4, !tbaa !7 %7 = getelementptr inbounds i32, ptr %6, i64 4 %wide.load37 = load <4 x i32>, ptr %7, align 4, !tbaa !7 %8 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1> %9 = icmp eq <4 x i32> %wide.load37, <i32 1, i32 1, i32 1, i32 1> %10 = zext <4 x i1> %8 to <4 x i32> %11 = zext <4 x i1> %9 to <4 x i32> %12 = add <4 x i32> %vec.phi, %10 %13 = add <4 x i32> %vec.phi36, %11 %index.next = add nuw i64 %index, 8 %14 = icmp eq i64 %index.next, %n.vec br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %13, %12 %15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %5, %n.vec br i1 %cmp.n, label %for.end14, label %for.body5.preheader38 for.body5.preheader38: ; preds = %for.body5.preheader, %middle.block %indvars.iv32.ph = phi i64 [ 1, %for.body5.preheader ], [ %ind.end, %middle.block ] %count.028.ph = phi i32 [ 0, %for.body5.preheader ], [ %15, %middle.block ] br label %for.body5 for.body5: ; preds = %for.body5.preheader38, %for.body5 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body5 ], [ %indvars.iv32.ph, %for.body5.preheader38 ] %count.028 = phi i32 [ %spec.select, %for.body5 ], [ %count.028.ph, %for.body5.preheader38 ] %arrayidx7 = getelementptr inbounds [1000000 x i32], ptr %dp, i64 0, i64 %indvars.iv32 %16 = load i32, ptr %arrayidx7, align 4, !tbaa !7 %cmp8 = icmp eq i32 %16, 1 %inc10 = zext i1 %cmp8 to i32 %spec.select = add nuw nsw i32 %count.028, %inc10 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %exitcond35.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count br i1 %exitcond35.not, label %for.end14, label %for.body5, !llvm.loop !15 for.end14: ; preds = %for.body5, %middle.block, %for.cond3.preheader %count.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ %15, %middle.block ], [ %spec.select, %for.body5 ] %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp2.not = icmp eq i32 %call1, -1 br i1 %cmp2.not, label %while.end, label %for.cond3.preheader, !llvm.loop !16 while.end: ; preds = %for.end14, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %dp) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5 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 = { 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 = { 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 = 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 = distinct !{!11, !6} !12 = distinct !{!12, !6, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !6, !14, !13} !16 = distinct !{!16, !6}
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main() { long long m, x, n, y, z, w, cnt = 0, i, m1 = 0, m2 = 0, sum = 0; int a[50][50] = {0, 1}; scanf("%lld", &m); while (m > 0) { scanf("%lld%lld%lld%lld", &n, &w, &x, &y); cnt = 0; sum = 0; for (i = 1; i <= n; i++) { m1 = cnt + x; m2 = cnt - y; if (m2 > w && m1 <= w) { sum = sum + m1; cnt = m1; } else if (m1 > w && m2 <= w) { sum = sum + m2; cnt = m2; } else if (m1 <= w && m2 <= w) { if (m1 > m2) { cnt = m1; sum = sum + m1; } else { sum = sum + m2; cnt = m2; } } } printf("%lld\n", sum); m--; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18230/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18230/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 [17 x i8] c"%lld%lld%lld%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: %m = alloca i64, align 8 %x = alloca i64, align 8 %n = alloca i64, align 8 %y = alloca i64, align 8 %w = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %.pr = load i64, ptr %m, align 8, !tbaa !5 %cmp53 = icmp sgt i64 %.pr, 0 br i1 %cmp53, label %while.body, label %while.end while.body: ; preds = %entry, %for.end %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %w, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp2.not49 = icmp slt i64 %0, 1 br i1 %cmp2.not49, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %while.body %1 = load i64, ptr %x, align 8, !tbaa !5 %2 = load i64, ptr %y, align 8, !tbaa !5 %3 = load i64, ptr %w, align 8, !tbaa !5 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %cnt.052 = phi i64 [ 0, %for.body.lr.ph ], [ %cnt.1, %for.inc ] %sum.051 = phi i64 [ 0, %for.body.lr.ph ], [ %sum.1, %for.inc ] %i.050 = phi i64 [ 1, %for.body.lr.ph ], [ %inc, %for.inc ] %add = add nsw i64 %1, %cnt.052 %sub = sub nsw i64 %cnt.052, %2 %cmp3 = icmp sle i64 %sub, %3 %cmp4.not = icmp sgt i64 %add, %3 %or.cond = select i1 %cmp3, i1 true, i1 %cmp4.not br i1 %or.cond, label %if.else, label %if.then if.then: ; preds = %for.body %add5 = add nsw i64 %add, %sum.051 br label %for.inc if.else: ; preds = %for.body %cmp6 = icmp sle i64 %add, %3 %cmp8.not = icmp sgt i64 %sub, %3 %or.cond47 = or i1 %cmp6, %cmp8.not br i1 %or.cond47, label %if.else11, label %if.then9 if.then9: ; preds = %if.else %add10 = add nsw i64 %sub, %sum.051 br label %for.inc if.else11: ; preds = %if.else %or.cond48 = or i1 %cmp4.not, %cmp8.not br i1 %or.cond48, label %for.inc, label %if.then15 if.then15: ; preds = %if.else11 %cmp16 = icmp sgt i64 %add, %sub br i1 %cmp16, label %if.then17, label %if.else19 if.then17: ; preds = %if.then15 %add18 = add nsw i64 %add, %sum.051 br label %for.inc if.else19: ; preds = %if.then15 %add20 = add nsw i64 %sub, %sum.051 br label %for.inc for.inc: ; preds = %if.then, %if.else11, %if.else19, %if.then17, %if.then9 %sum.1 = phi i64 [ %add5, %if.then ], [ %add10, %if.then9 ], [ %add18, %if.then17 ], [ %add20, %if.else19 ], [ %sum.051, %if.else11 ] %cnt.1 = phi i64 [ %add, %if.then ], [ %sub, %if.then9 ], [ %add, %if.then17 ], [ %sub, %if.else19 ], [ %cnt.052, %if.else11 ] %inc = add nuw i64 %i.050, 1 %exitcond.not = icmp eq i64 %i.050, %0 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %for.inc, %while.body %sum.0.lcssa = phi i64 [ 0, %while.body ], [ %sum.1, %for.inc ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0.lcssa) %4 = load i64, ptr %m, align 8, !tbaa !5 %dec = add nsw i64 %4, -1 store i64 %dec, ptr %m, align 8, !tbaa !5 %cmp = icmp sgt i64 %4, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11 while.end: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.end.p0(i64 8, 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)"} !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"} !11 = distinct !{!11, !10}
#include <stdio.h> int main(){ int num,i,j,flag,cnt; int prime[78498]; for(i = 0;i < 78498;i++){ prime[i] = 0; } prime[0] = 2; while(scanf("%d",&num) != EOF){ if(num == 1){ cnt = 0; }else{ cnt = 1; } for(i = 3;i <= num;i += 2){ flag = 1; for(j = 0;prime[j]*prime[j] <= i;j++){ if(i % prime[j] == 0){ flag = 0; break; } } if(flag){ if(prime[cnt] == 0){ prime[cnt] = i; } cnt++; } } printf("%d\n",cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182365/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182365/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i32, align 4 %prime = alloca [78498 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4 call void @llvm.lifetime.start.p0(i64 313992, ptr nonnull %prime) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(313992) %prime, i8 0, i64 313992, i1 false), !tbaa !5 store i32 2, ptr %prime, align 16, !tbaa !5 %call55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %cmp2.not56 = icmp eq i32 %call55, -1 br i1 %cmp2.not56, label %while.end, label %while.body while.body: ; preds = %entry, %for.end33 %0 = load i32, ptr %num, align 4, !tbaa !5 %cmp3 = icmp ne i32 %0, 1 %. = zext i1 %cmp3 to i32 %cmp5.not52 = icmp slt i32 %0, 3 br i1 %cmp5.not52, label %for.end33, label %for.cond7.preheader for.cond7.preheader: ; preds = %while.body, %for.inc32 %cnt.154 = phi i32 [ %cnt.2, %for.inc32 ], [ %., %while.body ] %i.153 = phi i32 [ %add, %for.inc32 ], [ 3, %while.body ] %1 = load i32, ptr %prime, align 16, !tbaa !5 %mul49 = mul nsw i32 %1, %1 %cmp12.not.not50 = icmp ugt i32 %mul49, %i.153 br i1 %cmp12.not.not50, label %if.then22, label %for.body13 for.cond7: ; preds = %for.body13 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx9 = getelementptr inbounds [78498 x i32], ptr %prime, i64 0, i64 %indvars.iv.next %2 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %mul = mul nsw i32 %2, %2 %cmp12.not.not = icmp ugt i32 %mul, %i.153 br i1 %cmp12.not.not, label %if.then22, label %for.body13, !llvm.loop !9 for.body13: ; preds = %for.cond7.preheader, %for.cond7 %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond7 ], [ 0, %for.cond7.preheader ] %3 = phi i32 [ %2, %for.cond7 ], [ %1, %for.cond7.preheader ] %rem = srem i32 %i.153, %3 %cmp16 = icmp eq i32 %rem, 0 br i1 %cmp16, label %for.inc32, label %for.cond7 if.then22: ; preds = %for.cond7, %for.cond7.preheader %idxprom23 = sext i32 %cnt.154 to i64 %arrayidx24 = getelementptr inbounds [78498 x i32], ptr %prime, i64 0, i64 %idxprom23 %4 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %cmp25 = icmp eq i32 %4, 0 %spec.store.select = select i1 %cmp25, i32 %i.153, i32 %4 store i32 %spec.store.select, ptr %arrayidx24, align 4 %inc30 = add nsw i32 %cnt.154, 1 br label %for.inc32 for.inc32: ; preds = %for.body13, %if.then22 %cnt.2 = phi i32 [ %inc30, %if.then22 ], [ %cnt.154, %for.body13 ] %add = add nuw nsw i32 %i.153, 2 %cmp5.not = icmp sgt i32 %add, %0 br i1 %cmp5.not, label %for.end33, label %for.cond7.preheader, !llvm.loop !11 for.end33: ; preds = %for.inc32, %while.body %cnt.1.lcssa = phi i32 [ %., %while.body ], [ %cnt.2, %for.inc32 ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.1.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %cmp2.not = icmp eq i32 %call, -1 br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !12 while.end: ; preds = %for.end33, %entry call void @llvm.lifetime.end.p0(i64 313992, ptr nonnull %prime) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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 = !{!"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 <stdlib.h> #include <time.h> #include <stdbool.h> #include <string.h> //faster vesion than initial submission bool* E_sieve( int n ){ bool* plist = (bool*)malloc( sizeof(bool)*(n+1) ); int i, j, k; memset( plist, true, sizeof(bool)*(n+1) ); /***sieve***/ for( i=2; i*i<=n; i++ ){ //find a prime number for( j=i; plist[j]!=true; j++ ) ; //eliminate multiple of the prime number for( k=2*j; k<=n; k+=j ){ plist[k]=false; } } return plist; } int main(){ int n, i, p; bool *table; table = E_sieve( 999999 ); while( scanf("%d", &n) != EOF ){ p=0; for( i=2; i<=n; i++){ if( table[i] == true ) p++; } printf("%d\n", p ); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182408/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182408/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 memory(readwrite, argmem: none) uwtable define dso_local noalias ptr @E_sieve(i32 noundef %n) local_unnamed_addr #0 { entry: %add = add nsw i32 %n, 1 %conv = sext i32 %add to i64 %call = tail call noalias ptr @malloc(i64 noundef %conv) #7 tail call void @llvm.memset.p0.i64(ptr align 1 %call, i8 1, i64 %conv, i1 false) %cmp.not40 = icmp slt i32 %n, 4 br i1 %cmp.not40, label %for.end23, label %for.cond6.preheader for.cond6.preheader: ; preds = %entry, %for.inc21 %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc21 ], [ 4, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc21 ], [ 2, %entry ] br label %for.cond6 for.cond6: ; preds = %for.cond6, %for.cond6.preheader %indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.cond6 ], [ %indvars.iv45, %for.cond6.preheader ] %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.cond6 ], [ %indvars.iv, %for.cond6.preheader ] %arrayidx = getelementptr inbounds i8, ptr %call, i64 %indvars.iv42 %0 = load i8, ptr %arrayidx, align 1, !tbaa !5, !range !9, !noundef !10 %cmp8.not.not = icmp eq i8 %0, 0 %indvars.iv.next43 = add nuw i64 %indvars.iv42, 1 %indvars.iv.next48 = add i64 %indvars.iv47, 2 br i1 %cmp8.not.not, label %for.cond6, label %for.end, !llvm.loop !11 for.end: ; preds = %for.cond6 %1 = trunc i64 %indvars.iv42 to i32 %mul11 = shl nuw nsw i32 %1, 1 %cmp13.not38 = icmp sgt i32 %mul11, %n br i1 %cmp13.not38, label %for.inc21, label %for.body15 for.body15: ; preds = %for.end, %for.body15 %indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body15 ], [ %indvars.iv47, %for.end ] %arrayidx17 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv49 store i8 0, ptr %arrayidx17, align 1, !tbaa !5 %indvars.iv.next50 = add i64 %indvars.iv49, %indvars.iv42 %2 = trunc i64 %indvars.iv.next50 to i32 %cmp13.not = icmp sgt i32 %2, %n br i1 %cmp13.not, label %for.inc21, label %for.body15, !llvm.loop !13 for.inc21: ; preds = %for.body15, %for.end %indvars.iv.next = add nuw i64 %indvars.iv, 1 %indvars = trunc i64 %indvars.iv.next to i32 %mul4 = mul nsw i32 %indvars, %indvars %cmp.not = icmp sgt i32 %mul4, %n %indvars.iv.next46 = add i64 %indvars.iv45, 2 br i1 %cmp.not, label %for.end23, label %for.cond6.preheader, !llvm.loop !14 for.end23: ; preds = %for.inc21, %entry ret ptr %call } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 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: 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 #4 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 %call.i = tail call noalias dereferenceable_or_null(1000000) ptr @malloc(i64 noundef 1000000) #7 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1000000) %call.i, i8 1, i64 1000000, i1 false) br label %for.cond6.preheader.i for.cond6.preheader.i: ; preds = %for.inc21.i, %entry %indvars.iv45.i = phi i64 [ %indvars.iv.next46.i, %for.inc21.i ], [ 4, %entry ] %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc21.i ], [ 2, %entry ] br label %for.cond6.i for.cond6.i: ; preds = %for.cond6.i, %for.cond6.preheader.i %indvars.iv47.i = phi i64 [ %indvars.iv.next48.i, %for.cond6.i ], [ %indvars.iv45.i, %for.cond6.preheader.i ] %indvars.iv42.i = phi i64 [ %indvars.iv.next43.i, %for.cond6.i ], [ %indvars.iv.i, %for.cond6.preheader.i ] %arrayidx.i = getelementptr inbounds i8, ptr %call.i, i64 %indvars.iv42.i %0 = load i8, ptr %arrayidx.i, align 1, !tbaa !5, !range !9, !noundef !10 %cmp8.not.not.i = icmp eq i8 %0, 0 %indvars.iv.next43.i = add nuw i64 %indvars.iv42.i, 1 %indvars.iv.next48.i = add i64 %indvars.iv47.i, 2 br i1 %cmp8.not.not.i, label %for.cond6.i, label %for.end.i, !llvm.loop !11 for.end.i: ; preds = %for.cond6.i %1 = trunc i64 %indvars.iv42.i to i32 %cmp13.not38.i = icmp ugt i32 %1, 499999 br i1 %cmp13.not38.i, label %for.inc21.i, label %for.body15.i for.body15.i: ; preds = %for.end.i, %for.body15.i %indvars.iv49.i = phi i64 [ %indvars.iv.next50.i, %for.body15.i ], [ %indvars.iv47.i, %for.end.i ] %arrayidx17.i = getelementptr inbounds i8, ptr %call.i, i64 %indvars.iv49.i store i8 0, ptr %arrayidx17.i, align 1, !tbaa !5 %indvars.iv.next50.i = add i64 %indvars.iv49.i, %indvars.iv42.i %2 = trunc i64 %indvars.iv.next50.i to i32 %cmp13.not.i = icmp sgt i32 %2, 999999 br i1 %cmp13.not.i, label %for.inc21.i, label %for.body15.i, !llvm.loop !13 for.inc21.i: ; preds = %for.body15.i, %for.end.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 2 %exitcond = icmp eq i64 %indvars.iv.next.i, 1000 br i1 %exitcond, label %while.cond.preheader, label %for.cond6.preheader.i, !llvm.loop !14 while.cond.preheader: ; preds = %for.inc21.i %call113 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not14 = icmp eq i32 %call113, -1 br i1 %cmp.not14, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %while.cond.preheader, %for.end %3 = load i32, ptr %n, align 4, !tbaa !15 %cmp2.not10 = icmp slt i32 %3, 2 br i1 %cmp2.not10, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %for.cond.preheader %4 = add nuw i32 %3, 1 %wide.trip.count = zext i32 %4 to i64 %5 = add nsw i64 %wide.trip.count, -2 %min.iters.check = icmp ult i64 %5, 8 br i1 %min.iters.check, label %for.body.preheader19, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %5, -8 %ind.end = or i64 %n.vec, 2 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.phi17 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %offset.idx = or i64 %index, 2 %6 = getelementptr inbounds i8, ptr %call.i, i64 %offset.idx %wide.load = load <4 x i8>, ptr %6, align 1, !tbaa !5 %7 = getelementptr inbounds i8, ptr %6, i64 4 %wide.load18 = load <4 x i8>, ptr %7, align 1, !tbaa !5 %8 = zext <4 x i8> %wide.load to <4 x i32> %9 = zext <4 x i8> %wide.load18 to <4 x i32> %10 = add <4 x i32> %vec.phi, %8 %11 = add <4 x i32> %vec.phi17, %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 !17 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 %5, %n.vec br i1 %cmp.n, label %for.end, label %for.body.preheader19 for.body.preheader19: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 2, %for.body.preheader ], [ %ind.end, %middle.block ] %p.011.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader19, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader19 ] %p.011 = phi i32 [ %spec.select, %for.body ], [ %p.011.ph, %for.body.preheader19 ] %arrayidx = getelementptr inbounds i8, ptr %call.i, i64 %indvars.iv %14 = load i8, ptr %arrayidx, align 1, !tbaa !5, !range !9, !noundef !10 %inc = zext i8 %14 to i32 %spec.select = add nuw nsw i32 %p.011, %inc %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond16.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond16.not, label %for.end, label %for.body, !llvm.loop !20 for.end: ; preds = %for.body, %middle.block, %for.cond.preheader %p.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %13, %middle.block ], [ %spec.select, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %p.0.lcssa) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not = icmp eq i32 %call1, -1 br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !21 while.end: ; preds = %for.end, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6 attributes #0 = { nofree nounwind memory(readwrite, argmem: 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 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind allocsize(0) } 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 = !{!"_Bool", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{i8 0, i8 2} !10 = !{} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = !{!16, !16, i64 0} !16 = !{!"int", !7, i64 0} !17 = distinct !{!17, !12, !18, !19} !18 = !{!"llvm.loop.isvectorized", i32 1} !19 = !{!"llvm.loop.unroll.runtime.disable"} !20 = distinct !{!20, !12, !19, !18} !21 = distinct !{!21, !12}
#include <stdio.h> #include <math.h> int main(void){ int Prime[1000000]; int i,j; int Flag = 0; Prime[0] = 0; Prime[1] = 0; for(i = 2;i < 1000000;i++){ for(j = 2;j <= sqrt(i);j++){ if(i % j == 0){ Flag = 1; break; } } if(Flag == 1){ Prime[i] = Prime[i-1]; }else{ Prime[i] = Prime[i-1] + 1; } Flag = 0; } while(scanf("%d",&i) != EOF){ printf("%d\n",Prime[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182459/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182459/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 [1000000 x i32], align 16 %i = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %Prime) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4 store i32 0, ptr %Prime, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds [1000000 x i32], ptr %Prime, i64 0, i64 1 store i32 0, ptr %arrayidx1, align 4, !tbaa !5 br label %for.cond2.preheader for.cond2.preheader: ; preds = %entry, %if.end20 %indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %if.end20 ] %0 = trunc i64 %indvars.iv to i32 %conv3 = sitofp i32 %0 to double %call32 = tail call double @sqrt(double noundef %conv3) #4 %cmp433 = fcmp ult double %call32, 2.000000e+00 br i1 %cmp433, label %if.else, label %for.body6 while.cond.preheader: ; preds = %if.end20 store i32 1000000, ptr %i, align 4, !tbaa !5 %call2436 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %cmp25.not37 = icmp eq i32 %call2436, -1 br i1 %cmp25.not37, label %while.end, label %while.body for.cond2: ; preds = %for.body6 %inc = add nuw nsw i32 %j.034, 1 %conv = sitofp i32 %inc to double %call = tail call double @sqrt(double noundef %conv3) #4 %cmp4 = fcmp ult double %call, %conv br i1 %cmp4, label %if.else, label %for.body6, !llvm.loop !9 for.body6: ; preds = %for.cond2.preheader, %for.cond2 %j.034 = phi i32 [ %inc, %for.cond2 ], [ 2, %for.cond2.preheader ] %rem = urem i32 %0, %j.034 %cmp7 = icmp eq i32 %rem, 0 br i1 %cmp7, label %if.then11, label %for.cond2 if.then11: ; preds = %for.body6 %1 = add nsw i64 %indvars.iv, -1 %arrayidx12 = getelementptr inbounds [1000000 x i32], ptr %Prime, i64 0, i64 %1 %2 = load i32, ptr %arrayidx12, align 4, !tbaa !5 br label %if.end20 if.else: ; preds = %for.cond2, %for.cond2.preheader %3 = add nsw i64 %indvars.iv, -1 %arrayidx17 = getelementptr inbounds [1000000 x i32], ptr %Prime, i64 0, i64 %3 %4 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %add = add nsw i32 %4, 1 br label %if.end20 if.end20: ; preds = %if.else, %if.then11 %add.sink = phi i32 [ %add, %if.else ], [ %2, %if.then11 ] %arrayidx19 = getelementptr inbounds [1000000 x i32], ptr %Prime, i64 0, i64 %indvars.iv store i32 %add.sink, ptr %arrayidx19, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 1000000 br i1 %exitcond.not, label %while.cond.preheader, label %for.cond2.preheader, !llvm.loop !11 while.body: ; preds = %while.cond.preheader, %while.body %5 = load i32, ptr %i, align 4, !tbaa !5 %idxprom27 = sext i32 %5 to i64 %arrayidx28 = getelementptr inbounds [1000000 x i32], ptr %Prime, i64 0, i64 %idxprom27 %6 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) %call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %cmp25.not = icmp eq i32 %call24, -1 br i1 %cmp25.not, label %while.end, label %while.body, !llvm.loop !12 while.end: ; preds = %while.body, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4 call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %Prime) #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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #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 nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-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 NO_DATA -1 #define MAX_COUNT 30 int check[999999]; int checkEnd=0; int isPrime(int n){ if(n&0b1){ } else { return 0; } if(3==n){ return 1; } int square_root = (int)sqrt(n); for(int i=3; i<=square_root; i+=2){ if(0==n%i){ return 0; } } return 1; } int countPrimarity(unsigned int n) { int i = 0; int count = check[checkEnd]; for( i=checkEnd+1;i<=n;i+=2 ) { if( isPrime(i)) count++; check[i]=count; check[i+1]=count; checkEnd=i+1; } return count; } int main(int argc, const char * argv[]) { unsigned int input; int result[MAX_COUNT]; int scanResult; for(int cnt=0;cnt<999999;cnt++){ check[cnt]=NO_DATA; } check[1]=0; check[2]=1; checkEnd=2; scanResult = scanf("%ud", &input); int index=0; while (scanResult!=EOF) { switch (input) { case 1: result[index]=0; break; case 2: result[index]=1; break; default: if(input<=checkEnd) result[index] = check[input]; else result[index]=countPrimarity(input); break; } index++; scanResult = scanf("%ud", &input); } for (int i=0;i<index;i++) { printf("%d\n", result[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182501/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182501/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" @checkEnd = dso_local local_unnamed_addr global i32 0, align 4 @check = dso_local local_unnamed_addr global [999999 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [4 x i8] c"%ud\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind memory(write) uwtable define dso_local i32 @isPrime(i32 noundef %n) local_unnamed_addr #0 { entry: %and = and i32 %n, 1 %tobool.not = icmp eq i32 %and, 0 br i1 %tobool.not, label %return, label %if.end if.end: ; preds = %entry %cmp = icmp eq i32 %n, 3 br i1 %cmp, label %return, label %if.end2 if.end2: ; preds = %if.end %conv = sitofp i32 %n to double %call = tail call double @sqrt(double noundef %conv) #8 %conv3 = fptosi double %call to i32 %cmp4.not16 = icmp slt i32 %conv3, 3 br i1 %cmp4.not16, label %return, label %for.body for.body: ; preds = %if.end2, %for.body %i.017 = phi i32 [ %add, %for.body ], [ 3, %if.end2 ] %rem = srem i32 %n, %i.017 %cmp6 = icmp ne i32 %rem, 0 %add = add nuw nsw i32 %i.017, 2 %cmp4.not = icmp sle i32 %add, %conv3 %or.cond.not = select i1 %cmp6, i1 %cmp4.not, i1 false br i1 %or.cond.not, label %for.body, label %cleanup.loopexit, !llvm.loop !5 cleanup.loopexit: ; preds = %for.body %0 = zext i1 %cmp6 to i32 br label %return return: ; preds = %if.end2, %cleanup.loopexit, %if.end, %entry %retval.2 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 1, %if.end2 ], [ %0, %cleanup.loopexit ] ret i32 %retval.2 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable define dso_local i32 @countPrimarity(i32 noundef %n) local_unnamed_addr #3 { entry: %0 = load i32, ptr @checkEnd, align 4, !tbaa !7 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !7 %add = add nsw i32 %0, 1 %cmp.not25 = icmp ugt i32 %add, %n br i1 %cmp.not25, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %2 = and i32 %0, 1 %3 = add nsw i64 %idxprom, 1 %tobool.not.i.not = icmp eq i32 %2, 0 br label %for.body for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ %3, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %count.028 = phi i32 [ %1, %for.body.preheader ], [ %6, %for.cond ] br i1 %tobool.not.i.not, label %if.end.i, label %isPrime.exit.thread20 if.end.i: ; preds = %for.body %4 = icmp eq i64 %indvars.iv, 3 br i1 %4, label %isPrime.exit.thread, label %if.end2.i if.end2.i: ; preds = %if.end.i %5 = trunc i64 %indvars.iv to i32 %conv.i = sitofp i32 %5 to double %call.i = tail call double @sqrt(double noundef %conv.i) #8 %conv3.i = fptosi double %call.i to i32 %cmp4.not16.i = icmp slt i32 %conv3.i, 3 br i1 %cmp4.not16.i, label %isPrime.exit.thread, label %for.body.i for.body.i: ; preds = %if.end2.i, %for.body.i %i.017.i = phi i32 [ %add.i, %for.body.i ], [ 3, %if.end2.i ] %rem.i = srem i32 %5, %i.017.i %rem.i.fr = freeze i32 %rem.i %cmp6.i = icmp ne i32 %rem.i.fr, 0 %add.i = add nuw nsw i32 %i.017.i, 2 %cmp4.not.i = icmp sle i32 %add.i, %conv3.i %or.cond.not.i = select i1 %cmp6.i, i1 %cmp4.not.i, i1 false br i1 %or.cond.not.i, label %for.body.i, label %isPrime.exit, !llvm.loop !5 isPrime.exit.thread: ; preds = %if.end.i, %if.end2.i %inc18 = add nsw i32 %count.028, 1 br label %for.cond isPrime.exit: ; preds = %for.body.i %inc = add nsw i32 %count.028, 1 br i1 %cmp6.i, label %for.cond, label %isPrime.exit.thread20 isPrime.exit.thread20: ; preds = %for.body, %isPrime.exit br label %for.cond for.cond: ; preds = %isPrime.exit.thread, %isPrime.exit, %isPrime.exit.thread20 %6 = phi i32 [ %count.028, %isPrime.exit.thread20 ], [ %inc, %isPrime.exit ], [ %inc18, %isPrime.exit.thread ] %arrayidx2 = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %indvars.iv store i32 %6, ptr %arrayidx2, align 4, !tbaa !7 %7 = add nsw i64 %indvars.iv, 1 %arrayidx5 = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %7 store i32 %6, ptr %arrayidx5, align 4, !tbaa !7 %8 = trunc i64 %7 to i32 store i32 %8, ptr @checkEnd, align 4, !tbaa !7 %indvars.iv.next = add i64 %indvars.iv, 2 %9 = trunc i64 %indvars.iv.next to i32 %cmp.not = icmp ugt i32 %9, %n br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !11 for.end: ; preds = %for.cond, %entry %count.0.lcssa = phi i32 [ %1, %entry ], [ %6, %for.cond ] ret i32 %count.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #4 { entry: %input = alloca i32, align 4 %result = alloca [30 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #8 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %result) #8 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3999996) @check, i8 -1, i64 3999996, i1 false), !tbaa !7 store i32 0, ptr getelementptr inbounds ([999999 x i32], ptr @check, i64 0, i64 1), align 4, !tbaa !7 store i32 1, ptr getelementptr inbounds ([999999 x i32], ptr @check, i64 0, i64 2), align 8, !tbaa !7 store i32 2, ptr @checkEnd, align 4, !tbaa !7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp1.not39 = icmp eq i32 %call, -1 br i1 %cmp1.not39, label %for.cond.cleanup19, label %while.body for.cond17.preheader: ; preds = %sw.epilog %0 = and i64 %indvars.iv.next, 4294967295 %cmp1841.not = icmp eq i64 %0, 0 br i1 %cmp1841.not, label %for.cond.cleanup19, label %for.body20.preheader for.body20.preheader: ; preds = %for.cond17.preheader %wide.trip.count = and i64 %indvars.iv.next, 4294967295 br label %for.body20 while.body: ; preds = %entry, %sw.epilog %indvars.iv = phi i64 [ %indvars.iv.next, %sw.epilog ], [ 0, %entry ] %1 = load i32, ptr %input, align 4, !tbaa !7 switch i32 %1, label %sw.default [ i32 1, label %sw.epilog i32 2, label %sw.bb4 ] sw.bb4: ; preds = %while.body br label %sw.epilog sw.default: ; preds = %while.body %2 = load i32, ptr @checkEnd, align 4, !tbaa !7 %cmp7.not = icmp ugt i32 %1, %2 br i1 %cmp7.not, label %for.body.preheader.i, label %if.then if.then: ; preds = %sw.default %idxprom8 = zext i32 %1 to i64 %arrayidx9 = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %idxprom8 %3 = load i32, ptr %arrayidx9, align 4, !tbaa !7 br label %sw.epilog for.body.preheader.i: ; preds = %sw.default %idxprom.i = sext i32 %2 to i64 %arrayidx.i = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %idxprom.i %4 = load i32, ptr %arrayidx.i, align 4, !tbaa !7 %5 = and i32 %2, 1 %6 = add nsw i64 %idxprom.i, 1 %tobool.not.i.not.i = icmp eq i32 %5, 0 br i1 %tobool.not.i.not.i, label %for.body.i.us, label %for.body.i.preheader for.body.i.preheader: ; preds = %for.body.preheader.i %7 = add i32 %2, 3 %8 = add i32 %1, 1 %umax = call i32 @llvm.umax.i32(i32 %7, i32 %8) %9 = add i32 %umax, -2 %10 = sub i32 %9, %2 %11 = lshr i32 %10, 1 %narrow = add nuw i32 %11, 1 %12 = zext i32 %narrow to i64 %min.iters.check = icmp ult i32 %10, 6 br i1 %min.iters.check, label %for.body.i.preheader53, label %vector.ph vector.ph: ; preds = %for.body.i.preheader %n.vec = and i64 %12, 4294967292 %13 = shl nuw nsw i64 %n.vec, 1 %ind.end = add nsw i64 %6, %13 %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %4, i64 0 %14 = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %15 = shl i64 %index, 1 %offset.idx = add i64 %6, %15 %16 = add nsw i64 %offset.idx, 1 %17 = add i64 %offset.idx, 5 %gep = getelementptr [999999 x i32], ptr getelementptr (i32, ptr @check, i64 -1), i64 0, i64 %16 %gep56 = getelementptr [999999 x i32], ptr getelementptr (i32, ptr @check, i64 -1), i64 0, i64 %17 store <4 x i32> %14, ptr %gep, align 4, !tbaa !7 store <4 x i32> %14, ptr %gep56, align 4, !tbaa !7 %index.next = add nuw i64 %index, 4 %18 = icmp eq i64 %index.next, %n.vec br i1 %18, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %19 = add i64 %offset.idx, 7 %cmp.n = icmp eq i64 %n.vec, %12 br i1 %cmp.n, label %countPrimarity.exit.split, label %for.body.i.preheader53 for.body.i.preheader53: ; preds = %for.body.i.preheader, %middle.block %indvars.iv.i.ph = phi i64 [ %6, %for.body.i.preheader ], [ %ind.end, %middle.block ] br label %for.body.i for.body.i.us: ; preds = %for.body.preheader.i, %for.cond.i.us %indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %for.cond.i.us ], [ %6, %for.body.preheader.i ] %count.028.i.us = phi i32 [ %spec.select, %for.cond.i.us ], [ %4, %for.body.preheader.i ] %20 = icmp eq i64 %indvars.iv.i.us, 3 br i1 %20, label %for.cond.i.us, label %if.end2.i.i.us if.end2.i.i.us: ; preds = %for.body.i.us %21 = trunc i64 %indvars.iv.i.us to i32 %conv.i.i.us = sitofp i32 %21 to double %call.i.i.us = call double @sqrt(double noundef %conv.i.i.us) #8 %conv3.i.i.us = fptosi double %call.i.i.us to i32 %cmp4.not16.i.i.us = icmp slt i32 %conv3.i.i.us, 3 br i1 %cmp4.not16.i.i.us, label %for.cond.i.us, label %for.body.i.i.us for.body.i.i.us: ; preds = %if.end2.i.i.us, %for.body.i.i.us %i.017.i.i.us = phi i32 [ %add.i.i.us, %for.body.i.i.us ], [ 3, %if.end2.i.i.us ] %rem.i.i.us = srem i32 %21, %i.017.i.i.us %rem.i.fr.i.us = freeze i32 %rem.i.i.us %cmp6.i.i.us = icmp ne i32 %rem.i.fr.i.us, 0 %add.i.i.us = add nuw nsw i32 %i.017.i.i.us, 2 %cmp4.not.i.i.us = icmp sle i32 %add.i.i.us, %conv3.i.i.us %or.cond.not.i.i.us = select i1 %cmp6.i.i.us, i1 %cmp4.not.i.i.us, i1 false br i1 %or.cond.not.i.i.us, label %for.body.i.i.us, label %isPrime.exit.i.us, !llvm.loop !5 isPrime.exit.i.us: ; preds = %for.body.i.i.us %inc.i.us = zext i1 %cmp6.i.i.us to i32 br label %for.cond.i.us for.cond.i.us: ; preds = %for.body.i.us, %if.end2.i.i.us, %isPrime.exit.i.us %inc.i.us.sink = phi i32 [ %inc.i.us, %isPrime.exit.i.us ], [ 1, %if.end2.i.i.us ], [ 1, %for.body.i.us ] %spec.select = add nsw i32 %count.028.i.us, %inc.i.us.sink %arrayidx2.i.us = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %indvars.iv.i.us store i32 %spec.select, ptr %arrayidx2.i.us, align 4, !tbaa !7 %22 = add nsw i64 %indvars.iv.i.us, 1 %arrayidx5.i.us = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %22 store i32 %spec.select, ptr %arrayidx5.i.us, align 4, !tbaa !7 %23 = trunc i64 %22 to i32 store i32 %23, ptr @checkEnd, align 4, !tbaa !7 %indvars.iv.next.i.us = add i64 %indvars.iv.i.us, 2 %24 = trunc i64 %indvars.iv.next.i.us to i32 %cmp.not.i.us = icmp ult i32 %1, %24 br i1 %cmp.not.i.us, label %sw.epilog, label %for.body.i.us, !llvm.loop !11 for.body.i: ; preds = %for.body.i.preheader53, %for.body.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader53 ] %arrayidx2.i = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %indvars.iv.i store i32 %4, ptr %arrayidx2.i, align 4, !tbaa !7 %25 = add nsw i64 %indvars.iv.i, 1 %arrayidx5.i = getelementptr inbounds [999999 x i32], ptr @check, i64 0, i64 %25 store i32 %4, ptr %arrayidx5.i, align 4, !tbaa !7 %indvars.iv.next.i = add nsw i64 %indvars.iv.i, 2 %26 = trunc i64 %indvars.iv.next.i to i32 %cmp.not.i = icmp ult i32 %1, %26 br i1 %cmp.not.i, label %countPrimarity.exit.split, label %for.body.i, !llvm.loop !15 countPrimarity.exit.split: ; preds = %for.body.i, %middle.block %.lcssa = phi i64 [ %19, %middle.block ], [ %25, %for.body.i ] %27 = trunc i64 %.lcssa to i32 store i32 %27, ptr @checkEnd, align 4, !tbaa !7 br label %sw.epilog sw.epilog: ; preds = %for.cond.i.us, %countPrimarity.exit.split, %while.body, %if.then, %sw.bb4 %.sink = phi i32 [ %3, %if.then ], [ 1, %sw.bb4 ], [ 0, %while.body ], [ %4, %countPrimarity.exit.split ], [ %spec.select, %for.cond.i.us ] %arrayidx11 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %indvars.iv store i32 %.sink, ptr %arrayidx11, align 4, !tbaa !7 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp1.not = icmp eq i32 %call16, -1 br i1 %cmp1.not, label %for.cond17.preheader, label %while.body, !llvm.loop !16 for.cond.cleanup19: ; preds = %for.body20, %entry, %for.cond17.preheader call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %result) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #8 ret i32 0 for.body20: ; preds = %for.body20.preheader, %for.body20 %indvars.iv46 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next47, %for.body20 ] %arrayidx22 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %indvars.iv46 %28 = load i32, ptr %arrayidx22, align 4, !tbaa !7 %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28) %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 %exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup19, label %for.body20, !llvm.loop !17 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.umax.i32(i32, i32) #7 attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind 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 #4 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = 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 = distinct !{!11, !6} !12 = distinct !{!12, !6, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !6, !14, !13} !16 = distinct !{!16, !6} !17 = distinct !{!17, !6}
#include<stdio.h> int main() { double x1,y1,x2,y2,xp,yp,xq,yq,x,y; double vx,vy,t; while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq)!=EOF) { vx=x2-x1; vy=y2-y1; t=(vx*(xq-x1)+vy*(yq-y1))/(vx*vx+vy*vy); xp=x1+t*vx; yp=y1+t*vy; x=2*xp-xq; y=2*yp-yq; printf("%lf %lf\n",x,y); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182545/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182545/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 [24 x i8] c"%lf,%lf,%lf,%lf,%lf,%lf\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"%lf %lf\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 %xq = alloca double, align 8 %yq = 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xq) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yq) #5 %call15 = 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, ptr noundef nonnull %xq, ptr noundef nonnull %yq) %cmp.not16 = icmp eq i32 %call15, -1 br i1 %cmp.not16, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %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 = load double, ptr %xq, align 8, !tbaa !5 %5 = load double, ptr %yq, align 8, !tbaa !5 %6 = insertelement <2 x double> poison, double %4, i64 0 %7 = insertelement <2 x double> %6, double %0, i64 1 %8 = insertelement <2 x double> poison, double %1, i64 0 %9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer %10 = fsub <2 x double> %7, %9 %11 = insertelement <2 x double> poison, double %5, i64 0 %12 = insertelement <2 x double> %11, double %2, i64 1 %13 = insertelement <2 x double> poison, double %3, i64 0 %14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer %15 = fsub <2 x double> %12, %14 %16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 1> %17 = fmul <2 x double> %16, %15 %18 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> <i32 1, i32 1> %19 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %10, <2 x double> %17) %20 = extractelement <2 x double> %19, i64 0 %21 = extractelement <2 x double> %19, i64 1 %div = fdiv double %20, %21 %22 = extractelement <2 x double> %10, i64 1 %23 = call double @llvm.fmuladd.f64(double %div, double %22, double %1) %24 = extractelement <2 x double> %15, i64 1 %25 = call double @llvm.fmuladd.f64(double %div, double %24, double %3) %neg = fneg double %4 %26 = call double @llvm.fmuladd.f64(double %23, double 2.000000e+00, double %neg) %neg6 = fneg double %5 %27 = call double @llvm.fmuladd.f64(double %25, double 2.000000e+00, double %neg6) %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %26, double noundef %27) %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, ptr noundef nonnull %xq, ptr noundef nonnull %yq) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yq) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xq) #5 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <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 = { 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> char convtable[32] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '.', ',', '-', '\'', '?' }; char * convtable1[32] = { "100101", //"A" "10011010", // B "0101", // C "0001", // D "110", // E "01001", // F "10011011", // G "010000", // H "0111", // I "10011000", // J "0110", // K "00100", // L "10011001", // M "10011110", // N "00101", // O "111", // P "10011111", // Q "1000", // R "00110", // S "00111", // T "10011100", // U "10011101", // V "000010", // W "10010010", // X "10010011", // Y "10010000", // Z "101", //' ' "010001", //"." "000011", //',' "10010001", //'-' "000000", //''' "000001" // ? }; int main() { char str[101]; char tmp[10000], *p, *p2, tmp5[6]; int strsize, i, wordsize, j = 0, round = 0; while ( fgets( str, 101, stdin ) ) { //printf( "round %3d => strlen : %3d ::: %s", round, strlen( str ), str ); if ( str[0] == '\n' ) { continue; } p = str; p2 = tmp; j = 0; round++; strsize = 0; while ( *p != '\n' && *p != '\0' ) { // *pをインクリメントしながら文字符号表に文字か判定する for ( i = 0 ; i < 32 ; i++ ) { // 入力文字を符号に変換し連結していく if ( convtable[i] == *p ) { // *pと一致する文字の場合, その符号語分tmpへコピーする strncpy( p2, convtable1[i], wordsize = strlen( convtable1[i] ) ); //printf( "%c = %s [%d]\n", *p, convtable1[i], strlen( convtable1[i] ) ); // printf( "%s ", convtable1[i] ); // tmpへコピーした文字の符号語の長さ分だけアドレスを加算 p2 += wordsize; // 一応符号語文字列の長さを記憶 strsize += wordsize; //*pをインクリメントする p++; j++; break; } } } // 連結した符号文字列が5の倍数ではない場合, 連結文字列が5の倍数になるように // 0をパディングする while ( strsize % 5 != 0 ) { *p2 = '0'; p2++; strsize++; } i = 0; p2 = tmp; // 変換した符号語を5文字区切りで変換する while ( i < strsize / 5 ) { strncpy( tmp5, p2, 5 ); printf( "%c", convtable[strtol( tmp5, NULL, 2 )] ); p2 += 5; i++; } printf( "\n" ); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182617/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182617/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" @convtable = dso_local local_unnamed_addr global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?", align 16 @.str = private unnamed_addr constant [7 x i8] c"100101\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"10011010\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"0101\00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"0001\00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"110\00", align 1 @.str.5 = private unnamed_addr constant [6 x i8] c"01001\00", align 1 @.str.6 = private unnamed_addr constant [9 x i8] c"10011011\00", align 1 @.str.7 = private unnamed_addr constant [7 x i8] c"010000\00", align 1 @.str.8 = private unnamed_addr constant [5 x i8] c"0111\00", align 1 @.str.9 = private unnamed_addr constant [9 x i8] c"10011000\00", align 1 @.str.10 = private unnamed_addr constant [5 x i8] c"0110\00", align 1 @.str.11 = private unnamed_addr constant [6 x i8] c"00100\00", align 1 @.str.12 = private unnamed_addr constant [9 x i8] c"10011001\00", align 1 @.str.13 = private unnamed_addr constant [9 x i8] c"10011110\00", align 1 @.str.14 = private unnamed_addr constant [6 x i8] c"00101\00", align 1 @.str.15 = private unnamed_addr constant [4 x i8] c"111\00", align 1 @.str.16 = private unnamed_addr constant [9 x i8] c"10011111\00", align 1 @.str.17 = private unnamed_addr constant [5 x i8] c"1000\00", align 1 @.str.18 = private unnamed_addr constant [6 x i8] c"00110\00", align 1 @.str.19 = private unnamed_addr constant [6 x i8] c"00111\00", align 1 @.str.20 = private unnamed_addr constant [9 x i8] c"10011100\00", align 1 @.str.21 = private unnamed_addr constant [9 x i8] c"10011101\00", align 1 @.str.22 = private unnamed_addr constant [7 x i8] c"000010\00", align 1 @.str.23 = private unnamed_addr constant [9 x i8] c"10010010\00", align 1 @.str.24 = private unnamed_addr constant [9 x i8] c"10010011\00", align 1 @.str.25 = private unnamed_addr constant [9 x i8] c"10010000\00", align 1 @.str.26 = private unnamed_addr constant [4 x i8] c"101\00", align 1 @.str.27 = private unnamed_addr constant [7 x i8] c"010001\00", align 1 @.str.28 = private unnamed_addr constant [7 x i8] c"000011\00", align 1 @.str.29 = private unnamed_addr constant [9 x i8] c"10010001\00", align 1 @.str.30 = private unnamed_addr constant [7 x i8] c"000000\00", align 1 @.str.31 = private unnamed_addr constant [7 x i8] c"000001\00", align 1 @convtable1 = dso_local local_unnamed_addr global [32 x ptr] [ptr @.str, ptr @.str.1, ptr @.str.2, ptr @.str.3, ptr @.str.4, ptr @.str.5, ptr @.str.6, ptr @.str.7, ptr @.str.8, ptr @.str.9, ptr @.str.10, ptr @.str.11, ptr @.str.12, ptr @.str.13, ptr @.str.14, ptr @.str.15, ptr @.str.16, ptr @.str.17, ptr @.str.18, ptr @.str.19, ptr @.str.20, ptr @.str.21, ptr @.str.22, ptr @.str.23, ptr @.str.24, ptr @.str.25, ptr @.str.26, ptr @.str.27, ptr @.str.28, ptr @.str.29, ptr @.str.30, ptr @.str.31], align 16 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [101 x i8], align 16 %tmp = alloca [10000 x i8], align 16 %tmp5 = alloca [6 x i8], align 1 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %str) #7 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %tmp) #7 call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %tmp5) #7 br label %while.cond while.cond: ; preds = %while.cond.backedge, %entry %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 101, ptr noundef %0) %tobool.not = icmp eq ptr %call, null br i1 %tobool.not, label %while.end54, label %while.body while.body: ; preds = %while.cond %1 = load i8, ptr %str, align 16, !tbaa !9 %cmp = icmp eq i8 %1, 10 br i1 %cmp, label %while.cond.backedge, label %while.cond4.preheader while.cond.backedge: ; preds = %while.body, %while.end52 br label %while.cond, !llvm.loop !10 while.cond4.preheader: ; preds = %while.body %2 = load i8, ptr @convtable, align 16 %3 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 1), align 1 %4 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 2), align 2 %5 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 3), align 1 %6 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 4), align 4 %7 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 5), align 1 %8 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 6), align 2 %9 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 7), align 1 %10 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 8), align 8 %11 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 9), align 1 %12 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 10), align 2 %13 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 11), align 1 %14 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 12), align 4 %15 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 13), align 1 %16 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 14), align 2 %17 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 15), align 1 %18 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 16), align 16 %19 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 17), align 1 %20 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 18), align 2 %21 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 19), align 1 %22 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 20), align 4 %23 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 21), align 1 %24 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 22), align 2 %25 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 23), align 1 %26 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 24), align 8 %27 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 25), align 1 %28 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 26), align 2 %29 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 27), align 1 %30 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 28), align 4 %31 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 29), align 1 %32 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 30), align 2 %33 = load i8, ptr getelementptr inbounds ([32 x i8], ptr @convtable, i64 0, i64 31), align 1 br label %while.cond4.outer while.cond4.outer: ; preds = %while.cond4.preheader, %if.then19 %.pr84.ph = phi i8 [ %1, %while.cond4.preheader ], [ %.pr.pre, %if.then19 ] %p2.0.ph = phi ptr [ %tmp, %while.cond4.preheader ], [ %add.ptr, %if.then19 ] %strsize.0.ph = phi i32 [ 0, %while.cond4.preheader ], [ %add, %if.then19 ] %p.0.ph = phi ptr [ %str, %while.cond4.preheader ], [ %incdec.ptr, %if.then19 ] %cmp17 = icmp eq i8 %2, %.pr84.ph %cmp17.1 = icmp eq i8 %3, %.pr84.ph %cmp17.2 = icmp eq i8 %4, %.pr84.ph %cmp17.3 = icmp eq i8 %5, %.pr84.ph %cmp17.4 = icmp eq i8 %6, %.pr84.ph %cmp17.5 = icmp eq i8 %7, %.pr84.ph %cmp17.6 = icmp eq i8 %8, %.pr84.ph %cmp17.7 = icmp eq i8 %9, %.pr84.ph %cmp17.8 = icmp eq i8 %10, %.pr84.ph %cmp17.9 = icmp eq i8 %11, %.pr84.ph %cmp17.10 = icmp eq i8 %12, %.pr84.ph %cmp17.11 = icmp eq i8 %13, %.pr84.ph %cmp17.12 = icmp eq i8 %14, %.pr84.ph %cmp17.13 = icmp eq i8 %15, %.pr84.ph %cmp17.14 = icmp eq i8 %16, %.pr84.ph %cmp17.15 = icmp eq i8 %17, %.pr84.ph %cmp17.16 = icmp eq i8 %18, %.pr84.ph %cmp17.17 = icmp eq i8 %19, %.pr84.ph %cmp17.18 = icmp eq i8 %20, %.pr84.ph %cmp17.19 = icmp eq i8 %21, %.pr84.ph %cmp17.20 = icmp eq i8 %22, %.pr84.ph %cmp17.21 = icmp eq i8 %23, %.pr84.ph %cmp17.22 = icmp eq i8 %24, %.pr84.ph %cmp17.23 = icmp eq i8 %25, %.pr84.ph %cmp17.24 = icmp eq i8 %26, %.pr84.ph %cmp17.25 = icmp eq i8 %27, %.pr84.ph %cmp17.26 = icmp eq i8 %28, %.pr84.ph %cmp17.27 = icmp eq i8 %29, %.pr84.ph %cmp17.28 = icmp eq i8 %30, %.pr84.ph %cmp17.29 = icmp eq i8 %31, %.pr84.ph %cmp17.30 = icmp eq i8 %32, %.pr84.ph %cmp17.31 = icmp eq i8 %33, %.pr84.ph br label %while.cond4 while.cond4: ; preds = %for.body.preheader, %while.cond4.outer switch i8 %.pr84.ph, label %for.body.preheader [ i8 10, label %while.end i8 0, label %while.end ] for.body.preheader: ; preds = %while.cond4 %brmerge = select i1 %cmp17, i1 true, i1 %cmp17.1 %.mux = select i1 %cmp17, i64 0, i64 1 %brmerge86 = select i1 %brmerge, i1 true, i1 %cmp17.2 %.mux.mux = select i1 %brmerge, i64 %.mux, i64 2 %brmerge87 = select i1 %brmerge86, i1 true, i1 %cmp17.3 %.mux.mux.mux = select i1 %brmerge86, i64 %.mux.mux, i64 3 %brmerge88 = select i1 %brmerge87, i1 true, i1 %cmp17.4 %.mux.mux.mux.mux = select i1 %brmerge87, i64 %.mux.mux.mux, i64 4 %brmerge89 = select i1 %brmerge88, i1 true, i1 %cmp17.5 %.mux.mux.mux.mux.mux = select i1 %brmerge88, i64 %.mux.mux.mux.mux, i64 5 %brmerge90 = select i1 %brmerge89, i1 true, i1 %cmp17.6 %.mux.mux.mux.mux.mux.mux = select i1 %brmerge89, i64 %.mux.mux.mux.mux.mux, i64 6 %brmerge91 = select i1 %brmerge90, i1 true, i1 %cmp17.7 %.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge90, i64 %.mux.mux.mux.mux.mux.mux, i64 7 %brmerge92 = select i1 %brmerge91, i1 true, i1 %cmp17.8 %.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge91, i64 %.mux.mux.mux.mux.mux.mux.mux, i64 8 %brmerge93 = select i1 %brmerge92, i1 true, i1 %cmp17.9 %.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge92, i64 %.mux.mux.mux.mux.mux.mux.mux.mux, i64 9 %brmerge94 = select i1 %brmerge93, i1 true, i1 %cmp17.10 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge93, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 10 %brmerge95 = select i1 %brmerge94, i1 true, i1 %cmp17.11 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge94, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 11 %brmerge96 = select i1 %brmerge95, i1 true, i1 %cmp17.12 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge95, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 12 %brmerge97 = select i1 %brmerge96, i1 true, i1 %cmp17.13 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge96, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 13 %brmerge98 = select i1 %brmerge97, i1 true, i1 %cmp17.14 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge97, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 14 %brmerge99 = select i1 %brmerge98, i1 true, i1 %cmp17.15 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge98, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 15 %brmerge100 = select i1 %brmerge99, i1 true, i1 %cmp17.16 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge99, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 16 %brmerge101 = select i1 %brmerge100, i1 true, i1 %cmp17.17 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge100, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 17 %brmerge102 = select i1 %brmerge101, i1 true, i1 %cmp17.18 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge101, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 18 %brmerge103 = select i1 %brmerge102, i1 true, i1 %cmp17.19 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge102, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 19 %brmerge104 = select i1 %brmerge103, i1 true, i1 %cmp17.20 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge103, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 20 %brmerge105 = select i1 %brmerge104, i1 true, i1 %cmp17.21 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge104, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 21 %brmerge106 = select i1 %brmerge105, i1 true, i1 %cmp17.22 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge105, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 22 %brmerge107 = select i1 %brmerge106, i1 true, i1 %cmp17.23 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge106, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 23 %brmerge108 = select i1 %brmerge107, i1 true, i1 %cmp17.24 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge107, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 24 %brmerge109 = select i1 %brmerge108, i1 true, i1 %cmp17.25 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge108, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 25 %brmerge110 = select i1 %brmerge109, i1 true, i1 %cmp17.26 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge109, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 26 %brmerge111 = select i1 %brmerge110, i1 true, i1 %cmp17.27 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge110, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 27 %brmerge112 = select i1 %brmerge111, i1 true, i1 %cmp17.28 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge111, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 28 %brmerge113 = select i1 %brmerge112, i1 true, i1 %cmp17.29 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge112, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 29 %brmerge114 = select i1 %brmerge113, i1 true, i1 %cmp17.30 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge113, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 30 %brmerge115 = select i1 %brmerge114, i1 true, i1 %cmp17.31 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux = select i1 %brmerge114, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux, i64 31 br i1 %brmerge115, label %if.then19, label %while.cond4 if.then19: ; preds = %for.body.preheader %arrayidx21 = getelementptr inbounds [32 x ptr], ptr @convtable1, i64 0, i64 %.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux.mux %34 = load ptr, ptr %arrayidx21, align 8, !tbaa !5 %call24 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %34) #8 %conv25 = trunc i64 %call24 to i32 %sext = shl i64 %call24, 32 %conv26 = ashr exact i64 %sext, 32 %call27 = call ptr @strncpy(ptr noundef %p2.0.ph, ptr noundef %34, i64 noundef %conv26) #7 %add.ptr = getelementptr inbounds i8, ptr %p2.0.ph, i64 %conv26 %add = add nsw i32 %strsize.0.ph, %conv25 %incdec.ptr = getelementptr inbounds i8, ptr %p.0.ph, i64 1 %.pr.pre = load i8, ptr %incdec.ptr, align 1, !tbaa !9 br label %while.cond4.outer, !llvm.loop !12 while.end: ; preds = %while.cond4, %while.cond4 %rem75 = srem i32 %strsize.0.ph, 5 %cmp32.not76 = icmp eq i32 %rem75, 0 br i1 %cmp32.not76, label %while.cond39.preheader, label %while.body34 while.cond39.preheader: ; preds = %while.body34, %while.end %strsize.2.lcssa = phi i32 [ %strsize.0.ph, %while.end ], [ %inc36, %while.body34 ] %div = sdiv i32 %strsize.2.lcssa, 5 %cmp4079 = icmp sgt i32 %strsize.2.lcssa, 4 br i1 %cmp4079, label %while.body42, label %while.end52 while.body34: ; preds = %while.end, %while.body34 %strsize.278 = phi i32 [ %inc36, %while.body34 ], [ %strsize.0.ph, %while.end ] %p2.277 = phi ptr [ %incdec.ptr35, %while.body34 ], [ %p2.0.ph, %while.end ] store i8 48, ptr %p2.277, align 1, !tbaa !9 %incdec.ptr35 = getelementptr inbounds i8, ptr %p2.277, i64 1 %inc36 = add nsw i32 %strsize.278, 1 %rem = srem i32 %inc36, 5 %cmp32.not = icmp eq i32 %rem, 0 br i1 %cmp32.not, label %while.cond39.preheader, label %while.body34, !llvm.loop !13 while.body42: ; preds = %while.cond39.preheader, %while.body42 %i.181 = phi i32 [ %inc51, %while.body42 ], [ 0, %while.cond39.preheader ] %p2.380 = phi ptr [ %add.ptr50, %while.body42 ], [ %tmp, %while.cond39.preheader ] %call44 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %tmp5, ptr noundef nonnull dereferenceable(1) %p2.380, i64 noundef 5) #7 %call46 = call i64 @strtol(ptr nocapture noundef nonnull %tmp5, ptr noundef null, i32 noundef 2) #7 %arrayidx47 = getelementptr inbounds [32 x i8], ptr @convtable, i64 0, i64 %call46 %35 = load i8, ptr %arrayidx47, align 1, !tbaa !9 %conv48 = sext i8 %35 to i32 %putchar73 = call i32 @putchar(i32 %conv48) %add.ptr50 = getelementptr inbounds i8, ptr %p2.380, i64 5 %inc51 = add nuw nsw i32 %i.181, 1 %exitcond.not = icmp eq i32 %inc51, %div br i1 %exitcond.not, label %while.end52, label %while.body42, !llvm.loop !14 while.end52: ; preds = %while.body42, %while.cond39.preheader %putchar = call i32 @putchar(i32 10) br label %while.cond.backedge while.end54: ; preds = %while.cond call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %tmp5) #7 call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %tmp) #7 call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %str) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; 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 #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 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 = { mustprogress nofree nounwind willreturn "no-trapping-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 } attributes #8 = { 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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11} !14 = distinct !{!14, !11}
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { unsigned long long int n,a,b; int ok = 1; scanf("%lld%lld%lld",&n,&a,&b); unsigned long long int min = (n-1)*a + b; unsigned long long int max =(n-1)*b + a; if(a>b){ ok = 0; } else if((a!=b) && n<=1){ ok = 0; } else{ printf("%lld\n",max-min+1); } if(ok == 0){ printf("%d",0); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182675/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182675/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 [13 x i8] c"%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %a = alloca i64, align 8 %b = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i64, ptr %n, align 8 %sub = add i64 %0, -1 %1 = load i64, ptr %a, align 8, !tbaa !5 %2 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %1, %2 br i1 %cmp, label %if.then13, label %if.else if.else: ; preds = %entry %cmp4 = icmp ne i64 %1, %2 %cmp5 = icmp ult i64 %0, 2 %or.cond = select i1 %cmp4, i1 %cmp5, i1 false br i1 %or.cond, label %if.then13, label %if.else7 if.else7: ; preds = %if.else %reass.add = sub i64 %2, %1 %reass.mul = mul i64 %reass.add, %sub %add3 = add i64 %1, 1 %sub8 = sub i64 %add3, %2 %add9 = add i64 %sub8, %reass.mul %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add9) br label %if.end15 if.then13: ; preds = %entry, %if.else %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0) br label %if.end15 if.end15: ; preds = %if.else7, %if.then13 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %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 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void){ // Here your code ! long long N,A,B; long long min,max,ans; scanf("%lld %lld %lld",&N,&A,&B); min = A*(N-1)+B; max = A+(N-1)*B; ans = max-min+1; if(N != 1 && A<=B){ printf("%lld\n",ans); }else if(N == 1 && A<B){ printf("0\n"); }else if(N == 1 && A == B){ printf("1\n"); }else{ printf("0\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182718/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182718/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @str.4 = private unnamed_addr constant [2 x i8] c"1\00", align 1 @str.5 = 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, ptr noundef nonnull %A, ptr noundef nonnull %B) %0 = load i64, ptr %A, align 8, !tbaa !5 %1 = load i64, ptr %N, align 8, !tbaa !5 %2 = load i64, ptr %B, align 8, !tbaa !5 %cmp.not = icmp eq i64 %1, 1 %cmp6.not = icmp sgt i64 %0, %2 %or.cond = select i1 %cmp.not, i1 true, i1 %cmp6.not br i1 %or.cond, label %if.else, label %if.then if.then: ; preds = %entry %sub = add nsw i64 %1, -1 %reass.add = sub i64 %2, %0 %reass.mul = mul i64 %reass.add, %sub %add3 = add i64 %0, 1 %sub4 = sub i64 %add3, %2 %add5 = add i64 %sub4, %reass.mul %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add5) br label %if.end22 if.else: ; preds = %entry br i1 %cmp.not, label %land.lhs.true9, label %if.else19 land.lhs.true9: ; preds = %if.else %cmp10 = icmp slt i64 %0, %2 br i1 %cmp10, label %if.then11, label %land.lhs.true15 if.then11: ; preds = %land.lhs.true9 %puts24 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5) br label %if.end22 land.lhs.true15: ; preds = %land.lhs.true9 %cmp16 = icmp eq i64 %0, %2 br i1 %cmp16, label %if.then17, label %if.else19 if.then17: ; preds = %land.lhs.true15 %puts23 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end22 if.else19: ; preds = %if.else, %land.lhs.true15 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.5) br label %if.end22 if.end22: ; preds = %if.then11, %if.else19, %if.then17, %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> int less(const void* a, const void* b){ return *(int*)a - *(int*)b; } int is_no_need(int i, const int* a, int K, int N){ int dp[K]; dp[0] = 1; for(int k = 1; k < K; k++) dp[k] = 0; for(int j = 1; j <= N; j++){ if(j == i) continue; for(int k = K - 1; k >= a[j]; k--){ dp[k] |= dp[k - a[j]]; } } for(int k = K - 1; k >= 0; k--){ if(dp[k]) return k + a[i] < K; } } int count_no_need(const int* a, int K, int N){ //不必要でないカードのうち, 書かれた数が最小であるもの int need = N + 1; //不必要であるカードのうち, 書かれた数が最大であるもの int no_need = 0; while(need - no_need > 1){ int i = (need + no_need) / 2; if(is_no_need(i, a, K, N)) no_need = i; else need = i; } return no_need; } int main(){ int N, K; scanf(" %d %d ", &N, &K); int a[N + 1]; a[0] = 0; for(int i = 1; i <= N; i++) scanf(" %d ", a + i); qsort(a, N + 1, sizeof(int), less); printf("%d\n", count_no_need(a, K, N)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182769/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182769/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" %d %d \00", align 1 @.str.1 = private unnamed_addr constant [5 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 @less(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 nosync nounwind memory(argmem: read) uwtable define dso_local i32 @is_no_need(i32 noundef %i, ptr nocapture noundef readonly %a, i32 noundef %K, i32 noundef %N) local_unnamed_addr #1 { entry: %0 = zext i32 %K to i64 %vla = alloca i32, i64 %0, align 16 store i32 1, ptr %vla, align 16, !tbaa !5 %cmp64 = icmp sgt i32 %K, 1 br i1 %cmp64, label %for.body.preheader, label %for.cond2.preheader for.body.preheader: ; preds = %entry %scevgep = getelementptr i8, ptr %vla, i64 4 %1 = add nsw i32 %K, -1 %2 = zext i32 %1 to i64 %3 = shl nuw nsw i64 %2, 2 call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %3, i1 false), !tbaa !5 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.body.preheader, %entry %cmp3.not68 = icmp slt i32 %N, 1 br i1 %cmp3.not68, label %for.cond28.preheader, label %for.body5.preheader for.body5.preheader: ; preds = %for.cond2.preheader %4 = sext i32 %K to i64 %5 = zext i32 %i to i64 %6 = add nuw i32 %N, 1 %wide.trip.count = zext i32 %6 to i64 %7 = shl nsw i64 %4, 2 %8 = add nsw i64 %7, -4 %scevgep80 = getelementptr i8, ptr %vla, i64 %8 %scevgep81 = getelementptr i8, ptr %vla, i64 %8 %9 = shl nsw i64 %4, 2 %scevgep87 = getelementptr i8, ptr %vla, i64 %9 %scevgep88 = getelementptr i8, ptr %vla, i64 %9 %bound1 = icmp ult ptr %vla, %scevgep87 br label %for.body5 for.body5: ; preds = %for.body5.preheader, %for.inc23 %indvars.iv73 = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next74, %for.inc23 ] %cmp6 = icmp eq i64 %indvars.iv73, %5 br i1 %cmp6, label %for.inc23, label %for.cond8.preheader for.cond8.preheader: ; preds = %for.body5 %arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv73 %10 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11.not.not66 = icmp slt i32 %10, %K br i1 %cmp11.not.not66, label %for.body13.preheader, label %for.inc23 for.body13.preheader: ; preds = %for.cond8.preheader %11 = sext i32 %10 to i64 %12 = sub nsw i64 %4, %11 %min.iters.check = icmp ult i64 %12, 32 br i1 %min.iters.check, label %for.body13.preheader98, label %vector.scevcheck vector.scevcheck: ; preds = %for.body13.preheader %13 = xor i64 %11, -1 %14 = add nsw i64 %13, %4 %mul.result.neg = mul nsw i64 %14, -4 %15 = getelementptr i8, ptr %scevgep80, i64 %mul.result.neg %16 = icmp ugt ptr %15, %scevgep80 %17 = mul nsw i64 %11, -4 %scevgep82 = getelementptr i8, ptr %scevgep81, i64 %17 %mul.result84.neg = mul nsw i64 %14, -4 %mul.overflow85 = icmp ugt i64 %14, 4611686018427387903 %18 = getelementptr i8, ptr %scevgep82, i64 %mul.result84.neg %19 = icmp ugt ptr %18, %scevgep82 %20 = or i1 %19, %mul.overflow85 %21 = or i1 %16, %20 br i1 %21, label %for.body13.preheader98, label %vector.memcheck vector.memcheck: ; preds = %vector.scevcheck %22 = shl nsw i64 %11, 2 %scevgep86 = getelementptr i8, ptr %vla, i64 %22 %23 = mul nsw i64 %11, -4 %scevgep89 = getelementptr i8, ptr %scevgep88, i64 %23 %bound0 = icmp ult ptr %scevgep86, %scevgep89 %found.conflict = and i1 %bound0, %bound1 br i1 %found.conflict, label %for.body13.preheader98, label %vector.ph vector.ph: ; preds = %vector.memcheck %n.vec = and i64 %12, -8 %ind.end = sub nsw i64 %4, %n.vec br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %24 = xor i64 %index, -1 %25 = add i64 %24, %4 %26 = sub nsw i64 %25, %11 %27 = getelementptr inbounds i32, ptr %vla, i64 %26 %28 = getelementptr inbounds i32, ptr %27, i64 -3 %wide.load = load <4 x i32>, ptr %28, align 4, !tbaa !5, !alias.scope !9 %29 = getelementptr inbounds i32, ptr %27, i64 -7 %wide.load90 = load <4 x i32>, ptr %29, align 4, !tbaa !5, !alias.scope !9 %30 = getelementptr inbounds i32, ptr %vla, i64 %25 %31 = getelementptr inbounds i32, ptr %30, i64 -3 %wide.load92 = load <4 x i32>, ptr %31, align 4, !tbaa !5, !alias.scope !12, !noalias !9 %32 = getelementptr inbounds i32, ptr %30, i64 -7 %wide.load94 = load <4 x i32>, ptr %32, align 4, !tbaa !5, !alias.scope !12, !noalias !9 %33 = or <4 x i32> %wide.load92, %wide.load %34 = or <4 x i32> %wide.load94, %wide.load90 store <4 x i32> %33, ptr %31, align 4, !tbaa !5, !alias.scope !12, !noalias !9 store <4 x i32> %34, ptr %32, align 4, !tbaa !5, !alias.scope !12, !noalias !9 %index.next = add nuw i64 %index, 8 %35 = icmp eq i64 %index.next, %n.vec br i1 %35, label %middle.block, label %vector.body, !llvm.loop !14 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %12, %n.vec br i1 %cmp.n, label %for.inc23, label %for.body13.preheader98 for.body13.preheader98: ; preds = %vector.memcheck, %vector.scevcheck, %for.body13.preheader, %middle.block %indvars.iv.ph = phi i64 [ %4, %vector.memcheck ], [ %4, %vector.scevcheck ], [ %4, %for.body13.preheader ], [ %ind.end, %middle.block ] br label %for.body13 for.body13: ; preds = %for.body13.preheader98, %for.body13 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body13 ], [ %indvars.iv.ph, %for.body13.preheader98 ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %36 = sub nsw i64 %indvars.iv.next, %11 %arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %36 %37 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next %38 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %or = or i32 %38, %37 store i32 %or, ptr %arrayidx20, align 4, !tbaa !5 %cmp11.not.not = icmp sgt i64 %indvars.iv.next, %11 br i1 %cmp11.not.not, label %for.body13, label %for.inc23, !llvm.loop !18 for.inc23: ; preds = %for.body13, %middle.block, %for.cond8.preheader, %for.body5 %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count br i1 %exitcond.not, label %for.cond28.preheader, label %for.body5, !llvm.loop !19 for.cond28.preheader: ; preds = %for.inc23, %for.cond2.preheader br label %for.cond28 for.cond28: ; preds = %for.cond28.preheader, %for.body31 %indvars.iv76 = phi i64 [ %40, %for.body31 ], [ %0, %for.cond28.preheader ] %39 = trunc i64 %indvars.iv76 to i32 %cmp29 = icmp sgt i32 %39, 0 br i1 %cmp29, label %for.body31, label %cleanup for.body31: ; preds = %for.cond28 %40 = add nsw i64 %indvars.iv76, -1 %arrayidx33 = getelementptr inbounds i32, ptr %vla, i64 %40 %41 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %tobool.not = icmp eq i32 %41, 0 br i1 %tobool.not, label %for.cond28, label %if.then34, !llvm.loop !20 if.then34: ; preds = %for.body31 %42 = trunc i64 %40 to i32 %idxprom35 = sext i32 %i to i64 %arrayidx36 = getelementptr inbounds i32, ptr %a, i64 %idxprom35 %43 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %add = add nsw i32 %43, %42 %cmp37 = icmp slt i32 %add, %K %conv = zext i1 %cmp37 to i32 br label %cleanup cleanup: ; preds = %for.cond28, %if.then34 %retval.0 = phi i32 [ %conv, %if.then34 ], [ undef, %for.cond28 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #2 ; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable define dso_local i32 @count_no_need(ptr nocapture noundef readonly %a, i32 noundef %K, i32 noundef %N) local_unnamed_addr #1 { entry: %cmp8 = icmp sgt i32 %N, 0 br i1 %cmp8, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %entry %add = add nuw nsw i32 %N, 1 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %need.010 = phi i32 [ %div.need.0, %while.body ], [ %add, %while.body.preheader ] %no_need.09 = phi i32 [ %no_need.0.div, %while.body ], [ 0, %while.body.preheader ] %add1 = add nsw i32 %need.010, %no_need.09 %div = sdiv i32 %add1, 2 %call = tail call i32 @is_no_need(i32 noundef %div, ptr noundef %a, i32 noundef %K, i32 noundef %N) %tobool.not = icmp eq i32 %call, 0 %no_need.0.div = select i1 %tobool.not, i32 %no_need.09, i32 %div %div.need.0 = select i1 %tobool.not, i32 %div, i32 %need.010 %sub = sub nsw i32 %div.need.0, %no_need.0.div %cmp = icmp sgt i32 %sub, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !21 while.end: ; preds = %while.body, %entry %no_need.0.lcssa = phi i32 [ 0, %entry ], [ %no_need.0.div, %while.body ] ret i32 %no_need.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #4 { entry: %N = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #8 %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 %add = add nsw i32 %0, 1 %1 = zext i32 %add 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 %cmp.not7 = icmp slt i32 %3, 1 br i1 %cmp.not7, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.body, %entry %.lcssa = phi i32 [ %3, %entry ], [ %6, %for.body ] %add2 = add nsw i32 %.lcssa, 1 %conv = sext i32 %add2 to i64 call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @less) #8 %4 = load i32, ptr %K, align 4, !tbaa !5 %5 = load i32, ptr %N, align 4, !tbaa !5 %cmp8.i = icmp sgt i32 %5, 0 br i1 %cmp8.i, label %while.body.preheader.i, label %count_no_need.exit while.body.preheader.i: ; preds = %for.cond.cleanup %add.i = add nuw nsw i32 %5, 1 br label %while.body.i while.body.i: ; preds = %while.body.i, %while.body.preheader.i %need.010.i = phi i32 [ %div.need.0.i, %while.body.i ], [ %add.i, %while.body.preheader.i ] %no_need.09.i = phi i32 [ %no_need.0.div.i, %while.body.i ], [ 0, %while.body.preheader.i ] %add1.i = add nsw i32 %no_need.09.i, %need.010.i %div.i = sdiv i32 %add1.i, 2 %call.i = call i32 @is_no_need(i32 noundef %div.i, ptr noundef nonnull %vla, i32 noundef %4, i32 noundef %5) %tobool.not.i = icmp eq i32 %call.i, 0 %no_need.0.div.i = select i1 %tobool.not.i, i32 %no_need.09.i, i32 %div.i %div.need.0.i = select i1 %tobool.not.i, i32 %div.i, i32 %need.010.i %sub.i = sub nsw i32 %div.need.0.i, %no_need.0.div.i %cmp.i = icmp sgt i32 %sub.i, 1 br i1 %cmp.i, label %while.body.i, label %count_no_need.exit, !llvm.loop !21 count_no_need.exit: ; preds = %while.body.i, %for.cond.cleanup %no_need.0.lcssa.i = phi i32 [ 0, %for.cond.cleanup ], [ %no_need.0.div.i, %while.body.i ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %no_need.0.lcssa.i) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8 ret i32 0 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %add.ptr = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr) %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 %cmp.not.not = icmp slt i64 %indvars.iv, %7 br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !22 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7 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(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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { 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 #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 "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10} !10 = distinct !{!10, !11} !11 = distinct !{!11, !"LVerDomain"} !12 = !{!13} !13 = distinct !{!13, !11} !14 = distinct !{!14, !15, !16, !17} !15 = !{!"llvm.loop.mustprogress"} !16 = !{!"llvm.loop.isvectorized", i32 1} !17 = !{!"llvm.loop.unroll.runtime.disable"} !18 = distinct !{!18, !15, !16} !19 = distinct !{!19, !15} !20 = distinct !{!20, !15} !21 = distinct !{!21, !15} !22 = distinct !{!22, !15}
#include <stdio.h> int main(void) { int i, j; int n; int ball[10]; int min; int B; scanf("%d", &n); while (n--) { B = 0; for (i = 0; i < 10; i++) scanf("%d", &ball[i]); for (i = 0; i < 10; i++) { min = ball[i]; for (j = i + 1; j < 10; j++) if( ball[j] < min) min = ball[j]; if( ball[i] != min) if( B < ball[i]) B = ball[i]; else break; } if( i < 10) printf("NO\n"); else printf("YES\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182819/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182819/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 [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 %ball = alloca [10 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %ball) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec61 = add nsw i32 %0, -1 store i32 %dec61, ptr %n, align 4, !tbaa !5 %tobool.not62 = icmp eq i32 %0, 0 br i1 %tobool.not62, label %while.end, label %for.cond.preheader.preheader for.cond.preheader.preheader: ; preds = %entry %arrayidx.1 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 1 %arrayidx.2 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 2 %arrayidx.3 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 3 %arrayidx.4 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 4 %arrayidx.5 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 5 %arrayidx.6 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 6 %arrayidx.7 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 7 %arrayidx.8 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 8 %arrayidx.9 = getelementptr inbounds [10 x i32], ptr %ball, i64 0, i64 9 br label %for.end17 for.end17: ; preds = %for.cond.preheader.preheader, %if.end38 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4) %call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5) %call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.6) %call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.7) %call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.8) %call1.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.9) %1 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %2 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %3 = load <8 x i32>, ptr %ball, align 16, !tbaa !5 %4 = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> %3) %5 = call i32 @llvm.smin.i32(i32 %4, i32 %2) %6 = call i32 @llvm.smin.i32(i32 %5, i32 %1) %7 = extractelement <8 x i32> %3, i64 0 %cmp20.not = icmp eq i32 %7, %6 br i1 %cmp20.not, label %for.end17.1, label %if.then21 if.then21: ; preds = %for.end17 %cmp24 = icmp sgt i32 %7, 0 br i1 %cmp24, label %for.end17.1, label %if.then34 for.end17.1: ; preds = %if.then21, %for.end17 %B.1 = phi i32 [ 0, %for.end17 ], [ %7, %if.then21 ] %8 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %9 = load <8 x i32>, ptr %arrayidx.1, align 4, !tbaa !5 %10 = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> %9) %11 = call i32 @llvm.smin.i32(i32 %10, i32 %8) %12 = extractelement <8 x i32> %9, i64 0 %cmp20.not.1 = icmp eq i32 %12, %11 br i1 %cmp20.not.1, label %for.end17.2, label %if.then21.1 if.then21.1: ; preds = %for.end17.1 %cmp24.1 = icmp slt i32 %B.1, %12 br i1 %cmp24.1, label %for.end17.2, label %if.then34 for.end17.2: ; preds = %if.then21.1, %for.end17.1 %B.1.1 = phi i32 [ %B.1, %for.end17.1 ], [ %12, %if.then21.1 ] %13 = load <8 x i32>, ptr %arrayidx.2, align 8, !tbaa !5 %14 = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> %13) %15 = extractelement <8 x i32> %13, i64 0 %cmp20.not.2 = icmp eq i32 %15, %14 br i1 %cmp20.not.2, label %for.end17.3, label %if.then21.2 if.then21.2: ; preds = %for.end17.2 %cmp24.2 = icmp slt i32 %B.1.1, %15 br i1 %cmp24.2, label %for.end17.3, label %if.then34 for.end17.3: ; preds = %if.then21.2, %for.end17.2 %B.1.2 = phi i32 [ %B.1.1, %for.end17.2 ], [ %15, %if.then21.2 ] %16 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %17 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %18 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %19 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %20 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %21 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %22 = load i32, ptr %arrayidx.4, align 16, !tbaa !5 %spec.select.3 = call i32 @llvm.smin.i32(i32 %22, i32 %16) %spec.select.3.1 = call i32 @llvm.smin.i32(i32 %21, i32 %spec.select.3) %spec.select.3.2 = call i32 @llvm.smin.i32(i32 %20, i32 %spec.select.3.1) %spec.select.3.3 = call i32 @llvm.smin.i32(i32 %19, i32 %spec.select.3.2) %spec.select.3.4 = call i32 @llvm.smin.i32(i32 %18, i32 %spec.select.3.3) %spec.select.3.5 = call i32 @llvm.smin.i32(i32 %17, i32 %spec.select.3.4) %cmp20.not.3 = icmp eq i32 %16, %spec.select.3.5 br i1 %cmp20.not.3, label %for.end17.4, label %if.then21.3 if.then21.3: ; preds = %for.end17.3 %cmp24.3 = icmp slt i32 %B.1.2, %16 br i1 %cmp24.3, label %for.end17.4, label %if.then34 for.end17.4: ; preds = %if.then21.3, %for.end17.3 %B.1.3 = phi i32 [ %B.1.2, %for.end17.3 ], [ %16, %if.then21.3 ] %23 = load i32, ptr %arrayidx.4, align 16, !tbaa !5 %24 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %25 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %26 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %27 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %28 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %spec.select.4 = call i32 @llvm.smin.i32(i32 %28, i32 %23) %spec.select.4.1 = call i32 @llvm.smin.i32(i32 %27, i32 %spec.select.4) %spec.select.4.2 = call i32 @llvm.smin.i32(i32 %26, i32 %spec.select.4.1) %spec.select.4.3 = call i32 @llvm.smin.i32(i32 %25, i32 %spec.select.4.2) %spec.select.4.4 = call i32 @llvm.smin.i32(i32 %24, i32 %spec.select.4.3) %cmp20.not.4 = icmp eq i32 %23, %spec.select.4.4 br i1 %cmp20.not.4, label %for.end17.5, label %if.then21.4 if.then21.4: ; preds = %for.end17.4 %cmp24.4 = icmp slt i32 %B.1.3, %23 br i1 %cmp24.4, label %for.end17.5, label %if.then34 for.end17.5: ; preds = %if.then21.4, %for.end17.4 %B.1.4 = phi i32 [ %B.1.3, %for.end17.4 ], [ %23, %if.then21.4 ] %29 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %30 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %31 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %32 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %33 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %spec.select.5 = call i32 @llvm.smin.i32(i32 %33, i32 %29) %spec.select.5.1 = call i32 @llvm.smin.i32(i32 %32, i32 %spec.select.5) %spec.select.5.2 = call i32 @llvm.smin.i32(i32 %31, i32 %spec.select.5.1) %spec.select.5.3 = call i32 @llvm.smin.i32(i32 %30, i32 %spec.select.5.2) %cmp20.not.5 = icmp eq i32 %29, %spec.select.5.3 br i1 %cmp20.not.5, label %for.end17.6, label %if.then21.5 if.then21.5: ; preds = %for.end17.5 %cmp24.5 = icmp slt i32 %B.1.4, %29 br i1 %cmp24.5, label %for.end17.6, label %if.then34 for.end17.6: ; preds = %if.then21.5, %for.end17.5 %B.1.5 = phi i32 [ %B.1.4, %for.end17.5 ], [ %29, %if.then21.5 ] %34 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %35 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %36 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %37 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %spec.select.6 = call i32 @llvm.smin.i32(i32 %37, i32 %34) %spec.select.6.1 = call i32 @llvm.smin.i32(i32 %36, i32 %spec.select.6) %spec.select.6.2 = call i32 @llvm.smin.i32(i32 %35, i32 %spec.select.6.1) %cmp20.not.6 = icmp eq i32 %34, %spec.select.6.2 br i1 %cmp20.not.6, label %for.end17.7, label %if.then21.6 if.then21.6: ; preds = %for.end17.6 %cmp24.6 = icmp slt i32 %B.1.5, %34 br i1 %cmp24.6, label %for.end17.7, label %if.then34 for.end17.7: ; preds = %if.then21.6, %for.end17.6 %B.1.6 = phi i32 [ %B.1.5, %for.end17.6 ], [ %34, %if.then21.6 ] %38 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %39 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %40 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %spec.select.7 = call i32 @llvm.smin.i32(i32 %40, i32 %38) %spec.select.7.1 = call i32 @llvm.smin.i32(i32 %39, i32 %spec.select.7) %cmp20.not.7 = icmp eq i32 %38, %spec.select.7.1 br i1 %cmp20.not.7, label %for.end17.8, label %if.then21.7 if.then21.7: ; preds = %for.end17.7 %cmp24.7 = icmp slt i32 %B.1.6, %38 br i1 %cmp24.7, label %for.end17.8, label %if.then34 for.end17.8: ; preds = %if.then21.7, %for.end17.7 %B.1.7 = phi i32 [ %B.1.6, %for.end17.7 ], [ %38, %if.then21.7 ] %41 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %42 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %cmp20.not.8.not = icmp sle i32 %41, %42 %cmp24.8 = icmp slt i32 %B.1.7, %41 %or.cond = select i1 %cmp20.not.8.not, i1 true, i1 %cmp24.8 br i1 %or.cond, label %if.end38, label %if.then34 if.then34: ; preds = %for.end17.8, %if.then21.7, %if.then21.6, %if.then21.5, %if.then21.4, %if.then21.3, %if.then21.2, %if.then21.1, %if.then21 br label %if.end38 if.end38: ; preds = %for.end17.8, %if.then34 %str.sink = phi ptr [ @str.3, %if.then34 ], [ @str, %for.end17.8 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %43 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %43, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %43, 0 br i1 %tobool.not, label %while.end, label %for.end17, !llvm.loop !9 while.end: ; preds = %if.end38, %entry call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %ball) #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 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.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v8i32(<8 x i32>) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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"}
#include<stdio.h> int main(void) { int a, b[10], c[10], n, B, C, i; scanf("%d", &n); while ( n ) { scanf("%d", &a); B = 0; C = 0; b[B] = a; c[C] = 0; for ( i = 1; i < 10; i++ ) { scanf("%d", &a); if ( a > b[B] && a < c[C]) {B++; b[B] = a; /*printf("b%d c%d a\n", b[B], c[C - 1]);*/} else if ( a < b[B] && a > c[C] ) {C++; c[C] = a;/*printf("b%d c%d b\n", b[B], c[C - 1]);*/} else if ( a > b[B] && a > c[C] ) { if ( b[B] > c[C] ) {B++; b[B] = a; /*printf("b%d c%d c\n", b[B], c[C - 1]);*/} else {C++; c[C] = a; /*printf("b%d c%d d\n", b[B], c[C - 1]);*/} } else break; } if ( i == 10 ) printf("YES\n"); else printf("NO\n"); n--; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182862/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182862/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: %a = alloca i32, align 4 %b = alloca [10 x i32], align 16 %c = alloca [10 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %c) #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) %.pr = load i32, ptr %n, align 4, !tbaa !5 %tobool.not85 = icmp eq i32 %.pr, 0 br i1 %tobool.not85, label %while.end, label %while.body while.body: ; preds = %entry, %if.end56 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 16, !tbaa !5 store i32 0, ptr %c, align 16, !tbaa !5 br label %for.body for.body: ; preds = %while.body, %for.inc %i.084 = phi i32 [ 1, %while.body ], [ %inc50, %for.inc ] %C.083 = phi i32 [ 0, %while.body ], [ %C.1, %for.inc ] %B.082 = phi i32 [ 0, %while.body ], [ %B.1, %for.inc ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %idxprom5 = sext i32 %B.082 to i64 %arrayidx6 = getelementptr inbounds [10 x i32], ptr %b, i64 0, i64 %idxprom5 %2 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %cmp7 = icmp sgt i32 %1, %2 br i1 %cmp7, label %land.lhs.true, label %if.else land.lhs.true: ; preds = %for.body %idxprom8 = sext i32 %C.083 to i64 %arrayidx9 = getelementptr inbounds [10 x i32], ptr %c, i64 0, i64 %idxprom8 %3 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp slt i32 %1, %3 br i1 %cmp10, label %if.then, label %if.else if.then: ; preds = %land.lhs.true %inc = add nsw i32 %B.082, 1 br label %for.inc if.else: ; preds = %land.lhs.true, %for.body %cmp15 = icmp slt i32 %1, %2 br i1 %cmp15, label %land.lhs.true16, label %if.else24 land.lhs.true16: ; preds = %if.else %idxprom17 = sext i32 %C.083 to i64 %arrayidx18 = getelementptr inbounds [10 x i32], ptr %c, i64 0, i64 %idxprom17 %4 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %cmp19 = icmp sgt i32 %1, %4 br i1 %cmp19, label %if.then20, label %if.else24 if.then20: ; preds = %land.lhs.true16 %inc21 = add nsw i32 %C.083, 1 br label %for.inc if.else24: ; preds = %land.lhs.true16, %if.else br i1 %cmp7, label %land.lhs.true28, label %if.end56 land.lhs.true28: ; preds = %if.else24 %idxprom29 = sext i32 %C.083 to i64 %arrayidx30 = getelementptr inbounds [10 x i32], ptr %c, i64 0, i64 %idxprom29 %5 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %1, %5 br i1 %cmp31, label %if.then32, label %if.end56 if.then32: ; preds = %land.lhs.true28 %cmp37 = icmp sgt i32 %2, %5 br i1 %cmp37, label %if.then38, label %if.else42 if.then38: ; preds = %if.then32 %inc39 = add nsw i32 %B.082, 1 br label %for.inc if.else42: ; preds = %if.then32 %inc43 = add nsw i32 %C.083, 1 br label %for.inc for.inc: ; preds = %if.then, %if.else42, %if.then38, %if.then20 %inc.sink = phi i32 [ %inc, %if.then ], [ %inc43, %if.else42 ], [ %inc39, %if.then38 ], [ %inc21, %if.then20 ] %b.sink = phi ptr [ %b, %if.then ], [ %c, %if.else42 ], [ %b, %if.then38 ], [ %c, %if.then20 ] %B.1 = phi i32 [ %inc, %if.then ], [ %B.082, %if.else42 ], [ %inc39, %if.then38 ], [ %B.082, %if.then20 ] %C.1 = phi i32 [ %C.083, %if.then ], [ %inc43, %if.else42 ], [ %C.083, %if.then38 ], [ %inc21, %if.then20 ] %idxprom11 = sext i32 %inc.sink to i64 %arrayidx12 = getelementptr inbounds [10 x i32], ptr %b.sink, i64 0, i64 %idxprom11 store i32 %1, ptr %arrayidx12, align 4, !tbaa !5 %inc50 = add nuw nsw i32 %i.084, 1 %exitcond.not = icmp eq i32 %inc50, 10 br i1 %exitcond.not, label %if.end56, label %for.body, !llvm.loop !9 if.end56: ; preds = %if.else24, %land.lhs.true28, %for.inc %str.sink = phi ptr [ @str.3, %for.inc ], [ @str, %land.lhs.true28 ], [ @str, %if.else24 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %6 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %dec, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 while.end: ; preds = %if.end56, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 40, 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int main(){ int i, j, n, ball, hole_b, hole_c, check; scanf("%d", &n); for(i=0; i<n; i++){ check = 0; hole_b = 0; hole_c = 0; for(j=0; j<10; j++){ scanf("%d", &ball); if(check == 0){ if(ball > hole_b) hole_b = ball; else if(ball > hole_c) hole_c = ball; else check = ball; } } if(check == 0) printf("YES\n"); else printf("NO\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182927/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182927/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: %n = alloca i32, align 4 %ball = 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 %ball) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp30 = icmp sgt i32 %0, 0 br i1 %cmp30, label %if.then, label %for.end21 if.then: ; preds = %entry, %for.inc19 %i.031 = phi i32 [ %inc20, %for.inc19 ], [ 0, %entry ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %1 = load i32, ptr %ball, align 4, !tbaa !5 %call4.134 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %or.cond = icmp sgt i32 %1, -1 br i1 %or.cond, label %if.then.1, label %for.inc.1.thread44 for.inc.1.thread44: ; preds = %if.then %call4.248 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.2.thread60 if.then.1: ; preds = %if.then %2 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.1 = icmp sgt i32 %2, %1 br i1 %cmp6.1, label %for.inc.1.thread, label %for.inc.1 for.inc.1.thread: ; preds = %if.then.1 %call4.240 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.2 for.inc.1: ; preds = %if.then.1 %.hole_c.0.1 = call i32 @llvm.smax.i32(i32 %2, i32 0) %call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.2 = icmp sgt i32 %2, -1 br i1 %cmp5.2, label %if.then.2, label %for.inc.2.thread60 if.then.2: ; preds = %for.inc.1.thread, %for.inc.1 %hole_c.1.143 = phi i32 [ 0, %for.inc.1.thread ], [ %.hole_c.0.1, %for.inc.1 ] %hole_b.1.142 = phi i32 [ %2, %for.inc.1.thread ], [ %1, %for.inc.1 ] %3 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.2 = icmp sgt i32 %3, %hole_b.1.142 br i1 %cmp6.2, label %for.inc.2.thread, label %if.else.2 if.else.2: ; preds = %if.then.2 %cmp8.2 = icmp sgt i32 %3, %hole_c.1.143 %.hole_c.0.2 = call i32 @llvm.smax.i32(i32 %3, i32 %hole_c.1.143) br i1 %cmp8.2, label %for.inc.2.thread, label %for.inc.2 for.inc.2.thread: ; preds = %if.then.2, %if.else.2 %hole_b.1.2.ph = phi i32 [ %3, %if.then.2 ], [ %hole_b.1.142, %if.else.2 ] %hole_c.1.2.ph = phi i32 [ %hole_c.1.143, %if.then.2 ], [ %.hole_c.0.2, %if.else.2 ] %call4.353 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.3 for.inc.2.thread60: ; preds = %for.inc.1, %for.inc.1.thread44 %call4.364 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.3.thread77 for.inc.2: ; preds = %if.else.2 %call4.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.3 = icmp eq i32 %3, 0 br i1 %cmp5.3, label %if.then.3, label %for.inc.3.thread77 if.then.3: ; preds = %for.inc.2.thread, %for.inc.2 %hole_c.1.256 = phi i32 [ %hole_c.1.2.ph, %for.inc.2.thread ], [ %.hole_c.0.2, %for.inc.2 ] %hole_b.1.255 = phi i32 [ %hole_b.1.2.ph, %for.inc.2.thread ], [ %hole_b.1.142, %for.inc.2 ] %4 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.3 = icmp sgt i32 %4, %hole_b.1.255 br i1 %cmp6.3, label %for.inc.3.thread, label %if.else.3 if.else.3: ; preds = %if.then.3 %cmp8.3 = icmp sgt i32 %4, %hole_c.1.256 %.hole_c.0.3 = call i32 @llvm.smax.i32(i32 %4, i32 %hole_c.1.256) br i1 %cmp8.3, label %for.inc.3.thread, label %for.inc.3 for.inc.3.thread: ; preds = %if.then.3, %if.else.3 %hole_b.1.3.ph = phi i32 [ %4, %if.then.3 ], [ %hole_b.1.255, %if.else.3 ] %hole_c.1.3.ph = phi i32 [ %hole_c.1.256, %if.then.3 ], [ %.hole_c.0.3, %if.else.3 ] %call4.470 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.4 for.inc.3.thread77: ; preds = %for.inc.2, %for.inc.2.thread60 %call4.481 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.4.thread94 for.inc.3: ; preds = %if.else.3 %call4.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.4 = icmp eq i32 %4, 0 br i1 %cmp5.4, label %if.then.4, label %for.inc.4.thread94 if.then.4: ; preds = %for.inc.3.thread, %for.inc.3 %hole_c.1.373 = phi i32 [ %hole_c.1.3.ph, %for.inc.3.thread ], [ %.hole_c.0.3, %for.inc.3 ] %hole_b.1.372 = phi i32 [ %hole_b.1.3.ph, %for.inc.3.thread ], [ %hole_b.1.255, %for.inc.3 ] %5 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.4 = icmp sgt i32 %5, %hole_b.1.372 br i1 %cmp6.4, label %for.inc.4.thread, label %if.else.4 if.else.4: ; preds = %if.then.4 %cmp8.4 = icmp sgt i32 %5, %hole_c.1.373 %.hole_c.0.4 = call i32 @llvm.smax.i32(i32 %5, i32 %hole_c.1.373) br i1 %cmp8.4, label %for.inc.4.thread, label %for.inc.4 for.inc.4.thread: ; preds = %if.then.4, %if.else.4 %hole_b.1.4.ph = phi i32 [ %5, %if.then.4 ], [ %hole_b.1.372, %if.else.4 ] %hole_c.1.4.ph = phi i32 [ %hole_c.1.373, %if.then.4 ], [ %.hole_c.0.4, %if.else.4 ] %call4.587 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.5 for.inc.4.thread94: ; preds = %for.inc.3, %for.inc.3.thread77 %call4.598 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.5.thread111 for.inc.4: ; preds = %if.else.4 %call4.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.5 = icmp eq i32 %5, 0 br i1 %cmp5.5, label %if.then.5, label %for.inc.5.thread111 if.then.5: ; preds = %for.inc.4.thread, %for.inc.4 %hole_c.1.490 = phi i32 [ %hole_c.1.4.ph, %for.inc.4.thread ], [ %.hole_c.0.4, %for.inc.4 ] %hole_b.1.489 = phi i32 [ %hole_b.1.4.ph, %for.inc.4.thread ], [ %hole_b.1.372, %for.inc.4 ] %6 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.5 = icmp sgt i32 %6, %hole_b.1.489 br i1 %cmp6.5, label %for.inc.5.thread, label %if.else.5 if.else.5: ; preds = %if.then.5 %cmp8.5 = icmp sgt i32 %6, %hole_c.1.490 %.hole_c.0.5 = call i32 @llvm.smax.i32(i32 %6, i32 %hole_c.1.490) br i1 %cmp8.5, label %for.inc.5.thread, label %for.inc.5 for.inc.5.thread: ; preds = %if.then.5, %if.else.5 %hole_b.1.5.ph = phi i32 [ %6, %if.then.5 ], [ %hole_b.1.489, %if.else.5 ] %hole_c.1.5.ph = phi i32 [ %hole_c.1.490, %if.then.5 ], [ %.hole_c.0.5, %if.else.5 ] %call4.6104 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.6 for.inc.5.thread111: ; preds = %for.inc.4, %for.inc.4.thread94 %call4.6115 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.6.thread128 for.inc.5: ; preds = %if.else.5 %call4.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.6 = icmp eq i32 %6, 0 br i1 %cmp5.6, label %if.then.6, label %for.inc.6.thread128 if.then.6: ; preds = %for.inc.5.thread, %for.inc.5 %hole_c.1.5107 = phi i32 [ %hole_c.1.5.ph, %for.inc.5.thread ], [ %.hole_c.0.5, %for.inc.5 ] %hole_b.1.5106 = phi i32 [ %hole_b.1.5.ph, %for.inc.5.thread ], [ %hole_b.1.489, %for.inc.5 ] %7 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.6 = icmp sgt i32 %7, %hole_b.1.5106 br i1 %cmp6.6, label %for.inc.6.thread, label %if.else.6 if.else.6: ; preds = %if.then.6 %cmp8.6 = icmp sgt i32 %7, %hole_c.1.5107 %.hole_c.0.6 = call i32 @llvm.smax.i32(i32 %7, i32 %hole_c.1.5107) br i1 %cmp8.6, label %for.inc.6.thread, label %for.inc.6 for.inc.6.thread: ; preds = %if.then.6, %if.else.6 %hole_b.1.6.ph = phi i32 [ %7, %if.then.6 ], [ %hole_b.1.5106, %if.else.6 ] %hole_c.1.6.ph = phi i32 [ %hole_c.1.5107, %if.then.6 ], [ %.hole_c.0.6, %if.else.6 ] %call4.7121 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.7 for.inc.6.thread128: ; preds = %for.inc.5, %for.inc.5.thread111 %call4.7132 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.7.thread145 for.inc.6: ; preds = %if.else.6 %call4.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.7 = icmp eq i32 %7, 0 br i1 %cmp5.7, label %if.then.7, label %for.inc.7.thread145 if.then.7: ; preds = %for.inc.6.thread, %for.inc.6 %hole_c.1.6124 = phi i32 [ %hole_c.1.6.ph, %for.inc.6.thread ], [ %.hole_c.0.6, %for.inc.6 ] %hole_b.1.6123 = phi i32 [ %hole_b.1.6.ph, %for.inc.6.thread ], [ %hole_b.1.5106, %for.inc.6 ] %8 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.7 = icmp sgt i32 %8, %hole_b.1.6123 br i1 %cmp6.7, label %for.inc.7.thread, label %if.else.7 if.else.7: ; preds = %if.then.7 %cmp8.7 = icmp sgt i32 %8, %hole_c.1.6124 %.hole_c.0.7 = call i32 @llvm.smax.i32(i32 %8, i32 %hole_c.1.6124) br i1 %cmp8.7, label %for.inc.7.thread, label %for.inc.7 for.inc.7.thread: ; preds = %if.then.7, %if.else.7 %hole_b.1.7.ph = phi i32 [ %8, %if.then.7 ], [ %hole_b.1.6123, %if.else.7 ] %hole_c.1.7.ph = phi i32 [ %hole_c.1.6124, %if.then.7 ], [ %.hole_c.0.7, %if.else.7 ] %call4.8138 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.8 for.inc.7.thread145: ; preds = %for.inc.6, %for.inc.6.thread128 %call4.8149 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %for.inc.8.thread162 for.inc.7: ; preds = %if.else.7 %call4.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.8 = icmp eq i32 %8, 0 br i1 %cmp5.8, label %if.then.8, label %for.inc.8.thread162 if.then.8: ; preds = %for.inc.7.thread, %for.inc.7 %hole_c.1.7141 = phi i32 [ %hole_c.1.7.ph, %for.inc.7.thread ], [ %.hole_c.0.7, %for.inc.7 ] %hole_b.1.7140 = phi i32 [ %hole_b.1.7.ph, %for.inc.7.thread ], [ %hole_b.1.6123, %for.inc.7 ] %9 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.8 = icmp sgt i32 %9, %hole_b.1.7140 br i1 %cmp6.8, label %for.inc.8.thread, label %if.else.8 if.else.8: ; preds = %if.then.8 %cmp8.8 = icmp sgt i32 %9, %hole_c.1.7141 %.hole_c.0.8 = call i32 @llvm.smax.i32(i32 %9, i32 %hole_c.1.7141) br i1 %cmp8.8, label %for.inc.8.thread, label %for.inc.8 for.inc.8.thread: ; preds = %if.then.8, %if.else.8 %hole_b.1.8.ph = phi i32 [ %9, %if.then.8 ], [ %hole_b.1.7140, %if.else.8 ] %hole_c.1.8.ph = phi i32 [ %hole_c.1.7141, %if.then.8 ], [ %.hole_c.0.8, %if.else.8 ] %call4.9155 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.then.9 for.inc.8.thread162: ; preds = %for.inc.7, %for.inc.7.thread145 %call4.9166 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) br label %if.else16 for.inc.8: ; preds = %if.else.8 %call4.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ball) %cmp5.9 = icmp eq i32 %9, 0 br i1 %cmp5.9, label %if.then.9, label %if.else16 if.then.9: ; preds = %for.inc.8.thread, %for.inc.8 %hole_c.1.8158 = phi i32 [ %hole_c.1.8.ph, %for.inc.8.thread ], [ %.hole_c.0.8, %for.inc.8 ] %hole_b.1.8157 = phi i32 [ %hole_b.1.8.ph, %for.inc.8.thread ], [ %hole_b.1.7140, %for.inc.8 ] %10 = load i32, ptr %ball, align 4, !tbaa !5 %cmp6.9 = icmp sgt i32 %10, %hole_b.1.8157 %cmp8.9 = icmp sgt i32 %10, %hole_c.1.8158 %or.cond175 = select i1 %cmp6.9, i1 true, i1 %cmp8.9 %cmp13 = icmp eq i32 %10, 0 %or.cond176 = or i1 %or.cond175, %cmp13 br i1 %or.cond176, label %for.inc19, label %if.else16 if.else16: ; preds = %if.then.9, %for.inc.8.thread162, %for.inc.8 br label %for.inc19 for.inc19: ; preds = %if.then.9, %if.else16 %str.3.sink = phi ptr [ @str, %if.else16 ], [ @str.3, %if.then.9 ] %puts25 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) %inc20 = add nuw nsw i32 %i.031, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc20, %11 br i1 %cmp, label %if.then, label %for.end21, !llvm.loop !9 for.end21: ; preds = %for.inc19, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ball) #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 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.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 = { 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"}
#include<stdio.h> int main(){ int a[10],b,i,j,c=0,d=0,e=0; scanf("%d\n",&b); for(j=0;j<b;j++){ for(i=0;i<10;i++){ scanf("%d ",&a[i]); } scanf("\n"); for(i=0;i<10;i++){ if(a[i]>c){ c=a[i]; e++; } else if(a[i]>d){ d=a[i]; e++; } } if(e==10){ printf("YES\n"); } else{ printf("NO\n"); } c=0,d=0,e=0; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182992/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182992/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @str = 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 [10 x i32], align 16 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 40, 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 %b) %0 = load i32, ptr %b, align 4, !tbaa !5 %cmp53 = icmp sgt i32 %0, 0 br i1 %cmp53, label %for.cond1.preheader.preheader, label %for.end34 for.cond1.preheader.preheader: ; preds = %entry %arrayidx.1 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 1 %arrayidx.2 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 2 %arrayidx.3 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 3 %arrayidx.4 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 4 %arrayidx.5 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 5 %arrayidx.6 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 6 %arrayidx.7 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 7 %arrayidx.8 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 8 %arrayidx.9 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 9 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc23.8 %j.054 = phi i32 [ %inc33, %for.inc23.8 ], [ 0, %for.cond1.preheader.preheader ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.1) %call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.2) %call4.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.3) %call4.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.4) %call4.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.5) %call4.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.6) %call4.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.7) %call4.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.8) %call4.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.9) %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2) %1 = load i32, ptr %a, align 16, !tbaa !5 %cmp11 = icmp sgt i32 %1, 0 %spec.select = call i32 @llvm.smax.i32(i32 %1, i32 0) %spec.select57 = zext i1 %cmp11 to i32 %2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11.1 = icmp sgt i32 %2, %spec.select br i1 %cmp11.1, label %for.inc23.1, label %if.else.1 if.else.1: ; preds = %for.cond1.preheader %cmp17.1 = icmp sgt i32 %2, 0 %spec.select.1 = call i32 @llvm.smax.i32(i32 %2, i32 0) %inc21.1 = zext i1 %cmp17.1 to i32 br label %for.inc23.1 for.inc23.1: ; preds = %for.cond1.preheader, %if.else.1 %.sink = phi i32 [ %inc21.1, %if.else.1 ], [ 1, %for.cond1.preheader ] %c.2.1 = phi i32 [ %spec.select, %if.else.1 ], [ %2, %for.cond1.preheader ] %d.2.1 = phi i32 [ %spec.select.1, %if.else.1 ], [ 0, %for.cond1.preheader ] %inc14.1 = add nuw nsw i32 %.sink, %spec.select57 %3 = load i32, ptr %arrayidx.2, align 8, !tbaa !5 %cmp11.2 = icmp sgt i32 %3, %c.2.1 br i1 %cmp11.2, label %for.inc23.2, label %if.else.2 if.else.2: ; preds = %for.inc23.1 %cmp17.2 = icmp sgt i32 %3, %d.2.1 %spec.select.2 = call i32 @llvm.smax.i32(i32 %3, i32 %d.2.1) %inc21.2 = zext i1 %cmp17.2 to i32 br label %for.inc23.2 for.inc23.2: ; preds = %for.inc23.1, %if.else.2 %.sink58 = phi i32 [ %inc21.2, %if.else.2 ], [ 1, %for.inc23.1 ] %c.2.2 = phi i32 [ %c.2.1, %if.else.2 ], [ %3, %for.inc23.1 ] %d.2.2 = phi i32 [ %spec.select.2, %if.else.2 ], [ %d.2.1, %for.inc23.1 ] %inc14.2 = add nuw nsw i32 %inc14.1, %.sink58 %4 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %cmp11.3 = icmp sgt i32 %4, %c.2.2 br i1 %cmp11.3, label %for.inc23.3, label %if.else.3 if.else.3: ; preds = %for.inc23.2 %cmp17.3 = icmp sgt i32 %4, %d.2.2 %spec.select.3 = call i32 @llvm.smax.i32(i32 %4, i32 %d.2.2) %inc21.3 = zext i1 %cmp17.3 to i32 br label %for.inc23.3 for.inc23.3: ; preds = %for.inc23.2, %if.else.3 %.sink59 = phi i32 [ %inc21.3, %if.else.3 ], [ 1, %for.inc23.2 ] %c.2.3 = phi i32 [ %c.2.2, %if.else.3 ], [ %4, %for.inc23.2 ] %d.2.3 = phi i32 [ %spec.select.3, %if.else.3 ], [ %d.2.2, %for.inc23.2 ] %inc14.3 = add nuw nsw i32 %inc14.2, %.sink59 %5 = load i32, ptr %arrayidx.4, align 16, !tbaa !5 %cmp11.4 = icmp sgt i32 %5, %c.2.3 br i1 %cmp11.4, label %for.inc23.4, label %if.else.4 if.else.4: ; preds = %for.inc23.3 %cmp17.4 = icmp sgt i32 %5, %d.2.3 %spec.select.4 = call i32 @llvm.smax.i32(i32 %5, i32 %d.2.3) %inc21.4 = zext i1 %cmp17.4 to i32 br label %for.inc23.4 for.inc23.4: ; preds = %for.inc23.3, %if.else.4 %.sink60 = phi i32 [ %inc21.4, %if.else.4 ], [ 1, %for.inc23.3 ] %c.2.4 = phi i32 [ %c.2.3, %if.else.4 ], [ %5, %for.inc23.3 ] %d.2.4 = phi i32 [ %spec.select.4, %if.else.4 ], [ %d.2.3, %for.inc23.3 ] %inc14.4 = add nuw nsw i32 %inc14.3, %.sink60 %6 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %cmp11.5 = icmp sgt i32 %6, %c.2.4 br i1 %cmp11.5, label %for.inc23.5, label %if.else.5 if.else.5: ; preds = %for.inc23.4 %cmp17.5 = icmp sgt i32 %6, %d.2.4 %spec.select.5 = call i32 @llvm.smax.i32(i32 %6, i32 %d.2.4) %inc21.5 = zext i1 %cmp17.5 to i32 br label %for.inc23.5 for.inc23.5: ; preds = %for.inc23.4, %if.else.5 %.sink61 = phi i32 [ %inc21.5, %if.else.5 ], [ 1, %for.inc23.4 ] %c.2.5 = phi i32 [ %c.2.4, %if.else.5 ], [ %6, %for.inc23.4 ] %d.2.5 = phi i32 [ %spec.select.5, %if.else.5 ], [ %d.2.4, %for.inc23.4 ] %inc14.5 = add nuw nsw i32 %inc14.4, %.sink61 %7 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %cmp11.6 = icmp sgt i32 %7, %c.2.5 br i1 %cmp11.6, label %for.inc23.6, label %if.else.6 if.else.6: ; preds = %for.inc23.5 %cmp17.6 = icmp sgt i32 %7, %d.2.5 %spec.select.6 = call i32 @llvm.smax.i32(i32 %7, i32 %d.2.5) %inc21.6 = zext i1 %cmp17.6 to i32 br label %for.inc23.6 for.inc23.6: ; preds = %for.inc23.5, %if.else.6 %.sink62 = phi i32 [ %inc21.6, %if.else.6 ], [ 1, %for.inc23.5 ] %c.2.6 = phi i32 [ %c.2.5, %if.else.6 ], [ %7, %for.inc23.5 ] %d.2.6 = phi i32 [ %spec.select.6, %if.else.6 ], [ %d.2.5, %for.inc23.5 ] %inc14.6 = add nuw nsw i32 %inc14.5, %.sink62 %8 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %cmp11.7 = icmp sgt i32 %8, %c.2.6 br i1 %cmp11.7, label %for.inc23.7, label %if.else.7 if.else.7: ; preds = %for.inc23.6 %cmp17.7 = icmp sgt i32 %8, %d.2.6 %spec.select.7 = call i32 @llvm.smax.i32(i32 %8, i32 %d.2.6) %inc21.7 = zext i1 %cmp17.7 to i32 br label %for.inc23.7 for.inc23.7: ; preds = %for.inc23.6, %if.else.7 %.sink63 = phi i32 [ %inc21.7, %if.else.7 ], [ 1, %for.inc23.6 ] %c.2.7 = phi i32 [ %c.2.6, %if.else.7 ], [ %8, %for.inc23.6 ] %d.2.7 = phi i32 [ %spec.select.7, %if.else.7 ], [ %d.2.6, %for.inc23.6 ] %inc14.7 = add nuw nsw i32 %inc14.6, %.sink63 %9 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %cmp11.8 = icmp sgt i32 %9, %c.2.7 br i1 %cmp11.8, label %for.inc23.8, label %if.else.8 if.else.8: ; preds = %for.inc23.7 %cmp17.8 = icmp sgt i32 %9, %d.2.7 %spec.select.8 = call i32 @llvm.smax.i32(i32 %9, i32 %d.2.7) %inc21.8 = zext i1 %cmp17.8 to i32 br label %for.inc23.8 for.inc23.8: ; preds = %for.inc23.7, %if.else.8 %.sink64 = phi i32 [ %inc21.8, %if.else.8 ], [ 1, %for.inc23.7 ] %c.2.8 = phi i32 [ %c.2.7, %if.else.8 ], [ %9, %for.inc23.7 ] %d.2.8 = phi i32 [ %spec.select.8, %if.else.8 ], [ %d.2.7, %for.inc23.7 ] %inc14.8 = add nuw nsw i32 %inc14.7, %.sink64 %10 = load i32, ptr %arrayidx.9, align 4, !tbaa !5 %cmp11.9 = icmp sgt i32 %10, %c.2.8 %cmp17.9 = icmp sgt i32 %10, %d.2.8 %narrow = select i1 %cmp11.9, i1 true, i1 %cmp17.9 %.sink65 = zext i1 %narrow to i32 %inc14.9 = add nuw nsw i32 %inc14.8, %.sink65 %cmp26 = icmp eq i32 %inc14.9, 10 %str.sink = select i1 %cmp26, ptr @str.5, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %inc33 = add nuw nsw i32 %j.054, 1 %11 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp slt i32 %inc33, %11 br i1 %cmp, label %for.cond1.preheader, label %for.end34, !llvm.loop !9 for.end34: ; preds = %for.inc23.8, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 40, 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.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 = { 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"}
//treeDP-allside //https://atcoder.jp/contests/dp/tasks/dp_v //https://ei1333.hateblo.jp/entry/2017/04/10/224413 //https://lumakernel.github.io/ecasdqina/graph/DP-all-subtree #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #include<assert.h> #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 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 zt(int a,int b){return max(a,b)-min(a,b);} int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} int nHr(int a,int b){return nCr(a+b-1,b);} int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} int sankaku(int x){return ((1+x)*x)/2;} void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;} long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;} double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;} void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;} int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);} int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);} int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} void shuffledget(int x[],int n){ int i,b[524288],p,c; for(i=0;i<n;i++){ b[i]=i; } for(i=n;i>=1;i--){ p=rand()%i; c=b[i-1];b[i-1]=b[p];b[p]=c; } for(i=0;i<n;i++){ scanf("%d",&x[b[i]]); } } int dx4[4]={1,-1,0,0}; int dy4[4]={0,0,1,-1}; int dx8[8]={-1,-1,-1,0,0,1,1,1}; int dy8[8]={-1,0,1,-1,1,-1,0,1}; int search(int x,int a[],int n){ int st=0,fi=n-1,te; while(st<=fi){ te=(st+fi)/2; if(a[te]<x){st=te+1;}else{fi=te-1;} } return st; } void prarr(int arr[],int n){ int i; for(i=0;i<n;i++){ if(i){printf(" ");} printf("%d",arr[i]); } printf("\n"); return; } void getperm(int a[],int n){ int i,p; for(i=0;i<n;i++){ a[i]=i; } for(i=n-1;i>=1;i--){ p=rand()%(i+1); swap(&a[p],&a[i]); } } typedef struct{ long long val; long long node; }sd; int sdsortfnc(const void *a,const void *b){ if(((sd*)a)->val < ((sd*)b)->val){return -1;} if(((sd*)a)->val > ((sd*)b)->val){return 1;} return 0; } void coordinate_comp(int a[],int n){ int i,c=0; sd dat[524288]; for(i=0;i<n;i++){ dat[i].val=a[i]; dat[i].node=i; } qsort(dat,n,sizeof(dat[0]),sdsortfnc); a[dat[0].node]=c; for(i=1;i<n;i++){ if(dat[i-1].val!=dat[i].val){c++;} a[dat[i].node]=c; } } typedef struct{ long long st; long long fi; long long kr; long long id; long long rev; }rs; typedef struct{ long long st; long long kz; }mkj; int sortfnc(const void *a,const void *b){ if(((rs*)a)->st > ((rs*)b)->st){return 1;} if(((rs*)a)->st < ((rs*)b)->st){return -1;} if(((rs*)a)->fi > ((rs*)b)->fi){return 1;} if(((rs*)a)->fi < ((rs*)b)->fi){return -1;} return 0; } int revsortfnc(const void *a,const void *b){ long long p,q,r,s,t; p=((rs*)a)->st; q=((rs*)a)->fi; r=((rs*)b)->st; s=((rs*)b)->fi; if(p>q){t=p;p=q;q=t;} if(r>s){t=r;r=s;s=t;} if(p<r){return -1;} if(p>r){return 1;} if(q<s){return -1;} if(q>s){return 1;} return 0; } void makemkj(rs g[],mkj x[],long long n){ long long i,ms=0,nst=g[0].st; for(i=1;i<n;i++){ if(g[i].st!=g[i-1].st){ x[nst].kz=i-ms; x[nst].st=ms; nst=g[i].st;ms=i; } } x[nst].kz=n-ms; x[nst].st=ms; } long long power(long long a,long long b){ long long x=1,y=a; while(b>0){ if(b&1ll){ x=(x*y)%mod; } y=(y*y)%mod; b>>=1; } return x%mod; } long long modular_inverse(long long n){ return power(n,mod-2); } long long factorial[524288]; long long invfact[524288]; void cfact(){ long long i; factorial[0]=1; factorial[1]=1; for(i=2;i<524288;i++){ factorial[i]=factorial[i-1]*i; factorial[i]%=mod; } invfact[524287]=modular_inverse(factorial[524287]); for(i=524286;i>=0;i--){ invfact[i]=invfact[i+1]*(i+1); invfact[i]%=mod; } } long long calcnCr(long long n,long long k){ if(k<0 || n<k){return 0;} return (factorial[n]*((invfact[k]*invfact[n-k])%mod))%mod; } long long dist[524288],par[524288]; void dfs(long long t,long long l,long long bp,rs g[],mkj x[]){ long long i; if(dist[t]<=l){return;} dist[t]=l; par[t]=bp; for(i=x[t].st;i<x[t].st+x[t].kz;i++){ dfs(g[i].fi,l+1,t,g,x); } } long long calcfl[524288]={0}; long long dc[524288]={0}; long long dp[524288]={0}; long long sc[524288]={0}; long long sp[524288]={0}; //repdp(v,-1,g,x) := pattern(v is a painted node) long long repdp(long long v,long long bk,rs g[],mkj x[]){ long long i,p,np=1,nc=1,ne,nrev,mem,tc=0; for(i=x[v].st;i<x[v].st+x[v].kz;i++){ if(g[i].fi==bk){mem=g[i].id;continue;} ne=g[i].rev; if(calcfl[ne]==0){ repdp(g[i].fi,v,g,x); } tc+=dc[ne]; } for(i=x[v].st;i<x[v].st+x[v].kz;i++){ if(g[i].fi==bk){mem=g[i].id;continue;} p=i-x[v].st; ne=g[i].rev; if(bk==-1){ sc[p]=dc[ne]; sp[p]=dp[ne]; } //printf("<%lld %lld %lld>\n",tc,dc[ne],dp[ne]); nc+=dc[ne]; np*=dp[ne];np%=mod; np*=calcnCr(tc,dc[ne]);np%=mod; tc-=dc[ne]; } //DP spread if(bk!=-1){ dc[mem]=nc; dp[mem]=np; calcfl[mem]=1; } else{ for(i=x[v].st;i<x[v].st+x[v].kz;i++){ p=i-x[v].st; ne=g[i].id; dc[ne]=nc-sc[p]; dp[ne]=(np*modular_inverse(calcnCr(nc-1,sc[p])))%mod; dp[ne]=(dp[ne]*modular_inverse(sp[p]))%mod; calcfl[ne]=1; } } //printf("(%lld %lld): %lld %lld\n",v,bk,nc,np); return np; } int main(void){ cfact(); long long i,j,n,m,k,a,b,c,h,w,r=0,l,t,cnt=0; long long res[524288]; sd dat[524288]; rs g[524288]; mkj x[524288]; scanf("%lld",&n); for(i=0;i<(n-1);i++){ scanf("%lld%lld",&g[cnt].st,&g[cnt].fi); g[cnt].kr=1; cnt++; g[cnt]=g[cnt-1]; llswap(&g[cnt].st,&g[cnt].fi); cnt++; } qsort(g,cnt,sizeof(g[0]),sortfnc); for(i=0;i<cnt;i++){ g[i].id=i; } qsort(g,cnt,sizeof(g[0]),revsortfnc); for(i=0;i<cnt;i+=2){ g[i].rev=g[i+1].id; g[i+1].rev=g[i].id; } qsort(g,cnt,sizeof(g[0]),sortfnc); makemkj(g,x,cnt); for(i=0;i<=n;i++){dist[i]=llinf;} dfs(1,0,-1,g,x); for(i=0;i<n;i++){ dat[i].val=dist[i+1]; dat[i].node=i+1; //printf("<%lld %lld>\n",dat[i].val,dat[i].node); } qsort(dat,n,sizeof(dat[0]),sdsortfnc); for(i=0;i<n;i++){ res[dat[i].node]=repdp(dat[i].node,-1,g,x); } for(i=1;i<=n;i++){ printf("%lld\n",res[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183041/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183041/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.sd = type { i64, i64 } %struct.rs = type { i64, i64, i64, i64, i64 } %struct.mkj = type { i64, i64 } @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16 @dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16 @dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16 @dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16 @factorial = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @invfact = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @dist = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @par = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @calcfl = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @dc = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @dp = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @sc = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @sp = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.4 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1 @.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %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 #0 { entry: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %sub5 = sub nsw i32 %a, %b %sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true) ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i32 %a, %b %mul = shl nsw i32 %rem, 1 %cmp.not = icmp sge i32 %mul, %b %div1 = sdiv i32 %a, %b %add = zext i1 %cmp.not to i32 %retval.0 = add nsw i32 %div1, %add ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i32 %a, %b %cmp = icmp ne i32 %rem, 0 %div = sdiv i32 %a, %b %add = zext i1 %cmp to i32 %retval.0 = add nsw i32 %div, %add ret i32 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4 = icmp eq i32 %b, 0 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ] %b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ] %rem = srem i32 %a.addr.06, %b.addr.05 %cmp.not = icmp eq i32 %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 i32 [ %a, %entry ], [ %b.addr.05, %while.body ] ret i32 %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) #3 ; 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 norecurse nosync nounwind memory(none) uwtable define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4.i = icmp eq i32 %b, 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 i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ] %b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ] %rem.i = srem i32 %a.addr.06.i, %b.addr.05.i %cmp.not.i = icmp eq i32 %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 i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ] %div = sdiv i32 %a, %a.addr.0.lcssa.i %mul = mul nsw i32 %div, %b ret i32 %mul } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not6 = icmp slt i32 %b, 1 br i1 %cmp.not6, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %add = add nsw i32 %a, 1 %xtraiter = and i32 %b, 1 %0 = icmp eq i32 %b, 1 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i32 %b, -2 br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph.new %r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ] %i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ] %niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %sub = sub i32 %add, %i.07 %mul = mul nsw i32 %r.08, %sub %div = sdiv i32 %mul, %i.07 %inc = add nuw i32 %i.07, 1 %sub.1 = sub i32 %add, %inc %mul.1 = mul nsw i32 %div, %sub.1 %div.1 = sdiv i32 %mul.1, %inc %inc.1 = add nuw i32 %i.07, 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 %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ] %r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ] %i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %sub.epil = sub i32 %add, %i.07.unr %mul.epil = mul nsw i32 %r.08.unr, %sub.epil %div.epil = sdiv i32 %mul.epil, %i.07.unr br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %add = add nsw i32 %b, %a %cmp.not6.i = icmp slt i32 %b, 1 br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %entry %xtraiter = and i32 %b, 1 %0 = icmp eq i32 %b, 1 br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new for.body.i.preheader.new: ; preds = %for.body.i.preheader %unroll_iter = and i32 %b, -2 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new %r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ] %i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ] %niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ] %sub.i = sub i32 %add, %i.07.i %mul.i = mul nsw i32 %sub.i, %r.08.i %div.i = sdiv i32 %mul.i, %i.07.i %inc.i = add nuw i32 %i.07.i, 1 %sub.i.1 = sub i32 %add, %inc.i %mul.i.1 = mul nsw i32 %sub.i.1, %div.i %div.i.1 = sdiv i32 %mul.i.1, %inc.i %inc.i.1 = add nuw i32 %i.07.i, 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 %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7 nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader %div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa %sub.i.epil = sub i32 %add, %i.07.i.unr %mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr %div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr br label %nCr.exit nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry %r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ] ret i32 %r.0.lcssa.i } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 { entry: %cmp.not4 = icmp slt i32 %a, 1 br i1 %cmp.not4, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %a, 8 br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %a, -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> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ] %vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = mul <4 x i32> %vec.phi, %vec.ind %1 = mul <4 x i32> %vec.phi7, %step.add %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i32 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %1, %0 %3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %n.vec, %a br i1 %cmp.n, label %for.end, label %for.body.preheader9 for.body.preheader9: ; preds = %for.body.preheader, %middle.block %r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ] %i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader9, %for.body %r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ] %i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ] %mul = mul nsw i32 %r.06, %i.05 %inc = add nuw i32 %i.05, 1 %exitcond.not = icmp eq i32 %i.05, %a br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11 for.end: ; preds = %for.body, %middle.block, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not3 = icmp slt i32 %b, 1 br i1 %cmp.not3, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %b, 8 br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %b, -8 %ind.end = or i32 %n.vec, 1 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer 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> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ] %vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ] %0 = mul <4 x i32> %vec.phi, %broadcast.splat %1 = mul <4 x i32> %vec.phi6, %broadcast.splat %index.next = add nuw i32 %index, 8 %2 = icmp eq i32 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %1, %0 %3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %n.vec, %b br i1 %cmp.n, label %for.end, label %for.body.preheader7 for.body.preheader7: ; preds = %for.body.preheader, %middle.block %r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ] %i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader7, %for.body %r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ] %i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ] %mul = mul nsw i32 %r.05, %a %inc = add nuw i32 %i.04, 1 %exitcond.not = icmp eq i32 %i.04, %b br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 { entry: %tobool.not4 = icmp eq i32 %x, 0 br i1 %tobool.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ] %x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ] %rem = srem i32 %x.addr.05, 10 %add = add nsw i32 %r.06, %rem %div = sdiv i32 %x.addr.05, 10 %x.addr.05.off = add i32 %x.addr.05, 9 %tobool.not = icmp ult i32 %x.addr.05.off, 19 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 { entry: %tobool.not5 = icmp eq i32 %x, 0 br i1 %tobool.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ] %x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ] %rem = srem i32 %x.addr.06, %b %add = add nsw i32 %rem, %r.07 %div = sdiv i32 %x.addr.06, %b %tobool.not = icmp eq i32 %div, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ] ret i32 %r.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 { entry: %add = add nsw i32 %x, 1 %mul = mul nsw i32 %add, %x %div = sdiv i32 %mul, 2 ret i32 %div } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 store i32 %1, ptr %a, align 4, !tbaa !16 store i32 %0, ptr %b, align 4, !tbaa !16 ret void } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %sub5 = sub nsw i64 %a, %b %sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true) ret i64 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i64 %a, %b %mul = shl nsw i64 %rem, 1 %cmp.not = icmp sge i64 %mul, %b %div1 = sdiv i64 %a, %b %add = zext i1 %cmp.not to i64 %retval.0 = add nsw i64 %div1, %add ret i64 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i64 %a, %b %cmp = icmp ne i64 %rem, 0 %div = sdiv i64 %a, %b %add = zext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %add ret i64 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { 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 !20 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: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4.i = icmp eq i64 %b, 0 br i1 %cmp.not4.i, label %llgcd.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 ], [ %a, %entry ] %b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %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 %llgcd.exit, label %while.body.i, !llvm.loop !20 llgcd.exit: ; preds = %while.body.i, %entry %a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ] %div = sdiv i64 %a, %a.addr.0.lcssa.i %mul = mul nsw i64 %div, %b ret i64 %mul } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not6 = icmp slt i64 %b, 1 br i1 %cmp.not6, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %add = add nsw i64 %a, 1 %xtraiter = and i64 %b, 1 %0 = icmp eq i64 %b, 1 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %b, -2 br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph.new %r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ] %i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %sub = sub i64 %add, %i.07 %mul = mul nsw i64 %r.08, %sub %div = sdiv i64 %mul, %i.07 %inc = add nuw i64 %i.07, 1 %sub.1 = sub i64 %add, %inc %mul.1 = mul nsw i64 %div, %sub.1 %div.1 = sdiv i64 %mul.1, %inc %inc.1 = add nuw i64 %i.07, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ] %r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ] %i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %sub.epil = sub i64 %add, %i.07.unr %mul.epil = mul nsw i64 %r.08.unr, %sub.epil %div.epil = sdiv i64 %mul.epil, %i.07.unr br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %add = add nsw i64 %b, %a %cmp.not6.i = icmp slt i64 %b, 1 br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %entry %xtraiter = and i64 %b, 1 %0 = icmp eq i64 %b, 1 br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new for.body.i.preheader.new: ; preds = %for.body.i.preheader %unroll_iter = and i64 %b, -2 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new %r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ] %i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ] %sub.i = sub i64 %add, %i.07.i %mul.i = mul nsw i64 %sub.i, %r.08.i %div.i = sdiv i64 %mul.i, %i.07.i %inc.i = add nuw i64 %i.07.i, 1 %sub.i.1 = sub i64 %add, %inc.i %mul.i.1 = mul nsw i64 %sub.i.1, %div.i %div.i.1 = sdiv i64 %mul.i.1, %inc.i %inc.i.1 = add nuw i64 %i.07.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21 llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader %div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa %sub.i.epil = sub i64 %add, %i.07.i.unr %mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr %div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr br label %llnCr.exit llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry %r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ] ret i64 %r.0.lcssa.i } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 { entry: %cmp.not4 = icmp slt i64 %a, 1 br i1 %cmp.not4, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %a, 7 %0 = icmp ult i64 %a, 8 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %a, -8 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ] %i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ] %mul = mul nsw i64 %r.06, %i.05 %inc = add nuw nsw i64 %i.05, 1 %mul.1 = mul nsw i64 %mul, %inc %inc.1 = add nuw nsw i64 %i.05, 2 %mul.2 = mul nsw i64 %mul.1, %inc.1 %inc.2 = add nuw nsw i64 %i.05, 3 %mul.3 = mul nsw i64 %mul.2, %inc.2 %inc.3 = add nuw nsw i64 %i.05, 4 %mul.4 = mul nsw i64 %mul.3, %inc.3 %inc.4 = add nuw nsw i64 %i.05, 5 %mul.5 = mul nsw i64 %mul.4, %inc.4 %inc.5 = add nuw nsw i64 %i.05, 6 %mul.6 = mul nsw i64 %mul.5, %inc.5 %inc.6 = add nuw i64 %i.05, 7 %mul.7 = mul nsw i64 %mul.6, %inc.6 %inc.7 = add nuw i64 %i.05, 8 %niter.next.7 = add i64 %niter, 8 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ] %r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ] %i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ] %i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %r.06.epil, %i.05.epil %inc.epil = add nuw i64 %i.05.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not3 = icmp slt i64 %b, 1 br i1 %cmp.not3, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %b, 7 %0 = icmp ult i64 %b, 8 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %b, -8 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ] %mul = mul nsw i64 %r.05, %a %mul.1 = mul nsw i64 %mul, %a %mul.2 = mul nsw i64 %mul.1, %a %mul.3 = mul nsw i64 %mul.2, %a %mul.4 = mul nsw i64 %mul.3, %a %mul.5 = mul nsw i64 %mul.4, %a %mul.6 = mul nsw i64 %mul.5, %a %mul.7 = mul nsw i64 %mul.6, %a %niter.next.7 = add i64 %niter, 8 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ] %r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %r.05.epil, %a %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 { entry: %tobool.not4 = icmp eq i64 %x, 0 br i1 %tobool.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ] %x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ] %rem = srem i64 %x.addr.05, 10 %add = add nsw i64 %r.06, %rem %div = sdiv i64 %x.addr.05, 10 %x.addr.05.off = add i64 %x.addr.05, 9 %tobool.not = icmp ult i64 %x.addr.05.off, 19 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 { entry: %tobool.not5 = icmp eq i64 %x, 0 br i1 %tobool.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ] %x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ] %rem = srem i64 %x.addr.06, %b %add = add nsw i64 %rem, %r.07 %div = sdiv i64 %x.addr.06, %b %tobool.not = icmp eq i64 %div, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ] ret i64 %r.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 { entry: %add = add nsw i64 %x, 1 %mul = mul nsw i64 %add, %x %div = sdiv i64 %mul, 2 ret i64 %div } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 store i64 %1, ptr %a, align 8, !tbaa !29 store i64 %0, ptr %b, align 8, !tbaa !29 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp = fcmp ogt double %a, %b %a.b = select i1 %cmp, double %a, double %b ret double %a.b } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp = fcmp olt double %a, %b %a.b = select i1 %cmp, double %a, double %b ret double %a.b } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp.i = fcmp ogt double %a, %b %a.b.i = select i1 %cmp.i, double %a, double %b %cmp.i4 = fcmp olt double %a, %b %a.b.i5 = select i1 %cmp.i4, double %a, double %b %sub = fsub double %a.b.i, %a.b.i5 ret double %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 store double %1, ptr %a, align 8, !tbaa !31 store double %0, ptr %b, align 8, !tbaa !31 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 store i8 %1, ptr %a, align 1, !tbaa !33 store i8 %0, ptr %b, align 1, !tbaa !33 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %cmp = icmp sgt i32 %0, %1 %cmp1 = icmp ne i32 %0, %1 %. = sext 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 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %cmp = icmp slt i32 %0, %1 %cmp1 = icmp ne i32 %0, %1 %. = sext 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 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 %cmp = icmp sgt i64 %0, %1 %cmp1 = icmp ne i64 %0, %1 %. = sext 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 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp ne i64 %0, %1 %. = sext 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 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 %cmp = fcmp ogt double %0, %1 %cmp1 = fcmp une double %0, %1 %. = sext 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 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 %cmp = fcmp olt double %0, %1 %cmp1 = fcmp une double %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #22 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #22 ret i32 %call } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp sgt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext 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 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp slt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 { entry: %b = alloca [524288 x i32], align 16 call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #23 %cmp40 = icmp sgt i32 %n, 0 br i1 %cmp40, label %for.body.preheader, label %for.end25 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.preheader57, 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 ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57 for.body.preheader57: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block br i1 %cmp40, label %for.body3.preheader, label %for.end25 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader57, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ] %arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv %4 = trunc i64 %indvars.iv to i32 store i32 %4, ptr %arrayidx, align 4, !tbaa !16 %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.cond1.preheader, label %for.body, !llvm.loop !35 for.cond15.preheader: ; preds = %for.body3 br i1 %cmp40, label %for.body17.preheader, label %for.end25 for.body17.preheader: ; preds = %for.cond15.preheader %wide.trip.count54 = zext i32 %n to i64 br label %for.body17 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ] %call = tail call i32 @rand() #23 %5 = trunc i64 %indvars.iv47 to i32 %rem = srem i32 %call, %5 %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1 %idxprom4 = and i64 %indvars.iv.next48, 4294967295 %arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %idxprom6 = sext i32 %rem to i64 %arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv47, 1 br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36 for.body17: ; preds = %for.body17.preheader, %for.body17 %indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ] %arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50 %8 = load i32, ptr %arrayidx19, align 4, !tbaa !16 %idxprom20 = sext i32 %8 to i64 %arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20 %call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21) %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54 br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37 for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #23 ret void } ; Function Attrs: nounwind declare i32 @rand() local_unnamed_addr #9 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 { entry: %cmp.not9 = icmp slt i32 %n, 1 br i1 %cmp.not9, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ] %fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ] %add = add nsw i32 %st.011, %fi.010 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !16 %cmp1 = icmp slt i32 %0, %x %add2 = add nsw i32 %div, 1 %sub3 = add nsw i32 %div, -1 %fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3 %st.1 = select i1 %cmp1, i32 %add2, i32 %st.011 %cmp.not = icmp sgt i32 %st.1, %fi.1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38 while.end: ; preds = %while.body, %entry %st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ] ret i32 %st.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 { entry: %cmp7 = icmp sgt i32 %n, 0 br i1 %cmp7, label %if.end.peel, label %for.end if.end.peel: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %.pre = load i32, ptr %arr, align 4, !tbaa !16 %call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %exitcond.peel.not = icmp eq i32 %n, 1 br i1 %exitcond.peel.not, label %for.end, label %if.end if.end: ; preds = %if.end.peel, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ] %putchar6 = tail call i32 @putchar(i32 32) %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv %0 = load i32, ptr %arrayidx, align 4, !tbaa !16 %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %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 %if.end, !llvm.loop !39 for.end: ; preds = %if.end, %if.end.peel, %entry %putchar = tail call i32 @putchar(i32 10) ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; Function Attrs: nounwind uwtable define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 { entry: %cmp20 = icmp sgt i32 %n, 0 br i1 %cmp20, label %for.body.preheader, label %for.end9 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.preheader30, 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 ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = getelementptr inbounds i32, ptr %a, i64 %index store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30 for.body.preheader30: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block %cmp222 = icmp sgt i32 %n, 1 br i1 %cmp222, label %for.body3.preheader, label %for.end9 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader30, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %4 = trunc i64 %indvars.iv to i32 store i32 %4, ptr %arrayidx, align 4, !tbaa !16 %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.cond1.preheader, label %for.body, !llvm.loop !42 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ] %indvars.iv.next26 = add nsw i64 %indvars.iv25, -1 %call = tail call i32 @rand() #23 %5 = trunc i64 %indvars.iv25 to i32 %rem = srem i32 %call, %5 %idxprom4 = sext i32 %rem to i64 %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4 %idxprom6 = and i64 %indvars.iv.next26, 4294967295 %arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv25, 2 br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43 for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !44 %1 = load i64, ptr %b, align 8, !tbaa !44 %cmp = icmp slt i64 %0, %1 %cmp4 = icmp sgt i64 %0, %1 %. = zext i1 %cmp4 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 { entry: %dat = alloca [524288 x %struct.sd], align 16 call void @llvm.lifetime.start.p0(i64 8388608, ptr nonnull %dat) #23 %cmp46 = icmp sgt i32 %n, 0 br i1 %cmp46, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %xtraiter = and i64 %wide.trip.count, 1 %0 = icmp eq i32 %n, 1 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %1 = load i32, ptr %arrayidx, align 4, !tbaa !16 %conv = sext i32 %1 to i64 %arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv store i64 %conv, ptr %arrayidx2, align 16, !tbaa !44 %node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1 store i64 %indvars.iv, ptr %node, align 8, !tbaa !46 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next %2 = load i32, ptr %arrayidx.1, align 4, !tbaa !16 %conv.1 = sext i32 %2 to i64 %arrayidx2.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next store i64 %conv.1, ptr %arrayidx2.1, align 16, !tbaa !44 %node.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next, i32 1 store i64 %indvars.iv.next, ptr %node.1, align 8, !tbaa !46 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !47 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.unr %3 = load i32, ptr %arrayidx.epil, align 4, !tbaa !16 %conv.epil = sext i32 %3 to i64 %arrayidx2.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.unr store i64 %conv.epil, ptr %arrayidx2.epil, align 16, !tbaa !44 %node.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.unr, i32 1 store i64 %indvars.iv.unr, ptr %node.epil, align 8, !tbaa !46 br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %conv6 = sext i32 %n to i64 call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv6, i64 noundef 16, ptr noundef nonnull @sdsortfnc) #23 %node8 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1 %4 = load i64, ptr %node8, align 8, !tbaa !46 %arrayidx9 = getelementptr inbounds i32, ptr %a, i64 %4 store i32 0, ptr %arrayidx9, align 4, !tbaa !16 %cmp1148 = icmp sgt i32 %n, 1 br i1 %cmp1148, label %for.body13.preheader, label %for.end29 for.body13.preheader: ; preds = %for.end %wide.trip.count56 = zext i32 %n to i64 %.pre = load i64, ptr %dat, align 16, !tbaa !44 %5 = add nsw i64 %wide.trip.count56, -1 %xtraiter58 = and i64 %5, 1 %6 = icmp eq i32 %n, 2 br i1 %6, label %for.end29.loopexit.unr-lcssa, label %for.body13.preheader.new for.body13.preheader.new: ; preds = %for.body13.preheader %unroll_iter60 = and i64 %5, -2 br label %for.body13 for.body13: ; preds = %for.body13, %for.body13.preheader.new %7 = phi i64 [ %.pre, %for.body13.preheader.new ], [ %10, %for.body13 ] %indvars.iv52 = phi i64 [ 1, %for.body13.preheader.new ], [ %indvars.iv.next53.1, %for.body13 ] %c.050 = phi i32 [ 0, %for.body13.preheader.new ], [ %spec.select.1, %for.body13 ] %niter61 = phi i64 [ 0, %for.body13.preheader.new ], [ %niter61.next.1, %for.body13 ] %arrayidx18 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52 %8 = load i64, ptr %arrayidx18, align 16, !tbaa !44 %cmp20.not = icmp ne i64 %7, %8 %inc22 = zext i1 %cmp20.not to i32 %spec.select = add nuw nsw i32 %c.050, %inc22 %node25 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1 %9 = load i64, ptr %node25, align 8, !tbaa !46 %arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %9 store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16 %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %arrayidx18.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53 %10 = load i64, ptr %arrayidx18.1, align 16, !tbaa !44 %cmp20.not.1 = icmp ne i64 %8, %10 %inc22.1 = zext i1 %cmp20.not.1 to i32 %spec.select.1 = add nuw nsw i32 %spec.select, %inc22.1 %node25.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1 %11 = load i64, ptr %node25.1, align 8, !tbaa !46 %arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %11 store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16 %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2 %niter61.next.1 = add i64 %niter61, 2 %niter61.ncmp.1 = icmp eq i64 %niter61.next.1, %unroll_iter60 br i1 %niter61.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body13, !llvm.loop !48 for.end29.loopexit.unr-lcssa: ; preds = %for.body13, %for.body13.preheader %.unr = phi i64 [ %.pre, %for.body13.preheader ], [ %10, %for.body13 ] %indvars.iv52.unr = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next53.1, %for.body13 ] %c.050.unr = phi i32 [ 0, %for.body13.preheader ], [ %spec.select.1, %for.body13 ] %lcmp.mod59.not = icmp eq i64 %xtraiter58, 0 br i1 %lcmp.mod59.not, label %for.end29, label %for.body13.epil for.body13.epil: ; preds = %for.end29.loopexit.unr-lcssa %arrayidx18.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr %12 = load i64, ptr %arrayidx18.epil, align 16, !tbaa !44 %cmp20.not.epil = icmp ne i64 %.unr, %12 %inc22.epil = zext i1 %cmp20.not.epil to i32 %spec.select.epil = add nuw nsw i32 %c.050.unr, %inc22.epil %node25.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1 %13 = load i64, ptr %node25.epil, align 8, !tbaa !46 %arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %13 store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16 br label %for.end29 for.end29: ; preds = %for.body13.epil, %for.end29.loopexit.unr-lcssa, %for.end call void @llvm.lifetime.end.p0(i64 8388608, ptr nonnull %dat) #23 ret void } ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !49 %1 = load i64, ptr %b, align 8, !tbaa !49 %cmp = icmp sgt i64 %0, %1 br i1 %cmp, label %return, label %if.end if.end: ; preds = %entry %cmp4 = icmp slt i64 %0, %1 br i1 %cmp4, label %return, label %if.end6 if.end6: ; preds = %if.end %fi = getelementptr inbounds %struct.rs, ptr %a, i64 0, i32 1 %2 = load i64, ptr %fi, align 8, !tbaa !51 %fi7 = getelementptr inbounds %struct.rs, ptr %b, i64 0, i32 1 %3 = load i64, ptr %fi7, align 8, !tbaa !51 %cmp8 = icmp sgt i64 %2, %3 br i1 %cmp8, label %return, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp slt i64 %2, %3 %. = sext i1 %cmp13 to i32 br label %return return: ; 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 nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @revsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 { entry: %0 = load i64, ptr %a, align 8, !tbaa !49 %fi = getelementptr inbounds %struct.rs, ptr %a, i64 0, i32 1 %1 = load i64, ptr %fi, align 8, !tbaa !51 %2 = load i64, ptr %b, align 8, !tbaa !49 %fi2 = getelementptr inbounds %struct.rs, ptr %b, i64 0, i32 1 %3 = load i64, ptr %fi2, align 8, !tbaa !51 %spec.select = tail call i64 @llvm.smin.i64(i64 %0, i64 %1) %spec.select43 = tail call i64 @llvm.smax.i64(i64 %0, i64 %1) %r.0 = tail call i64 @llvm.smin.i64(i64 %2, i64 %3) %s.0 = tail call i64 @llvm.smax.i64(i64 %2, i64 %3) %cmp6 = icmp slt i64 %spec.select, %r.0 br i1 %cmp6, label %cleanup, label %if.end8 if.end8: ; preds = %entry %cmp9 = icmp sgt i64 %spec.select, %r.0 br i1 %cmp9, label %cleanup, label %if.end11 if.end11: ; preds = %if.end8 %cmp12 = icmp slt i64 %spec.select43, %s.0 br i1 %cmp12, label %cleanup, label %if.end14 if.end14: ; preds = %if.end11 %cmp15 = icmp sgt i64 %spec.select43, %s.0 %. = zext i1 %cmp15 to i32 br label %cleanup cleanup: ; preds = %if.end14, %if.end11, %if.end8, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end8 ], [ -1, %if.end11 ], [ %., %if.end14 ] ret i32 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @makemkj(ptr nocapture noundef readonly %g, ptr nocapture noundef writeonly %x, i64 noundef %n) local_unnamed_addr #15 { entry: %0 = load i64, ptr %g, align 8, !tbaa !49 %cmp36 = icmp sgt i64 %n, 1 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %nst.039 = phi i64 [ %nst.1, %for.inc ], [ %0, %entry ] %ms.038 = phi i64 [ %ms.1, %for.inc ], [ 0, %entry ] %i.037 = phi i64 [ %inc, %for.inc ], [ 1, %entry ] %arrayidx1 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.037 %1 = load i64, ptr %arrayidx1, align 8, !tbaa !49 %arrayidx3 = getelementptr %struct.rs, ptr %arrayidx1, i64 -1 %2 = load i64, ptr %arrayidx3, align 8, !tbaa !49 %cmp5.not = icmp eq i64 %1, %2 br i1 %cmp5.not, label %for.inc, label %if.then if.then: ; preds = %for.body %sub6 = sub nsw i64 %i.037, %ms.038 %arrayidx7 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039 %kz = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039, i32 1 store i64 %sub6, ptr %kz, align 8, !tbaa !46 store i64 %ms.038, ptr %arrayidx7, align 8, !tbaa !44 br label %for.inc for.inc: ; preds = %for.body, %if.then %ms.1 = phi i64 [ %i.037, %if.then ], [ %ms.038, %for.body ] %nst.1 = phi i64 [ %1, %if.then ], [ %nst.039, %for.body ] %inc = add nuw nsw i64 %i.037, 1 %exitcond.not = icmp eq i64 %inc, %n br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !52 for.end: ; preds = %for.inc, %entry %ms.0.lcssa = phi i64 [ 0, %entry ], [ %ms.1, %for.inc ] %nst.0.lcssa = phi i64 [ %0, %entry ], [ %nst.1, %for.inc ] %sub12 = sub nsw i64 %n, %ms.0.lcssa %arrayidx13 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa %kz14 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa, i32 1 store i64 %sub12, ptr %kz14, align 8, !tbaa !46 store i64 %ms.0.lcssa, ptr %arrayidx13, align 8, !tbaa !44 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @power(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp9 = icmp sgt i64 %b, 0 br i1 %cmp9, label %while.body, label %while.end while.body: ; preds = %entry, %if.end %y.012 = phi i64 [ %rem2, %if.end ], [ %a, %entry ] %x.011 = phi i64 [ %x.1, %if.end ], [ 1, %entry ] %b.addr.010 = phi i64 [ %shr, %if.end ], [ %b, %entry ] %and = and i64 %b.addr.010, 1 %tobool.not = icmp eq i64 %and, 0 br i1 %tobool.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul nsw i64 %y.012, %x.011 %rem = srem i64 %mul, 1000000007 br label %if.end if.end: ; preds = %if.then, %while.body %x.1 = phi i64 [ %rem, %if.then ], [ %x.011, %while.body ] %mul1 = mul nsw i64 %y.012, %y.012 %rem2 = urem i64 %mul1, 1000000007 %shr = lshr i64 %b.addr.010, 1 %cmp.not = icmp ult i64 %b.addr.010, 2 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !53 while.end.loopexit: ; preds = %if.end %0 = srem i64 %x.1, 1000000007 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %x.0.lcssa = phi i64 [ 1, %entry ], [ %0, %while.end.loopexit ] ret i64 %x.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @modular_inverse(i64 noundef %n) local_unnamed_addr #2 { entry: br label %while.body.i while.body.i: ; preds = %if.end.i, %entry %y.012.i = phi i64 [ %rem2.i, %if.end.i ], [ %n, %entry ] %x.011.i = phi i64 [ %x.1.i, %if.end.i ], [ 1, %entry ] %b.addr.010.i = phi i64 [ %shr.i, %if.end.i ], [ 1000000005, %entry ] %and.i = and i64 %b.addr.010.i, 1 %tobool.not.i = icmp eq i64 %and.i, 0 br i1 %tobool.not.i, label %if.end.i, label %if.then.i if.then.i: ; preds = %while.body.i %mul.i = mul nsw i64 %x.011.i, %y.012.i %rem.i = srem i64 %mul.i, 1000000007 br label %if.end.i if.end.i: ; preds = %if.then.i, %while.body.i %x.1.i = phi i64 [ %rem.i, %if.then.i ], [ %x.011.i, %while.body.i ] %mul1.i = mul nsw i64 %y.012.i, %y.012.i %rem2.i = urem i64 %mul1.i, 1000000007 %shr.i = lshr i64 %b.addr.010.i, 1 %cmp.not.i = icmp ult i64 %b.addr.010.i, 2 br i1 %cmp.not.i, label %power.exit, label %while.body.i, !llvm.loop !53 power.exit: ; preds = %if.end.i %0 = srem i64 %x.1.i, 1000000007 ret i64 %0 } ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @cfact() local_unnamed_addr #16 { entry: store i64 1, ptr @factorial, align 16, !tbaa !29 store i64 1, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !29 br label %for.body for.body: ; preds = %for.body, %entry %0 = phi i64 [ 1, %entry ], [ %rem.1, %for.body ] %i.025 = phi i64 [ 2, %entry ], [ %inc.1, %for.body ] %mul = mul nsw i64 %0, %i.025 %arrayidx1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %i.025 %rem = srem i64 %mul, 1000000007 store i64 %rem, ptr %arrayidx1, align 16, !tbaa !29 %inc = or i64 %i.025, 1 %mul.1 = mul nsw i64 %rem, %inc %arrayidx1.1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %inc %rem.1 = srem i64 %mul.1, 1000000007 store i64 %rem.1, ptr %arrayidx1.1, align 8, !tbaa !29 %inc.1 = add nuw nsw i64 %i.025, 2 %exitcond.not.1 = icmp eq i64 %inc.1, 524288 br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !54 for.end: ; preds = %for.body %1 = load i64, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 524287), align 8, !tbaa !29 br label %while.body.i.i while.body.i.i: ; preds = %if.end.i.i, %for.end %y.012.i.i = phi i64 [ %rem2.i.i, %if.end.i.i ], [ %1, %for.end ] %x.011.i.i = phi i64 [ %x.1.i.i, %if.end.i.i ], [ 1, %for.end ] %b.addr.010.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ 1000000005, %for.end ] %and.i.i = and i64 %b.addr.010.i.i, 1 %tobool.not.i.i = icmp eq i64 %and.i.i, 0 br i1 %tobool.not.i.i, label %if.end.i.i, label %if.then.i.i if.then.i.i: ; preds = %while.body.i.i %mul.i.i = mul nsw i64 %x.011.i.i, %y.012.i.i %rem.i.i = srem i64 %mul.i.i, 1000000007 br label %if.end.i.i if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i %x.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %x.011.i.i, %while.body.i.i ] %mul1.i.i = mul nsw i64 %y.012.i.i, %y.012.i.i %rem2.i.i = urem i64 %mul1.i.i, 1000000007 %shr.i.i = lshr i64 %b.addr.010.i.i, 1 %cmp.not.i.i = icmp ult i64 %b.addr.010.i.i, 2 br i1 %cmp.not.i.i, label %modular_inverse.exit, label %while.body.i.i, !llvm.loop !53 modular_inverse.exit: ; preds = %if.end.i.i %2 = srem i64 %x.1.i.i, 1000000007 store i64 %2, ptr getelementptr inbounds ([524288 x i64], ptr @invfact, i64 0, i64 524287), align 8, !tbaa !29 br label %for.body5 for.body5: ; preds = %for.body5.1, %modular_inverse.exit %3 = phi i64 [ %2, %modular_inverse.exit ], [ %rem11.1, %for.body5.1 ] %i.126 = phi i64 [ 524286, %modular_inverse.exit ], [ %dec.1, %for.body5.1 ] %add = or i64 %i.126, 1 %mul8 = mul nsw i64 %3, %add %arrayidx9 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %i.126 %rem11 = srem i64 %mul8, 1000000007 store i64 %rem11, ptr %arrayidx9, align 16, !tbaa !29 %cmp4.not = icmp eq i64 %i.126, 0 br i1 %cmp4.not, label %for.end13, label %for.body5.1, !llvm.loop !55 for.body5.1: ; preds = %for.body5 %dec = add nsw i64 %i.126, -1 %mul8.1 = mul nsw i64 %rem11, %i.126 %arrayidx9.1 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %dec %rem11.1 = srem i64 %mul8.1, 1000000007 store i64 %rem11.1, ptr %arrayidx9.1, align 8, !tbaa !29 %dec.1 = add nsw i64 %i.126, -2 br label %for.body5 for.end13: ; preds = %for.body5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @calcnCr(i64 noundef %n, i64 noundef %k) local_unnamed_addr #17 { entry: %cmp = icmp slt i64 %k, 0 %cmp1 = icmp slt i64 %n, %k %or.cond = or i1 %cmp, %cmp1 br i1 %or.cond, label %return, label %if.end if.end: ; preds = %entry %arrayidx = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %n %0 = load i64, ptr %arrayidx, align 8, !tbaa !29 %arrayidx2 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %k %1 = load i64, ptr %arrayidx2, align 8, !tbaa !29 %sub = sub nsw i64 %n, %k %arrayidx3 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub %2 = load i64, ptr %arrayidx3, align 8, !tbaa !29 %mul = mul nsw i64 %2, %1 %rem = srem i64 %mul, 1000000007 %mul4 = mul nsw i64 %rem, %0 %rem5 = srem i64 %mul4, 1000000007 br label %return return: ; preds = %entry, %if.end %retval.0 = phi i64 [ %rem5, %if.end ], [ 0, %entry ] ret i64 %retval.0 } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local void @dfs(i64 noundef %t, i64 noundef %l, i64 noundef %bp, ptr nocapture noundef readonly %g, ptr nocapture noundef readonly %x) local_unnamed_addr #18 { entry: %arrayidx = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %t %0 = load i64, ptr %arrayidx, align 8, !tbaa !29 %cmp.not = icmp sgt i64 %0, %l br i1 %cmp.not, label %if.end, label %cleanup if.end: ; preds = %entry store i64 %l, ptr %arrayidx, align 8, !tbaa !29 %arrayidx2 = getelementptr inbounds [524288 x i64], ptr @par, i64 0, i64 %t store i64 %bp, ptr %arrayidx2, align 8, !tbaa !29 %arrayidx3 = getelementptr inbounds %struct.mkj, ptr %x, i64 %t %kz = getelementptr inbounds %struct.mkj, ptr %x, i64 %t, i32 1 %1 = load i64, ptr %kz, align 8, !tbaa !46 %cmp725 = icmp sgt i64 %1, 0 br i1 %cmp725, label %for.body.lr.ph, label %cleanup for.body.lr.ph: ; preds = %if.end %2 = load i64, ptr %arrayidx3, align 8, !tbaa !44 %add9 = add nsw i64 %l, 1 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.body %i.026 = phi i64 [ %2, %for.body.lr.ph ], [ %inc, %for.body ] %fi = getelementptr inbounds %struct.rs, ptr %g, i64 %i.026, i32 1 %3 = load i64, ptr %fi, align 8, !tbaa !51 tail call void @dfs(i64 noundef %3, i64 noundef %add9, i64 noundef %t, ptr noundef %g, ptr noundef nonnull %x) %inc = add nsw i64 %i.026, 1 %4 = load i64, ptr %arrayidx3, align 8, !tbaa !44 %5 = load i64, ptr %kz, align 8, !tbaa !46 %add = add nsw i64 %5, %4 %cmp7 = icmp slt i64 %inc, %add br i1 %cmp7, label %for.body, label %cleanup, !llvm.loop !56 cleanup: ; preds = %for.body, %if.end, %entry ret void } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i64 @repdp(i64 noundef %v, i64 noundef %bk, ptr nocapture noundef readonly %g, ptr nocapture noundef readonly %x) local_unnamed_addr #18 { entry: %arrayidx = getelementptr inbounds %struct.mkj, ptr %x, i64 %v %0 = load i64, ptr %arrayidx, align 8, !tbaa !44 %kz = getelementptr inbounds %struct.mkj, ptr %x, i64 %v, i32 1 %1 = load i64, ptr %kz, align 8, !tbaa !46 %cmp206 = icmp sgt i64 %1, 0 br i1 %cmp206, label %for.body, label %entry.for.cond18.preheader_crit_edge entry.for.cond18.preheader_crit_edge: ; preds = %entry %.pre240 = add nsw i64 %1, %0 br label %for.cond18.preheader for.cond18.preheader: ; preds = %for.inc, %entry.for.cond18.preheader_crit_edge %add23213.pre-phi = phi i64 [ %.pre240, %entry.for.cond18.preheader_crit_edge ], [ %add, %for.inc ] %2 = phi i64 [ %1, %entry.for.cond18.preheader_crit_edge ], [ %11, %for.inc ] %mem.0.lcssa = phi i64 [ undef, %entry.for.cond18.preheader_crit_edge ], [ %mem.1, %for.inc ] %tc.0.lcssa = phi i64 [ 0, %entry.for.cond18.preheader_crit_edge ], [ %tc.1, %for.inc ] %3 = phi i64 [ %0, %entry.for.cond18.preheader_crit_edge ], [ %12, %for.inc ] %cmp24214 = icmp slt i64 %3, %add23213.pre-phi br i1 %cmp24214, label %for.body25.lr.ph, label %for.end55 for.body25.lr.ph: ; preds = %for.cond18.preheader %cmp37 = icmp eq i64 %bk, -1 br label %for.body25 for.body: ; preds = %entry, %for.inc %.pre229237 = phi i64 [ %.pre229238, %for.inc ], [ %1, %entry ] %.pre234 = phi i64 [ %.pre235, %for.inc ], [ %0, %entry ] %4 = phi i64 [ %11, %for.inc ], [ %1, %entry ] %5 = phi i64 [ %12, %for.inc ], [ %0, %entry ] %tc.0209 = phi i64 [ %tc.1, %for.inc ], [ 0, %entry ] %mem.0208 = phi i64 [ %mem.1, %for.inc ], [ undef, %entry ] %i.0207 = phi i64 [ %inc, %for.inc ], [ %0, %entry ] %fi = getelementptr inbounds %struct.rs, ptr %g, i64 %i.0207, i32 1 %6 = load i64, ptr %fi, align 8, !tbaa !51 %cmp5 = icmp eq i64 %6, %bk br i1 %cmp5, label %if.then, label %if.end if.then: ; preds = %for.body %id = getelementptr inbounds %struct.rs, ptr %g, i64 %i.0207, i32 3 %7 = load i64, ptr %id, align 8, !tbaa !57 br label %for.inc if.end: ; preds = %for.body %rev = getelementptr inbounds %struct.rs, ptr %g, i64 %i.0207, i32 4 %8 = load i64, ptr %rev, align 8, !tbaa !58 %arrayidx8 = getelementptr inbounds [524288 x i64], ptr @calcfl, i64 0, i64 %8 %9 = load i64, ptr %arrayidx8, align 8, !tbaa !29 %cmp9 = icmp eq i64 %9, 0 br i1 %cmp9, label %if.then10, label %if.end13 if.then10: ; preds = %if.end %call = tail call i64 @repdp(i64 noundef %6, i64 noundef %v, ptr noundef nonnull %g, ptr noundef nonnull %x), !range !59 %.pre.pre = load i64, ptr %arrayidx, align 8, !tbaa !44 %.pre229.pre = load i64, ptr %kz, align 8, !tbaa !46 br label %if.end13 if.end13: ; preds = %if.then10, %if.end %.pre229 = phi i64 [ %.pre229.pre, %if.then10 ], [ %.pre229237, %if.end ] %.pre = phi i64 [ %.pre.pre, %if.then10 ], [ %.pre234, %if.end ] %arrayidx14 = getelementptr inbounds [524288 x i64], ptr @dc, i64 0, i64 %8 %10 = load i64, ptr %arrayidx14, align 8, !tbaa !29 %add15 = add nsw i64 %10, %tc.0209 br label %for.inc for.inc: ; preds = %if.end13, %if.then %.pre229238 = phi i64 [ %.pre229237, %if.then ], [ %.pre229, %if.end13 ] %.pre235 = phi i64 [ %.pre234, %if.then ], [ %.pre, %if.end13 ] %11 = phi i64 [ %4, %if.then ], [ %.pre229, %if.end13 ] %12 = phi i64 [ %5, %if.then ], [ %.pre, %if.end13 ] %mem.1 = phi i64 [ %7, %if.then ], [ %mem.0208, %if.end13 ] %tc.1 = phi i64 [ %tc.0209, %if.then ], [ %add15, %if.end13 ] %inc = add nsw i64 %i.0207, 1 %add = add nsw i64 %11, %12 %cmp = icmp slt i64 %inc, %add br i1 %cmp, label %for.body, label %for.cond18.preheader, !llvm.loop !60 for.body25: ; preds = %for.body25.lr.ph, %for.inc53 %13 = phi i64 [ %2, %for.body25.lr.ph ], [ %25, %for.inc53 ] %14 = phi i64 [ %3, %for.body25.lr.ph ], [ %26, %for.inc53 ] %tc.2219 = phi i64 [ %tc.0.lcssa, %for.body25.lr.ph ], [ %tc.3, %for.inc53 ] %mem.2218 = phi i64 [ %mem.0.lcssa, %for.body25.lr.ph ], [ %mem.3, %for.inc53 ] %i.1217 = phi i64 [ %3, %for.body25.lr.ph ], [ %inc54, %for.inc53 ] %nc.0216 = phi i64 [ 1, %for.body25.lr.ph ], [ %nc.1, %for.inc53 ] %np.0215 = phi i64 [ 1, %for.body25.lr.ph ], [ %np.1, %for.inc53 ] %fi27 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.1217, i32 1 %15 = load i64, ptr %fi27, align 8, !tbaa !51 %cmp28 = icmp eq i64 %15, %bk br i1 %cmp28, label %if.then29, label %if.end32 if.then29: ; preds = %for.body25 %id31 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.1217, i32 3 %16 = load i64, ptr %id31, align 8, !tbaa !57 br label %for.inc53 if.end32: ; preds = %for.body25 %rev36 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.1217, i32 4 %17 = load i64, ptr %rev36, align 8, !tbaa !58 br i1 %cmp37, label %if.then38, label %if.end32.if.end43_crit_edge if.end32.if.end43_crit_edge: ; preds = %if.end32 %arrayidx44.phi.trans.insert = getelementptr inbounds [524288 x i64], ptr @dc, i64 0, i64 %17 %.pre230 = load i64, ptr %arrayidx44.phi.trans.insert, align 8, !tbaa !29 %arrayidx46.phi.trans.insert = getelementptr inbounds [524288 x i64], ptr @dp, i64 0, i64 %17 %.pre231 = load i64, ptr %arrayidx46.phi.trans.insert, align 8, !tbaa !29 br label %if.end43 if.then38: ; preds = %if.end32 %sub = sub nsw i64 %i.1217, %14 %arrayidx39 = getelementptr inbounds [524288 x i64], ptr @dc, i64 0, i64 %17 %18 = load i64, ptr %arrayidx39, align 8, !tbaa !29 %arrayidx40 = getelementptr inbounds [524288 x i64], ptr @sc, i64 0, i64 %sub store i64 %18, ptr %arrayidx40, align 8, !tbaa !29 %arrayidx41 = getelementptr inbounds [524288 x i64], ptr @dp, i64 0, i64 %17 %19 = load i64, ptr %arrayidx41, align 8, !tbaa !29 %arrayidx42 = getelementptr inbounds [524288 x i64], ptr @sp, i64 0, i64 %sub store i64 %19, ptr %arrayidx42, align 8, !tbaa !29 br label %if.end43 if.end43: ; preds = %if.end32.if.end43_crit_edge, %if.then38 %20 = phi i64 [ %.pre231, %if.end32.if.end43_crit_edge ], [ %19, %if.then38 ] %21 = phi i64 [ %.pre230, %if.end32.if.end43_crit_edge ], [ %18, %if.then38 ] %add45 = add nsw i64 %21, %nc.0216 %mul = mul nsw i64 %20, %np.0215 %rem = srem i64 %mul, 1000000007 %cmp.i = icmp slt i64 %21, 0 %cmp1.i = icmp slt i64 %tc.2219, %21 %or.cond.i = or i1 %cmp.i, %cmp1.i br i1 %or.cond.i, label %if.end43.calcnCr.exit_crit_edge, label %if.end.i if.end43.calcnCr.exit_crit_edge: ; preds = %if.end43 %.pre241 = sub nsw i64 %tc.2219, %21 br label %calcnCr.exit if.end.i: ; preds = %if.end43 %arrayidx.i = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %tc.2219 %22 = load i64, ptr %arrayidx.i, align 8, !tbaa !29 %arrayidx2.i = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %21 %23 = load i64, ptr %arrayidx2.i, align 8, !tbaa !29 %sub.i = sub nsw i64 %tc.2219, %21 %arrayidx3.i = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub.i %24 = load i64, ptr %arrayidx3.i, align 8, !tbaa !29 %mul.i = mul nsw i64 %24, %23 %rem.i = srem i64 %mul.i, 1000000007 %mul4.i = mul nsw i64 %rem.i, %22 %rem5.i = srem i64 %mul4.i, 1000000007 br label %calcnCr.exit calcnCr.exit: ; preds = %if.end43.calcnCr.exit_crit_edge, %if.end.i %sub52.pre-phi = phi i64 [ %.pre241, %if.end43.calcnCr.exit_crit_edge ], [ %sub.i, %if.end.i ] %retval.0.i = phi i64 [ 0, %if.end43.calcnCr.exit_crit_edge ], [ %rem5.i, %if.end.i ] %mul49 = mul nsw i64 %retval.0.i, %rem %rem50 = srem i64 %mul49, 1000000007 %.pre232 = load i64, ptr %arrayidx, align 8, !tbaa !44 %.pre233 = load i64, ptr %kz, align 8, !tbaa !46 br label %for.inc53 for.inc53: ; preds = %calcnCr.exit, %if.then29 %25 = phi i64 [ %13, %if.then29 ], [ %.pre233, %calcnCr.exit ] %26 = phi i64 [ %14, %if.then29 ], [ %.pre232, %calcnCr.exit ] %np.1 = phi i64 [ %np.0215, %if.then29 ], [ %rem50, %calcnCr.exit ] %nc.1 = phi i64 [ %nc.0216, %if.then29 ], [ %add45, %calcnCr.exit ] %mem.3 = phi i64 [ %16, %if.then29 ], [ %mem.2218, %calcnCr.exit ] %tc.3 = phi i64 [ %tc.2219, %if.then29 ], [ %sub52.pre-phi, %calcnCr.exit ] %inc54 = add nsw i64 %i.1217, 1 %add23 = add nsw i64 %25, %26 %cmp24 = icmp slt i64 %inc54, %add23 br i1 %cmp24, label %for.body25, label %for.end55, !llvm.loop !61 for.end55: ; preds = %for.inc53, %for.cond18.preheader %27 = phi i64 [ %2, %for.cond18.preheader ], [ %25, %for.inc53 ] %np.0.lcssa = phi i64 [ 1, %for.cond18.preheader ], [ %np.1, %for.inc53 ] %nc.0.lcssa = phi i64 [ 1, %for.cond18.preheader ], [ %nc.1, %for.inc53 ] %mem.2.lcssa = phi i64 [ %mem.0.lcssa, %for.cond18.preheader ], [ %mem.3, %for.inc53 ] %28 = phi i64 [ %3, %for.cond18.preheader ], [ %26, %for.inc53 ] %cmp56.not = icmp eq i64 %bk, -1 br i1 %cmp56.not, label %for.cond63.preheader, label %if.then57 for.cond63.preheader: ; preds = %for.end55 %cmp69225 = icmp sgt i64 %27, 0 br i1 %cmp69225, label %for.body70.lr.ph, label %if.end96 for.body70.lr.ph: ; preds = %for.cond63.preheader %sub79 = add nsw i64 %nc.0.lcssa, -1 %arrayidx.i178 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %sub79 br label %for.body70 if.then57: ; preds = %for.end55 %arrayidx58 = getelementptr inbounds [524288 x i64], ptr @dc, i64 0, i64 %mem.2.lcssa store i64 %nc.0.lcssa, ptr %arrayidx58, align 8, !tbaa !29 %arrayidx59 = getelementptr inbounds [524288 x i64], ptr @dp, i64 0, i64 %mem.2.lcssa store i64 %np.0.lcssa, ptr %arrayidx59, align 8, !tbaa !29 %arrayidx60 = getelementptr inbounds [524288 x i64], ptr @calcfl, i64 0, i64 %mem.2.lcssa store i64 1, ptr %arrayidx60, align 8, !tbaa !29 br label %if.end96 for.body70: ; preds = %for.body70.lr.ph, %modular_inverse.exit203 %29 = phi i64 [ %28, %for.body70.lr.ph ], [ %38, %modular_inverse.exit203 ] %i.2226 = phi i64 [ %28, %for.body70.lr.ph ], [ %inc94, %modular_inverse.exit203 ] %sub73 = sub nsw i64 %i.2226, %29 %id75 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.2226, i32 3 %30 = load i64, ptr %id75, align 8, !tbaa !57 %arrayidx76 = getelementptr inbounds [524288 x i64], ptr @sc, i64 0, i64 %sub73 %31 = load i64, ptr %arrayidx76, align 8, !tbaa !29 %sub77 = sub nsw i64 %nc.0.lcssa, %31 %arrayidx78 = getelementptr inbounds [524288 x i64], ptr @dc, i64 0, i64 %30 store i64 %sub77, ptr %arrayidx78, align 8, !tbaa !29 %cmp.i174 = icmp slt i64 %31, 0 %cmp1.i175 = icmp sle i64 %nc.0.lcssa, %31 %or.cond.i176 = or i1 %cmp.i174, %cmp1.i175 br i1 %or.cond.i176, label %while.body.i.i.preheader, label %if.end.i177 if.end.i177: ; preds = %for.body70 %32 = load i64, ptr %arrayidx.i178, align 8, !tbaa !29 %arrayidx2.i179 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %31 %33 = load i64, ptr %arrayidx2.i179, align 8, !tbaa !29 %sub.i180 = sub nsw i64 %sub79, %31 %arrayidx3.i181 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub.i180 %34 = load i64, ptr %arrayidx3.i181, align 8, !tbaa !29 %mul.i182 = mul nsw i64 %34, %33 %rem.i183 = srem i64 %mul.i182, 1000000007 %mul4.i184 = mul nsw i64 %rem.i183, %32 %rem5.i185 = srem i64 %mul4.i184, 1000000007 br label %while.body.i.i.preheader while.body.i.i.preheader: ; preds = %for.body70, %if.end.i177 %y.012.i.i.ph = phi i64 [ 0, %for.body70 ], [ %rem5.i185, %if.end.i177 ] br label %while.body.i.i while.body.i.i: ; preds = %while.body.i.i.preheader, %if.end.i.i %y.012.i.i = phi i64 [ %rem2.i.i, %if.end.i.i ], [ %y.012.i.i.ph, %while.body.i.i.preheader ] %x.011.i.i = phi i64 [ %x.1.i.i, %if.end.i.i ], [ 1, %while.body.i.i.preheader ] %b.addr.010.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ 1000000005, %while.body.i.i.preheader ] %and.i.i = and i64 %b.addr.010.i.i, 1 %tobool.not.i.i = icmp eq i64 %and.i.i, 0 br i1 %tobool.not.i.i, label %if.end.i.i, label %if.then.i.i if.then.i.i: ; preds = %while.body.i.i %mul.i.i = mul nsw i64 %x.011.i.i, %y.012.i.i %rem.i.i = srem i64 %mul.i.i, 1000000007 br label %if.end.i.i if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i %x.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %x.011.i.i, %while.body.i.i ] %mul1.i.i = mul nsw i64 %y.012.i.i, %y.012.i.i %rem2.i.i = urem i64 %mul1.i.i, 1000000007 %shr.i.i = lshr i64 %b.addr.010.i.i, 1 %cmp.not.i.i = icmp ult i64 %b.addr.010.i.i, 2 br i1 %cmp.not.i.i, label %modular_inverse.exit, label %while.body.i.i, !llvm.loop !53 modular_inverse.exit: ; preds = %if.end.i.i %35 = srem i64 %x.1.i.i, 1000000007 %mul83 = mul nsw i64 %35, %np.0.lcssa %rem84 = srem i64 %mul83, 1000000007 %arrayidx85 = getelementptr inbounds [524288 x i64], ptr @dp, i64 0, i64 %30 %arrayidx87 = getelementptr inbounds [524288 x i64], ptr @sp, i64 0, i64 %sub73 %36 = load i64, ptr %arrayidx87, align 8, !tbaa !29 br label %while.body.i.i188 while.body.i.i188: ; preds = %if.end.i.i197, %modular_inverse.exit %y.012.i.i189 = phi i64 [ %rem2.i.i200, %if.end.i.i197 ], [ %36, %modular_inverse.exit ] %x.011.i.i190 = phi i64 [ %x.1.i.i198, %if.end.i.i197 ], [ 1, %modular_inverse.exit ] %b.addr.010.i.i191 = phi i64 [ %shr.i.i201, %if.end.i.i197 ], [ 1000000005, %modular_inverse.exit ] %and.i.i192 = and i64 %b.addr.010.i.i191, 1 %tobool.not.i.i193 = icmp eq i64 %and.i.i192, 0 br i1 %tobool.not.i.i193, label %if.end.i.i197, label %if.then.i.i194 if.then.i.i194: ; preds = %while.body.i.i188 %mul.i.i195 = mul nsw i64 %x.011.i.i190, %y.012.i.i189 %rem.i.i196 = srem i64 %mul.i.i195, 1000000007 br label %if.end.i.i197 if.end.i.i197: ; preds = %if.then.i.i194, %while.body.i.i188 %x.1.i.i198 = phi i64 [ %rem.i.i196, %if.then.i.i194 ], [ %x.011.i.i190, %while.body.i.i188 ] %mul1.i.i199 = mul nsw i64 %y.012.i.i189, %y.012.i.i189 %rem2.i.i200 = urem i64 %mul1.i.i199, 1000000007 %shr.i.i201 = lshr i64 %b.addr.010.i.i191, 1 %cmp.not.i.i202 = icmp ult i64 %b.addr.010.i.i191, 2 br i1 %cmp.not.i.i202, label %modular_inverse.exit203, label %while.body.i.i188, !llvm.loop !53 modular_inverse.exit203: ; preds = %if.end.i.i197 %37 = srem i64 %x.1.i.i198, 1000000007 %mul89 = mul nsw i64 %37, %rem84 %rem90 = srem i64 %mul89, 1000000007 store i64 %rem90, ptr %arrayidx85, align 8, !tbaa !29 %arrayidx92 = getelementptr inbounds [524288 x i64], ptr @calcfl, i64 0, i64 %30 store i64 1, ptr %arrayidx92, align 8, !tbaa !29 %inc94 = add nsw i64 %i.2226, 1 %38 = load i64, ptr %arrayidx, align 8, !tbaa !44 %39 = load i64, ptr %kz, align 8, !tbaa !46 %add68 = add nsw i64 %39, %38 %cmp69 = icmp slt i64 %inc94, %add68 br i1 %cmp69, label %for.body70, label %if.end96, !llvm.loop !62 if.end96: ; preds = %modular_inverse.exit203, %for.cond63.preheader, %if.then57 ret i64 %np.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #12 { entry: %n = alloca i64, align 8 %res = alloca [524288 x i64], align 16 %dat = alloca [524288 x %struct.sd], align 16 %g = alloca [524288 x %struct.rs], align 16 %x = alloca [524288 x %struct.mkj], align 16 store i64 1, ptr @factorial, align 16, !tbaa !29 store i64 1, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !29 br label %for.body.i for.body.i: ; preds = %for.body.i, %entry %0 = phi i64 [ 1, %entry ], [ %rem.i.1, %for.body.i ] %i.025.i = phi i64 [ 2, %entry ], [ %inc.i.1, %for.body.i ] %mul.i = mul nsw i64 %i.025.i, %0 %arrayidx1.i = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %i.025.i %rem.i = srem i64 %mul.i, 1000000007 store i64 %rem.i, ptr %arrayidx1.i, align 16, !tbaa !29 %inc.i = or i64 %i.025.i, 1 %mul.i.1 = mul nsw i64 %inc.i, %rem.i %arrayidx1.i.1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %inc.i %rem.i.1 = srem i64 %mul.i.1, 1000000007 store i64 %rem.i.1, ptr %arrayidx1.i.1, align 8, !tbaa !29 %inc.i.1 = add nuw nsw i64 %i.025.i, 2 %exitcond.not.i.1 = icmp eq i64 %inc.i.1, 524288 br i1 %exitcond.not.i.1, label %for.end.i, label %for.body.i, !llvm.loop !54 for.end.i: ; preds = %for.body.i %1 = load i64, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 524287), align 8, !tbaa !29 br label %while.body.i.i.i while.body.i.i.i: ; preds = %if.end.i.i.i, %for.end.i %y.012.i.i.i = phi i64 [ %rem2.i.i.i, %if.end.i.i.i ], [ %1, %for.end.i ] %x.011.i.i.i = phi i64 [ %x.1.i.i.i, %if.end.i.i.i ], [ 1, %for.end.i ] %b.addr.010.i.i.i = phi i64 [ %shr.i.i.i, %if.end.i.i.i ], [ 1000000005, %for.end.i ] %and.i.i.i = and i64 %b.addr.010.i.i.i, 1 %tobool.not.i.i.i = icmp eq i64 %and.i.i.i, 0 br i1 %tobool.not.i.i.i, label %if.end.i.i.i, label %if.then.i.i.i if.then.i.i.i: ; preds = %while.body.i.i.i %mul.i.i.i = mul nsw i64 %x.011.i.i.i, %y.012.i.i.i %rem.i.i.i = srem i64 %mul.i.i.i, 1000000007 br label %if.end.i.i.i if.end.i.i.i: ; preds = %if.then.i.i.i, %while.body.i.i.i %x.1.i.i.i = phi i64 [ %rem.i.i.i, %if.then.i.i.i ], [ %x.011.i.i.i, %while.body.i.i.i ] %mul1.i.i.i = mul nsw i64 %y.012.i.i.i, %y.012.i.i.i %rem2.i.i.i = urem i64 %mul1.i.i.i, 1000000007 %shr.i.i.i = lshr i64 %b.addr.010.i.i.i, 1 %cmp.not.i.i.i = icmp ult i64 %b.addr.010.i.i.i, 2 br i1 %cmp.not.i.i.i, label %modular_inverse.exit.i, label %while.body.i.i.i, !llvm.loop !53 modular_inverse.exit.i: ; preds = %if.end.i.i.i %2 = srem i64 %x.1.i.i.i, 1000000007 store i64 %2, ptr getelementptr inbounds ([524288 x i64], ptr @invfact, i64 0, i64 524287), align 8, !tbaa !29 br label %for.body5.i for.body5.i: ; preds = %for.body5.i.1, %modular_inverse.exit.i %3 = phi i64 [ %2, %modular_inverse.exit.i ], [ %rem11.i.1, %for.body5.i.1 ] %i.126.i = phi i64 [ 524286, %modular_inverse.exit.i ], [ %dec.i.1, %for.body5.i.1 ] %add.i = or i64 %i.126.i, 1 %mul8.i = mul nsw i64 %add.i, %3 %arrayidx9.i = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %i.126.i %rem11.i = srem i64 %mul8.i, 1000000007 store i64 %rem11.i, ptr %arrayidx9.i, align 16, !tbaa !29 %cmp4.not.i = icmp eq i64 %i.126.i, 0 br i1 %cmp4.not.i, label %cfact.exit, label %for.body5.i.1, !llvm.loop !55 for.body5.i.1: ; preds = %for.body5.i %dec.i = add nsw i64 %i.126.i, -1 %mul8.i.1 = mul nsw i64 %i.126.i, %rem11.i %arrayidx9.i.1 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %dec.i %rem11.i.1 = srem i64 %mul8.i.1, 1000000007 store i64 %rem11.i.1, ptr %arrayidx9.i.1, align 8, !tbaa !29 %dec.i.1 = add nsw i64 %i.126.i, -2 br label %for.body5.i cfact.exit: ; preds = %for.body5.i call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #23 call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %res) #23 call void @llvm.lifetime.start.p0(i64 8388608, ptr nonnull %dat) #23 call void @llvm.lifetime.start.p0(i64 20971520, ptr nonnull %g) #23 call void @llvm.lifetime.start.p0(i64 8388608, ptr nonnull %x) #23 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n) %4 = load i64, ptr %n, align 8, !tbaa !29 %cmp128 = icmp sgt i64 %4, 1 br i1 %cmp128, label %for.body, label %for.end34.thread for.end34.thread: ; preds = %cfact.exit call void @qsort(ptr noundef nonnull %g, i64 noundef 0, i64 noundef 40, ptr noundef nonnull @sortfnc) #23 call void @qsort(ptr noundef nonnull %g, i64 noundef 0, i64 noundef 40, ptr noundef nonnull @revsortfnc) #23 call void @qsort(ptr noundef nonnull %g, i64 noundef 0, i64 noundef 40, ptr noundef nonnull @sortfnc) #23 %5 = load i64, ptr %g, align 16, !tbaa !49 br label %makemkj.exit for.body: ; preds = %cfact.exit, %for.body %cnt.0130 = phi i64 [ %inc11, %for.body ], [ 0, %cfact.exit ] %i.0129 = phi i64 [ %inc12, %for.body ], [ 0, %cfact.exit ] %arrayidx = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %cnt.0130 %fi = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %cnt.0130, i32 1 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx, ptr noundef nonnull %fi) %kr = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %cnt.0130, i32 2 store i64 1, ptr %kr, align 16, !tbaa !63 %inc = or i64 %cnt.0130, 1 %arrayidx4 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %inc call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %arrayidx4, ptr noundef nonnull align 16 dereferenceable(40) %arrayidx, i64 40, i1 false), !tbaa.struct !64 %6 = load <2 x i64>, ptr %arrayidx4, align 8, !tbaa !29 %7 = shufflevector <2 x i64> %6, <2 x i64> poison, <2 x i32> <i32 1, i32 0> store <2 x i64> %7, ptr %arrayidx4, align 8, !tbaa !29 %inc11 = add nuw nsw i64 %cnt.0130, 2 %inc12 = add nuw nsw i64 %i.0129, 1 %8 = load i64, ptr %n, align 8, !tbaa !29 %sub = add nsw i64 %8, -1 %cmp = icmp slt i64 %inc12, %sub br i1 %cmp, label %for.body, label %for.body15.preheader, !llvm.loop !65 for.body15.preheader: ; preds = %for.body call void @qsort(ptr noundef nonnull %g, i64 noundef %inc11, i64 noundef 40, ptr noundef nonnull @sortfnc) #23 %9 = shl nuw i64 %i.0129, 1 %10 = or i64 %9, 1 %xtraiter = and i64 %inc11, 2 %11 = icmp ult i64 %10, 3 br i1 %11, label %for.body23.preheader.unr-lcssa, label %for.body15.preheader.new for.body15.preheader.new: ; preds = %for.body15.preheader %unroll_iter = and i64 %inc11, 9223372036854775804 br label %for.body15 for.body15: ; preds = %for.body15, %for.body15.preheader.new %i.1132 = phi i64 [ 0, %for.body15.preheader.new ], [ %inc18.3, %for.body15 ] %niter = phi i64 [ 0, %for.body15.preheader.new ], [ %niter.next.3, %for.body15 ] %id = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.1132, i32 3 store i64 %i.1132, ptr %id, align 8, !tbaa !57 %inc18 = or i64 %i.1132, 1 %id.1 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %inc18, i32 3 store i64 %inc18, ptr %id.1, align 16, !tbaa !57 %inc18.1 = or i64 %i.1132, 2 %id.2 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %inc18.1, i32 3 store i64 %inc18.1, ptr %id.2, align 8, !tbaa !57 %inc18.2 = or i64 %i.1132, 3 %id.3 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %inc18.2, i32 3 store i64 %inc18.2, ptr %id.3, align 16, !tbaa !57 %inc18.3 = add nuw nsw i64 %i.1132, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.body23.preheader.unr-lcssa, label %for.body15, !llvm.loop !66 for.body23.preheader.unr-lcssa: ; preds = %for.body15, %for.body15.preheader %i.1132.unr = phi i64 [ 0, %for.body15.preheader ], [ %inc18.3, %for.body15 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body23.preheader, label %for.body15.epil for.body15.epil: ; preds = %for.body23.preheader.unr-lcssa, %for.body15.epil %i.1132.epil = phi i64 [ %inc18.epil, %for.body15.epil ], [ %i.1132.unr, %for.body23.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body15.epil ], [ 0, %for.body23.preheader.unr-lcssa ] %id.epil = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.1132.epil, i32 3 store i64 %i.1132.epil, ptr %id.epil, align 8, !tbaa !57 %inc18.epil = add nuw nsw i64 %i.1132.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.body23.preheader, label %for.body15.epil, !llvm.loop !67 for.body23.preheader: ; preds = %for.body15.epil, %for.body23.preheader.unr-lcssa call void @qsort(ptr noundef nonnull %g, i64 noundef %inc11, i64 noundef 40, ptr noundef nonnull @revsortfnc) #23 %12 = add nuw i64 %i.0129, 1 %xtraiter159 = and i64 %12, 1 %13 = icmp eq i64 %i.0129, 0 br i1 %13, label %for.body.i123.preheader.unr-lcssa, label %for.body23.preheader.new for.body23.preheader.new: ; preds = %for.body23.preheader %unroll_iter162 = and i64 %12, -2 br label %for.body23 for.body23: ; preds = %for.body23, %for.body23.preheader.new %i.2134 = phi i64 [ 0, %for.body23.preheader.new ], [ %add33.1, %for.body23 ] %niter163 = phi i64 [ 0, %for.body23.preheader.new ], [ %niter163.next.1, %for.body23 ] %add = or i64 %i.2134, 1 %id25 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add, i32 3 %14 = load i64, ptr %id25, align 16, !tbaa !57 %rev = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.2134, i32 4 store i64 %14, ptr %rev, align 16, !tbaa !58 %id28 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.2134, i32 3 %15 = load i64, ptr %id28, align 8, !tbaa !57 %rev31 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add, i32 4 store i64 %15, ptr %rev31, align 8, !tbaa !58 %add33 = or i64 %i.2134, 2 %add.1 = or i64 %i.2134, 3 %id25.1 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add.1, i32 3 %16 = load i64, ptr %id25.1, align 16, !tbaa !57 %rev.1 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add33, i32 4 store i64 %16, ptr %rev.1, align 16, !tbaa !58 %id28.1 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add33, i32 3 %17 = load i64, ptr %id28.1, align 8, !tbaa !57 %rev31.1 = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add.1, i32 4 store i64 %17, ptr %rev31.1, align 8, !tbaa !58 %add33.1 = add nuw nsw i64 %i.2134, 4 %niter163.next.1 = add nuw i64 %niter163, 2 %niter163.ncmp.1.not = icmp eq i64 %niter163.next.1, %unroll_iter162 br i1 %niter163.ncmp.1.not, label %for.body.i123.preheader.unr-lcssa, label %for.body23, !llvm.loop !68 for.body.i123.preheader.unr-lcssa: ; preds = %for.body23, %for.body23.preheader %i.2134.unr = phi i64 [ 0, %for.body23.preheader ], [ %add33.1, %for.body23 ] %lcmp.mod161.not = icmp eq i64 %xtraiter159, 0 br i1 %lcmp.mod161.not, label %for.body.i123.preheader, label %for.body23.epil for.body23.epil: ; preds = %for.body.i123.preheader.unr-lcssa %add.epil = or i64 %i.2134.unr, 1 %id25.epil = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add.epil, i32 3 %18 = load i64, ptr %id25.epil, align 16, !tbaa !57 %rev.epil = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.2134.unr, i32 4 store i64 %18, ptr %rev.epil, align 16, !tbaa !58 %id28.epil = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %i.2134.unr, i32 3 %19 = load i64, ptr %id28.epil, align 8, !tbaa !57 %rev31.epil = getelementptr inbounds [524288 x %struct.rs], ptr %g, i64 0, i64 %add.epil, i32 4 store i64 %19, ptr %rev31.epil, align 8, !tbaa !58 br label %for.body.i123.preheader for.body.i123.preheader: ; preds = %for.body.i123.preheader.unr-lcssa, %for.body23.epil call void @qsort(ptr noundef nonnull %g, i64 noundef %inc11, i64 noundef 40, ptr noundef nonnull @sortfnc) #23 %20 = load i64, ptr %g, align 16, !tbaa !49 br label %for.body.i123 for.body.i123: ; preds = %for.body.i123.preheader, %for.inc.i %nst.039.i = phi i64 [ %nst.1.i, %for.inc.i ], [ %20, %for.body.i123.preheader ] %ms.038.i = phi i64 [ %ms.1.i, %for.inc.i ], [ 0, %for.body.i123.preheader ] %i.037.i = phi i64 [ %inc.i125, %for.inc.i ], [ 1, %for.body.i123.preheader ] %arrayidx1.i124 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.037.i %21 = load i64, ptr %arrayidx1.i124, align 8, !tbaa !49 %arrayidx3.i = getelementptr %struct.rs, ptr %arrayidx1.i124, i64 -1 %22 = load i64, ptr %arrayidx3.i, align 8, !tbaa !49 %cmp5.not.i = icmp eq i64 %21, %22 br i1 %cmp5.not.i, label %for.inc.i, label %if.then.i if.then.i: ; preds = %for.body.i123 %sub6.i = sub nsw i64 %i.037.i, %ms.038.i %arrayidx7.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039.i %kz.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039.i, i32 1 store i64 %sub6.i, ptr %kz.i, align 8, !tbaa !46 store i64 %ms.038.i, ptr %arrayidx7.i, align 16, !tbaa !44 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body.i123 %ms.1.i = phi i64 [ %i.037.i, %if.then.i ], [ %ms.038.i, %for.body.i123 ] %nst.1.i = phi i64 [ %21, %if.then.i ], [ %nst.039.i, %for.body.i123 ] %inc.i125 = add nuw nsw i64 %i.037.i, 1 %exitcond.not.i126 = icmp eq i64 %inc.i125, %inc11 br i1 %exitcond.not.i126, label %makemkj.exit, label %for.body.i123, !llvm.loop !52 makemkj.exit: ; preds = %for.inc.i, %for.end34.thread %cnt.0.lcssa148153156 = phi i64 [ 0, %for.end34.thread ], [ %inc11, %for.inc.i ] %ms.0.lcssa.i = phi i64 [ 0, %for.end34.thread ], [ %ms.1.i, %for.inc.i ] %nst.0.lcssa.i = phi i64 [ %5, %for.end34.thread ], [ %nst.1.i, %for.inc.i ] %sub12.i = sub nsw i64 %cnt.0.lcssa148153156, %ms.0.lcssa.i %arrayidx13.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa.i %kz14.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa.i, i32 1 store i64 %sub12.i, ptr %kz14.i, align 8, !tbaa !46 store i64 %ms.0.lcssa.i, ptr %arrayidx13.i, align 16, !tbaa !44 %23 = load i64, ptr %n, align 8, !tbaa !29 %cmp39.not135 = icmp slt i64 %23, 0 br i1 %cmp39.not135, label %for.end44, label %for.body40.preheader for.body40.preheader: ; preds = %makemkj.exit %24 = add i64 %23, 1 %min.iters.check = icmp ult i64 %24, 4 br i1 %min.iters.check, label %for.body40.preheader158, label %vector.ph vector.ph: ; preds = %for.body40.preheader %n.vec = and i64 %24, -4 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %25 = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %index store <2 x i64> <i64 4154118101919364364, i64 4154118101919364364>, ptr %25, align 16, !tbaa !29 %26 = getelementptr inbounds i64, ptr %25, i64 2 store <2 x i64> <i64 4154118101919364364, i64 4154118101919364364>, ptr %26, align 16, !tbaa !29 %index.next = add nuw i64 %index, 4 %27 = icmp eq i64 %index.next, %n.vec br i1 %27, label %middle.block, label %vector.body, !llvm.loop !69 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %24, %n.vec br i1 %cmp.n, label %for.end44, label %for.body40.preheader158 for.body40.preheader158: ; preds = %for.body40.preheader, %middle.block %i.3136.ph = phi i64 [ 0, %for.body40.preheader ], [ %n.vec, %middle.block ] br label %for.body40 for.body40: ; preds = %for.body40.preheader158, %for.body40 %i.3136 = phi i64 [ %inc43, %for.body40 ], [ %i.3136.ph, %for.body40.preheader158 ] %arrayidx41 = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %i.3136 store i64 4154118101919364364, ptr %arrayidx41, align 8, !tbaa !29 %inc43 = add nuw i64 %i.3136, 1 %exitcond144.not = icmp eq i64 %i.3136, %23 br i1 %exitcond144.not, label %for.end44, label %for.body40, !llvm.loop !70 for.end44: ; preds = %for.body40, %middle.block, %makemkj.exit call void @dfs(i64 noundef 1, i64 noundef 0, i64 noundef -1, ptr noundef nonnull %g, ptr noundef nonnull %x) %28 = load i64, ptr %n, align 8, !tbaa !29 %cmp48137 = icmp sgt i64 %28, 0 br i1 %cmp48137, label %for.body49.preheader, label %for.end57 for.body49.preheader: ; preds = %for.end44 %xtraiter164 = and i64 %28, 1 %29 = icmp eq i64 %28, 1 br i1 %29, label %for.end57.loopexit.unr-lcssa, label %for.body49.preheader.new for.body49.preheader.new: ; preds = %for.body49.preheader %unroll_iter167 = and i64 %28, -2 br label %for.body49 for.body49: ; preds = %for.body49, %for.body49.preheader.new %i.4138 = phi i64 [ 0, %for.body49.preheader.new ], [ %add50.1, %for.body49 ] %niter168 = phi i64 [ 0, %for.body49.preheader.new ], [ %niter168.next.1, %for.body49 ] %add50 = or i64 %i.4138, 1 %arrayidx51 = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %add50 %30 = load i64, ptr %arrayidx51, align 8, !tbaa !29 %arrayidx52 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %i.4138 store i64 %30, ptr %arrayidx52, align 16, !tbaa !44 %node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %i.4138, i32 1 store i64 %add50, ptr %node, align 8, !tbaa !46 %add50.1 = add nuw nsw i64 %i.4138, 2 %arrayidx51.1 = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %add50.1 %31 = load i64, ptr %arrayidx51.1, align 16, !tbaa !29 %arrayidx52.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %add50 store i64 %31, ptr %arrayidx52.1, align 16, !tbaa !44 %node.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %add50, i32 1 store i64 %add50.1, ptr %node.1, align 8, !tbaa !46 %niter168.next.1 = add i64 %niter168, 2 %niter168.ncmp.1 = icmp eq i64 %niter168.next.1, %unroll_iter167 br i1 %niter168.ncmp.1, label %for.end57.loopexit.unr-lcssa, label %for.body49, !llvm.loop !71 for.end57.loopexit.unr-lcssa: ; preds = %for.body49, %for.body49.preheader %i.4138.unr = phi i64 [ 0, %for.body49.preheader ], [ %add50.1, %for.body49 ] %lcmp.mod166.not = icmp eq i64 %xtraiter164, 0 br i1 %lcmp.mod166.not, label %for.end57, label %for.body49.epil for.body49.epil: ; preds = %for.end57.loopexit.unr-lcssa %add50.epil = add nuw nsw i64 %i.4138.unr, 1 %arrayidx51.epil = getelementptr inbounds [524288 x i64], ptr @dist, i64 0, i64 %add50.epil %32 = load i64, ptr %arrayidx51.epil, align 8, !tbaa !29 %arrayidx52.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %i.4138.unr store i64 %32, ptr %arrayidx52.epil, align 16, !tbaa !44 %node.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %i.4138.unr, i32 1 store i64 %add50.epil, ptr %node.epil, align 8, !tbaa !46 br label %for.end57 for.end57: ; preds = %for.body49.epil, %for.end57.loopexit.unr-lcssa, %for.end44 call void @qsort(ptr noundef nonnull %dat, i64 noundef %28, i64 noundef 16, ptr noundef nonnull @sdsortfnc) #23 %33 = load i64, ptr %n, align 8, !tbaa !29 %cmp60140 = icmp sgt i64 %33, 0 br i1 %cmp60140, label %for.body61, label %for.end80 for.cond73.preheader: ; preds = %for.body61 %34 = icmp slt i64 %37, 1 br i1 %34, label %for.end80, label %for.body75 for.body61: ; preds = %for.end57, %for.body61 %i.5141 = phi i64 [ %inc71, %for.body61 ], [ 0, %for.end57 ] %node63 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %i.5141, i32 1 %35 = load i64, ptr %node63, align 8, !tbaa !46 %call66 = call i64 @repdp(i64 noundef %35, i64 noundef -1, ptr noundef nonnull %g, ptr noundef nonnull %x), !range !59 %36 = load i64, ptr %node63, align 8, !tbaa !46 %arrayidx69 = getelementptr inbounds [524288 x i64], ptr %res, i64 0, i64 %36 store i64 %call66, ptr %arrayidx69, align 8, !tbaa !29 %inc71 = add nuw nsw i64 %i.5141, 1 %37 = load i64, ptr %n, align 8, !tbaa !29 %cmp60 = icmp slt i64 %inc71, %37 br i1 %cmp60, label %for.body61, label %for.cond73.preheader, !llvm.loop !72 for.body75: ; preds = %for.cond73.preheader, %for.body75 %i.6143 = phi i64 [ %inc79, %for.body75 ], [ 1, %for.cond73.preheader ] %arrayidx76 = getelementptr inbounds [524288 x i64], ptr %res, i64 0, i64 %i.6143 %38 = load i64, ptr %arrayidx76, align 8, !tbaa !29 %call77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %38) %inc79 = add nuw nsw i64 %i.6143, 1 %39 = load i64, ptr %n, align 8, !tbaa !29 %cmp74.not.not = icmp slt i64 %i.6143, %39 br i1 %cmp74.not.not, label %for.body75, label %for.end80, !llvm.loop !73 for.end80: ; preds = %for.body75, %for.end57, %for.cond73.preheader call void @llvm.lifetime.end.p0(i64 8388608, ptr nonnull %x) #23 call void @llvm.lifetime.end.p0(i64 20971520, ptr nonnull %g) #23 call void @llvm.lifetime.end.p0(i64 8388608, ptr nonnull %dat) #23 call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %res) #23 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #23 ret i32 0 } ; 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) #19 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #20 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #21 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #21 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 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { 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 #6 = { mustprogress nofree 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 #7 = { 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 #8 = { 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 #9 = { 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 #10 = { 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 #11 = { nofree norecurse nosync nounwind 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 #12 = { 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 #13 = { 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 #14 = { mustprogress nofree 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 #15 = { 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 #16 = { 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 #17 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #18 = { 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 #19 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #20 = { nofree nounwind } attributes #21 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #22 = { nounwind willreturn memory(read) } attributes #23 = { 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 = distinct !{!7, !6} !8 = distinct !{!8, !6, !9, !10} !9 = !{!"llvm.loop.isvectorized", i32 1} !10 = !{!"llvm.loop.unroll.runtime.disable"} !11 = distinct !{!11, !6, !10, !9} !12 = distinct !{!12, !6, !9, !10} !13 = distinct !{!13, !6, !10, !9} !14 = distinct !{!14, !6} !15 = distinct !{!15, !6} !16 = !{!17, !17, i64 0} !17 = !{!"int", !18, i64 0} !18 = !{!"omnipotent char", !19, i64 0} !19 = !{!"Simple C/C++ TBAA"} !20 = distinct !{!20, !6} !21 = distinct !{!21, !6} !22 = distinct !{!22, !6} !23 = distinct !{!23, !24} !24 = !{!"llvm.loop.unroll.disable"} !25 = distinct !{!25, !6} !26 = distinct !{!26, !24} !27 = distinct !{!27, !6} !28 = distinct !{!28, !6} !29 = !{!30, !30, i64 0} !30 = !{!"long long", !18, i64 0} !31 = !{!32, !32, i64 0} !32 = !{!"double", !18, i64 0} !33 = !{!18, !18, i64 0} !34 = distinct !{!34, !6, !9, !10} !35 = distinct !{!35, !6, !10, !9} !36 = distinct !{!36, !6} !37 = distinct !{!37, !6} !38 = distinct !{!38, !6} !39 = distinct !{!39, !6, !40} !40 = !{!"llvm.loop.peeled.count", i32 1} !41 = distinct !{!41, !6, !9, !10} !42 = distinct !{!42, !6, !10, !9} !43 = distinct !{!43, !6} !44 = !{!45, !30, i64 0} !45 = !{!"", !30, i64 0, !30, i64 8} !46 = !{!45, !30, i64 8} !47 = distinct !{!47, !6} !48 = distinct !{!48, !6} !49 = !{!50, !30, i64 0} !50 = !{!"", !30, i64 0, !30, i64 8, !30, i64 16, !30, i64 24, !30, i64 32} !51 = !{!50, !30, i64 8} !52 = distinct !{!52, !6} !53 = distinct !{!53, !6} !54 = distinct !{!54, !6} !55 = distinct !{!55, !6} !56 = distinct !{!56, !6} !57 = !{!50, !30, i64 24} !58 = !{!50, !30, i64 32} !59 = !{i64 -1000000006, i64 1000000007} !60 = distinct !{!60, !6} !61 = distinct !{!61, !6} !62 = distinct !{!62, !6} !63 = !{!50, !30, i64 16} !64 = !{i64 0, i64 8, !29, i64 8, i64 8, !29, i64 16, i64 8, !29, i64 24, i64 8, !29, i64 32, i64 8, !29} !65 = distinct !{!65, !6} !66 = distinct !{!66, !6} !67 = distinct !{!67, !24} !68 = distinct !{!68, !6} !69 = distinct !{!69, !6, !9, !10} !70 = distinct !{!70, !6, !10, !9} !71 = distinct !{!71, !6} !72 = distinct !{!72, !6} !73 = distinct !{!73, !6}
#include<stdio.h> int main(void) { float a,b; int c,d; char t[][4]={ "AAA","AA","A","B","C","D","E","NA" }; while(scanf("%f%f",&a,&b)==2){ if(a<35.5)c=0; else if(a<37.5)c=1; else if(a<40)c=2; else if(a<43)c=3; else if(a<50)c=4; else if(a<55)c=5; else if(a<70)c=6; else c=7; if(b<71)d=0; else if(b<77)d=1; else if(b<83)d=2; else if(b<89)d=3; else if(b<105)d=4; else if(b<116)d=5; else if(b<148)d=6; else d=7; puts(t[c>d?c:d]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183085/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183085/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" @__const.main.t = private unnamed_addr constant [8 x [4 x i8]] [[4 x i8] c"AAA\00", [4 x i8] c"AA\00\00", [4 x i8] c"A\00\00\00", [4 x i8] c"B\00\00\00", [4 x i8] c"C\00\00\00", [4 x i8] c"D\00\00\00", [4 x i8] c"E\00\00\00", [4 x i8] c"NA\00\00"], align 16 @.str = private unnamed_addr constant [5 x i8] c"%f%f\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca float, align 4 %b = alloca float, 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 %call76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %cmp77 = icmp eq i32 %call76, 2 br i1 %cmp77, label %while.body, label %while.end while.body: ; preds = %entry, %if.end68 %0 = load float, ptr %a, align 4, !tbaa !5 %cmp1 = fcmp olt float %0, 3.550000e+01 br i1 %cmp1, label %if.end33, label %if.else if.else: ; preds = %while.body %cmp4 = fcmp olt float %0, 3.750000e+01 br i1 %cmp4, label %if.end33, label %if.else7 if.else7: ; preds = %if.else %cmp8 = fcmp olt float %0, 4.000000e+01 br i1 %cmp8, label %if.end33, label %if.else11 if.else11: ; preds = %if.else7 %cmp12 = fcmp olt float %0, 4.300000e+01 br i1 %cmp12, label %if.end33, label %if.else15 if.else15: ; preds = %if.else11 %cmp16 = fcmp olt float %0, 5.000000e+01 br i1 %cmp16, label %if.end33, label %if.else19 if.else19: ; preds = %if.else15 %cmp20 = fcmp olt float %0, 5.500000e+01 br i1 %cmp20, label %if.end33, label %if.else23 if.else23: ; preds = %if.else19 %cmp24 = fcmp olt float %0, 7.000000e+01 %. = select i1 %cmp24, i32 6, i32 7 br label %if.end33 if.end33: ; preds = %if.else23, %if.else19, %if.else15, %if.else11, %if.else7, %if.else, %while.body %c.0 = phi i32 [ 0, %while.body ], [ 1, %if.else ], [ 2, %if.else7 ], [ 3, %if.else11 ], [ 4, %if.else15 ], [ 5, %if.else19 ], [ %., %if.else23 ] %1 = load float, ptr %b, align 4, !tbaa !5 %cmp34 = fcmp olt float %1, 7.100000e+01 br i1 %cmp34, label %if.end68, label %if.else37 if.else37: ; preds = %if.end33 %cmp38 = fcmp olt float %1, 7.700000e+01 br i1 %cmp38, label %if.end68, label %if.else41 if.else41: ; preds = %if.else37 %cmp42 = fcmp olt float %1, 8.300000e+01 br i1 %cmp42, label %if.end68, label %if.else45 if.else45: ; preds = %if.else41 %cmp46 = fcmp olt float %1, 8.900000e+01 br i1 %cmp46, label %if.end68, label %if.else49 if.else49: ; preds = %if.else45 %cmp50 = fcmp olt float %1, 1.050000e+02 br i1 %cmp50, label %if.end68, label %if.else53 if.else53: ; preds = %if.else49 %cmp54 = fcmp olt float %1, 1.160000e+02 br i1 %cmp54, label %if.end68, label %if.else57 if.else57: ; preds = %if.else53 %cmp58 = fcmp olt float %1, 1.480000e+02 %.75 = select i1 %cmp58, i32 6, i32 7 br label %if.end68 if.end68: ; preds = %if.else57, %if.else53, %if.else49, %if.else45, %if.else41, %if.else37, %if.end33 %d.0 = phi i32 [ 0, %if.end33 ], [ 1, %if.else37 ], [ 2, %if.else41 ], [ 3, %if.else45 ], [ 4, %if.else49 ], [ 5, %if.else53 ], [ %.75, %if.else57 ] %cond = call i32 @llvm.umax.i32(i32 %c.0, i32 %d.0) %idxprom = zext i32 %cond to i64 %arrayidx = getelementptr inbounds [8 x [4 x i8]], ptr @__const.main.t, i64 0, i64 %idxprom %call71 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %arrayidx) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %cmp = icmp eq i32 %call, 2 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %if.end68, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.umax.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 = !{!"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> int main() { int a, d1, d2; scanf("%d", &a); d1 = a/10; d2 = a%10; if(d1==9) { printf("Yes"); } else if(d2==9) { printf("Yes"); } else { printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183142/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183142/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 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %.off = add i32 %0, -90 %cmp = icmp ult i32 %.off, 10 br i1 %cmp, label %if.end7, label %if.else if.else: ; preds = %entry %rem = srem i32 %0, 10 %cmp2 = icmp eq i32 %rem, 9 %.str.1..str.2 = select i1 %cmp2, ptr @.str.1, ptr @.str.2 br label %if.end7 if.end7: ; preds = %if.else, %entry %.str.1.sink = phi ptr [ @.str.1, %entry ], [ %.str.1..str.2, %if.else ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int a; scanf("%d",&a); if(a/10==9 || a%10==9){ printf("Yes\n"); } else{ printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183193/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183193/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: %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 %.off = add i32 %0, -90 %cmp = icmp ult i32 %.off, 10 %rem = srem i32 %0, 10 %cmp1 = icmp eq i32 %rem, 9 %or.cond = or i1 %cmp, %cmp1 %str.3.str = select i1 %or.cond, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) 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> int main(void){ int N; scanf("%d", &N); if (N/10==9 || N%10==9) printf("Yes"); else printf("No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183236/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183236/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: %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 %rem = srem i32 %0, 10 %cmp1 = icmp eq i32 %rem, 9 %or.cond = or i1 %cmp, %cmp1 %.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) 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> void testcase(int n); int convert(int n); // first block is the number // second block is truthiness, if its 0, its unupdated, if its 1 its updated. int dp[200005][2]; int main() { dp[0][1] = 1; int t; scanf("%d", &t); int n, k; for (int i = 0; i < t; i++) { scanf("%d%d", &n, &k); testcase(n); } } void testcase(int n) { // query every number in the sequence int r; for (int i = 0; i < n; i++) { printf("%d\n", convert(i)); fflush(stdout); scanf("%d", &r); if (r == 1) return; } } int convert(int n) { if (dp[n][1] == 1) return dp[n][0]; dp[n][1] = 1; dp[n][0] = (n - 1) ^ n; return dp[n][0]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18328/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18328/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @dp = dso_local local_unnamed_addr global [200005 x [2 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"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\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: %r.i = alloca i32, align 4 %t = alloca i32, align 4 %n = alloca i32, align 4 %k = alloca i32, align 4 store i32 1, ptr getelementptr inbounds ([200005 x [2 x i32]], ptr @dp, i64 0, i64 0, i64 1), align 4, !tbaa !5 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) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp3 = icmp sgt i32 %0, 0 br i1 %cmp3, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %testcase.exit, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 ret i32 0 for.body: ; preds = %entry, %testcase.exit %i.04 = phi i32 [ %inc, %testcase.exit ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k) %1 = load i32, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r.i) #4 %cmp9.i = icmp sgt i32 %1, 0 br i1 %cmp9.i, label %for.body.preheader.i, label %testcase.exit for.body.preheader.i: ; preds = %for.body %wide.trip.count.i = zext i32 %1 to i64 br label %for.body.i for.body.i: ; preds = %convert.exit.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %convert.exit.i ] %arrayidx.i.i = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv.i %arrayidx1.i.i = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv.i, i64 1 %2 = load i32, ptr %arrayidx1.i.i, align 4, !tbaa !5 %cmp.i.i = icmp eq i32 %2, 1 br i1 %cmp.i.i, label %if.then.i.i, label %if.end.i.i if.then.i.i: ; preds = %for.body.i %3 = load i32, ptr %arrayidx.i.i, align 8, !tbaa !5 br label %convert.exit.i if.end.i.i: ; preds = %for.body.i %indvars12.i = trunc i64 %indvars.iv.i to i32 store i32 1, ptr %arrayidx1.i.i, align 4, !tbaa !5 %sub.i.i = add nsw i32 %indvars12.i, -1 %xor.i.i = xor i32 %sub.i.i, %indvars12.i store i32 %xor.i.i, ptr %arrayidx.i.i, align 8, !tbaa !5 br label %convert.exit.i convert.exit.i: ; preds = %if.end.i.i, %if.then.i.i %retval.0.i.i = phi i32 [ %3, %if.then.i.i ], [ %xor.i.i, %if.end.i.i ] %call1.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i.i) %4 = load ptr, ptr @stdout, align 8, !tbaa !9 %call2.i = call i32 @fflush(ptr noundef %4) %call3.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r.i) %5 = load i32, ptr %r.i, align 4, !tbaa !5 %cmp4.i = icmp eq i32 %5, 1 %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 %or.cond.i = select i1 %cmp4.i, i1 true, i1 %exitcond.not.i br i1 %or.cond.i, label %testcase.exit, label %for.body.i, !llvm.loop !11 testcase.exit: ; preds = %convert.exit.i, %for.body call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r.i) #4 %inc = add nuw nsw i32 %i.04, 1 %6 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %6 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @testcase(i32 noundef %n) local_unnamed_addr #0 { entry: %r = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4 %cmp9 = icmp sgt i32 %n, 0 br i1 %cmp9, label %for.body.preheader, label %cleanup for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 br label %for.body for.body: ; preds = %convert.exit, %for.body.preheader %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %convert.exit ] %arrayidx.i = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv %arrayidx1.i = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 1 %0 = load i32, ptr %arrayidx1.i, align 4, !tbaa !5 %cmp.i = icmp eq i32 %0, 1 br i1 %cmp.i, label %if.then.i, label %if.end.i if.then.i: ; preds = %for.body %1 = load i32, ptr %arrayidx.i, align 8, !tbaa !5 br label %convert.exit if.end.i: ; preds = %for.body %indvars12 = trunc i64 %indvars.iv to i32 store i32 1, ptr %arrayidx1.i, align 4, !tbaa !5 %sub.i = add nsw i32 %indvars12, -1 %xor.i = xor i32 %sub.i, %indvars12 store i32 %xor.i, ptr %arrayidx.i, align 8, !tbaa !5 br label %convert.exit convert.exit: ; preds = %if.then.i, %if.end.i %retval.0.i = phi i32 [ %1, %if.then.i ], [ %xor.i, %if.end.i ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i) %2 = load ptr, ptr @stdout, align 8, !tbaa !9 %call2 = call i32 @fflush(ptr noundef %2) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %3 = load i32, ptr %r, align 4, !tbaa !5 %cmp4 = icmp eq i32 %3, 1 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count %or.cond = select i1 %cmp4, i1 true, i1 %exitcond.not br i1 %or.cond, label %cleanup, label %for.body, !llvm.loop !11 cleanup: ; preds = %convert.exit, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @convert(i32 noundef %n) local_unnamed_addr #3 { entry: %idxprom = sext i32 %n to i64 %arrayidx = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %idxprom %arrayidx1 = getelementptr inbounds [200005 x [2 x i32]], ptr @dp, i64 0, i64 %idxprom, i64 1 %0 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %1 = load i32, ptr %arrayidx, align 8, !tbaa !5 br label %return if.end: ; preds = %entry store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %sub = add nsw i32 %n, -1 %xor = xor i32 %sub, %n store i32 %xor, ptr %arrayidx, align 8, !tbaa !5 br label %return return: ; preds = %if.end, %if.then %retval.0 = phi i32 [ %1, %if.then ], [ %xor, %if.end ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @fflush(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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !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 main() { int t; scanf("%d",&t); while(t--) { long long a,b,min; scanf("%lld%lld",&a,&b); if(a==b) printf("0 0\n"); else { if(a<b) { min=a; a=b; b=min; } long long d=a-b; min =a%d; if(d-min<min) min=d-min; printf("%lld %lld\n",d,min); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18333/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18333/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"%lld%lld\00", align 1 @.str.3 = private unnamed_addr constant [11 x i8] c"%lld %lld\0A\00", align 1 @str = private unnamed_addr constant [4 x i8] c"0 0\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 i64, align 8 %b = alloca i64, align 8 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 %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.end11 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %1 = load i64, ptr %a, align 8, !tbaa !9 %2 = load i64, ptr %b, align 8, !tbaa !9 %cmp = icmp eq i64 %1, %2 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %while.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end11 if.else: ; preds = %while.body %cmp3 = icmp slt i64 %1, %2 br i1 %cmp3, label %if.then4, label %if.end if.then4: ; preds = %if.else store i64 %2, ptr %a, align 8, !tbaa !9 store i64 %1, ptr %b, align 8, !tbaa !9 br label %if.end if.end: ; preds = %if.then4, %if.else %3 = phi i64 [ %1, %if.then4 ], [ %2, %if.else ] %4 = phi i64 [ %2, %if.then4 ], [ %1, %if.else ] %sub = sub nsw i64 %4, %3 %rem = srem i64 %4, %sub %sub5 = sub nsw i64 %sub, %rem %spec.select = call i64 @llvm.smin.i64(i64 %sub5, i64 %rem) %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %sub, i64 noundef %spec.select) br label %if.end11 if.end11: ; preds = %if.end, %if.then call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5 %5 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %5, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %5, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 while.end: ; preds = %if.end11, %entry call void @llvm.lifetime.end.p0(i64 4, 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: 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 i64 @llvm.smin.i64(i64, i64) #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 = !{!10, !10, i64 0} !10 = !{!"long long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void){ int n; int i; scanf("%d",&n); if(n/10==9 || n%10==9) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183373/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183373/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: %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 %.off = add i32 %0, -90 %cmp = icmp ult i32 %.off, 10 %rem = srem i32 %0, 10 %cmp1 = icmp eq i32 %rem, 9 %or.cond = or i1 %cmp, %cmp1 %str.3.str = select i1 %or.cond, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) 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> #include <stdlib.h> #include <string.h> #include <math.h> int main(void){ int N, a, b; scanf("%d",&N); a = N%10; b = (N-a)/10; if(a!=9 && b!=9) printf("No\n"); else printf("Yes\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183416/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183416/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 [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 ne i32 %rem, 9 %1 = add i32 %0, -100 %cmp1 = icmp ult i32 %1, -10 %or.cond = and i1 %cmp, %cmp1 %str.3.str = select i1 %or.cond, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) 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> #include <math.h> #define forin(i, n) for (i = 0; i < n; i++) #define lli long long int #define printSp(i, a, n) forin(i, n) printf('%d ', a[i]); #define printLn(i, a, n) forin(i, n) printf('%d\n', a[i]); #define fis(n) fast_int_scan(n) #define fls(n) fast_long_scan(n) #define flli(n) fast_lli_scan(n) #define scanIA(i, a, n) forin(i, n) fis(a + i); #define scanLA(i, a, n) forin(i, n) fls(a + i); #define scanLLIA(i, a, n) forin(i, n) flli(a + i); void fast_int_scan(int *number) { //variable to indicate sign of input number int negative = 0; register int c; *number = 0; // extract current character from buffer c = getchar(); if (c == '-') { // number is negative negative = 1; // extract the next character from the buffer c = getchar(); } // Keep on extracting characters if they are integers // i.e ASCII Value lies from '0'(48) to '9' (57) for (; (c > 47 && c < 58); c = getchar()) (*number) = (*number) * 10 + c - 48; // if scanned input has a negative sign, negate the value if (negative) (*number) *= -1; } void fast_lli_scan(lli *number) { //variable to indicate sign of input number int negative = 0; register int c; *number = 0; // extract current character from buffer c = getchar(); if (c == '-') { // number is negative negative = 1; // extract the next character from the buffer c = getchar(); } // Keep on extracting characters if they are integers // i.e ASCII Value lies from '0'(48) to '9' (57) for (; (c > 47 && c < 58); c = getchar()) (*number) = (*number) * 10 + c - 48; // if scanned input has a negative sign, negate the value if (negative) (*number) *= -1; } int main(void) { int T; fast_int_scan(&T); while (T--) { int n; fast_int_scan(&n); int arr[n], i; for(i = 0; i < n; i ++) fast_int_scan(arr + i); lli sum = 0; forin(i, n) sum += arr[i]; lli f = sum % n; printf("%lli\n", (n - f) * f); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18346/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18346/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"%lli\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local void @fast_int_scan(ptr nocapture noundef %number) local_unnamed_addr #0 { entry: store i32 0, ptr %number, align 4, !tbaa !5 %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i = tail call i32 @getc(ptr noundef %0) %cmp.not = icmp eq i32 %call.i, 45 br i1 %cmp.not, label %if.then, label %if.end if.then: ; preds = %entry %1 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i14 = tail call i32 @getc(ptr noundef %1) br label %if.end if.end: ; preds = %if.then, %entry %c.0 = phi i32 [ %call.i14, %if.then ], [ %call.i, %entry ] %2 = add i32 %c.0, -48 %3 = icmp ult i32 %2, 10 br i1 %3, label %for.body, label %for.end for.body: ; preds = %if.end, %for.body %c.116 = phi i32 [ %call.i15, %for.body ], [ %c.0, %if.end ] %4 = load i32, ptr %number, align 4, !tbaa !5 %mul = mul nsw i32 %4, 10 %add = add nsw i32 %c.116, -48 %sub = add i32 %add, %mul store i32 %sub, ptr %number, align 4, !tbaa !5 %5 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i15 = tail call i32 @getc(ptr noundef %5) %6 = add i32 %call.i15, -48 %7 = icmp ult i32 %6, 10 br i1 %7, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %if.end br i1 %cmp.not, label %if.then5, label %if.end7 if.then5: ; preds = %for.end %8 = load i32, ptr %number, align 4, !tbaa !5 %mul6 = sub nsw i32 0, %8 store i32 %mul6, ptr %number, align 4, !tbaa !5 br label %if.end7 if.end7: ; preds = %if.then5, %for.end ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @fast_lli_scan(ptr nocapture noundef %number) local_unnamed_addr #0 { entry: store i64 0, ptr %number, align 8, !tbaa !13 %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i = tail call i32 @getc(ptr noundef %0) %cmp.not = icmp eq i32 %call.i, 45 br i1 %cmp.not, label %if.then, label %if.end if.then: ; preds = %entry %1 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i14 = tail call i32 @getc(ptr noundef %1) br label %if.end if.end: ; preds = %if.then, %entry %c.0 = phi i32 [ %call.i14, %if.then ], [ %call.i, %entry ] %2 = add i32 %c.0, -48 %3 = icmp ult i32 %2, 10 br i1 %3, label %for.body, label %for.end for.body: ; preds = %if.end, %for.body %c.116 = phi i32 [ %call.i15, %for.body ], [ %c.0, %if.end ] %4 = load i64, ptr %number, align 8, !tbaa !13 %mul = mul nsw i64 %4, 10 %conv = zext i32 %c.116 to i64 %add = add nsw i64 %conv, -48 %sub = add i64 %add, %mul store i64 %sub, ptr %number, align 8, !tbaa !13 %5 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i15 = tail call i32 @getc(ptr noundef %5) %6 = add i32 %call.i15, -48 %7 = icmp ult i32 %6, 10 br i1 %7, label %for.body, label %for.end, !llvm.loop !15 for.end: ; preds = %for.body, %if.end br i1 %cmp.not, label %if.then5, label %if.end7 if.then5: ; preds = %for.end %8 = load i64, ptr %number, align 8, !tbaa !13 %mul6 = sub nsw i64 0, %8 store i64 %mul6, ptr %number, align 8, !tbaa !13 br label %if.end7 if.end7: ; preds = %if.then5, %for.end ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i = tail call i32 @getc(ptr noundef %0) %cmp.not.i = icmp eq i32 %call.i.i, 45 br i1 %cmp.not.i, label %if.then.i, label %if.end.i if.then.i: ; preds = %entry %1 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i14.i = tail call i32 @getc(ptr noundef %1) br label %if.end.i if.end.i: ; preds = %if.then.i, %entry %c.0.i = phi i32 [ %call.i14.i, %if.then.i ], [ %call.i.i, %entry ] %2 = add i32 %c.0.i, -48 %3 = icmp ult i32 %2, 10 br i1 %3, label %for.body.i, label %for.end.i for.body.i: ; preds = %if.end.i, %for.body.i %T.0 = phi i32 [ %sub.i, %for.body.i ], [ 0, %if.end.i ] %c.116.i = phi i32 [ %call.i15.i, %for.body.i ], [ %c.0.i, %if.end.i ] %mul.i = mul nsw i32 %T.0, 10 %add.i = add nsw i32 %c.116.i, -48 %sub.i = add i32 %add.i, %mul.i %4 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i15.i = tail call i32 @getc(ptr noundef %4) %5 = add i32 %call.i15.i, -48 %6 = icmp ult i32 %5, 10 br i1 %6, label %for.body.i, label %for.end.i, !llvm.loop !11 for.end.i: ; preds = %for.body.i, %if.end.i %T.1 = phi i32 [ 0, %if.end.i ], [ %sub.i, %for.body.i ] %mul6.i = sub nsw i32 0, %T.1 %spec.select = select i1 %cmp.not.i, i32 %mul6.i, i32 %T.1 %tobool.not62 = icmp eq i32 %spec.select, 0 br i1 %tobool.not62, label %while.end, label %while.body while.body: ; preds = %for.end.i, %for.end6 %dec63.in = phi i32 [ %dec63, %for.end6 ], [ %spec.select, %for.end.i ] %dec63 = add nsw i32 %dec63.in, -1 %7 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i16 = tail call i32 @getc(ptr noundef %7) %cmp.not.i17 = icmp eq i32 %call.i.i16, 45 br i1 %cmp.not.i17, label %if.then.i29, label %if.end.i18 if.then.i29: ; preds = %while.body %8 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i14.i30 = tail call i32 @getc(ptr noundef %8) br label %if.end.i18 if.end.i18: ; preds = %if.then.i29, %while.body %c.0.i19 = phi i32 [ %call.i14.i30, %if.then.i29 ], [ %call.i.i16, %while.body ] %9 = add i32 %c.0.i19, -48 %10 = icmp ult i32 %9, 10 br i1 %10, label %for.body.i23, label %for.end.i20 for.body.i23: ; preds = %if.end.i18, %for.body.i23 %n.0 = phi i32 [ %sub.i27, %for.body.i23 ], [ 0, %if.end.i18 ] %c.116.i24 = phi i32 [ %call.i15.i28, %for.body.i23 ], [ %c.0.i19, %if.end.i18 ] %mul.i25 = mul nsw i32 %n.0, 10 %add.i26 = add nsw i32 %c.116.i24, -48 %sub.i27 = add i32 %add.i26, %mul.i25 %11 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i15.i28 = tail call i32 @getc(ptr noundef %11) %12 = add i32 %call.i15.i28, -48 %13 = icmp ult i32 %12, 10 br i1 %13, label %for.body.i23, label %for.end.i20, !llvm.loop !11 for.end.i20: ; preds = %for.body.i23, %if.end.i18 %n.1 = phi i32 [ 0, %if.end.i18 ], [ %sub.i27, %for.body.i23 ] %mul6.i22 = sub nsw i32 0, %n.1 %spec.select54 = select i1 %cmp.not.i17, i32 %mul6.i22, i32 %n.1 %14 = zext i32 %spec.select54 to i64 %15 = tail call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %14, align 16 %cmp56 = icmp sgt i32 %spec.select54, 0 br i1 %cmp56, label %for.body, label %for.end6 for.cond1.preheader: ; preds = %fast_int_scan.exit47 br i1 %cmp56, label %for.body3.preheader, label %for.end6 for.body3.preheader: ; preds = %for.cond1.preheader %min.iters.check = icmp ult i32 %spec.select54, 4 br i1 %min.iters.check, label %for.body3.preheader72, label %vector.ph vector.ph: ; preds = %for.body3.preheader %n.vec = and i64 %14, 4294967292 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ] %vec.phi70 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ] %16 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <2 x i32>, ptr %16, align 16, !tbaa !5 %17 = getelementptr inbounds i32, ptr %16, i64 2 %wide.load71 = load <2 x i32>, ptr %17, align 8, !tbaa !5 %18 = sext <2 x i32> %wide.load to <2 x i64> %19 = sext <2 x i32> %wide.load71 to <2 x i64> %20 = add <2 x i64> %vec.phi, %18 %21 = add <2 x i64> %vec.phi70, %19 %index.next = add nuw i64 %index, 4 %22 = icmp eq i64 %index.next, %n.vec br i1 %22, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %21, %20 %23 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %14 br i1 %cmp.n, label %for.end6, label %for.body3.preheader72 for.body3.preheader72: ; preds = %for.body3.preheader, %middle.block %indvars.iv65.ph = phi i64 [ 0, %for.body3.preheader ], [ %n.vec, %middle.block ] %sum.059.ph = phi i64 [ 0, %for.body3.preheader ], [ %23, %middle.block ] br label %for.body3 for.body: ; preds = %for.end.i20, %fast_int_scan.exit47 %indvars.iv = phi i64 [ %indvars.iv.next, %fast_int_scan.exit47 ], [ 0, %for.end.i20 ] %add.ptr = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 0, ptr %add.ptr, align 4, !tbaa !5 %24 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i32 = tail call i32 @getc(ptr noundef %24) %cmp.not.i33 = icmp eq i32 %call.i.i32, 45 br i1 %cmp.not.i33, label %if.then.i45, label %if.end.i34 if.then.i45: ; preds = %for.body %25 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i14.i46 = tail call i32 @getc(ptr noundef %25) br label %if.end.i34 if.end.i34: ; preds = %if.then.i45, %for.body %c.0.i35 = phi i32 [ %call.i14.i46, %if.then.i45 ], [ %call.i.i32, %for.body ] %26 = add i32 %c.0.i35, -48 %27 = icmp ult i32 %26, 10 br i1 %27, label %for.body.i39, label %for.end.i36 for.body.i39: ; preds = %if.end.i34, %for.body.i39 %sub.i4355 = phi i32 [ %sub.i43, %for.body.i39 ], [ 0, %if.end.i34 ] %c.116.i40 = phi i32 [ %call.i15.i44, %for.body.i39 ], [ %c.0.i35, %if.end.i34 ] %mul.i41 = mul nsw i32 %sub.i4355, 10 %add.i42 = add nsw i32 %c.116.i40, -48 %sub.i43 = add i32 %add.i42, %mul.i41 %28 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i15.i44 = tail call i32 @getc(ptr noundef %28) %29 = add i32 %call.i15.i44, -48 %30 = icmp ult i32 %29, 10 br i1 %30, label %for.body.i39, label %for.end.i36.loopexit, !llvm.loop !11 for.end.i36.loopexit: ; preds = %for.body.i39 store i32 %sub.i43, ptr %add.ptr, align 4, !tbaa !5 br label %for.end.i36 for.end.i36: ; preds = %for.end.i36.loopexit, %if.end.i34 %31 = phi i32 [ %sub.i43, %for.end.i36.loopexit ], [ 0, %if.end.i34 ] br i1 %cmp.not.i33, label %if.then5.i37, label %fast_int_scan.exit47 if.then5.i37: ; preds = %for.end.i36 %mul6.i38 = sub nsw i32 0, %31 store i32 %mul6.i38, ptr %add.ptr, align 4, !tbaa !5 br label %fast_int_scan.exit47 fast_int_scan.exit47: ; preds = %for.end.i36, %if.then5.i37 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %14 br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !19 for.body3: ; preds = %for.body3.preheader72, %for.body3 %indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body3 ], [ %indvars.iv65.ph, %for.body3.preheader72 ] %sum.059 = phi i64 [ %add, %for.body3 ], [ %sum.059.ph, %for.body3.preheader72 ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv65 %32 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %32 to i64 %add = add nsw i64 %sum.059, %conv %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1 %exitcond69.not = icmp eq i64 %indvars.iv.next66, %14 br i1 %exitcond69.not, label %for.end6, label %for.body3, !llvm.loop !20 for.end6: ; preds = %for.body3, %middle.block, %for.end.i20, %for.cond1.preheader %sum.0.lcssa = phi i64 [ 0, %for.cond1.preheader ], [ 0, %for.end.i20 ], [ %23, %middle.block ], [ %add, %for.body3 ] %conv7 = sext i32 %spec.select54 to i64 %rem = srem i64 %sum.0.lcssa, %conv7 %sub = sub nsw i64 %conv7, %rem %mul = mul nsw i64 %sub, %rem %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %mul) tail call void @llvm.stackrestore.p0(ptr %15) %tobool.not = icmp eq i32 %dec63, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !21 while.end: ; preds = %for.end6, %for.end.i ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #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) #1 ; 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 i64 @llvm.vector.reduce.add.v2i64(<2 x 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 } 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 = !{!"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 = !{!14, !14, i64 0} !14 = !{!"long long", !7, i64 0} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12, !17, !18} !17 = !{!"llvm.loop.isvectorized", i32 1} !18 = !{!"llvm.loop.unroll.runtime.disable"} !19 = distinct !{!19, !12} !20 = distinct !{!20, !12, !18, !17} !21 = distinct !{!21, !12}
#include <stdio.h> int main(){ char s[100]; char t[100]; scanf("%s %s",s,t); printf("%s%s",t,s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183502/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183502/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 %s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 %t = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 100, 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 @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 <stdlib.h> #include <string.h> #include <math.h> #define ll long long #define ull unsigned long long int main(){ char s[102]={},t[102]={}; scanf("%s%s",s,t); printf("%s%s",t,s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183546/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183546/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"%s%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [102 x i8], align 16 %t = alloca [102 x i8], align 16 call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %s) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(102) %s, i8 0, i64 102, i1 false) call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %t) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(102) %t, i8 0, i64 102, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 102, 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: 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)"}
#include <stdio.h> int a[10]; char out[1234567]; int out_len; int main() { int v, c, i, j, low, g = 1; scanf("%d", &v); c = v; for (i = 1; i <= 9; i++) { scanf("%d", a+i); if (i == 1 || a[i] <= a[low]) low = i; } if (v < a[low]) { printf("-1\n"); return 0; } while (c - a[low] >= 0) { out[out_len++] = '0' + low; c -= a[low]; } j = 1; while (g && j <= out_len) { g = 0; for (i = 9; i > low; i--) { if (c + a[low] - a[i] >= 0) { out[out_len-j] = '0' + i; g = 1; c -= a[i] - a[low]; break; } } j++; } for (i = out_len-1; i >= 0; i--) printf("%c", out[i]); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18359/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18359/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 @a = dso_local global [10 x i32] zeroinitializer, align 16 @out = dso_local local_unnamed_addr global [1234567 x i8] zeroinitializer, align 16 @out_len = dso_local local_unnamed_addr global i32 0, align 4 @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 { lor.lhs.false.1: %v = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v) %0 = load i32, ptr %v, align 4, !tbaa !5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 1)) %call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 2)) %1 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5 %2 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5 %cmp5.not.1 = icmp sgt i32 %1, %2 %spec.select = select i1 %cmp5.not.1, i32 1, i32 2 %call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 3)) %3 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5 %idxprom3.2 = zext i32 %spec.select to i64 %arrayidx4.2 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.2 %4 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5 %cmp5.not.2 = icmp sgt i32 %3, %4 %low.1.2 = select i1 %cmp5.not.2, i32 %spec.select, i32 3 %call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 4)) %5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5 %idxprom3.3 = zext i32 %low.1.2 to i64 %arrayidx4.3 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.3 %6 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5 %cmp5.not.3 = icmp sgt i32 %5, %6 %low.1.3 = select i1 %cmp5.not.3, i32 %low.1.2, i32 4 %call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 5)) %7 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5 %idxprom3.4 = zext i32 %low.1.3 to i64 %arrayidx4.4 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.4 %8 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5 %cmp5.not.4 = icmp sgt i32 %7, %8 %low.1.4 = select i1 %cmp5.not.4, i32 %low.1.3, i32 5 %call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 6)) %9 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5 %idxprom3.5 = zext i32 %low.1.4 to i64 %arrayidx4.5 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.5 %10 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5 %cmp5.not.5 = icmp sgt i32 %9, %10 %low.1.5 = select i1 %cmp5.not.5, i32 %low.1.4, i32 6 %call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 7)) %11 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 7), align 4, !tbaa !5 %idxprom3.6 = zext i32 %low.1.5 to i64 %arrayidx4.6 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.6 %12 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5 %cmp5.not.6 = icmp sgt i32 %11, %12 %low.1.6 = select i1 %cmp5.not.6, i32 %low.1.5, i32 7 %call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 8)) %13 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 8), align 16, !tbaa !5 %idxprom3.7 = zext i32 %low.1.6 to i64 %arrayidx4.7 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.7 %14 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5 %cmp5.not.7 = icmp sgt i32 %13, %14 %low.1.7 = select i1 %cmp5.not.7, i32 %low.1.6, i32 8 %call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 9)) %15 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @a, i64 0, i64 9), align 4, !tbaa !5 %idxprom3.8 = zext i32 %low.1.7 to i64 %arrayidx4.8 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom3.8 %16 = load i32, ptr %arrayidx4.8, align 4, !tbaa !5 %cmp5.not.8 = icmp sgt i32 %15, %16 %17 = call i32 @llvm.smin.i32(i32 %15, i32 %16) %low.1.8 = select i1 %cmp5.not.8, i32 %low.1.7, i32 9 %18 = load i32, ptr %v, align 4, !tbaa !5 %cmp8 = icmp slt i32 %18, %17 br i1 %cmp8, label %if.then9, label %while.cond.preheader while.cond.preheader: ; preds = %lor.lhs.false.1 %cmp14.not103 = icmp slt i32 %0, %17 %.pre131 = load i32, ptr @out_len, align 4 br i1 %cmp14.not103, label %while.cond21.preheader, label %while.body.lr.ph while.body.lr.ph: ; preds = %while.cond.preheader %19 = trunc i32 %low.1.8 to i8 %conv = add nuw nsw i8 %19, 48 %20 = sext i32 %.pre131 to i64 br label %while.body if.then9: ; preds = %lor.lhs.false.1 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup while.cond.while.cond21.preheader_crit_edge: ; preds = %while.body %21 = trunc i64 %indvars.iv.next to i32 store i32 %21, ptr @out_len, align 4, !tbaa !5 br label %while.cond21.preheader while.cond21.preheader: ; preds = %while.cond.preheader, %while.cond.while.cond21.preheader_crit_edge %22 = phi i32 [ %21, %while.cond.while.cond21.preheader_crit_edge ], [ %.pre131, %while.cond.preheader ] %c.0.lcssa = phi i32 [ %sub20, %while.cond.while.cond21.preheader_crit_edge ], [ %0, %while.cond.preheader ] %cmp22108 = icmp sgt i32 %22, 0 br i1 %cmp22108, label %for.cond25.preheader.lr.ph, label %for.end65 for.cond25.preheader.lr.ph: ; preds = %while.cond21.preheader br i1 %cmp5.not.8, label %for.cond25.preheader.us.preheader, label %for.body58.preheader for.cond25.preheader.us.preheader: ; preds = %for.cond25.preheader.lr.ph %23 = zext i32 %low.1.8 to i64 %24 = zext i32 %22 to i64 br label %for.cond25.preheader.us for.cond25.preheader.us: ; preds = %for.cond25.preheader.us.preheader, %for.end51.us %indvars.iv124 = phi i64 [ 1, %for.cond25.preheader.us.preheader ], [ %indvars.iv.next125, %for.end51.us ] %c.1109.us = phi i32 [ %c.0.lcssa, %for.cond25.preheader.us.preheader ], [ %sub48.us, %for.end51.us ] %add31.us = add nsw i32 %c.1109.us, %17 br label %for.body28.us for.body28.us: ; preds = %for.cond25.preheader.us, %for.inc50.us %indvars.iv121 = phi i64 [ 9, %for.cond25.preheader.us ], [ %indvars.iv.next122, %for.inc50.us ] %arrayidx33.us = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv121 %25 = load i32, ptr %arrayidx33.us, align 4, !tbaa !5 %cmp35.not.us.not.not = icmp slt i32 %add31.us, %25 br i1 %cmp35.not.us.not.not, label %for.inc50.us, label %for.end51.us for.end51.us: ; preds = %for.body28.us %26 = trunc i64 %indvars.iv121 to i8 %conv39.us = add i8 %26, 48 %27 = sub nsw i64 %24, %indvars.iv124 %arrayidx42.us = getelementptr inbounds [1234567 x i8], ptr @out, i64 0, i64 %27 store i8 %conv39.us, ptr %arrayidx42.us, align 1, !tbaa !9 %sub48.us = sub i32 %add31.us, %25 %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %cmp22.us = icmp ult i64 %indvars.iv124, %24 br i1 %cmp22.us, label %for.cond25.preheader.us, label %for.cond55.preheader, !llvm.loop !10 for.inc50.us: ; preds = %for.body28.us %indvars.iv.next122 = add nsw i64 %indvars.iv121, -1 %cmp26.us = icmp ugt i64 %indvars.iv.next122, %23 br i1 %cmp26.us, label %for.body28.us, label %for.cond55.preheader, !llvm.loop !12 while.body: ; preds = %while.body.lr.ph, %while.body %indvars.iv = phi i64 [ %20, %while.body.lr.ph ], [ %indvars.iv.next, %while.body ] %c.0105 = phi i32 [ %0, %while.body.lr.ph ], [ %sub20, %while.body ] %indvars.iv.next = add i64 %indvars.iv, 1 %arrayidx17 = getelementptr inbounds [1234567 x i8], ptr @out, i64 0, i64 %indvars.iv store i8 %conv, ptr %arrayidx17, align 1, !tbaa !9 %sub20 = sub nsw i32 %c.0105, %17 %cmp14.not = icmp slt i32 %sub20, %17 br i1 %cmp14.not, label %while.cond.while.cond21.preheader_crit_edge, label %while.body, !llvm.loop !13 for.cond55.preheader: ; preds = %for.end51.us, %for.inc50.us br i1 %cmp22108, label %for.body58.preheader, label %for.end65 for.body58.preheader: ; preds = %for.cond25.preheader.lr.ph, %for.cond55.preheader %28 = zext i32 %22 to i64 br label %for.body58 for.body58: ; preds = %for.body58.preheader, %for.body58 %indvars.iv128 = phi i64 [ %28, %for.body58.preheader ], [ %indvars.iv.next129, %for.body58 ] %indvars.iv.next129 = add nsw i64 %indvars.iv128, -1 %idxprom59 = and i64 %indvars.iv.next129, 4294967295 %arrayidx60 = getelementptr inbounds [1234567 x i8], ptr @out, i64 0, i64 %idxprom59 %29 = load i8, ptr %arrayidx60, align 1, !tbaa !9 %conv61 = sext i8 %29 to i32 %putchar97 = call i32 @putchar(i32 %conv61) %cmp56 = icmp ugt i64 %indvars.iv128, 1 br i1 %cmp56, label %for.body58, label %for.end65, !llvm.loop !14 for.end65: ; preds = %for.body58, %while.cond21.preheader, %for.cond55.preheader %putchar = call i32 @putchar(i32 10) br label %cleanup cleanup: ; preds = %for.end65, %if.then9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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 @putchar(i32 noundef) local_unnamed_addr #3 ; 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.smin.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 = { 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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11} !14 = distinct !{!14, !11}
#include <stdio.h> int main() { char s[101]; /* 英小文字からなる文字列s */ char t[101]; /* 英小文字からなる文字列t */ scanf("%s %s", &s, &t); printf("%s%s\n", t, s); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183632/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183632/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 %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [101 x i8], align 16 %t = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 101, 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 @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> int main(void) { char s[100]; char t[100]; scanf("%s %s" ,s ,t); printf("%s%s\n", t, s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183676/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183676/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 %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 %t = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 100, 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 @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> int main(void) { char s[100], t[100]; scanf("%s", s); scanf("%s", t); printf("%s", t); printf("%s", s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183719/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183719/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: %s = alloca [100 x i8], align 16 %t = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %t) %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 100, 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 @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> int main(void) { char s[100],t[100]; scanf("%s %s", &s, &t); printf("%s%s", t, s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183762/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183762/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 %s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 %t = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 100, 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 @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> #include<stdlib.h> #include<math.h> #define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) #define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k)) #define INF ((1LL<<62)-(1LL<<31)) #define max(p,q)((p)>(q)?(p):(q)) #define min(p,q)((p)<(q)?(p):(q)) #define bit(n,m)(((n)>>(m))&1) int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;} int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;} void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);} void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);} ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;} //#define MOD 998244353 #define MOD 1000000007 #define invp(a,p)pom(a,p-2,p) int main(){ char s[101]; char t[101]; scanf("%s %s",s,t); printf("%s%s",t,s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183805/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183805/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 %s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp sgt i64 %0, %1 %cond = zext i1 %cmp1 to i32 %cond2 = select i1 %cmp, i32 -1, i32 %cond ret i32 %cond2 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp sgt i64 %0, %1 %cond = sext i1 %cmp1 to i32 %cond2 = select i1 %cmp, i32 1, i32 %cond ret i32 %cond2 } ; Function Attrs: nofree nounwind uwtable define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 { entry: %conv = sext i32 %n to i64 tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #6 ret void } ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 { entry: %conv = sext i32 %n to i64 tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #6 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @pom(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #3 { entry: %conv = sext i32 %m to i64 %tobool.not16 = icmp eq i64 %n, 0 br i1 %tobool.not16, label %for.end, label %for.body for.body: ; preds = %entry, %cond.end %mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ] %x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ] %n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ] %a.addr.019 = srem i64 %mul4.pn, %conv %and = and i64 %n.addr.017, 1 %tobool1.not = icmp eq i64 %and, 0 br i1 %tobool1.not, label %cond.end, label %cond.true cond.true: ; preds = %for.body %mul = mul nsw i64 %a.addr.019, %x.018 %rem3 = srem i64 %mul, %conv br label %cond.end cond.end: ; preds = %for.body, %cond.true %x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ] %mul4 = mul nsw i64 %a.addr.019, %a.addr.019 %div = sdiv i64 %n.addr.017, 2 %n.addr.017.off = add i64 %n.addr.017, 1 %tobool.not = icmp ult i64 %n.addr.017.off, 3 br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %cond.end, %entry %x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ] ret i64 %x.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4 ; 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 uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [101 x i8], align 16 %t = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #6 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #6 call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #6 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 @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 = { 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 = { 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 #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(void) { int n, m, i; scanf("%d", &n); scanf("%d", &m); int as[m]; for(i = 0; i < m; i++) { scanf("%d", &as[i]); } int answer, b, scores[n], j; for(j = 0; j < n; j++) scores[j] = 0; for(i = 0; i < m; i++) { answer = as[i]; for(j = 0; j < n; j++) { scanf("%d", &b); if(b == answer) { scores[j]++; } else{ scores[answer - 1]++; } } } for(j = 0; j < n; j++) printf("%d\n", scores[j]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183849/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183849/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 %m = alloca i32, align 4 %b = 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 = 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 %m) %0 = load i32, ptr %m, 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 %m, align 4, !tbaa !5 %cmp57 = icmp sgt i32 %3, 0 br i1 %cmp57, label %for.body, label %for.end 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 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %m, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %6 = phi i32 [ %3, %entry ], [ %4, %for.body ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 %7 = load i32, ptr %n, align 4, !tbaa !5 %8 = zext i32 %7 to i64 %vla3 = alloca i32, i64 %8, align 16 %cmp559 = icmp sgt i32 %7, 0 br i1 %cmp559, label %for.cond12.preheader, label %for.end42 for.cond12.preheader: ; preds = %for.end %9 = shl nuw nsw i64 %8, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla3, i8 0, i64 %9, i1 false), !tbaa !5 %cmp1363 = icmp sgt i32 %6, 0 br i1 %cmp1363, label %for.body14, label %for.body36.preheader for.body36.preheader: ; preds = %for.cond34.preheader.loopexit, %for.cond12.preheader br label %for.body36 for.cond34.preheader.loopexit: ; preds = %for.inc31 %10 = icmp sgt i32 %19, 0 br i1 %10, label %for.body36.preheader, label %for.end42 for.body14: ; preds = %for.cond12.preheader, %for.inc31 %11 = phi i32 [ %18, %for.inc31 ], [ %6, %for.cond12.preheader ] %12 = phi i32 [ %19, %for.inc31 ], [ %7, %for.cond12.preheader ] %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc31 ], [ 0, %for.cond12.preheader ] %arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv75 %13 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp1861 = icmp sgt i32 %12, 0 br i1 %cmp1861, label %for.body19.lr.ph, label %for.inc31 for.body19.lr.ph: ; preds = %for.body14 %sub = add nsw i32 %13, -1 %idxprom25 = sext i32 %sub to i64 br label %for.body19 for.body19: ; preds = %for.body19.lr.ph, %for.body19 %indvars.iv72 = phi i64 [ 0, %for.body19.lr.ph ], [ %indvars.iv.next73, %for.body19 ] %call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b) %14 = load i32, ptr %b, align 4, !tbaa !5 %cmp21 = icmp eq i32 %14, %13 %arrayidx23.sink85.v = select i1 %cmp21, i64 %indvars.iv72, i64 %idxprom25 %arrayidx23.sink85 = getelementptr inbounds i32, ptr %vla3, i64 %arrayidx23.sink85.v %15 = load i32, ptr %arrayidx23.sink85, align 4, !tbaa !5 %inc24 = add nsw i32 %15, 1 store i32 %inc24, ptr %arrayidx23.sink85, align 4, !tbaa !5 %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %16 = load i32, ptr %n, align 4, !tbaa !5 %17 = sext i32 %16 to i64 %cmp18 = icmp slt i64 %indvars.iv.next73, %17 br i1 %cmp18, label %for.body19, label %for.inc31.loopexit, !llvm.loop !11 for.inc31.loopexit: ; preds = %for.body19 %.pre = load i32, ptr %m, align 4, !tbaa !5 br label %for.inc31 for.inc31: ; preds = %for.inc31.loopexit, %for.body14 %18 = phi i32 [ %.pre, %for.inc31.loopexit ], [ %11, %for.body14 ] %19 = phi i32 [ %16, %for.inc31.loopexit ], [ %12, %for.body14 ] %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %20 = sext i32 %18 to i64 %cmp13 = icmp slt i64 %indvars.iv.next76, %20 br i1 %cmp13, label %for.body14, label %for.cond34.preheader.loopexit, !llvm.loop !12 for.body36: ; preds = %for.body36.preheader, %for.body36 %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body36 ], [ 0, %for.body36.preheader ] %arrayidx38 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv78 %21 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21) %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %22 = load i32, ptr %n, align 4, !tbaa !5 %23 = sext i32 %22 to i64 %cmp35 = icmp slt i64 %indvars.iv.next79, %23 br i1 %cmp35, label %for.body36, label %for.end42, !llvm.loop !14 for.end42: ; preds = %for.body36, %for.end, %for.cond34.preheader.loopexit call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.stackrestore.p0(ptr %2) 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 nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn } 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, !13} !13 = !{!"llvm.loop.unswitch.partial.disable"} !14 = distinct !{!14, !10}
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <time.h> typedef long long llint; int main(void){ llint n,i,k,ans=0,a,b,c,judge=0,many=0,rest; scanf("%lld%lld",&n,&k); // if(n/k>100){ // many=n/1000; // rest = n; // n=1000; // } if(n>k){ many=n/k; rest = n; n=k; } for(a=n;a>=1;a--){ for(i= (2*a%k==0)? 2*a/k: 2*a/k-1 ;i>0;i--){ judge=0; b = k*i-a; if(a<b) break; if(b<1) break; c=b; if((c+b)%k==0){ llint div; if(a==b){ if(a==c) ans++; if(b!=c) ans+=3; div = c%k==0?c/k-1:c/k; if(div<1) continue; ans+=3*div; }else{ if(b!=c) ans+=6; if(b==c ) ans+=3; div = c%k==0?c/k-1:c/k; if(div<1) continue; ans+=6*div; } judge++; // printf("%lld %lld %lld %lld %lld\n",a,b,c,ans,div); } } if(k!=2 && judge==1) a-=k-1; } if(many!=0){ ans*=pow(many,3); for(a=rest;a>=rest-rest%k+1;a--){ for(i= (2*a%k==0)? 2*a/k: 2*a/k-1 ;i>0;i--){ judge=0; b = k*i-a; if(a<b) break; if(b<1) break; c=b; if((c+b)%k==0){ llint div; if(a==b){ if(a==c) ans++; if(b!=c) ans+=3; div = c%k==0?c/k-1:c/k; if(div<1) continue; ans+=3*div; }else{ if(b!=c) ans+=6; if(b==c ) ans+=3; div = c%k==0?c/k-1:c/k; if(div<1) continue; ans+=6*div; } judge++; // printf("%lld %lld %lld %lld %lld\n",a,b,c,ans,div); } } if(k!=2 && judge==1) a-=k-1; } } printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183913/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183913/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 nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %k = 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 %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %1 = load i64, ptr %k, align 8, !tbaa !5 %cmp = icmp sgt i64 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %div = sdiv i64 %0, %1 store i64 %1, ptr %n, align 8, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i64 [ %1, %if.then ], [ %0, %entry ] %many.0 = phi i64 [ %div, %if.then ], [ 0, %entry ] %cmp1311 = icmp sgt i64 %2, 0 br i1 %cmp1311, label %for.body.lr.ph, label %for.end78 for.body.lr.ph: ; preds = %if.end %cmp70 = icmp ne i64 %1, 2 %3 = sub i64 0, %1 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.end %judge.0314 = phi i64 [ 0, %for.body.lr.ph ], [ %judge.4, %for.end ] %a.0313 = phi i64 [ %2, %for.body.lr.ph ], [ %dec77, %for.end ] %ans.0312 = phi i64 [ 0, %for.body.lr.ph ], [ %ans.1.lcssa, %for.end ] %mul = shl nuw nsw i64 %a.0313, 1 %rem = srem i64 %mul, %1 %cmp2 = icmp ne i64 %rem, 0 %div4 = sdiv i64 %mul, %1 %sub = sext i1 %cmp2 to i64 %cond = add nsw i64 %div4, %sub %cmp8305 = icmp sgt i64 %cond, 0 br i1 %cmp8305, label %for.body9, label %for.end for.body9: ; preds = %for.body, %for.inc %ans.1307 = phi i64 [ %ans.8, %for.inc ], [ %ans.0312, %for.body ] %i.0306 = phi i64 [ %dec, %for.inc ], [ %cond, %for.body ] %mul10 = mul nsw i64 %i.0306, %1 %sub11 = sub nsw i64 %mul10, %a.0313 %cmp12 = icmp slt i64 %a.0313, %sub11 %cmp15 = icmp slt i64 %sub11, 1 %or.cond215 = or i1 %cmp12, %cmp15 br i1 %or.cond215, label %for.end, label %if.end17 if.end17: ; preds = %for.body9 %add = shl nuw nsw i64 %sub11, 1 %rem18 = srem i64 %add, %1 %cmp19 = icmp eq i64 %rem18, 0 br i1 %cmp19, label %if.then20, label %for.inc if.then20: ; preds = %if.end17 %cmp22 = icmp eq i64 %a.0313, %sub11 br i1 %cmp22, label %if.then25, label %if.then50 if.then25: ; preds = %if.then20 %inc = add nsw i64 %ans.1307, 1 %rem31 = srem i64 %a.0313, %1 %cmp32 = icmp eq i64 %rem31, 0 %div34 = sdiv i64 %a.0313, %1 %sub35 = sext i1 %cmp32 to i64 %cond39 = add nsw i64 %div34, %sub35 %cmp40 = icmp slt i64 %cond39, 1 br i1 %cmp40, label %for.inc, label %if.end42 if.end42: ; preds = %if.then25 %mul43 = mul nsw i64 %cond39, 3 %add44 = add nsw i64 %mul43, %inc br label %for.inc if.then50: ; preds = %if.then20 %add51 = add nsw i64 %ans.1307, 3 %rem53 = srem i64 %sub11, %1 %cmp54 = icmp eq i64 %rem53, 0 %div56 = sdiv i64 %sub11, %1 %sub57 = sext i1 %cmp54 to i64 %cond61 = add nsw i64 %div56, %sub57 %cmp62 = icmp slt i64 %cond61, 1 br i1 %cmp62, label %for.inc, label %if.end64 if.end64: ; preds = %if.then50 %mul65 = mul nsw i64 %cond61, 6 %add66 = add nsw i64 %mul65, %add51 br label %for.inc for.inc: ; preds = %if.then25, %if.then50, %if.end64, %if.end42, %if.end17 %ans.8 = phi i64 [ %ans.1307, %if.end17 ], [ %inc, %if.then25 ], [ %add51, %if.then50 ], [ %add44, %if.end42 ], [ %add66, %if.end64 ] %judge.3 = phi i64 [ 0, %if.end17 ], [ 0, %if.then25 ], [ 0, %if.then50 ], [ 1, %if.end42 ], [ 1, %if.end64 ] %dec = add nsw i64 %i.0306, -1 %cmp8 = icmp sgt i64 %i.0306, 1 br i1 %cmp8, label %for.body9, label %for.end, !llvm.loop !9 for.end: ; preds = %for.inc, %for.body9, %for.body %ans.1.lcssa = phi i64 [ %ans.0312, %for.body ], [ %ans.1307, %for.body9 ], [ %ans.8, %for.inc ] %judge.4 = phi i64 [ %judge.0314, %for.body ], [ 0, %for.body9 ], [ %judge.3, %for.inc ] %cmp71 = icmp eq i64 %judge.4, 1 %or.cond = select i1 %cmp70, i1 %cmp71, i1 false %4 = select i1 %or.cond, i64 %3, i64 -1 %dec77 = add i64 %4, %a.0313 %cmp1 = icmp sgt i64 %dec77, 0 br i1 %cmp1, label %for.body, label %for.end78, !llvm.loop !11 for.end78: ; preds = %for.end, %if.end %ans.0.lcssa = phi i64 [ 0, %if.end ], [ %ans.1.lcssa, %for.end ] %judge.0.lcssa = phi i64 [ 0, %if.end ], [ %judge.4, %for.end ] %cmp79.not = icmp eq i64 %many.0, 0 br i1 %cmp79.not, label %if.end202, label %if.then80 if.then80: ; preds = %for.end78 %conv = sitofp i64 %many.0 to double %call81 = call double @pow(double noundef %conv, double noundef 3.000000e+00) #4 %conv82 = sitofp i64 %ans.0.lcssa to double %mul83 = fmul double %call81, %conv82 %conv84 = fptosi double %mul83 to i64 %5 = load i64, ptr %k, align 8, !tbaa !5 %rem86 = srem i64 %0, %5 %sub87 = sub nsw i64 %0, %rem86 %cmp89.not.not324 = icmp sgt i64 %rem86, 0 br i1 %cmp89.not.not324, label %for.body91.lr.ph, label %if.end202 for.body91.lr.ph: ; preds = %if.then80 %cmp190 = icmp ne i64 %5, 2 %6 = sub i64 0, %5 br label %for.body91 for.body91: ; preds = %for.body91.lr.ph, %for.end189 %judge.5327 = phi i64 [ %judge.0.lcssa, %for.body91.lr.ph ], [ %judge.9, %for.end189 ] %a.2326 = phi i64 [ %0, %for.body91.lr.ph ], [ %dec200, %for.end189 ] %ans.9325 = phi i64 [ %conv84, %for.body91.lr.ph ], [ %ans.10.lcssa, %for.end189 ] %mul92 = shl nsw i64 %a.2326, 1 %rem93 = srem i64 %mul92, %5 %cmp94 = icmp ne i64 %rem93, 0 %div98 = sdiv i64 %mul92, %5 %sub102 = sext i1 %cmp94 to i64 %cond104 = add nsw i64 %div98, %sub102 %cmp106317 = icmp sgt i64 %cond104, 0 br i1 %cmp106317, label %for.body108, label %for.end189 for.body108: ; preds = %for.body91, %for.inc187 %ans.10319 = phi i64 [ %ans.17, %for.inc187 ], [ %ans.9325, %for.body91 ] %i.1318 = phi i64 [ %dec188, %for.inc187 ], [ %cond104, %for.body91 ] %mul109 = mul nsw i64 %i.1318, %5 %sub110 = sub nsw i64 %mul109, %a.2326 %cmp111 = icmp slt i64 %a.2326, %sub110 %cmp115 = icmp slt i64 %sub110, 1 %or.cond216 = or i1 %cmp111, %cmp115 br i1 %or.cond216, label %for.end189, label %if.end118 if.end118: ; preds = %for.body108 %add119 = shl nuw nsw i64 %sub110, 1 %rem120 = srem i64 %add119, %5 %cmp121 = icmp eq i64 %rem120, 0 br i1 %cmp121, label %if.then123, label %for.inc187 if.then123: ; preds = %if.end118 %cmp125 = icmp eq i64 %a.2326, %sub110 br i1 %cmp125, label %if.then130, label %if.then162 if.then130: ; preds = %if.then123 %inc131 = add nsw i64 %ans.10319, 1 %rem138 = srem i64 %a.2326, %5 %cmp139 = icmp eq i64 %rem138, 0 %div142 = sdiv i64 %a.2326, %5 %sub143 = sext i1 %cmp139 to i64 %cond147 = add nsw i64 %div142, %sub143 %cmp148 = icmp slt i64 %cond147, 1 br i1 %cmp148, label %for.inc187, label %if.end151 if.end151: ; preds = %if.then130 %mul152 = mul nsw i64 %cond147, 3 %add153 = add nsw i64 %mul152, %inc131 br label %for.inc187 if.then162: ; preds = %if.then123 %add163 = add nsw i64 %ans.10319, 3 %rem165 = srem i64 %sub110, %5 %cmp166 = icmp eq i64 %rem165, 0 %div169 = sdiv i64 %sub110, %5 %sub170 = sext i1 %cmp166 to i64 %cond174 = add nsw i64 %div169, %sub170 %cmp175 = icmp slt i64 %cond174, 1 br i1 %cmp175, label %for.inc187, label %if.end178 if.end178: ; preds = %if.then162 %mul179 = mul nsw i64 %cond174, 6 %add180 = add nsw i64 %mul179, %add163 br label %for.inc187 for.inc187: ; preds = %if.then130, %if.then162, %if.end178, %if.end151, %if.end118 %ans.17 = phi i64 [ %ans.10319, %if.end118 ], [ %inc131, %if.then130 ], [ %add163, %if.then162 ], [ %add153, %if.end151 ], [ %add180, %if.end178 ] %judge.8 = phi i64 [ 0, %if.end118 ], [ 0, %if.then130 ], [ 0, %if.then162 ], [ 1, %if.end151 ], [ 1, %if.end178 ] %dec188 = add nsw i64 %i.1318, -1 %cmp106 = icmp sgt i64 %i.1318, 1 br i1 %cmp106, label %for.body108, label %for.end189, !llvm.loop !12 for.end189: ; preds = %for.inc187, %for.body108, %for.body91 %ans.10.lcssa = phi i64 [ %ans.9325, %for.body91 ], [ %ans.10319, %for.body108 ], [ %ans.17, %for.inc187 ] %judge.9 = phi i64 [ %judge.5327, %for.body91 ], [ 0, %for.body108 ], [ %judge.8, %for.inc187 ] %cmp193 = icmp eq i64 %judge.9, 1 %or.cond214 = select i1 %cmp190, i1 %cmp193, i1 false %7 = select i1 %or.cond214, i64 %6, i64 -1 %dec200 = add i64 %7, %a.2326 %cmp89.not.not = icmp sgt i64 %dec200, %sub87 br i1 %cmp89.not.not, label %for.body91, label %if.end202, !llvm.loop !13 if.end202: ; preds = %for.end189, %if.then80, %for.end78 %ans.18 = phi i64 [ %ans.0.lcssa, %for.end78 ], [ %conv84, %if.then80 ], [ %ans.10.lcssa, %for.end189 ] %call203 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.18) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #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: 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 @pow(double noundef, double noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn 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 = !{!"long 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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(void){ int n,k,i; long long int a,e,c ; scanf("%d %d",&n,&k); c=n/k; e=(n+k/2)/k; if(k%2==1){ a=c*c*c; }else{ a=c*c*c+e*e*e; } printf("%lld",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183957/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183957/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 [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 %k = alloca i32, align 4 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 %1 = load i32, ptr %k, align 4, !tbaa !5 %div = sdiv i32 %0, %1 %conv = sext i32 %div to i64 %2 = and i32 %1, -2147483647 %cmp = icmp eq i32 %2, 1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %mul = mul nsw i64 %conv, %conv %mul5 = mul nsw i64 %mul, %conv br label %if.end if.else: ; preds = %entry %div1 = sdiv i32 %1, 2 %add = add nsw i32 %div1, %0 %div2 = sdiv i32 %add, %1 %conv3 = sext i32 %div2 to i64 %mul6 = mul nsw i64 %conv, %conv %mul7 = mul nsw i64 %mul6, %conv %mul8 = mul nsw i64 %conv3, %conv3 %mul9 = mul nsw i64 %mul8, %conv3 %add10 = add nsw i64 %mul9, %mul7 br label %if.end if.end: ; preds = %if.else, %if.then %a.0 = phi i64 [ %mul5, %if.then ], [ %add10, %if.else ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %a.0) 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"}
// AtCoder ABC054 D - Mixing Experiment // 2020.1.24 bal4u #include <stdio.h> #include <string.h> #if 1 #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif int in() { // 非負整数の入力 int n = 0; int c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } #define MAX 230000 #define SFT 9 #define MSK 511 #define INF 0x5ffffff int dp[MAX+5]; int N; int main() { int i, Ma, Mb; int ma, ans; N = in(), Ma = in(), Mb = in(); ans = INF, ma = 0; for (i = 0; i < MAX; ++i) dp[i] = INF; dp[0] = 0; while (N--) { int a = in(), b = in(), c = in(); for (i = ma; i >= 0; --i) if (dp[i] < INF) { int x = dp[i] + c; int aa = (i >> SFT) + a, bb = (i & MSK) + b; if (aa*Mb == bb*Ma && ans > x) ans = x; int k = (aa << SFT) | bb; if (k > ma) ma = k; if (dp[k] > x) dp[k] = x; } } if (ans < INF) printf("%d\n", ans); else puts("-1"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184006/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184006/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] } @N = dso_local local_unnamed_addr global i32 0, align 4 @dp = dso_local local_unnamed_addr global [230005 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nounwind uwtable define dso_local i32 @in() 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) #4 %.pre13.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.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 %do.body.preheader do.body.preheader: ; preds = %cond.true.i, %cond.false.i %.ph = phi ptr [ %0, %cond.false.i ], [ %.pre13.pre, %cond.true.i ] %c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ] br label %do.body do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit12 %4 = phi ptr [ %8, %getchar_unlocked.exit12 ], [ %.ph, %do.body.preheader ] %n.0 = phi i32 [ %add, %getchar_unlocked.exit12 ], [ 0, %do.body.preheader ] %c.0 = phi i32 [ %cond.i8, %getchar_unlocked.exit12 ], [ %c.0.ph, %do.body.preheader ] %mul = mul nsw i32 %n.0, 10 %and = and i32 %c.0, 15 %add = add nsw i32 %and, %mul %_IO_read_ptr.i3 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i3, align 8, !tbaa !9 %_IO_read_end.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i4, align 8, !tbaa !14 %cmp.not.i5 = icmp ult ptr %5, %6 br i1 %cmp.not.i5, label %cond.false.i9, label %cond.true.i6, !prof !15 cond.true.i6: ; preds = %do.body %call.i7 = tail call i32 @__uflow(ptr noundef nonnull %4) #4 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12 cond.false.i9: ; preds = %do.body %incdec.ptr.i10 = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i10, ptr %_IO_read_ptr.i3, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i11 = zext i8 %7 to i32 br label %getchar_unlocked.exit12 getchar_unlocked.exit12: ; preds = %cond.true.i6, %cond.false.i9 %8 = phi ptr [ %.pre, %cond.true.i6 ], [ %4, %cond.false.i9 ] %cond.i8 = phi i32 [ %call.i7, %cond.true.i6 ], [ %conv3.i11, %cond.false.i9 ] %cmp = icmp sgt i32 %cond.i8, 47 br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17 do.end: ; preds = %getchar_unlocked.exit12 ret i32 %add } ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14 %cmp.not.i.i = icmp ult ptr %1, %2 br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15 cond.true.i.i: ; preds = %entry %call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4 %.pre13.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i.preheader cond.false.i.i: ; preds = %entry %incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i.i = zext i8 %3 to i32 br label %do.body.i.preheader do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i %.ph257 = phi ptr [ %0, %cond.false.i.i ], [ %.pre13.pre.i, %cond.true.i.i ] %c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ] br label %do.body.i do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit12.i %4 = phi ptr [ %8, %getchar_unlocked.exit12.i ], [ %.ph257, %do.body.i.preheader ] %n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit12.i ], [ 0, %do.body.i.preheader ] %c.0.i = phi i32 [ %cond.i8.i, %getchar_unlocked.exit12.i ], [ %c.0.i.ph, %do.body.i.preheader ] %mul.i = mul nsw i32 %n.0.i, 10 %and.i = and i32 %c.0.i, 15 %add.i = add nsw i32 %and.i, %mul.i %_IO_read_ptr.i3.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9 %_IO_read_end.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i4.i, align 8, !tbaa !14 %cmp.not.i5.i = icmp ult ptr %5, %6 br i1 %cmp.not.i5.i, label %cond.false.i9.i, label %cond.true.i6.i, !prof !15 cond.true.i6.i: ; preds = %do.body.i %call.i7.i = tail call i32 @__uflow(ptr noundef nonnull %4) #4 %.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i cond.false.i9.i: ; preds = %do.body.i %incdec.ptr.i10.i = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i10.i, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i11.i = zext i8 %7 to i32 br label %getchar_unlocked.exit12.i getchar_unlocked.exit12.i: ; preds = %cond.false.i9.i, %cond.true.i6.i %8 = phi ptr [ %.pre.i, %cond.true.i6.i ], [ %4, %cond.false.i9.i ] %cond.i8.i = phi i32 [ %call.i7.i, %cond.true.i6.i ], [ %conv3.i11.i, %cond.false.i9.i ] %cmp.i = icmp sgt i32 %cond.i8.i, 47 br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !17 in.exit: ; preds = %getchar_unlocked.exit12.i store i32 %add.i, ptr @N, align 4, !tbaa !19 %_IO_read_ptr.i.i58 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1 %9 = load ptr, ptr %_IO_read_ptr.i.i58, align 8, !tbaa !9 %_IO_read_end.i.i59 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2 %10 = load ptr, ptr %_IO_read_end.i.i59, align 8, !tbaa !14 %cmp.not.i.i60 = icmp ult ptr %9, %10 br i1 %cmp.not.i.i60, label %cond.false.i.i85, label %cond.true.i.i61, !prof !15 cond.true.i.i61: ; preds = %in.exit %call.i.i62 = tail call i32 @__uflow(ptr noundef nonnull %8) #4 %.pre13.pre.i63 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i67.preheader cond.false.i.i85: ; preds = %in.exit %incdec.ptr.i.i86 = getelementptr inbounds i8, ptr %9, i64 1 store ptr %incdec.ptr.i.i86, ptr %_IO_read_ptr.i.i58, align 8, !tbaa !9 %11 = load i8, ptr %9, align 1, !tbaa !16 %conv3.i.i87 = zext i8 %11 to i32 br label %do.body.i67.preheader do.body.i67.preheader: ; preds = %cond.false.i.i85, %cond.true.i.i61 %.ph255 = phi ptr [ %8, %cond.false.i.i85 ], [ %.pre13.pre.i63, %cond.true.i.i61 ] %c.0.i69.ph = phi i32 [ %conv3.i.i87, %cond.false.i.i85 ], [ %call.i.i62, %cond.true.i.i61 ] br label %do.body.i67 do.body.i67: ; preds = %do.body.i67.preheader, %getchar_unlocked.exit12.i79 %12 = phi ptr [ %16, %getchar_unlocked.exit12.i79 ], [ %.ph255, %do.body.i67.preheader ] %n.0.i68 = phi i32 [ %add.i72, %getchar_unlocked.exit12.i79 ], [ 0, %do.body.i67.preheader ] %c.0.i69 = phi i32 [ %cond.i8.i80, %getchar_unlocked.exit12.i79 ], [ %c.0.i69.ph, %do.body.i67.preheader ] %mul.i70 = mul nsw i32 %n.0.i68, 10 %and.i71 = and i32 %c.0.i69, 15 %add.i72 = add nsw i32 %and.i71, %mul.i70 %_IO_read_ptr.i3.i73 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 1 %13 = load ptr, ptr %_IO_read_ptr.i3.i73, align 8, !tbaa !9 %_IO_read_end.i4.i74 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 2 %14 = load ptr, ptr %_IO_read_end.i4.i74, align 8, !tbaa !14 %cmp.not.i5.i75 = icmp ult ptr %13, %14 br i1 %cmp.not.i5.i75, label %cond.false.i9.i82, label %cond.true.i6.i76, !prof !15 cond.true.i6.i76: ; preds = %do.body.i67 %call.i7.i77 = tail call i32 @__uflow(ptr noundef nonnull %12) #4 %.pre.i78 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i79 cond.false.i9.i82: ; preds = %do.body.i67 %incdec.ptr.i10.i83 = getelementptr inbounds i8, ptr %13, i64 1 store ptr %incdec.ptr.i10.i83, ptr %_IO_read_ptr.i3.i73, align 8, !tbaa !9 %15 = load i8, ptr %13, align 1, !tbaa !16 %conv3.i11.i84 = zext i8 %15 to i32 br label %getchar_unlocked.exit12.i79 getchar_unlocked.exit12.i79: ; preds = %cond.false.i9.i82, %cond.true.i6.i76 %16 = phi ptr [ %.pre.i78, %cond.true.i6.i76 ], [ %12, %cond.false.i9.i82 ] %cond.i8.i80 = phi i32 [ %call.i7.i77, %cond.true.i6.i76 ], [ %conv3.i11.i84, %cond.false.i9.i82 ] %cmp.i81 = icmp sgt i32 %cond.i8.i80, 47 br i1 %cmp.i81, label %do.body.i67, label %in.exit88, !llvm.loop !17 in.exit88: ; preds = %getchar_unlocked.exit12.i79 %_IO_read_ptr.i.i89 = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 1 %17 = load ptr, ptr %_IO_read_ptr.i.i89, align 8, !tbaa !9 %_IO_read_end.i.i90 = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 2 %18 = load ptr, ptr %_IO_read_end.i.i90, align 8, !tbaa !14 %cmp.not.i.i91 = icmp ult ptr %17, %18 br i1 %cmp.not.i.i91, label %cond.false.i.i116, label %cond.true.i.i92, !prof !15 cond.true.i.i92: ; preds = %in.exit88 %call.i.i93 = tail call i32 @__uflow(ptr noundef nonnull %16) #4 %.pre13.pre.i94 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i98.preheader cond.false.i.i116: ; preds = %in.exit88 %incdec.ptr.i.i117 = getelementptr inbounds i8, ptr %17, i64 1 store ptr %incdec.ptr.i.i117, ptr %_IO_read_ptr.i.i89, align 8, !tbaa !9 %19 = load i8, ptr %17, align 1, !tbaa !16 %conv3.i.i118 = zext i8 %19 to i32 br label %do.body.i98.preheader do.body.i98.preheader: ; preds = %cond.false.i.i116, %cond.true.i.i92 %.ph253 = phi ptr [ %16, %cond.false.i.i116 ], [ %.pre13.pre.i94, %cond.true.i.i92 ] %c.0.i100.ph = phi i32 [ %conv3.i.i118, %cond.false.i.i116 ], [ %call.i.i93, %cond.true.i.i92 ] br label %do.body.i98 do.body.i98: ; preds = %do.body.i98.preheader, %getchar_unlocked.exit12.i110 %20 = phi ptr [ %24, %getchar_unlocked.exit12.i110 ], [ %.ph253, %do.body.i98.preheader ] %n.0.i99 = phi i32 [ %add.i103, %getchar_unlocked.exit12.i110 ], [ 0, %do.body.i98.preheader ] %c.0.i100 = phi i32 [ %cond.i8.i111, %getchar_unlocked.exit12.i110 ], [ %c.0.i100.ph, %do.body.i98.preheader ] %mul.i101 = mul nsw i32 %n.0.i99, 10 %and.i102 = and i32 %c.0.i100, 15 %add.i103 = add nsw i32 %and.i102, %mul.i101 %_IO_read_ptr.i3.i104 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 1 %21 = load ptr, ptr %_IO_read_ptr.i3.i104, align 8, !tbaa !9 %_IO_read_end.i4.i105 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 2 %22 = load ptr, ptr %_IO_read_end.i4.i105, align 8, !tbaa !14 %cmp.not.i5.i106 = icmp ult ptr %21, %22 br i1 %cmp.not.i5.i106, label %cond.false.i9.i113, label %cond.true.i6.i107, !prof !15 cond.true.i6.i107: ; preds = %do.body.i98 %call.i7.i108 = tail call i32 @__uflow(ptr noundef nonnull %20) #4 %.pre.i109 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i110 cond.false.i9.i113: ; preds = %do.body.i98 %incdec.ptr.i10.i114 = getelementptr inbounds i8, ptr %21, i64 1 store ptr %incdec.ptr.i10.i114, ptr %_IO_read_ptr.i3.i104, align 8, !tbaa !9 %23 = load i8, ptr %21, align 1, !tbaa !16 %conv3.i11.i115 = zext i8 %23 to i32 br label %getchar_unlocked.exit12.i110 getchar_unlocked.exit12.i110: ; preds = %cond.false.i9.i113, %cond.true.i6.i107 %24 = phi ptr [ %.pre.i109, %cond.true.i6.i107 ], [ %20, %cond.false.i9.i113 ] %cond.i8.i111 = phi i32 [ %call.i7.i108, %cond.true.i6.i107 ], [ %conv3.i11.i115, %cond.false.i9.i113 ] %cmp.i112 = icmp sgt i32 %cond.i8.i111, 47 br i1 %cmp.i112, label %do.body.i98, label %vector.body, !llvm.loop !17 vector.body: ; preds = %getchar_unlocked.exit12.i110, %vector.body %index = phi i64 [ %index.next.4, %vector.body ], [ 0, %getchar_unlocked.exit12.i110 ] %25 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %index store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %25, align 16, !tbaa !19 %26 = getelementptr inbounds i32, ptr %25, i64 4 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %26, align 16, !tbaa !19 %index.next = add nuw nsw i64 %index, 8 %27 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %index.next store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %27, align 16, !tbaa !19 %28 = getelementptr inbounds i32, ptr %27, i64 4 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %28, align 16, !tbaa !19 %index.next.1 = add nuw nsw i64 %index, 16 %29 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %index.next.1 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %29, align 16, !tbaa !19 %30 = getelementptr inbounds i32, ptr %29, i64 4 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %30, align 16, !tbaa !19 %index.next.2 = add nuw nsw i64 %index, 24 %31 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %index.next.2 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %31, align 16, !tbaa !19 %32 = getelementptr inbounds i32, ptr %31, i64 4 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %32, align 16, !tbaa !19 %index.next.3 = add nuw nsw i64 %index, 32 %33 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %index.next.3 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %33, align 16, !tbaa !19 %34 = getelementptr inbounds i32, ptr %33, i64 4 store <4 x i32> <i32 100663295, i32 100663295, i32 100663295, i32 100663295>, ptr %34, align 16, !tbaa !19 %index.next.4 = add nuw nsw i64 %index, 40 %35 = icmp eq i64 %index.next.4, 230000 br i1 %35, label %for.end, label %vector.body, !llvm.loop !20 for.end: ; preds = %vector.body store i32 0, ptr @dp, align 16, !tbaa !19 %36 = load i32, ptr @N, align 4, !tbaa !19 %dec219 = add nsw i32 %36, -1 store i32 %dec219, ptr @N, align 4, !tbaa !19 %tobool.not220 = icmp eq i32 %36, 0 br i1 %tobool.not220, label %if.else, label %while.body while.cond.loopexit: ; preds = %for.inc31, %for.cond6.preheader %ans.1.lcssa = phi i32 [ %ans.0221, %for.cond6.preheader ], [ %ans.3, %for.inc31 ] %ma.1.lcssa = phi i32 [ %ma.0222, %for.cond6.preheader ], [ %ma.3, %for.inc31 ] %37 = load i32, ptr @N, align 4, !tbaa !19 %dec = add nsw i32 %37, -1 store i32 %dec, ptr @N, align 4, !tbaa !19 %tobool.not = icmp eq i32 %37, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23 while.body: ; preds = %for.end, %while.cond.loopexit %38 = phi ptr [ %68, %while.cond.loopexit ], [ %24, %for.end ] %39 = phi ptr [ %69, %while.cond.loopexit ], [ %24, %for.end ] %ma.0222 = phi i32 [ %ma.1.lcssa, %while.cond.loopexit ], [ 0, %for.end ] %ans.0221 = phi i32 [ %ans.1.lcssa, %while.cond.loopexit ], [ 100663295, %for.end ] %_IO_read_ptr.i.i120 = getelementptr inbounds %struct._IO_FILE, ptr %39, i64 0, i32 1 %40 = load ptr, ptr %_IO_read_ptr.i.i120, align 8, !tbaa !9 %_IO_read_end.i.i121 = getelementptr inbounds %struct._IO_FILE, ptr %39, i64 0, i32 2 %41 = load ptr, ptr %_IO_read_end.i.i121, align 8, !tbaa !14 %cmp.not.i.i122 = icmp ult ptr %40, %41 br i1 %cmp.not.i.i122, label %cond.false.i.i147, label %cond.true.i.i123, !prof !15 cond.true.i.i123: ; preds = %while.body %call.i.i124 = tail call i32 @__uflow(ptr noundef nonnull %39) #4 %.pre13.pre.i125 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i129.preheader cond.false.i.i147: ; preds = %while.body %incdec.ptr.i.i148 = getelementptr inbounds i8, ptr %40, i64 1 store ptr %incdec.ptr.i.i148, ptr %_IO_read_ptr.i.i120, align 8, !tbaa !9 %42 = load i8, ptr %40, align 1, !tbaa !16 %conv3.i.i149 = zext i8 %42 to i32 br label %do.body.i129.preheader do.body.i129.preheader: ; preds = %cond.false.i.i147, %cond.true.i.i123 %.ph247 = phi ptr [ %38, %cond.false.i.i147 ], [ %.pre13.pre.i125, %cond.true.i.i123 ] %.ph248 = phi ptr [ %39, %cond.false.i.i147 ], [ %.pre13.pre.i125, %cond.true.i.i123 ] %c.0.i131.ph = phi i32 [ %conv3.i.i149, %cond.false.i.i147 ], [ %call.i.i124, %cond.true.i.i123 ] br label %do.body.i129 do.body.i129: ; preds = %do.body.i129.preheader, %getchar_unlocked.exit12.i141 %43 = phi ptr [ %48, %getchar_unlocked.exit12.i141 ], [ %.ph247, %do.body.i129.preheader ] %44 = phi ptr [ %49, %getchar_unlocked.exit12.i141 ], [ %.ph248, %do.body.i129.preheader ] %n.0.i130 = phi i32 [ %add.i134, %getchar_unlocked.exit12.i141 ], [ 0, %do.body.i129.preheader ] %c.0.i131 = phi i32 [ %cond.i8.i142, %getchar_unlocked.exit12.i141 ], [ %c.0.i131.ph, %do.body.i129.preheader ] %mul.i132 = mul nsw i32 %n.0.i130, 10 %and.i133 = and i32 %c.0.i131, 15 %add.i134 = add nsw i32 %and.i133, %mul.i132 %_IO_read_ptr.i3.i135 = getelementptr inbounds %struct._IO_FILE, ptr %44, i64 0, i32 1 %45 = load ptr, ptr %_IO_read_ptr.i3.i135, align 8, !tbaa !9 %_IO_read_end.i4.i136 = getelementptr inbounds %struct._IO_FILE, ptr %44, i64 0, i32 2 %46 = load ptr, ptr %_IO_read_end.i4.i136, align 8, !tbaa !14 %cmp.not.i5.i137 = icmp ult ptr %45, %46 br i1 %cmp.not.i5.i137, label %cond.false.i9.i144, label %cond.true.i6.i138, !prof !15 cond.true.i6.i138: ; preds = %do.body.i129 %call.i7.i139 = tail call i32 @__uflow(ptr noundef nonnull %44) #4 %.pre.i140 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i141 cond.false.i9.i144: ; preds = %do.body.i129 %incdec.ptr.i10.i145 = getelementptr inbounds i8, ptr %45, i64 1 store ptr %incdec.ptr.i10.i145, ptr %_IO_read_ptr.i3.i135, align 8, !tbaa !9 %47 = load i8, ptr %45, align 1, !tbaa !16 %conv3.i11.i146 = zext i8 %47 to i32 br label %getchar_unlocked.exit12.i141 getchar_unlocked.exit12.i141: ; preds = %cond.false.i9.i144, %cond.true.i6.i138 %48 = phi ptr [ %.pre.i140, %cond.true.i6.i138 ], [ %43, %cond.false.i9.i144 ] %49 = phi ptr [ %.pre.i140, %cond.true.i6.i138 ], [ %44, %cond.false.i9.i144 ] %cond.i8.i142 = phi i32 [ %call.i7.i139, %cond.true.i6.i138 ], [ %conv3.i11.i146, %cond.false.i9.i144 ] %cmp.i143 = icmp sgt i32 %cond.i8.i142, 47 br i1 %cmp.i143, label %do.body.i129, label %in.exit150, !llvm.loop !17 in.exit150: ; preds = %getchar_unlocked.exit12.i141 %_IO_read_ptr.i.i151 = getelementptr inbounds %struct._IO_FILE, ptr %49, i64 0, i32 1 %50 = load ptr, ptr %_IO_read_ptr.i.i151, align 8, !tbaa !9 %_IO_read_end.i.i152 = getelementptr inbounds %struct._IO_FILE, ptr %49, i64 0, i32 2 %51 = load ptr, ptr %_IO_read_end.i.i152, align 8, !tbaa !14 %cmp.not.i.i153 = icmp ult ptr %50, %51 br i1 %cmp.not.i.i153, label %cond.false.i.i178, label %cond.true.i.i154, !prof !15 cond.true.i.i154: ; preds = %in.exit150 %call.i.i155 = tail call i32 @__uflow(ptr noundef nonnull %49) #4 %.pre13.pre.i156 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i160.preheader cond.false.i.i178: ; preds = %in.exit150 %incdec.ptr.i.i179 = getelementptr inbounds i8, ptr %50, i64 1 store ptr %incdec.ptr.i.i179, ptr %_IO_read_ptr.i.i151, align 8, !tbaa !9 %52 = load i8, ptr %50, align 1, !tbaa !16 %conv3.i.i180 = zext i8 %52 to i32 br label %do.body.i160.preheader do.body.i160.preheader: ; preds = %cond.false.i.i178, %cond.true.i.i154 %.ph245 = phi ptr [ %48, %cond.false.i.i178 ], [ %.pre13.pre.i156, %cond.true.i.i154 ] %.ph246 = phi ptr [ %49, %cond.false.i.i178 ], [ %.pre13.pre.i156, %cond.true.i.i154 ] %c.0.i162.ph = phi i32 [ %conv3.i.i180, %cond.false.i.i178 ], [ %call.i.i155, %cond.true.i.i154 ] br label %do.body.i160 do.body.i160: ; preds = %do.body.i160.preheader, %getchar_unlocked.exit12.i172 %53 = phi ptr [ %58, %getchar_unlocked.exit12.i172 ], [ %.ph245, %do.body.i160.preheader ] %54 = phi ptr [ %59, %getchar_unlocked.exit12.i172 ], [ %.ph246, %do.body.i160.preheader ] %n.0.i161 = phi i32 [ %add.i165, %getchar_unlocked.exit12.i172 ], [ 0, %do.body.i160.preheader ] %c.0.i162 = phi i32 [ %cond.i8.i173, %getchar_unlocked.exit12.i172 ], [ %c.0.i162.ph, %do.body.i160.preheader ] %mul.i163 = mul nsw i32 %n.0.i161, 10 %and.i164 = and i32 %c.0.i162, 15 %add.i165 = add nsw i32 %and.i164, %mul.i163 %_IO_read_ptr.i3.i166 = getelementptr inbounds %struct._IO_FILE, ptr %54, i64 0, i32 1 %55 = load ptr, ptr %_IO_read_ptr.i3.i166, align 8, !tbaa !9 %_IO_read_end.i4.i167 = getelementptr inbounds %struct._IO_FILE, ptr %54, i64 0, i32 2 %56 = load ptr, ptr %_IO_read_end.i4.i167, align 8, !tbaa !14 %cmp.not.i5.i168 = icmp ult ptr %55, %56 br i1 %cmp.not.i5.i168, label %cond.false.i9.i175, label %cond.true.i6.i169, !prof !15 cond.true.i6.i169: ; preds = %do.body.i160 %call.i7.i170 = tail call i32 @__uflow(ptr noundef nonnull %54) #4 %.pre.i171 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i172 cond.false.i9.i175: ; preds = %do.body.i160 %incdec.ptr.i10.i176 = getelementptr inbounds i8, ptr %55, i64 1 store ptr %incdec.ptr.i10.i176, ptr %_IO_read_ptr.i3.i166, align 8, !tbaa !9 %57 = load i8, ptr %55, align 1, !tbaa !16 %conv3.i11.i177 = zext i8 %57 to i32 br label %getchar_unlocked.exit12.i172 getchar_unlocked.exit12.i172: ; preds = %cond.false.i9.i175, %cond.true.i6.i169 %58 = phi ptr [ %.pre.i171, %cond.true.i6.i169 ], [ %53, %cond.false.i9.i175 ] %59 = phi ptr [ %.pre.i171, %cond.true.i6.i169 ], [ %54, %cond.false.i9.i175 ] %cond.i8.i173 = phi i32 [ %call.i7.i170, %cond.true.i6.i169 ], [ %conv3.i11.i177, %cond.false.i9.i175 ] %cmp.i174 = icmp sgt i32 %cond.i8.i173, 47 br i1 %cmp.i174, label %do.body.i160, label %in.exit181, !llvm.loop !17 in.exit181: ; preds = %getchar_unlocked.exit12.i172 %_IO_read_ptr.i.i182 = getelementptr inbounds %struct._IO_FILE, ptr %58, i64 0, i32 1 %60 = load ptr, ptr %_IO_read_ptr.i.i182, align 8, !tbaa !9 %_IO_read_end.i.i183 = getelementptr inbounds %struct._IO_FILE, ptr %58, i64 0, i32 2 %61 = load ptr, ptr %_IO_read_end.i.i183, align 8, !tbaa !14 %cmp.not.i.i184 = icmp ult ptr %60, %61 br i1 %cmp.not.i.i184, label %cond.false.i.i209, label %cond.true.i.i185, !prof !15 cond.true.i.i185: ; preds = %in.exit181 %call.i.i186 = tail call i32 @__uflow(ptr noundef nonnull %58) #4 %.pre13.pre.i187 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i191.preheader cond.false.i.i209: ; preds = %in.exit181 %incdec.ptr.i.i210 = getelementptr inbounds i8, ptr %60, i64 1 store ptr %incdec.ptr.i.i210, ptr %_IO_read_ptr.i.i182, align 8, !tbaa !9 %62 = load i8, ptr %60, align 1, !tbaa !16 %conv3.i.i211 = zext i8 %62 to i32 br label %do.body.i191.preheader do.body.i191.preheader: ; preds = %cond.false.i.i209, %cond.true.i.i185 %.ph244 = phi ptr [ %58, %cond.false.i.i209 ], [ %.pre13.pre.i187, %cond.true.i.i185 ] %c.0.i193.ph = phi i32 [ %conv3.i.i211, %cond.false.i.i209 ], [ %call.i.i186, %cond.true.i.i185 ] br label %do.body.i191 do.body.i191: ; preds = %do.body.i191.preheader, %getchar_unlocked.exit12.i203 %63 = phi ptr [ %68, %getchar_unlocked.exit12.i203 ], [ %.ph244, %do.body.i191.preheader ] %64 = phi ptr [ %69, %getchar_unlocked.exit12.i203 ], [ %.ph244, %do.body.i191.preheader ] %n.0.i192 = phi i32 [ %add.i196, %getchar_unlocked.exit12.i203 ], [ 0, %do.body.i191.preheader ] %c.0.i193 = phi i32 [ %cond.i8.i204, %getchar_unlocked.exit12.i203 ], [ %c.0.i193.ph, %do.body.i191.preheader ] %mul.i194 = mul nsw i32 %n.0.i192, 10 %and.i195 = and i32 %c.0.i193, 15 %add.i196 = add nsw i32 %and.i195, %mul.i194 %_IO_read_ptr.i3.i197 = getelementptr inbounds %struct._IO_FILE, ptr %64, i64 0, i32 1 %65 = load ptr, ptr %_IO_read_ptr.i3.i197, align 8, !tbaa !9 %_IO_read_end.i4.i198 = getelementptr inbounds %struct._IO_FILE, ptr %64, i64 0, i32 2 %66 = load ptr, ptr %_IO_read_end.i4.i198, align 8, !tbaa !14 %cmp.not.i5.i199 = icmp ult ptr %65, %66 br i1 %cmp.not.i5.i199, label %cond.false.i9.i206, label %cond.true.i6.i200, !prof !15 cond.true.i6.i200: ; preds = %do.body.i191 %call.i7.i201 = tail call i32 @__uflow(ptr noundef nonnull %64) #4 %.pre.i202 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit12.i203 cond.false.i9.i206: ; preds = %do.body.i191 %incdec.ptr.i10.i207 = getelementptr inbounds i8, ptr %65, i64 1 store ptr %incdec.ptr.i10.i207, ptr %_IO_read_ptr.i3.i197, align 8, !tbaa !9 %67 = load i8, ptr %65, align 1, !tbaa !16 %conv3.i11.i208 = zext i8 %67 to i32 br label %getchar_unlocked.exit12.i203 getchar_unlocked.exit12.i203: ; preds = %cond.false.i9.i206, %cond.true.i6.i200 %68 = phi ptr [ %.pre.i202, %cond.true.i6.i200 ], [ %63, %cond.false.i9.i206 ] %69 = phi ptr [ %.pre.i202, %cond.true.i6.i200 ], [ %64, %cond.false.i9.i206 ] %cond.i8.i204 = phi i32 [ %call.i7.i201, %cond.true.i6.i200 ], [ %conv3.i11.i208, %cond.false.i9.i206 ] %cmp.i205 = icmp sgt i32 %cond.i8.i204, 47 br i1 %cmp.i205, label %do.body.i191, label %for.cond6.preheader, !llvm.loop !17 for.cond6.preheader: ; preds = %getchar_unlocked.exit12.i203 %cmp7214 = icmp sgt i32 %ma.0222, -1 br i1 %cmp7214, label %for.body8.preheader, label %while.cond.loopexit for.body8.preheader: ; preds = %for.cond6.preheader %70 = zext i32 %ma.0222 to i64 br label %for.body8 for.body8: ; preds = %for.body8.preheader, %for.inc31 %indvars.iv225 = phi i64 [ %70, %for.body8.preheader ], [ %indvars.iv.next226, %for.inc31 ] %ma.1216 = phi i32 [ %ma.0222, %for.body8.preheader ], [ %ma.3, %for.inc31 ] %ans.1215 = phi i32 [ %ans.0221, %for.body8.preheader ], [ %ans.3, %for.inc31 ] %arrayidx10 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %indvars.iv225 %71 = load i32, ptr %arrayidx10, align 4, !tbaa !19 %cmp11 = icmp slt i32 %71, 100663295 br i1 %cmp11, label %if.then, label %for.inc31 if.then: ; preds = %for.body8 %add = add nsw i32 %71, %add.i196 %72 = trunc i64 %indvars.iv225 to i32 %shr = lshr i32 %72, 9 %add14 = add nsw i32 %shr, %add.i134 %and = and i32 %72, 511 %add15 = add nsw i32 %and, %add.i165 %mul = mul nsw i32 %add14, %add.i103 %mul16 = mul nsw i32 %add15, %add.i72 %cmp17 = icmp eq i32 %mul, %mul16 %cmp18 = icmp sgt i32 %ans.1215, %add %or.cond = select i1 %cmp17, i1 %cmp18, i1 false %ans.2 = select i1 %or.cond, i32 %add, i32 %ans.1215 %shl = shl i32 %add14, 9 %or = or i32 %shl, %add15 %ma.2 = tail call i32 @llvm.smax.i32(i32 %or, i32 %ma.1216) %idxprom23 = sext i32 %or to i64 %arrayidx24 = getelementptr inbounds [230005 x i32], ptr @dp, i64 0, i64 %idxprom23 %73 = load i32, ptr %arrayidx24, align 4, !tbaa !19 %cmp25 = icmp sgt i32 %73, %add br i1 %cmp25, label %if.then26, label %for.inc31 if.then26: ; preds = %if.then store i32 %add, ptr %arrayidx24, align 4, !tbaa !19 br label %for.inc31 for.inc31: ; preds = %if.then, %if.then26, %for.body8 %ans.3 = phi i32 [ %ans.1215, %for.body8 ], [ %ans.2, %if.then26 ], [ %ans.2, %if.then ] %ma.3 = phi i32 [ %ma.1216, %for.body8 ], [ %ma.2, %if.then26 ], [ %ma.2, %if.then ] %indvars.iv.next226 = add nsw i64 %indvars.iv225, -1 %cmp7 = icmp sgt i64 %indvars.iv225, 0 br i1 %cmp7, label %for.body8, label %while.cond.loopexit, !llvm.loop !24 while.end: ; preds = %while.cond.loopexit %cmp34 = icmp slt i32 %ans.1.lcssa, 100663295 br i1 %cmp34, label %if.then35, label %if.else if.then35: ; preds = %while.end %call36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.1.lcssa) br label %if.end38 if.else: ; preds = %for.end, %while.end %call37 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1) br label %if.end38 if.end38: ; preds = %if.else, %if.then35 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1 declare i32 @__uflow(ptr noundef) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !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 = !{!11, !11, i64 0} !20 = distinct !{!20, !18, !21, !22} !21 = !{!"llvm.loop.isvectorized", i32 1} !22 = !{!"llvm.loop.unroll.runtime.disable"} !23 = distinct !{!23, !18} !24 = distinct !{!24, !18}
#include<stdio.h> #include<math.h> #include<stdlib.h> int main(){ long n = 0; long a[100000] = {}; long i=0; long sum = 0; long suma = 0; scanf("%ld",&n); for(i=0;i<n;i++){ scanf("%ld",&a[i]); } for(i=1;i<n;i++){ sum += labs(a[i]-a[i-1]); } //printf("%ld",sum); for(i=0;i<n;i++){ suma = sum; if(i != 0 && i != n-1){ suma = sum - labs(a[i-1] - a[i]) -labs(a[i+1] - a[i]) + labs(a[i-1]-a[i+1]); suma += labs(a[n-1]) + labs(a[0]); }else if(i == 0){ suma = sum - labs(a[1] - a[0]); suma += labs(a[n-1]) + labs(a[1]); }else{ suma = sum - labs(a[n-1]-a[n-2]); suma += labs(a[n-2]) + labs(a[0]); } printf("%ld\n",suma); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184057/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184057/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 [5 x i8] c"%ld\0A\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 [100000 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6 store i64 0, ptr %n, align 8, !tbaa !5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %a, i8 0, i64 800000, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp94 = icmp sgt i64 %0, 0 br i1 %cmp94, label %for.body, label %for.end65 for.cond2.preheader: ; preds = %for.body %cmp396 = icmp sgt i64 %14, 1 br i1 %cmp396, label %for.body4.preheader, label %for.cond11.preheader for.body4.preheader: ; preds = %for.cond2.preheader %.pre = load i64, ptr %a, align 16, !tbaa !5 %1 = add i64 %14, -1 %min.iters.check = icmp ult i64 %14, 5 br i1 %min.iters.check, label %for.body4.preheader109, label %vector.ph vector.ph: ; preds = %for.body4.preheader %n.vec = and i64 %1, -4 %ind.end = or i64 %n.vec, 1 %vector.recur.init = insertelement <2 x i64> poison, i64 %.pre, i64 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load108, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ] %vec.phi107 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %offset.idx = or i64 %index, 1 %2 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %offset.idx %wide.load = load <2 x i64>, ptr %2, align 8, !tbaa !5 %3 = getelementptr inbounds i64, ptr %2, i64 2 %wide.load108 = load <2 x i64>, ptr %3, align 8, !tbaa !5 %4 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2> %5 = shufflevector <2 x i64> %wide.load, <2 x i64> %wide.load108, <2 x i32> <i32 1, i32 2> %6 = sub nsw <2 x i64> %wide.load, %4 %7 = sub nsw <2 x i64> %wide.load108, %5 %8 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %6, i1 true) %9 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %7, i1 true) %10 = add <2 x i64> %8, %vec.phi %11 = add <2 x i64> %9, %vec.phi107 %index.next = add nuw i64 %index, 4 %12 = icmp eq i64 %index.next, %n.vec br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %11, %10 %13 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %1, %n.vec %vector.recur.extract = extractelement <2 x i64> %wide.load108, i64 1 br i1 %cmp.n, label %for.cond11.preheader, label %for.body4.preheader109 for.body4.preheader109: ; preds = %for.body4.preheader, %middle.block %scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body4.preheader ] %sum.098.ph = phi i64 [ %13, %middle.block ], [ 0, %for.body4.preheader ] %i.197.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body4.preheader ] br label %for.body4 for.body: ; preds = %entry, %for.body %i.095 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %i.095 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.095, 1 %14 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %14 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13 for.cond11.preheader: ; preds = %for.body4, %middle.block, %for.cond2.preheader %sum.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ %13, %middle.block ], [ %add, %for.body4 ] %cmp12100 = icmp sgt i64 %14, 0 br i1 %cmp12100, label %if.end61.peel, label %for.end65 if.end61.peel: ; preds = %for.cond11.preheader %arrayidx40 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 1 %15 = load i64, ptr %arrayidx40, align 8, !tbaa !5 %16 = call i64 @llvm.abs.i64(i64 %15, i1 true) %add47.peel = add i64 %16, %sum.0.lcssa %17 = load i64, ptr %a, align 16, !tbaa !5 %sub42.peel = sub nsw i64 %15, %17 %18 = call i64 @llvm.abs.i64(i64 %sub42.peel, i1 true) %sub43.peel = sub i64 %add47.peel, %18 %sub44.peel = add nsw i64 %14, -1 %arrayidx45.peel = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %sub44.peel %19 = load i64, ptr %arrayidx45.peel, align 8, !tbaa !5 %20 = call i64 @llvm.abs.i64(i64 %19, i1 true) %add48.peel = add i64 %sub43.peel, %20 %call62.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add48.peel) %21 = load i64, ptr %n, align 8, !tbaa !5 %cmp12.peel = icmp sgt i64 %21, 1 br i1 %cmp12.peel, label %land.lhs.true, label %for.end65 for.body4: ; preds = %for.body4.preheader109, %for.body4 %scalar.recur = phi i64 [ %22, %for.body4 ], [ %scalar.recur.ph, %for.body4.preheader109 ] %sum.098 = phi i64 [ %add, %for.body4 ], [ %sum.098.ph, %for.body4.preheader109 ] %i.197 = phi i64 [ %inc9, %for.body4 ], [ %i.197.ph, %for.body4.preheader109 ] %arrayidx5 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %i.197 %22 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %sub7 = sub nsw i64 %22, %scalar.recur %23 = call i64 @llvm.abs.i64(i64 %sub7, i1 true) %add = add nuw nsw i64 %23, %sum.098 %inc9 = add nuw nsw i64 %i.197, 1 %exitcond.not = icmp eq i64 %inc9, %14 br i1 %exitcond.not, label %for.cond11.preheader, label %for.body4, !llvm.loop !14 land.lhs.true: ; preds = %if.end61.peel, %if.end61 %24 = phi i64 [ %43, %if.end61 ], [ %21, %if.end61.peel ] %i.2101 = phi i64 [ %inc64, %if.end61 ], [ 1, %if.end61.peel ] %sub15 = add nsw i64 %24, -1 %cmp16.not = icmp eq i64 %i.2101, %sub15 br i1 %cmp16.not, label %if.else49, label %if.then if.then: ; preds = %land.lhs.true %sub17 = add nsw i64 %i.2101, -1 %arrayidx18 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %sub17 %25 = load i64, ptr %arrayidx18, align 8, !tbaa !5 %arrayidx19 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %i.2101 %26 = load i64, ptr %arrayidx19, align 8, !tbaa !5 %sub20 = sub nsw i64 %25, %26 %27 = call i64 @llvm.abs.i64(i64 %sub20, i1 true) %add22 = add nuw nsw i64 %i.2101, 1 %arrayidx23 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %add22 %28 = load i64, ptr %arrayidx23, align 8, !tbaa !5 %sub25 = sub nsw i64 %28, %26 %29 = call i64 @llvm.abs.i64(i64 %sub25, i1 true) %sub31 = sub nsw i64 %25, %28 %30 = call i64 @llvm.abs.i64(i64 %sub31, i1 true) %arrayidx34 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %sub15 %31 = load i64, ptr %arrayidx34, align 8, !tbaa !5 %32 = call i64 @llvm.abs.i64(i64 %31, i1 true) %33 = load i64, ptr %a, align 16, !tbaa !5 %34 = call i64 @llvm.abs.i64(i64 %33, i1 true) %35 = add i64 %sum.0.lcssa, %32 %36 = add nuw i64 %27, %29 %add32 = sub i64 %35, %36 %add36 = add i64 %add32, %30 %add37 = add i64 %add36, %34 br label %if.end61 if.else49: ; preds = %land.lhs.true %arrayidx51 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %i.2101 %37 = load i64, ptr %arrayidx51, align 8, !tbaa !5 %sub52 = add nsw i64 %24, -2 %arrayidx53 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %sub52 %38 = load i64, ptr %arrayidx53, align 8, !tbaa !5 %sub54 = sub nsw i64 %37, %38 %39 = call i64 @llvm.abs.i64(i64 %sub54, i1 true) %40 = call i64 @llvm.abs.i64(i64 %38, i1 true) %41 = load i64, ptr %a, align 16, !tbaa !5 %42 = call i64 @llvm.abs.i64(i64 %41, i1 true) %add59 = add i64 %40, %sum.0.lcssa %sub55 = sub i64 %add59, %39 %add60 = add i64 %sub55, %42 br label %if.end61 if.end61: ; preds = %if.else49, %if.then %suma.0 = phi i64 [ %add37, %if.then ], [ %add60, %if.else49 ] %call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %suma.0) %inc64 = add nuw nsw i64 %i.2101, 1 %43 = load i64, ptr %n, align 8, !tbaa !5 %cmp12 = icmp slt i64 %inc64, %43 br i1 %cmp12, label %land.lhs.true, label %for.end65, !llvm.loop !15 for.end65: ; preds = %if.end61, %entry, %if.end61.peel, %for.cond11.preheader call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 8, 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: 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 speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #4 ; 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 <2 x i64> @llvm.abs.v2i64(<2 x i64>, i1 immarg) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10, !16} !16 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(void) { long long int a,b,c,d,e,f,g,h,z; scanf("%lld%lld%lld%lld",&a,&b,&c,&d); e=a*c; f=a*d; g=b*c; h=b*d; z=e; if(z<f) z=f; if(z<g) z=g; if(z<h) z=h; printf("%lld",z); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184107/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184107/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %2, %0 %3 = load i64, ptr %b, align 8, !tbaa !5 %mul2 = mul nsw i64 %3, %1 %mul3 = mul nsw i64 %3, %2 %spec.select = call i64 @llvm.smax.i64(i64 %mul, i64 %mul1) %z.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %mul2) %z.2 = call i64 @llvm.smax.i64(i64 %z.1, i64 %mul3) %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %z.2) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define ll long long int int main(){ ll a,b,c,d; scanf("%lld %lld %lld %lld",&a,&b,&c,&d); ll ans_a1 = a*c; ll ans_a2 = a*d; ll ans_b1 = b*c; ll ans_b2 = b*d; if (ans_a1>ans_a2&&ans_a1>ans_b1&&ans_a1>ans_b2){ printf("%lld\n",ans_a1); } else if(ans_a2>ans_a1&&ans_a2>ans_b1&&ans_a2>ans_b2){ printf("%lld\n",ans_a2); } else if(ans_b1>ans_a1&&ans_b1>ans_a2&&ans_b1>ans_b2){ printf("%lld\n",ans_b1); } else{ printf("%lld\n",ans_b2); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184150/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184150/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %2, %0 %3 = load i64, ptr %b, align 8, !tbaa !5 %mul2 = mul nsw i64 %3, %1 %mul3 = mul nsw i64 %3, %2 %cmp = icmp sgt i64 %mul, %mul1 %cmp4 = icmp sgt i64 %mul, %mul2 %or.cond = select i1 %cmp, i1 %cmp4, i1 false %cmp6 = icmp sgt i64 %mul, %mul3 %or.cond45 = select i1 %or.cond, i1 %cmp6, i1 false br i1 %or.cond45, label %if.end26, label %if.else if.else: ; preds = %entry %cmp8 = icmp sgt i64 %mul1, %mul %cmp10 = icmp sgt i64 %mul1, %mul2 %or.cond46 = select i1 %cmp8, i1 %cmp10, i1 false %cmp12 = icmp sgt i64 %mul1, %mul3 %or.cond47 = select i1 %or.cond46, i1 %cmp12, i1 false br i1 %or.cond47, label %if.end26, label %if.else15 if.else15: ; preds = %if.else %cmp16 = icmp sgt i64 %mul2, %mul %cmp18 = icmp sgt i64 %mul2, %mul1 %or.cond48 = and i1 %cmp16, %cmp18 %cmp20 = icmp sgt i64 %mul2, %mul3 %or.cond49 = select i1 %or.cond48, i1 %cmp20, i1 false %mul2.mul3 = select i1 %or.cond49, i64 %mul2, i64 %mul3 br label %if.end26 if.end26: ; preds = %if.else15, %if.else, %entry %mul1.sink = phi i64 [ %mul, %entry ], [ %mul1, %if.else ], [ %mul2.mul3, %if.else15 ] %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul1.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { long long a,b,c,d; scanf("%lld%lld%lld%lld",&a,&b,&c,&d); long long arr[4]; arr[0] = a*c; arr[1] = a*d; arr[2] = b*c; arr[3] = b*d; long long max = arr[0]; for(int i=1;i<4;i++) { if(arr[i] > max) max = arr[i]; } printf("%lld",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184194/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184194/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %2, %0 %3 = load i64, ptr %b, align 8, !tbaa !5 %mul3 = mul nsw i64 %3, %1 %mul5 = mul nsw i64 %3, %2 %spec.select = call i64 @llvm.smax.i64(i64 %mul1, i64 %mul) %spec.select.1 = call i64 @llvm.smax.i64(i64 %mul3, i64 %spec.select) %spec.select.2 = call i64 @llvm.smax.i64(i64 %mul5, i64 %spec.select.1) %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select.2) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4 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 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.smax.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> int main(){ long long int a,b,c,d,ans; scanf("%lld %lld %lld %lld",&a,&b,&c,&d); if(a>0 && c>0) ans=b*d; else if(b<0 && d<0) ans=a*c; else if(a>0 && d<0) ans=a*d; else if(c>0 && b<0) ans=b*c; else if(b>0 && d>0 && a>0 || c>0) ans=b*d; else if(a<0 && c<0 && b<0 || d<0) ans=a*c; else{ if(a*c>b*d) ans=a*c; else ans=b*d; } printf("%lld",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184237/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184237/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8 %cmp = icmp sgt i64 %0, 0 %1 = load i64, ptr %c, align 8 %cmp1 = icmp sgt i64 %1, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false %2 = load i64, ptr %b, align 8 br i1 %or.cond, label %if.then, label %if.else if.then: ; preds = %entry %3 = load i64, ptr %d, align 8, !tbaa !5 %mul = mul nsw i64 %3, %2 br label %if.end51 if.else: ; preds = %entry %cmp2 = icmp slt i64 %2, 0 %4 = load i64, ptr %d, align 8 %cmp4 = icmp slt i64 %4, 0 %or.cond53 = select i1 %cmp2, i1 %cmp4, i1 false br i1 %or.cond53, label %if.then5, label %if.else7 if.then5: ; preds = %if.else %mul6 = mul nsw i64 %1, %0 br label %if.end51 if.else7: ; preds = %if.else %or.cond54 = select i1 %cmp, i1 %cmp4, i1 false br i1 %or.cond54, label %if.then11, label %if.else13 if.then11: ; preds = %if.else7 %mul12 = mul nsw i64 %4, %0 br label %if.end51 if.else13: ; preds = %if.else7 %or.cond55 = and i1 %cmp1, %cmp2 br i1 %or.cond55, label %if.then17, label %if.else19 if.then17: ; preds = %if.else13 %mul18 = mul nsw i64 %2, %1 br label %if.end51 if.else19: ; preds = %if.else13 %cmp20 = icmp sgt i64 %2, 0 %cmp22 = icmp sgt i64 %4, 0 %or.cond56 = select i1 %cmp20, i1 %cmp22, i1 false %or.cond57 = and i1 %cmp, %or.cond56 %or.cond58 = select i1 %or.cond57, i1 true, i1 %cmp1 br i1 %or.cond58, label %if.then26, label %if.else28 if.then26: ; preds = %if.else19 %mul27 = mul nsw i64 %4, %2 br label %if.end51 if.else28: ; preds = %if.else19 %cmp29 = icmp slt i64 %0, 0 %5 = and i64 %2, %1 %6 = icmp slt i64 %5, 0 %or.cond60 = select i1 %cmp29, i1 %6, i1 false %or.cond61 = select i1 %or.cond60, i1 true, i1 %cmp4 %mul37 = mul nsw i64 %1, %0 br i1 %or.cond61, label %if.end51, label %if.else38 if.else38: ; preds = %if.else28 %mul40 = mul nsw i64 %4, %2 %mul39.mul40 = call i64 @llvm.smax.i64(i64 %mul37, i64 %mul40) br label %if.end51 if.end51: ; preds = %if.else28, %if.else38, %if.then5, %if.then17, %if.then26, %if.then11, %if.then %ans.0 = phi i64 [ %mul, %if.then ], [ %mul6, %if.then5 ], [ %mul12, %if.then11 ], [ %mul18, %if.then17 ], [ %mul27, %if.then26 ], [ %mul39.mul40, %if.else38 ], [ %mul37, %if.else28 ] %call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> long long MAX(long long a,long long b){return a<b?b:a;} int main(){ long long a,b,c,d,m=-1e18; scanf("%lld %lld %lld %lld",&a,&b,&c,&d); m=MAX(m,a*c); m=MAX(m,b*c); m=MAX(m,a*d); m=MAX(m,b*d); printf("%lld\n",m); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184280/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184280/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @MAX(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) ret i64 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %b, align 8, !tbaa !5 %mul2 = mul nsw i64 %2, %1 %cond.i = call i64 @llvm.smax.i64(i64 %mul, i64 %mul2) %3 = load i64, ptr %d, align 8, !tbaa !5 %mul4 = mul nsw i64 %3, %0 %cond.i13 = call i64 @llvm.smax.i64(i64 %cond.i, i64 %mul4) %mul6 = mul nsw i64 %3, %2 %cond.i14 = call i64 @llvm.smax.i64(i64 %cond.i13, i64 %mul6) %cond.i15 = call i64 @llvm.smax.i64(i64 %cond.i14, i64 -1000000000000000000) %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond.i15) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 8, 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: 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 i64 @llvm.smax.i64(i64, i64) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !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, x2, x3; double y1, y2, y3; double a1, a2, b1, b2; double px, py, r; int n; double A1, B1, C1, A2, B2, C2; scanf("%d", &n); while (n--){ scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); A1 = 2.0*(x2-x1); B1 = 2.0*(y2-y1); C1 = x1*x1-x2*x2+y1*y1-y2*y2; A2 = 2.0*(x3-x1); B2 = 2.0*(y3-y1); C2 = x1*x1-x3*x3+y1*y1-y3*y3; px = (B1*C2-B2*C1)/(A1*B2-A2*B1); py = (C1*A2-C2*A1)/(A1*B2-A2*B1); r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1)); printf("%.3lf %.3lf %.3lf\n", px, py, r); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184323/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184323/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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [19 x i8] c"%.3lf %.3lf %.3lf\0A\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 %x3 = alloca double, align 8 %y1 = alloca double, align 8 %y2 = alloca double, align 8 %y3 = alloca double, align 8 %n = alloca i32, align 4 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 %x3) #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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec54 = add nsw i32 %0, -1 store i32 %dec54, ptr %n, align 4, !tbaa !5 %tobool.not55 = icmp eq i32 %0, 0 br i1 %tobool.not55, 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 %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load double, ptr %x2, align 8, !tbaa !9 %2 = load double, ptr %x1, align 8, !tbaa !9 %3 = load double, ptr %y2, align 8, !tbaa !9 %4 = load double, ptr %y1, align 8, !tbaa !9 %5 = fneg double %1 %neg = fmul double %1, %5 %6 = call double @llvm.fmuladd.f64(double %2, double %2, double %neg) %7 = call double @llvm.fmuladd.f64(double %4, double %4, double %6) %neg8 = fneg double %3 %8 = call double @llvm.fmuladd.f64(double %neg8, double %3, double %7) %9 = load double, ptr %x3, align 8, !tbaa !9 %10 = load double, ptr %y3, align 8, !tbaa !9 %11 = fneg double %9 %neg15 = fmul double %9, %11 %12 = call double @llvm.fmuladd.f64(double %2, double %2, double %neg15) %13 = call double @llvm.fmuladd.f64(double %4, double %4, double %12) %neg18 = fneg double %10 %14 = call double @llvm.fmuladd.f64(double %neg18, double %10, double %13) %15 = insertelement <2 x double> poison, double %3, i64 0 %16 = insertelement <2 x double> %15, double %1, i64 1 %17 = insertelement <2 x double> poison, double %4, i64 0 %18 = insertelement <2 x double> %17, double %2, i64 1 %19 = fsub <2 x double> %16, %18 %20 = fmul <2 x double> %19, <double 2.000000e+00, double 2.000000e+00> %21 = insertelement <2 x double> poison, double %10, i64 0 %22 = insertelement <2 x double> %21, double %9, i64 1 %23 = fsub <2 x double> %22, %18 %24 = fmul <2 x double> %23, <double 2.000000e+00, double 2.000000e+00> %25 = fneg <2 x double> %24 %26 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %27 = insertelement <2 x double> %26, double %8, i64 0 %28 = fmul <2 x double> %27, %25 %29 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %30 = insertelement <2 x double> %29, double %14, i64 0 %31 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %30, <2 x double> %28) %32 = extractelement <2 x double> %31, i64 0 %33 = extractelement <2 x double> %31, i64 1 %div = fdiv double %32, %33 %34 = fneg double %14 %35 = extractelement <2 x double> %20, i64 1 %neg27 = fmul double %35, %34 %36 = extractelement <2 x double> %24, i64 1 %37 = call double @llvm.fmuladd.f64(double %8, double %36, double %neg27) %div31 = fdiv double %37, %33 %sub32 = fsub double %div, %2 %sub35 = fsub double %div31, %4 %mul37 = fmul double %sub35, %sub35 %38 = call double @llvm.fmuladd.f64(double %sub32, double %sub32, double %mul37) %sqrt = call double @llvm.sqrt.f64(double %38) %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div, double noundef %div31, double noundef %sqrt) %39 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %39, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %39, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #5 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 %x3) #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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <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 = { 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 = !{!10, !10, i64 0} !10 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> int main(void) { int n, i; double x1, x2, x3, y1, y2, y3, px, py, r; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); px = ((y1-y3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(y1-y2)*(y1*y1-y3*y3+x1*x1-x3*x3)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3)); py = ((x1-x3)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x1-x2)*(x1*x1-x3*x3+y1*y1-y3*y3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3)); r = sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py)); printf("%.3f %.3f %.3f\n", px, py, r); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184367/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184367/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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x1 = alloca double, align 8 %x2 = alloca double, align 8 %x3 = alloca double, align 8 %y1 = alloca double, align 8 %y2 = alloca double, align 8 %y3 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 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 %x3) #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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp61 = icmp sgt i32 %0, 0 br i1 %cmp61, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.062 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load double, ptr %y1, align 8, !tbaa !9 %2 = load double, ptr %y3, align 8, !tbaa !9 %3 = load double, ptr %y2, align 8, !tbaa !9 %4 = fneg double %3 %neg = fmul double %3, %4 %5 = call double @llvm.fmuladd.f64(double %1, double %1, double %neg) %6 = load double, ptr %x1, align 8, !tbaa !9 %7 = call double @llvm.fmuladd.f64(double %6, double %6, double %5) %8 = load double, ptr %x2, align 8, !tbaa !9 %neg3 = fneg double %8 %9 = call double @llvm.fmuladd.f64(double %neg3, double %8, double %7) %sub4 = fsub double %1, %3 %10 = fneg double %2 %neg7 = fmul double %2, %10 %11 = call double @llvm.fmuladd.f64(double %1, double %1, double %neg7) %12 = call double @llvm.fmuladd.f64(double %6, double %6, double %11) %13 = load double, ptr %x3, align 8, !tbaa !9 %neg10 = fneg double %13 %14 = call double @llvm.fmuladd.f64(double %neg10, double %13, double %12) %15 = fneg double %sub4 %sub14 = fsub double %6, %8 %16 = fmul double %sub4, -2.000000e+00 %sub = fsub double %1, %2 %mul = fmul double %sub, 2.000000e+00 %17 = insertelement <2 x double> poison, double %14, i64 0 %18 = insertelement <2 x double> %17, double %16, i64 1 %19 = insertelement <2 x double> poison, double %15, i64 0 %20 = insertelement <2 x double> poison, double %sub, i64 0 %21 = insertelement <2 x double> %20, double %mul, i64 1 %22 = insertelement <2 x double> poison, double %9, i64 0 %23 = insertelement <2 x double> %22, double %sub14, i64 1 %neg24 = fmul double %8, %neg3 %24 = call double @llvm.fmuladd.f64(double %6, double %6, double %neg24) %25 = call double @llvm.fmuladd.f64(double %1, double %1, double %24) %26 = call double @llvm.fmuladd.f64(double %4, double %3, double %25) %neg32 = fmul double %13, %neg10 %27 = call double @llvm.fmuladd.f64(double %6, double %6, double %neg32) %28 = call double @llvm.fmuladd.f64(double %1, double %1, double %27) %29 = call double @llvm.fmuladd.f64(double %10, double %2, double %28) %30 = fneg double %sub14 %31 = fmul double %sub14, -2.000000e+00 %sub18 = fsub double %6, %13 %32 = insertelement <2 x double> %19, double %sub18, i64 1 %33 = fmul <2 x double> %18, %32 %34 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %23, <2 x double> %33) %35 = extractelement <2 x double> %34, i64 0 %36 = extractelement <2 x double> %34, i64 1 %div = fdiv double %35, %36 %mul39 = fmul double %sub18, 2.000000e+00 %37 = insertelement <2 x double> poison, double %29, i64 0 %38 = insertelement <2 x double> %37, double %sub, i64 1 %39 = insertelement <2 x double> poison, double %30, i64 0 %40 = insertelement <2 x double> %39, double %31, i64 1 %41 = fmul <2 x double> %38, %40 %42 = insertelement <2 x double> poison, double %sub18, i64 0 %43 = insertelement <2 x double> %42, double %mul39, i64 1 %44 = insertelement <2 x double> poison, double %26, i64 0 %45 = insertelement <2 x double> %44, double %sub4, i64 1 %46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %45, <2 x double> %41) %47 = extractelement <2 x double> %46, i64 0 %48 = extractelement <2 x double> %46, i64 1 %div47 = fdiv double %47, %48 %sub48 = fsub double %6, %div %sub51 = fsub double %1, %div47 %mul53 = fmul double %sub51, %sub51 %49 = call double @llvm.fmuladd.f64(double %sub48, double %sub48, double %mul53) %sqrt = call double @llvm.sqrt.f64(double %49) %call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div, double noundef %div47, double noundef %sqrt) %inc = add nuw nsw i32 %i.062, 1 %50 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %50 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #5 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 %x3) #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 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <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 = { 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 = !{!10, !10, i64 0} !10 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> /* prototype declaration */ void calc(double x0, double y0, double x1, double y1, double x2, double y2); void init(); double xr, yr, r; int main(int argc, const char *argv[]) { int cnt = getchar() - '0'; double x0, y0, x1, y1, x2, y2; init(); for(; cnt>0; cnt--){ scanf("%lf %lf %lf %lf %lf %lf",&x0, &y0, &x1, &y1, &x2, &y2); calc(x0, y0, x1, y1, x2, y2); printf("%.3f %.3f %.3f\n", xr, yr, r); } return 0; } void init() { xr = 0.0; yr = 0.0; r = 0.0; } void calc(double x0, double y0, double x1, double y1, double x2, double y2) { double a, b, c, d, e, f, det; a = 2*(x1 - x0); b = 2*(y1 - y0); c = 2*(x2 - x0); d = 2*(y2 - y0); e = x1*x1 - x0*x0 + y1*y1 - y0*y0; f = x2*x2 - x0*x0 + y2*y2 - y0*y0; det = a*d - b*c; xr = (d*e - b*f)/det; yr = (a*f - c*e)/det; r = sqrt((x0-xr)*(x0-xr) + (y0-yr)*(y0-yr)); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184417/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184417/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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1 @xr = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @yr = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @r = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %x0 = alloca double, align 8 %y0 = alloca double, align 8 %x1 = alloca double, align 8 %y1 = alloca double, align 8 %x2 = alloca double, align 8 %y2 = alloca double, align 8 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i = tail call i32 @getc(ptr noundef %0) call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x0) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y0) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #7 store double 0.000000e+00, ptr @xr, align 8, !tbaa !9 store double 0.000000e+00, ptr @yr, align 8, !tbaa !9 store double 0.000000e+00, ptr @r, align 8, !tbaa !9 %cmp4 = icmp sgt i32 %call.i, 48 br i1 %cmp4, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %sub = add nsw i32 %call.i, -48 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %cnt.05 = phi i32 [ %dec, %for.body ], [ %sub, %for.body.preheader ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x0, ptr noundef nonnull %y0, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2) %1 = load double, ptr %x0, align 8, !tbaa !9 %2 = load double, ptr %y0, align 8, !tbaa !9 %3 = load double, ptr %x1, align 8, !tbaa !9 %4 = load double, ptr %y1, align 8, !tbaa !9 %5 = load double, ptr %x2, align 8, !tbaa !9 %6 = load double, ptr %y2, align 8, !tbaa !9 %sub1.i = fsub double %4, %2 %sub3.i = fsub double %5, %1 %mul4.i = fmul double %sub3.i, 2.000000e+00 %7 = fneg double %1 %neg.i = fmul double %1, %7 %8 = call double @llvm.fmuladd.f64(double %3, double %3, double %neg.i) %9 = call double @llvm.fmuladd.f64(double %4, double %4, double %8) %neg11.i = fneg double %2 %10 = call double @llvm.fmuladd.f64(double %neg11.i, double %2, double %9) %11 = call double @llvm.fmuladd.f64(double %5, double %5, double %neg.i) %12 = call double @llvm.fmuladd.f64(double %6, double %6, double %11) %13 = call double @llvm.fmuladd.f64(double %neg11.i, double %2, double %12) %14 = fmul double %sub1.i, -2.000000e+00 %15 = insertelement <2 x double> poison, double %6, i64 0 %16 = insertelement <2 x double> %15, double %3, i64 1 %17 = insertelement <2 x double> poison, double %2, i64 0 %18 = insertelement <2 x double> %17, double %1, i64 1 %19 = fsub <2 x double> %16, %18 %20 = fmul <2 x double> %19, <double 2.000000e+00, double 2.000000e+00> %21 = insertelement <2 x double> poison, double %14, i64 0 %22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer %23 = insertelement <2 x double> poison, double %13, i64 0 %24 = insertelement <2 x double> %23, double %mul4.i, i64 1 %25 = fmul <2 x double> %22, %24 %26 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %27 = insertelement <2 x double> %26, double %10, i64 0 %28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %27, <2 x double> %25) %29 = extractelement <2 x double> %28, i64 0 %30 = extractelement <2 x double> %28, i64 1 %div.i = fdiv double %29, %30 store double %div.i, ptr @xr, align 8, !tbaa !9 %31 = fneg double %mul4.i %neg26.i = fmul double %10, %31 %32 = extractelement <2 x double> %20, i64 1 %33 = call double @llvm.fmuladd.f64(double %32, double %13, double %neg26.i) %div27.i = fdiv double %33, %30 store double %div27.i, ptr @yr, align 8, !tbaa !9 %sub28.i = fsub double %1, %div.i %sub31.i = fsub double %2, %div27.i %mul33.i = fmul double %sub31.i, %sub31.i %34 = call double @llvm.fmuladd.f64(double %sub28.i, double %sub28.i, double %mul33.i) %sqrt.i = call double @llvm.sqrt.f64(double %34) store double %sqrt.i, ptr @r, align 8, !tbaa !9 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div.i, double noundef %div27.i, double noundef %sqrt.i) %dec = add nsw i32 %cnt.05, -1 %cmp = icmp ugt i32 %cnt.05, 1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y0) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x0) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable define dso_local void @calc(double noundef %x0, double noundef %y0, double noundef %x1, double noundef %y1, double noundef %x2, double noundef %y2) local_unnamed_addr #3 { entry: %0 = insertelement <2 x double> poison, double %y2, i64 0 %1 = insertelement <2 x double> %0, double %x1, i64 1 %2 = insertelement <2 x double> poison, double %y0, i64 0 %3 = insertelement <2 x double> %2, double %x0, i64 1 %4 = fsub <2 x double> %1, %3 %sub1 = fsub double %y1, %y0 %sub3 = fsub double %x2, %x0 %mul4 = fmul double %sub3, 2.000000e+00 %5 = fneg double %x0 %neg = fmul double %5, %x0 %6 = tail call double @llvm.fmuladd.f64(double %x1, double %x1, double %neg) %7 = tail call double @llvm.fmuladd.f64(double %y1, double %y1, double %6) %neg11 = fneg double %y0 %8 = tail call double @llvm.fmuladd.f64(double %neg11, double %y0, double %7) %9 = tail call double @llvm.fmuladd.f64(double %x2, double %x2, double %neg) %10 = tail call double @llvm.fmuladd.f64(double %y2, double %y2, double %9) %11 = tail call double @llvm.fmuladd.f64(double %neg11, double %y0, double %10) %12 = fmul double %sub1, -2.000000e+00 %13 = fmul <2 x double> %4, <double 2.000000e+00, double 2.000000e+00> %14 = insertelement <2 x double> poison, double %12, i64 0 %15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer %16 = insertelement <2 x double> poison, double %11, i64 0 %17 = insertelement <2 x double> %16, double %mul4, i64 1 %18 = fmul <2 x double> %15, %17 %19 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %20 = insertelement <2 x double> %19, double %8, i64 0 %21 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %20, <2 x double> %18) %22 = extractelement <2 x double> %21, i64 0 %23 = extractelement <2 x double> %21, i64 1 %div = fdiv double %22, %23 store double %div, ptr @xr, align 8, !tbaa !9 %24 = fneg double %mul4 %neg26 = fmul double %8, %24 %25 = extractelement <2 x double> %13, i64 1 %26 = tail call double @llvm.fmuladd.f64(double %25, double %11, double %neg26) %div27 = fdiv double %26, %23 store double %div27, ptr @yr, align 8, !tbaa !9 %sub28 = fsub double %x0, %div %sub31 = fsub double %y0, %div27 %mul33 = fmul double %sub31, %sub31 %27 = tail call double @llvm.fmuladd.f64(double %sub28, double %sub28, double %mul33) %sqrt = tail call double @llvm.sqrt.f64(double %27) store double %sqrt, ptr @r, align 8, !tbaa !9 ret void } ; 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 nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable define dso_local void @init() local_unnamed_addr #4 { entry: store double 0.000000e+00, ptr @xr, align 8, !tbaa !9 store double 0.000000e+00, ptr @yr, align 8, !tbaa !9 store double 0.000000e+00, ptr @r, align 8, !tbaa !9 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #5 ; 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 double @llvm.sqrt.f64(double) #6 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6 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 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 #4 = { mustprogress nofree norecurse 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> void chk(float x1,float y1,float x2,float y2,float x3,float y3); int main(){ int sn; float x1,y1,x2,y2,x3,y3; int i; scanf("%d",&sn); for(i=1;i<=sn;i++){ scanf("%f %f %f %f %f %f ",&x1,&y1,&x2,&y2,&x3,&y3); chk(x1,y1,x2,y2,x3,y3); } return 0; } void chk(float x1,float y1,float x2,float y2,float x3,float y3){ float a,b,c,d,e,f; float x,y; double R; // (x1,y1)(x2,y2) line // (y1-y2)X - (x1-x2)Y = (y1-y2)x2 - (x1-x2)y2 // -> vertical & center-cross // (x1-x2)(X - (x1+x2)/2 ) + (y1-y2) (Y - (y1+y2)/2 ) =0 // -> // (x1-x2)X +(y1-y2)Y = (x1^2-x2^2)/2 + (y1^2-y2-2)/2 a=x1-x2; b=y1-y2; c=x1*x1-x2*x2 + y1*y1-y2*y2; c=c/2.0; d=x3-x2; e=y3-y2; f=x3*x3-x2*x2 + y3*y3-y2*y2; f=f/2.0; x=(-e*c+b*f)/(-a*e+b*d); y=(+d*c-a*f)/(-a*e+b*d); R=sqrt((double)((x1-x)*(x1-x)+(y1-y)*(y1-y))); if(y<0.0005 && y>=-0.0005)y=0.0; if(y<0.0005 && y>=-0.0005)y=0.0; printf("%.3f %.3f %.3lf\n",x,y,R); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184460/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184460/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 [19 x i8] c"%f %f %f %f %f %f \00", align 1 @.str.2 = private unnamed_addr constant [17 x i8] c"%.3f %.3f %.3lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %sn = alloca i32, align 4 %x1 = alloca float, align 4 %y1 = alloca float, align 4 %x2 = alloca float, align 4 %y2 = alloca float, align 4 %x3 = alloca float, align 4 %y3 = alloca float, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sn) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x3) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y3) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sn) %0 = load i32, ptr %sn, align 4, !tbaa !5 %cmp.not3 = icmp slt i32 %0, 1 br i1 %cmp.not3, label %for.end, label %for.body for.body: ; preds = %entry, %for.body %i.04 = phi i32 [ %inc, %for.body ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load float, ptr %x1, align 4, !tbaa !9 %2 = load float, ptr %y1, align 4, !tbaa !9 %3 = load float, ptr %x2, align 4, !tbaa !9 %4 = load float, ptr %y2, align 4, !tbaa !9 %5 = load float, ptr %x3, align 4, !tbaa !9 %6 = load float, ptr %y3, align 4, !tbaa !9 %sub.i = fsub float %1, %3 %sub1.i = fsub float %2, %4 %7 = fneg float %3 %neg.i = fmul float %3, %7 %8 = call float @llvm.fmuladd.f32(float %1, float %1, float %neg.i) %9 = call float @llvm.fmuladd.f32(float %2, float %2, float %8) %neg3.i = fneg float %4 %10 = call float @llvm.fmuladd.f32(float %neg3.i, float %4, float %9) %conv4.i = fmul float %10, 5.000000e-01 %sub5.i = fsub float %5, %3 %sub6.i = fsub float %6, %4 %11 = call float @llvm.fmuladd.f32(float %5, float %5, float %neg.i) %12 = call float @llvm.fmuladd.f32(float %6, float %6, float %11) %13 = call float @llvm.fmuladd.f32(float %neg3.i, float %4, float %12) %conv12.i = fmul float %13, 5.000000e-01 %fneg.i = fneg float %sub6.i %mul13.i = fmul float %sub1.i, %conv12.i %14 = call float @llvm.fmuladd.f32(float %fneg.i, float %conv4.i, float %mul13.i) %fneg14.i = fneg float %sub.i %mul15.i = fmul float %sub1.i, %sub5.i %15 = call float @llvm.fmuladd.f32(float %fneg14.i, float %sub6.i, float %mul15.i) %div16.i = fdiv float %14, %15 %neg18.i = fmul float %conv12.i, %fneg14.i %16 = call float @llvm.fmuladd.f32(float %sub5.i, float %conv4.i, float %neg18.i) %div21.i = fdiv float %16, %15 %sub22.i = fsub float %1, %div16.i %sub24.i = fsub float %2, %div21.i %mul26.i = fmul float %sub24.i, %sub24.i %17 = call float @llvm.fmuladd.f32(float %sub22.i, float %sub22.i, float %mul26.i) %conv27.i = fpext float %17 to double %sqrt.i = call double @llvm.sqrt.f64(double %conv27.i) %conv28.i = fpext float %div21.i to double %cmp.i = fcmp uge double %conv28.i, 5.000000e-04 %cmp31.i = fcmp ult double %conv28.i, -5.000000e-04 %or.cond.i = or i1 %cmp.i, %cmp31.i %conv33.i = select i1 %or.cond.i, double %conv28.i, double 0.000000e+00 %cmp34.i = fcmp uge double %conv33.i, 5.000000e-04 %cmp38.i = fcmp ult double %conv33.i, -5.000000e-04 %or.cond87.i = or i1 %cmp34.i, %cmp38.i %conv42.i = fpext float %div16.i to double %conv43.i = select i1 %or.cond87.i, double %conv33.i, double 0.000000e+00 %call44.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %conv42.i, double noundef %conv43.i, double noundef %sqrt.i) %inc = add nuw nsw i32 %i.04, 1 %18 = load i32, ptr %sn, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.04, %18 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y3) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x3) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sn) #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 uwtable define dso_local void @chk(float noundef %x1, float noundef %y1, float noundef %x2, float noundef %y2, float noundef %x3, float noundef %y3) local_unnamed_addr #0 { entry: %sub = fsub float %x1, %x2 %sub1 = fsub float %y1, %y2 %0 = fneg float %x2 %neg = fmul float %0, %x2 %1 = tail call float @llvm.fmuladd.f32(float %x1, float %x1, float %neg) %2 = tail call float @llvm.fmuladd.f32(float %y1, float %y1, float %1) %neg3 = fneg float %y2 %3 = tail call float @llvm.fmuladd.f32(float %neg3, float %y2, float %2) %conv4 = fmul float %3, 5.000000e-01 %sub5 = fsub float %x3, %x2 %sub6 = fsub float %y3, %y2 %4 = tail call float @llvm.fmuladd.f32(float %x3, float %x3, float %neg) %5 = tail call float @llvm.fmuladd.f32(float %y3, float %y3, float %4) %6 = tail call float @llvm.fmuladd.f32(float %neg3, float %y2, float %5) %conv12 = fmul float %6, 5.000000e-01 %fneg = fneg float %sub6 %mul13 = fmul float %sub1, %conv12 %7 = tail call float @llvm.fmuladd.f32(float %fneg, float %conv4, float %mul13) %fneg14 = fneg float %sub %mul15 = fmul float %sub1, %sub5 %8 = tail call float @llvm.fmuladd.f32(float %fneg14, float %sub6, float %mul15) %div16 = fdiv float %7, %8 %neg18 = fmul float %conv12, %fneg14 %9 = tail call float @llvm.fmuladd.f32(float %sub5, float %conv4, float %neg18) %div21 = fdiv float %9, %8 %sub22 = fsub float %x1, %div16 %sub24 = fsub float %y1, %div21 %mul26 = fmul float %sub24, %sub24 %10 = tail call float @llvm.fmuladd.f32(float %sub22, float %sub22, float %mul26) %conv27 = fpext float %10 to double %sqrt = tail call double @llvm.sqrt.f64(double %conv27) %conv28 = fpext float %div21 to double %cmp = fcmp uge double %conv28, 5.000000e-04 %cmp31 = fcmp ult double %conv28, -5.000000e-04 %or.cond = or i1 %cmp, %cmp31 %11 = fpext float %div21 to double %conv33 = select i1 %or.cond, double %11, double 0.000000e+00 %cmp34 = fcmp uge double %conv33, 5.000000e-04 %cmp38 = fcmp ult double %conv33, -5.000000e-04 %or.cond87 = or i1 %cmp34, %cmp38 %conv42 = fpext float %div16 to double %conv43 = select i1 %or.cond87, double %conv33, double 0.000000e+00 %call44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %conv42, double noundef %conv43, double noundef %sqrt) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare float @llvm.fmuladd.f32(float, float, float) #3 ; 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 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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"float", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> int main(void) { int n; int i; scanf("%d", &n); for(i = 0; i < n; i++) { double x1, x2, x3; double y1, y2, y3; double a, b, c, s, S; double A, B, f, g, h, i; double px, py, r; scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); a = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); b = sqrt(pow(x2 - x3, 2) + pow(y2 - y3, 2)); c = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2)); s = (a + b + c) / 2; S = sqrt(s * (s - a) * (s - b) * (s - c)); r = (a * b * c) / (4 * S); f = 2 * (x1 - x2); g = 2 * (y1 - y2); h = 2 * (x1 - x3); i = 2 * (y1 - y3); A = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; B = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; px = (A * i - B * g) / (f * i - g * h); py = (A * h - B * f) / (g * h - f * i); printf("%.3f %.3f %.3f\n", px, py, r); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184503/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184503/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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x1 = alloca double, align 8 %x2 = alloca double, align 8 %x3 = alloca double, align 8 %y1 = alloca double, align 8 %y2 = alloca double, align 8 %y3 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp92 = icmp sgt i32 %0, 0 br i1 %cmp92, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.093 = phi i32 [ %inc, %for.body ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #6 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load double, ptr %x1, align 8, !tbaa !9 %2 = load double, ptr %x2, align 8, !tbaa !9 %3 = load double, ptr %y1, align 8, !tbaa !9 %4 = load double, ptr %y2, align 8, !tbaa !9 %5 = load double, ptr %x3, align 8, !tbaa !9 %6 = load double, ptr %y3, align 8, !tbaa !9 %7 = insertelement <2 x double> poison, double %1, i64 0 %8 = insertelement <2 x double> %7, double %2, i64 1 %9 = insertelement <2 x double> poison, double %2, i64 0 %10 = insertelement <2 x double> %9, double %5, i64 1 %11 = fsub <2 x double> %8, %10 %12 = fmul <2 x double> %11, %11 %13 = insertelement <2 x double> poison, double %3, i64 0 %14 = insertelement <2 x double> %13, double %4, i64 1 %15 = insertelement <2 x double> poison, double %4, i64 0 %16 = insertelement <2 x double> %15, double %6, i64 1 %17 = fsub <2 x double> %14, %16 %18 = fmul <2 x double> %17, %17 %19 = fadd <2 x double> %12, %18 %20 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %19) %21 = insertelement <2 x double> poison, double %5, i64 0 %22 = insertelement <2 x double> %21, double %6, i64 1 %23 = insertelement <2 x double> %7, double %3, i64 1 %24 = fsub <2 x double> %22, %23 %25 = fmul <2 x double> %24, %24 %shift = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %26 = fadd <2 x double> %25, %shift %add17 = extractelement <2 x double> %26, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add17) %27 = extractelement <2 x double> %20, i64 0 %28 = extractelement <2 x double> %20, i64 1 %add19 = fadd double %27, %28 %add20 = fadd double %add19, %sqrt %div = fmul double %add20, 5.000000e-01 %sub21 = fsub double %div, %27 %mul = fmul double %div, %sub21 %sub22 = fsub double %div, %28 %mul23 = fmul double %sub22, %mul %sub24 = fsub double %div, %sqrt %mul25 = fmul double %sub24, %mul23 %call26 = call double @sqrt(double noundef %mul25) #6 %mul27 = fmul double %27, %28 %mul28 = fmul double %mul27, %sqrt %mul29 = fmul double %call26, 4.000000e+00 %div30 = fdiv double %mul28, %mul29 %29 = load double, ptr %x1, align 8, !tbaa !9 %30 = load double, ptr %x2, align 8, !tbaa !9 %31 = load double, ptr %y1, align 8, !tbaa !9 %32 = load double, ptr %y2, align 8, !tbaa !9 %33 = load double, ptr %x3, align 8, !tbaa !9 %34 = load double, ptr %y3, align 8, !tbaa !9 %35 = fneg double %30 %neg = fmul double %30, %35 %36 = call double @llvm.fmuladd.f64(double %29, double %29, double %neg) %37 = call double @llvm.fmuladd.f64(double %31, double %31, double %36) %neg43 = fneg double %32 %38 = call double @llvm.fmuladd.f64(double %neg43, double %32, double %37) %39 = fneg double %33 %neg46 = fmul double %33, %39 %40 = call double @llvm.fmuladd.f64(double %29, double %29, double %neg46) %41 = call double @llvm.fmuladd.f64(double %31, double %31, double %40) %neg49 = fneg double %34 %42 = call double @llvm.fmuladd.f64(double %neg49, double %34, double %41) %43 = insertelement <2 x double> poison, double %31, i64 0 %44 = insertelement <2 x double> %43, double %29, i64 1 %45 = insertelement <2 x double> poison, double %32, i64 0 %46 = insertelement <2 x double> %45, double %33, i64 1 %47 = fsub <2 x double> %44, %46 %48 = fmul <2 x double> %47, <double 2.000000e+00, double 2.000000e+00> %49 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %50 = insertelement <2 x double> %49, double %42, i64 0 %51 = fneg <2 x double> %50 %52 = fmul <2 x double> %48, %51 %53 = insertelement <2 x double> poison, double %38, i64 0 %54 = insertelement <2 x double> poison, double %29, i64 0 %55 = insertelement <2 x double> %54, double %31, i64 1 %56 = insertelement <2 x double> poison, double %30, i64 0 %57 = insertelement <2 x double> %56, double %34, i64 1 %58 = fsub <2 x double> %55, %57 %59 = fmul <2 x double> %58, <double 2.000000e+00, double 2.000000e+00> %60 = shufflevector <2 x double> %53, <2 x double> %59, <2 x i32> <i32 0, i32 2> %61 = shufflevector <2 x double> %59, <2 x double> poison, <2 x i32> <i32 1, i32 1> %62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %61, <2 x double> %52) %63 = extractelement <2 x double> %62, i64 0 %64 = extractelement <2 x double> %62, i64 1 %div56 = fdiv double %63, %64 %65 = extractelement <2 x double> %59, i64 0 %66 = fneg double %65 %67 = insertelement <2 x double> %51, double %66, i64 1 %68 = fmul <2 x double> %59, %67 %69 = insertelement <2 x double> %49, double %38, i64 0 %70 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> <i32 1, i32 1> %71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %69, <2 x double> %70, <2 x double> %68) %72 = extractelement <2 x double> %71, i64 0 %73 = extractelement <2 x double> %71, i64 1 %div63 = fdiv double %72, %73 %call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div56, double noundef %div63, double noundef %div30) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #6 %inc = add nuw nsw i32 %i.093, 1 %74 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %74 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!10, !10, i64 0} !10 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include"stdio.h" int main(){int N;scanf("%d",&N);int po[N];for(int i=0;i<N;i++){po[i]=(N-i)%2;po[i]*=2;if(po[0]==2)po[0]=1;}for(int i=0;i<N;i++){int kari;scanf("%d",&kari);po[kari]--;}for(int i=0;i<N;i++)if(po[i]!=0){printf("0\n");return 0;}int ans=1;for(int i=0;i<N/2;i++)ans=(ans*2)%1000000007;printf("%d\n",ans);return 0;}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184547/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184547/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"%d\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 i32, align 4 %kari = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %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 %cmp55 = icmp sgt i32 %3, 0 br i1 %cmp55, label %for.body.preheader, label %for.cond.cleanup34 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %3 to i64 br label %for.body for.cond7.preheader: ; preds = %for.body br i1 %cmp55, label %for.body10, label %for.cond.cleanup34 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %4 = trunc i64 %indvars.iv to i32 %sub = sub nsw i32 %3, %4 %rem = srem i32 %sub, 2 %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %mul = shl nsw i32 %rem, 1 store i32 %mul, ptr %arrayidx, align 4, !tbaa !5 %5 = load i32, ptr %vla, align 16, !tbaa !5 %cmp4 = icmp eq i32 %5, 2 %spec.store.select = select i1 %cmp4, i32 1, i32 %5 store i32 %spec.store.select, ptr %vla, align 16 %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.cond7.preheader, label %for.body, !llvm.loop !9 for.cond18.preheader: ; preds = %for.body10 %cmp19.not59 = icmp sgt i32 %8, 0 br i1 %cmp19.not59, label %for.body21.preheader, label %for.cond.cleanup34 for.body21.preheader: ; preds = %for.cond18.preheader %wide.trip.count70 = zext i32 %8 to i64 br label %for.body21 for.body10: ; preds = %for.cond7.preheader, %for.body10 %i6.058 = phi i32 [ %inc15, %for.body10 ], [ 0, %for.cond7.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kari) #5 %call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kari) %6 = load i32, ptr %kari, align 4, !tbaa !5 %idxprom12 = sext i32 %6 to i64 %arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12 %7 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %dec = add nsw i32 %7, -1 store i32 %dec, ptr %arrayidx13, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kari) #5 %inc15 = add nuw nsw i32 %i6.058, 1 %8 = load i32, ptr %N, align 4, !tbaa !5 %cmp8 = icmp slt i32 %inc15, %8 br i1 %cmp8, label %for.body10, label %for.cond18.preheader, !llvm.loop !11 for.cond18: ; preds = %for.body21 %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70 br i1 %exitcond71.not, label %for.cond32.preheader, label %for.body21, !llvm.loop !12 for.cond32.preheader: ; preds = %for.cond18 %div = sdiv i32 %8, 2 %cmp3361 = icmp sgt i32 %8, 1 br i1 %cmp3361, label %for.body35.preheader, label %for.cond.cleanup34 for.body35.preheader: ; preds = %for.cond32.preheader %9 = add nsw i32 %div, -1 %xtraiter = and i32 %div, 3 %10 = icmp ult i32 %9, 3 br i1 %10, label %for.cond.cleanup34.loopexit.unr-lcssa, label %for.body35.preheader.new for.body35.preheader.new: ; preds = %for.body35.preheader %unroll_iter = and i32 %div, -4 br label %for.body35 for.body21: ; preds = %for.body21.preheader, %for.cond18 %indvars.iv67 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next68, %for.cond18 ] %arrayidx23 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv67 %11 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %cmp24.not = icmp eq i32 %11, 0 br i1 %cmp24.not, label %for.cond18, label %if.then25 if.then25: ; preds = %for.body21 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup44 for.cond.cleanup34.loopexit.unr-lcssa: ; preds = %for.body35, %for.body35.preheader %rem37.lcssa.ph = phi i32 [ undef, %for.body35.preheader ], [ %rem37.3, %for.body35 ] %ans.062.unr = phi i32 [ 1, %for.body35.preheader ], [ %rem37.3, %for.body35 ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup34, label %for.body35.epil for.body35.epil: ; preds = %for.cond.cleanup34.loopexit.unr-lcssa, %for.body35.epil %ans.062.epil = phi i32 [ %rem37.epil, %for.body35.epil ], [ %ans.062.unr, %for.cond.cleanup34.loopexit.unr-lcssa ] %epil.iter = phi i32 [ %epil.iter.next, %for.body35.epil ], [ 0, %for.cond.cleanup34.loopexit.unr-lcssa ] %mul36.epil = shl nsw i32 %ans.062.epil, 1 %rem37.epil = srem i32 %mul36.epil, 1000000007 %epil.iter.next = add i32 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup34, label %for.body35.epil, !llvm.loop !13 for.cond.cleanup34: ; preds = %for.cond.cleanup34.loopexit.unr-lcssa, %for.body35.epil, %entry, %for.cond7.preheader, %for.cond18.preheader, %for.cond32.preheader %ans.0.lcssa = phi i32 [ 1, %for.cond32.preheader ], [ 1, %for.cond18.preheader ], [ 1, %for.cond7.preheader ], [ 1, %entry ], [ %rem37.lcssa.ph, %for.cond.cleanup34.loopexit.unr-lcssa ], [ %rem37.epil, %for.body35.epil ] %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa) br label %cleanup44 for.body35: ; preds = %for.body35, %for.body35.preheader.new %ans.062 = phi i32 [ 1, %for.body35.preheader.new ], [ %rem37.3, %for.body35 ] %niter = phi i32 [ 0, %for.body35.preheader.new ], [ %niter.next.3, %for.body35 ] %mul36 = shl nsw i32 %ans.062, 1 %rem37 = srem i32 %mul36, 1000000007 %mul36.1 = shl nsw i32 %rem37, 1 %rem37.1 = srem i32 %mul36.1, 1000000007 %mul36.2 = shl nsw i32 %rem37.1, 1 %rem37.2 = srem i32 %mul36.2, 1000000007 %mul36.3 = shl nsw i32 %rem37.2, 1 %rem37.3 = srem i32 %mul36.3, 1000000007 %niter.next.3 = add i32 %niter, 4 %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup34.loopexit.unr-lcssa, label %for.body35, !llvm.loop !15 cleanup44: ; preds = %if.then25, %for.cond.cleanup34 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 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 ; 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 = !{!"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, !14} !14 = !{!"llvm.loop.unroll.disable"} !15 = distinct !{!15, !10}
#include <stdio.h> #include <stdlib.h> #define N 10000 #define INT(X) \ ( *( (int *)(X) ) ) int cmpr ( const void * a, const void * b ) { return ( INT( b ) - INT( a ) ); } /** Application main entry point. */ int main ( int argc, char * argv[ ] ) { int i; for ( ; ; ) { int d[ N ][ 2 ]; int res = 0; int n, m; scanf ( "%d%d", &n, &m ); if ( !( n | m ) ) break ; for ( i = 0; i < n; ++i ) { scanf ( "%d%d", &d[ i ][ 1 ], &d[ i ][ 0 ] ); } qsort ( d, n, sizeof ( int ) * 2, cmpr ); for ( i = 0; i < n && m > 0; ++i ) { if ( d[ i ][ 1 ] <= m ) { m -= d[ i ][ 1 ]; d[ i ][ 1 ] = 0; } else { d[ i ][ 1 ] -= m; m = 0; } } for ( i = 0; i < n; ++i ) { res += d[ i ][ 1 ] * d[ i ][ 0 ]; } printf ( "%d\n", res ); } return ( 0 ); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184590/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184590/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @cmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #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: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 { entry: %d = alloca [10000 x [2 x i32]], align 16 %n = alloca i32, align 4 %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %d) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6 %call81 = 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 %1 = load i32, ptr %m, align 4, !tbaa !5 %or82 = or i32 %1, %0 %tobool.not83 = icmp eq i32 %or82, 0 br i1 %tobool.not83, label %for.end50, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %cleanup %2 = phi i32 [ %22, %cleanup ], [ %0, %entry ] %cmp71 = icmp sgt i32 %2, 0 br i1 %cmp71, label %for.body, label %for.cond1.preheader.for.end_crit_edge for.cond1.preheader.for.end_crit_edge: ; preds = %for.cond1.preheader %.pre = sext i32 %2 to i64 br label %for.end for.body: ; preds = %for.cond1.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ] %arrayidx = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 1 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %for.cond1.preheader.for.end_crit_edge %conv.pre-phi = phi i64 [ %.pre, %for.cond1.preheader.for.end_crit_edge ], [ %4, %for.body ] call void @qsort(ptr noundef nonnull %d, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmpr) #6 %5 = load i32, ptr %n, align 4, !tbaa !5 %m.promoted = load i32, ptr %m, align 4 %cmp873 = icmp sgt i32 %5, 0 %cmp1074 = icmp sgt i32 %m.promoted, 0 %6 = select i1 %cmp873, i1 %cmp1074, i1 false br i1 %6, label %for.body12.preheader, label %for.cond33.preheader for.body12.preheader: ; preds = %for.end %7 = zext i32 %5 to i64 br label %for.body12 for.cond33.preheader: ; preds = %for.inc30, %for.inc30.thread, %for.end br i1 %cmp873, label %for.body36.preheader, label %cleanup for.body36.preheader: ; preds = %for.cond33.preheader %wide.trip.count = zext i32 %5 to i64 %min.iters.check = icmp ult i32 %5, 8 br i1 %min.iters.check, label %for.body36.preheader112, label %vector.ph vector.ph: ; preds = %for.body36.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 ], [ %13, %vector.body ] %vec.phi107 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %8 = or i64 %index, 4 %9 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %index %10 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %8 %wide.vec = load <8 x i32>, ptr %9, align 16, !tbaa !5 %wide.vec108 = load <8 x i32>, ptr %10, align 16, !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.vec109 = shufflevector <8 x i32> %wide.vec108, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6> %strided.vec110 = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7> %strided.vec111 = shufflevector <8 x i32> %wide.vec108, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7> %11 = mul nsw <4 x i32> %strided.vec, %strided.vec110 %12 = mul nsw <4 x i32> %strided.vec109, %strided.vec111 %13 = add <4 x i32> %11, %vec.phi %14 = add <4 x i32> %12, %vec.phi107 %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 !11 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, %wide.trip.count br i1 %cmp.n, label %cleanup, label %for.body36.preheader112 for.body36.preheader112: ; preds = %for.body36.preheader, %middle.block %indvars.iv89.ph = phi i64 [ 0, %for.body36.preheader ], [ %n.vec, %middle.block ] %res.079.ph = phi i32 [ 0, %for.body36.preheader ], [ %16, %middle.block ] br label %for.body36 for.body12: ; preds = %for.body12.preheader, %for.inc30 %indvars.iv86 = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next87, %for.inc30 ] %17 = phi i32 [ %m.promoted, %for.body12.preheader ], [ %sub, %for.inc30 ] %arrayidx15 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv86, i64 1 %18 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %cmp16.not = icmp sgt i32 %18, %17 br i1 %cmp16.not, label %for.inc30.thread, label %for.inc30 for.inc30.thread: ; preds = %for.body12 %sub28 = sub nsw i32 %18, %17 store i32 %sub28, ptr %arrayidx15, align 4 store i32 0, ptr %m, align 4 br label %for.cond33.preheader for.inc30: ; preds = %for.body12 %sub = sub nsw i32 %17, %18 store i32 0, ptr %arrayidx15, align 4 store i32 %sub, ptr %m, align 4 %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %cmp8 = icmp ult i64 %indvars.iv.next87, %7 %cmp10 = icmp sgt i32 %sub, 0 %19 = select i1 %cmp8, i1 %cmp10, i1 false br i1 %19, label %for.body12, label %for.cond33.preheader, !llvm.loop !14 for.body36: ; preds = %for.body36.preheader112, %for.body36 %indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.body36 ], [ %indvars.iv89.ph, %for.body36.preheader112 ] %res.079 = phi i32 [ %add, %for.body36 ], [ %res.079.ph, %for.body36.preheader112 ] %arrayidx38 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv89 %arrayidx39 = getelementptr inbounds [10000 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv89, i64 1 %20 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %21 = load i32, ptr %arrayidx38, align 8, !tbaa !5 %mul = mul nsw i32 %21, %20 %add = add nsw i32 %mul, %res.079 %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1 %exitcond.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count br i1 %exitcond.not, label %cleanup, label %for.body36, !llvm.loop !15 cleanup: ; preds = %for.body36, %middle.block, %for.cond33.preheader %res.0.lcssa = phi i32 [ 0, %for.cond33.preheader ], [ %16, %middle.block ], [ %add, %for.body36 ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %d) #6 call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %d) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %22 = load i32, ptr %n, align 4, !tbaa !5 %23 = load i32, ptr %m, align 4, !tbaa !5 %or = or i32 %23, %22 %tobool.not = icmp eq i32 %or, 0 br i1 %tobool.not, label %for.end50, label %for.cond1.preheader for.end50: ; preds = %cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %d) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4 ; 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 nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = 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} !15 = distinct !{!15, !10, !13, !12}
#include<stdio.h> #define N 100000 int func(int); int a[N],n; int main(){ int i,j,q,cnt=0; int k; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } scanf("%d",&q); for(j=0;j<q;j++){ scanf("%d",&k); if(func(k)) cnt++; } printf("%d\n",cnt); return 0; } int func(int k){ int l=0,r=n,m; a[n] = k; while(l < r){ m = (l + r)/2; if(k == a[m]) return 1; if(k > a[m]) l = m + 1; else if(k < a[m]) r = m; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184633/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184633/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 @n = dso_local global i32 0, align 4 @a = dso_local global [100000 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: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail 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.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 = tail 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp422 = icmp sgt i32 %3, 0 br i1 %cmp422, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %cnt.024 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %j.023 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %idxprom.i = sext i32 %5 to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %idxprom.i store i32 %4, ptr %arrayidx.i, align 4, !tbaa !5 %cmp26.i = icmp sgt i32 %5, 0 br i1 %cmp26.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %r.028.i = phi i32 [ %r.1.i, %if.end.i ], [ %5, %for.body5 ] %l.027.i = phi i32 [ %l.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %l.027.i, %r.028.i %div.i = sdiv i32 %add.i, 2 %idxprom1.i = sext i32 %div.i to i64 %arrayidx2.i = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %idxprom1.i %6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5 %cmp3.i = icmp eq i32 %6, %4 br i1 %cmp3.i, label %func.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp6.i = icmp slt i32 %6, %4 %add8.i = add nsw i32 %div.i, 1 %cmp11.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp11.i, i32 %div.i, i32 %r.028.i %l.1.i = select i1 %cmp6.i, i32 %add8.i, i32 %l.027.i %r.1.i = select i1 %cmp6.i, i32 %r.028.i, i32 %spec.select.i %cmp.i = icmp slt i32 %l.1.i, %r.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !11 func.exit: ; preds = %while.body.i %inc8 = add nsw i32 %cnt.024, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %func.exit %7 = phi i32 [ %inc8, %func.exit ], [ %cnt.024, %for.body5 ], [ %cnt.024, %if.end.i ] %inc10 = add nuw nsw i32 %j.023, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @func(i32 noundef %k) local_unnamed_addr #3 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %idxprom store i32 %k, ptr %arrayidx, align 4, !tbaa !5 %cmp26 = icmp sgt i32 %0, 0 br i1 %cmp26, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %r.028 = phi i32 [ %r.1, %if.end ], [ %0, %entry ] %l.027 = phi i32 [ %l.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %r.028, %l.027 %div = sdiv i32 %add, 2 %idxprom1 = sext i32 %div to i64 %arrayidx2 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %idxprom1 %1 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp3 = icmp eq i32 %1, %k br i1 %cmp3, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp6 = icmp slt i32 %1, %k %add8 = add nsw i32 %div, 1 %cmp11 = icmp sgt i32 %1, %k %spec.select = select i1 %cmp11, i32 %div, i32 %r.028 %l.1 = select i1 %cmp6, i32 %add8, i32 %l.027 %r.1 = select i1 %cmp6, i32 %r.028, i32 %spec.select %cmp = icmp slt i32 %l.1, %r.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree 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 #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> int s[100000]; int n; int binary_search(int key) { int left = 0; int right = n; int mid; while(left < right) { mid = (left + right) / 2; if (s[mid] == key) return 1; else if (s[mid] > key) right = mid; else left = mid + 1; } return 0; } int main(void) { int q; int t; int i; int count = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &s[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &t); if (binary_search(t)) count++; } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184677/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184677/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" @n = dso_local global i32 0, align 4 @s = dso_local global [100000 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binary_search(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.019 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.018, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.019 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %count.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %4 = load i32, ptr %t, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %5, 0 br i1 %cmp17.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.else.i %right.019.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.018.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.018.i, %right.019.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binary_search.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %add7.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %left.018.i, i32 %add7.i %right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.019.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binary_search.exit: ; preds = %while.body.i %inc8 = add nsw i32 %count.025, 1 br label %for.cond3 for.cond3: ; preds = %if.else.i, %for.body5, %binary_search.exit %7 = phi i32 [ %inc8, %binary_search.exit ], [ %count.025, %for.body5 ], [ %count.025, %if.else.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %count.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int A[100000],n; int Binary( int key ){ int left = 0; int right = n; int mid; while( left < right ){ mid = ( left + right )/2; if( key == A[mid] ){ return 1; } else if(key > A[mid] ){ left = mid + 1; } else { right =mid; } } return 0; } int main(void){ int i,q,m,sum=0; scanf("%d",&n); for( i = 0 ; i < n ; i++){ scanf("%d",&A[i]); } scanf("%d",&q); for( i = 0 ; i < q ; i++){ scanf("%d",&m); if( Binary(m)){ sum++; } } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184734/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184734/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" @n = dso_local global i32 0, align 4 @A = dso_local global [100000 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @Binary(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.019 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.018 %right.1 = select i1 %cmp4, i32 %right.019, i32 %div %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end 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 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %4 = load i32, ptr %m, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %5, 0 br i1 %cmp17.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.else.i %right.019.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.018.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.018.i, %right.019.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %Binary.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.018.i %right.1.i = select i1 %cmp4.i, i32 %right.019.i, i32 %div.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 Binary.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.else.i, %for.body5, %Binary.exit %7 = phi i32 [ %inc8, %Binary.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.else.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = 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 %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> int main() { char str[102]; int n,i,digit,age; long count ; scanf("%d",&n); count = 0; for(i=0;i<n;i++) { scanf("%s",str); digit = str[0]-'0'; if(digit >=0 && digit <=9) { age = atoi(str); if(age < 18) count++; } else { if (strcmp(str,"ABSINTH") && strcmp(str,"BEER") && strcmp(str,"BRANDY") && strcmp(str,"CHAMPAGNE") && strcmp(str,"GIN") && strcmp(str,"RUM") && strcmp(str,"SAKE") && strcmp(str,"TEQUILA") && strcmp(str,"VODKA") && strcmp(str,"WHISKEY") && strcmp(str,"WINE")) ; else count++; } } printf("%ld\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1848/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1848/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.3 = private unnamed_addr constant [5 x i8] c"BEER\00", align 1 @.str.4 = private unnamed_addr constant [7 x i8] c"BRANDY\00", align 1 @.str.5 = private unnamed_addr constant [10 x i8] c"CHAMPAGNE\00", align 1 @.str.8 = private unnamed_addr constant [5 x i8] c"SAKE\00", align 1 @.str.10 = private unnamed_addr constant [6 x i8] c"VODKA\00", align 1 @.str.12 = private unnamed_addr constant [5 x i8] c"WINE\00", align 1 @.str.13 = 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: %str = alloca [102 x i8], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %str) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp86 = icmp sgt i32 %0, 0 br i1 %cmp86, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %count.088 = phi i64 [ %count.1, %for.inc ], [ 0, %entry ] %i.087 = phi i32 [ %inc58, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str) %1 = load i8, ptr %str, align 16, !tbaa !9 %2 = add i8 %1, -48 %or.cond = icmp ult i8 %2, 10 br i1 %or.cond, label %if.then, label %if.else if.then: ; preds = %for.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %cmp8 = icmp slt i32 %conv.i, 18 %inc = zext i1 %cmp8 to i64 %spec.select = add nsw i64 %count.088, %inc br label %for.inc if.else: ; preds = %for.body %lhsv = load i64, ptr %str, align 16 %.not = icmp eq i64 %lhsv, 20358893537542721 %3 = trunc i64 %lhsv to i32 br i1 %.not, label %if.else54, label %land.lhs.true13 land.lhs.true13: ; preds = %if.else %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %str, ptr noundef nonnull dereferenceable(5) @.str.3, i64 5) %tobool16.not = icmp eq i32 %bcmp, 0 br i1 %tobool16.not, label %if.else54, label %land.lhs.true17 land.lhs.true17: ; preds = %land.lhs.true13 %bcmp65 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %str, ptr noundef nonnull dereferenceable(7) @.str.4, i64 7) %tobool20.not = icmp eq i32 %bcmp65, 0 br i1 %tobool20.not, label %if.else54, label %land.lhs.true21 land.lhs.true21: ; preds = %land.lhs.true17 %bcmp66 = call i32 @bcmp(ptr noundef nonnull dereferenceable(10) %str, ptr noundef nonnull dereferenceable(10) @.str.5, i64 10) %tobool24.not = icmp eq i32 %bcmp66, 0 %.not69 = icmp eq i32 %3, 5130567 %or.cond82 = or i1 %tobool24.not, %.not69 %.not72 = icmp eq i32 %3, 5068114 %or.cond83 = or i1 %or.cond82, %.not72 br i1 %or.cond83, label %if.else54, label %land.lhs.true33 land.lhs.true33: ; preds = %land.lhs.true21 %bcmp73 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %str, ptr noundef nonnull dereferenceable(5) @.str.8, i64 5) %tobool36.not = icmp eq i32 %bcmp73, 0 %.not76 = icmp eq i64 %lhsv, 18379751333905748 %or.cond84 = or i1 %tobool36.not, %.not76 br i1 %or.cond84, label %if.else54, label %land.lhs.true41 land.lhs.true41: ; preds = %land.lhs.true33 %bcmp77 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %str, ptr noundef nonnull dereferenceable(6) @.str.10, i64 6) %tobool44.not = icmp eq i32 %bcmp77, 0 %.not80 = icmp eq i64 %lhsv, 25127462749423703 %or.cond85 = or i1 %tobool44.not, %.not80 br i1 %or.cond85, label %if.else54, label %land.lhs.true49 land.lhs.true49: ; preds = %land.lhs.true41 %bcmp81 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %str, ptr noundef nonnull dereferenceable(5) @.str.12, i64 5) %tobool52.not = icmp eq i32 %bcmp81, 0 br i1 %tobool52.not, label %if.else54, label %for.inc if.else54: ; preds = %land.lhs.true49, %land.lhs.true41, %land.lhs.true33, %land.lhs.true21, %land.lhs.true17, %land.lhs.true13, %if.else %inc55 = add nsw i64 %count.088, 1 br label %for.inc for.inc: ; preds = %if.then, %land.lhs.true49, %if.else54 %count.1 = phi i64 [ %count.088, %land.lhs.true49 ], [ %inc55, %if.else54 ], [ %spec.select, %if.then ] %inc58 = add nuw nsw i32 %i.087, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc58, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.inc, %entry %count.0.lcssa = phi i64 [ 0, %entry ], [ %count.1, %for.inc ] %call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i64 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %str) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 nofree nounwind willreturn "no-trapping-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 willreturn memory(argmem: read) } 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"}
#include <stdio.h> int main() { int t; scanf("%d",&t); for (int i=1; i<=t;i++){ int n; scanf("%d",&n); for (int j=1; j<=n; j++){ printf("%d ",j); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18490/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18490/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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not16 = icmp slt i32 %0, 1 br i1 %cmp.not16, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.cond.cleanup4, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 ret i32 0 for.body: ; preds = %entry, %for.cond.cleanup4 %i.017 = phi i32 [ %inc9, %for.cond.cleanup4 ], [ 1, %entry ] 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 %cmp3.not14 = icmp slt i32 %1, 1 br i1 %cmp3.not14, label %for.cond.cleanup4, label %for.body5 for.cond.cleanup4: ; preds = %for.body5, %for.body %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %inc9 = add nuw nsw i32 %i.017, 1 %2 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.017, %2 br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !9 for.body5: ; preds = %for.body, %for.body5 %j.015 = phi i32 [ %inc, %for.body5 ], [ 1, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.015) %inc = add nuw nsw i32 %j.015, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp3.not.not = icmp slt i32 %j.015, %3 br i1 %cmp3.not.not, label %for.body5, label %for.cond.cleanup4, !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: 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> int S[100000]; int binaryserch(int q,int n) { int high, low,mid; high = n - 1; low = 0; while (high >= low) { mid = (high + low) / 2; if (S[mid] == q) { return 1; } else if (S[mid] > q) { high = mid - 1; } else { low = mid + 1; } } return 0; } int main(void) { int i, j, q, n; int T[50000]; int count = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &T[i]); } for (i = 0; i < q; i++) { count += binaryserch(T[i], n); } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184943/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184943/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" @S = dso_local global [100000 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binaryserch(i32 noundef %q, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp.not18 = icmp slt i32 %n, 1 br i1 %cmp.not18, label %cleanup, label %while.body.preheader while.body.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 br label %while.body while.body: ; preds = %while.body.preheader, %if.else %low.020 = phi i32 [ %low.1, %if.else ], [ 0, %while.body.preheader ] %high.019 = phi i32 [ %high.1, %if.else ], [ %sub, %while.body.preheader ] %add = add nsw i32 %low.020, %high.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %q br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %q %sub6 = add nsw i32 %div, -1 %add8 = add nsw i32 %div, 1 %high.1 = select i1 %cmp4, i32 %sub6, i32 %high.019 %low.1 = select i1 %cmp4, i32 %low.020, i32 %add8 %cmp.not = icmp slt i32 %high.1, %low.1 br i1 %cmp.not, label %cleanup, label %while.body, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %n = alloca i32, align 4 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp433 = icmp sgt i32 %3, 0 br i1 %cmp433, label %for.body5, label %for.end20 for.cond12.preheader: ; preds = %for.body5 %cmp1335 = icmp sgt i32 %5, 0 br i1 %cmp1335, label %for.body14.lr.ph, label %for.end20 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not18.i = icmp slt i32 %4, 1 %sub.i = add nsw i32 %4, -1 br i1 %cmp.not18.i, label %for.end20, label %for.body14.preheader for.body14.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %5 to i64 br label %for.body14 for.body5: ; preds = %for.end, %for.body5 %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv42 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 %5 = load i32, ptr %q, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp4 = icmp slt i64 %indvars.iv.next43, %6 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !12 for.body14: ; preds = %for.body14.preheader, %binaryserch.exit.loopexit %indvars.iv45 = phi i64 [ 0, %for.body14.preheader ], [ %indvars.iv.next46, %binaryserch.exit.loopexit ] %count.037 = phi i32 [ 0, %for.body14.preheader ], [ %add, %binaryserch.exit.loopexit ] %arrayidx16 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv45 %7 = load i32, ptr %arrayidx16, align 4, !tbaa !5 br label %while.body.i while.body.i: ; preds = %if.else.i, %for.body14 %low.020.i = phi i32 [ %low.1.i, %if.else.i ], [ 0, %for.body14 ] %high.019.i = phi i32 [ %high.1.i, %if.else.i ], [ %sub.i, %for.body14 ] %add.i = add nsw i32 %high.019.i, %low.020.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %8, %7 br i1 %cmp1.i, label %binaryserch.exit.loopexit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %8, %7 %sub6.i = add nsw i32 %div.i, -1 %add8.i = add nsw i32 %div.i, 1 %high.1.i = select i1 %cmp4.i, i32 %sub6.i, i32 %high.019.i %low.1.i = select i1 %cmp4.i, i32 %low.020.i, i32 %add8.i %cmp.not.i = icmp slt i32 %high.1.i, %low.1.i br i1 %cmp.not.i, label %binaryserch.exit.loopexit, label %while.body.i, !llvm.loop !9 binaryserch.exit.loopexit: ; preds = %if.else.i, %while.body.i %retval.0.i.ph = phi i32 [ 1, %while.body.i ], [ 0, %if.else.i ] %add = add nuw nsw i32 %retval.0.i.ph, %count.037 %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count br i1 %exitcond.not, label %for.end20, label %for.body14, !llvm.loop !13 for.end20: ; preds = %binaryserch.exit.loopexit, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %add, %binaryserch.exit.loopexit ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int main(){ int s[100000]; int t[50000]; int n,q,i,count=0; int left,right,mid; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&s[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&t[i]); } for(i=0;i<q;i++){ left=0; right=n; while(left<right){ mid=(left+right)/2; if(t[i]==s[mid]) { count++; break; } if(t[i]>s[mid]){ left=mid+1; } else if(t[i]<s[mid]){ right=mid; } } } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184987/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184987/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: %s = alloca [100000 x i32], align 16 %t = alloca [50000 x i32], align 16 %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %t) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp59 = icmp sgt i32 %0, 0 br i1 %cmp59, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %s, 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp461 = icmp sgt i32 %3, 0 br i1 %cmp461, label %for.body5, label %for.end39 for.cond12.preheader: ; preds = %for.body5 %cmp1366 = icmp sgt i32 %7, 0 br i1 %cmp1366, label %for.body14.lr.ph, label %for.end39 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1563 = icmp sgt i32 %4, 0 br i1 %cmp1563, label %for.body14.us.preheader, label %for.end39 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc37.us %indvars.iv77 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next78, %for.inc37.us ] %count.067.us = phi i32 [ 0, %for.body14.us.preheader ], [ %count.1.us, %for.inc37.us ] %arrayidx17.us = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv77 %5 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.end.us %right.065.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end.us ] %left.064.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end.us ] %add.us = add nsw i32 %right.065.us, %left.064.us %div.us = sdiv i32 %add.us, 2 %idxprom18.us = sext i32 %div.us to i64 %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %idxprom18.us %6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %5, %6 br i1 %cmp20.us, label %if.then.us, label %if.end.us if.end.us: ; preds = %while.body.us %cmp26.us = icmp sgt i32 %5, %6 %add28.us = add nsw i32 %div.us, 1 %cmp33.us = icmp slt i32 %5, %6 %spec.select.us = select i1 %cmp33.us, i32 %div.us, i32 %right.065.us %left.1.us = select i1 %cmp26.us, i32 %add28.us, i32 %left.064.us %right.1.us = select i1 %cmp26.us, i32 %right.065.us, i32 %spec.select.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc37.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %count.067.us, 1 br label %for.inc37.us for.inc37.us: ; preds = %if.end.us, %if.then.us %count.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %count.067.us, %if.end.us ] %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1 %exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count br i1 %exitcond.not, label %for.end39, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv74 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next75, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end39: ; preds = %for.inc37.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc37.us ] %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 400000, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int A[1000000],n; int Binary(int key) { int Left=0; int Right=n; int Middle; while(Left<Right) { Middle=(Left+Right)/2; if(key==A[Middle]) return 1; if(key<A[Middle]) Right=Middle; else if(key>A[Middle]) Left=Middle+1; } return 0; } int main() { int i,q,key,cnt=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&A[i]); } scanf("%d",&q); for(i=0;i<q;i++) { scanf("%d",&key); if(Binary(key)==1) cnt++; } printf("%d\n",cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185036/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185036/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" @n = dso_local global i32 0, align 4 @A = dso_local 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @Binary(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %Right.025 = phi i32 [ %Right.1, %if.end ], [ %0, %entry ] %Left.024 = phi i32 [ %Left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %Right.025, %Left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %cmp8 = icmp slt i32 %1, %key %add10 = add nsw i32 %div, 1 %spec.select = select i1 %cmp8, i32 %add10, i32 %Left.024 %Left.1 = select i1 %cmp4, i32 %Left.024, i32 %spec.select %Right.1 = select i1 %cmp4, i32 %div, i32 %Right.025 %cmp = icmp slt i32 %Left.1, %Right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %key = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp424 = icmp sgt i32 %3, 0 br i1 %cmp424, label %for.body5, label %for.end12 for.body5: ; preds = %for.end, %for.cond3 %cnt.026 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.125 = phi i32 [ %inc11, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %key, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %Right.025.i = phi i32 [ %Right.1.i, %if.end.i ], [ %5, %for.body5 ] %Left.024.i = phi i32 [ %Left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %Left.024.i, %Right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %Binary.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %cmp8.i = icmp slt i32 %6, %4 %add10.i = add nsw i32 %div.i, 1 %spec.select.i = select i1 %cmp8.i, i32 %add10.i, i32 %Left.024.i %Left.1.i = select i1 %cmp4.i, i32 %Left.024.i, i32 %spec.select.i %Right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %Right.025.i %cmp.i = icmp slt i32 %Left.1.i, %Right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 Binary.exit: ; preds = %while.body.i %inc9 = add nsw i32 %cnt.026, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %Binary.exit %7 = phi i32 [ %inc9, %Binary.exit ], [ %cnt.026, %for.body5 ], [ %cnt.026, %if.end.i ] %inc11 = add nuw nsw i32 %i.125, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc11, %8 br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12 for.end12: ; preds = %for.cond3, %for.end %cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main() { int n,i,t; scanf("%d", &t); while(t--){ scanf("%d",&n); for(i=1;i<=n;i++){ printf("%d ", i); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18508/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18508/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: %n = alloca i32, align 4 %t = 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 %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 %dec8 = add nsw i32 %0, -1 store i32 %dec8, ptr %t, align 4, !tbaa !5 %tobool.not9 = icmp eq i32 %0, 0 br i1 %tobool.not9, label %while.end, label %while.body while.body: ; preds = %entry, %for.end %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not6 = icmp slt i32 %1, 1 br i1 %cmp.not6, label %for.end, label %for.body for.body: ; preds = %while.body, %for.body %i.07 = phi i32 [ %inc, %for.body ], [ 1, %while.body ] %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.07) %inc = add nuw nsw i32 %i.07, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.07, %2 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %while.body %putchar = call i32 @putchar(i32 10) %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 !11 while.end: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int A[1000000],n; int binarySearch(int key){ int left=0; int right=n; int mid; while(left<right){ mid=(left+right)/2; if (key==A[mid]) return 1; if (key>A[mid]) left=mid+1; else if(key<A[mid]) right=mid; } return 0; } int main(){ int i,q,k,sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&A[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&k); if (binarySearch(k))sum++; } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185122/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185122/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" @n = dso_local global i32 0, align 4 @A = dso_local 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.025, %left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %1, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.025 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.024 %right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.024.i, %right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i %right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = 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) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int n; int s[100000]; int Binary(int a){ int L=0; int C=0; int R=n; while(R > L){ C=(L+R)/2; if(a==s[C]){ return 1; } else if(a<s[C]) R=C; else if(a>s[C]) L=C+1; } return 0; } int main(void){ int a, q, i, j, ans=0; scanf("%d", &n); for(i=0;i<n; i++){ scanf("%d",&s[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&a); if(Binary(a)==1) ans++; } printf("%d\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185166/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185166/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" @n = dso_local global i32 0, align 4 @s = dso_local global [100000 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @Binary(i32 noundef %a) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp24 = icmp sgt i32 %0, 0 br i1 %cmp24, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %R.026 = phi i32 [ %R.1, %if.else ], [ %0, %entry ] %L.025 = phi i32 [ %L.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %R.026, %L.025 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %a br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %a %cmp9 = icmp slt i32 %1, %a %add11 = add nsw i32 %div, 1 %spec.select = select i1 %cmp9, i32 %add11, i32 %L.025 %L.1 = select i1 %cmp4, i32 %L.025, i32 %spec.select %R.1 = select i1 %cmp4, i32 %div, i32 %R.026 %cmp = icmp sgt i32 %R.1, %L.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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 i32, align 4 %q = 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 %q) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp424 = icmp sgt i32 %3, 0 br i1 %cmp424, label %for.body5, label %for.end12 for.body5: ; preds = %for.end, %for.cond3 %ans.026 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.125 = phi i32 [ %inc11, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %4 = load i32, ptr %a, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp24.i = icmp sgt i32 %5, 0 br i1 %cmp24.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.else.i %R.026.i = phi i32 [ %R.1.i, %if.else.i ], [ %5, %for.body5 ] %L.025.i = phi i32 [ %L.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %L.025.i, %R.026.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %Binary.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %cmp9.i = icmp slt i32 %6, %4 %add11.i = add nsw i32 %div.i, 1 %spec.select.i = select i1 %cmp9.i, i32 %add11.i, i32 %L.025.i %L.1.i = select i1 %cmp4.i, i32 %L.025.i, i32 %spec.select.i %R.1.i = select i1 %cmp4.i, i32 %div.i, i32 %R.026.i %cmp.i = icmp sgt i32 %R.1.i, %L.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 Binary.exit: ; preds = %while.body.i %inc9 = add nsw i32 %ans.026, 1 br label %for.cond3 for.cond3: ; preds = %if.else.i, %for.body5, %Binary.exit %7 = phi i32 [ %inc9, %Binary.exit ], [ %ans.026, %for.body5 ], [ %ans.026, %if.else.i ] %inc11 = add nuw nsw i32 %i.125, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc11, %8 br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12 for.end12: ; preds = %for.cond3, %for.end %ans.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, 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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main(){ int n,q,i,key,l,u,m; int S[100000],ans = 0; scanf("%d" ,&n); for(i = 0 ; i < n ; i++){ scanf("%d" , S + i); } scanf("%d" ,&q); for(i = 0 ; i < q ; i++){ scanf("%d" ,&key); l = 0; u = n; while(u >= l){ m = (l + u) / 2; if(S[m] == key){ ans++; break; } if(S[m] < key){ l = m+1; }else{ u = m-1; } } } printf("%d\n" ,ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185216/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185216/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 %q = alloca i32, align 4 %key = alloca i32, align 4 %S = 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 %q) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, 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 %S, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %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 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp436 = icmp sgt i32 %3, 0 br i1 %cmp436, label %for.body5, label %for.end18 for.body5: ; preds = %for.end, %for.inc16 %ans.038 = phi i32 [ %ans.1, %for.inc16 ], [ 0, %for.end ] %i.137 = phi i32 [ %inc17, %for.inc16 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp7.not33 = icmp slt i32 %4, 0 br i1 %cmp7.not33, label %for.inc16, label %while.body.lr.ph while.body.lr.ph: ; preds = %for.body5 %5 = load i32, ptr %key, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.end %u.035 = phi i32 [ %4, %while.body.lr.ph ], [ %u.1, %if.end ] %l.034 = phi i32 [ 0, %while.body.lr.ph ], [ %l.1, %if.end ] %add = add nsw i32 %u.035, %l.034 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom %6 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp8 = icmp eq i32 %6, %5 br i1 %cmp8, label %if.then, label %if.end if.then: ; preds = %while.body %inc9 = add nsw i32 %ans.038, 1 br label %for.inc16 if.end: ; preds = %while.body %cmp12 = icmp slt i32 %6, %5 %add14 = add nsw i32 %div, 1 %sub = add nsw i32 %div, -1 %l.1 = select i1 %cmp12, i32 %add14, i32 %l.034 %u.1 = select i1 %cmp12, i32 %u.035, i32 %sub %cmp7.not = icmp slt i32 %u.1, %l.1 br i1 %cmp7.not, label %for.inc16, label %while.body, !llvm.loop !11 for.inc16: ; preds = %if.end, %for.body5, %if.then %ans.1 = phi i32 [ %inc9, %if.then ], [ %ans.038, %for.body5 ], [ %ans.038, %if.end ] %inc17 = add nuw nsw i32 %i.137, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc17, %7 br i1 %cmp4, label %for.body5, label %for.end18, !llvm.loop !12 for.end18: ; preds = %for.inc16, %for.end %ans.0.lcssa = phi i32 [ 0, %for.end ], [ %ans.1, %for.inc16 ] %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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} !12 = distinct !{!12, !10}
#include<stdio.h> #define N 1000000 int binarySearch(int S[], int key, int n){ int left, right, mid; left = 0; right = n; while(left < right){ mid = (left + right)/2; if(S[mid] == key) return 1; if(key > S[mid]) left = mid + 1; else if(key < S[mid]) right = mid; } return 0; } int main(){ int i, n, S[N], q, key, cont = 0; scanf("%d", &n); for( i = 0 ; i < n ; i++ ){ scanf("%d", &S[i]); } scanf("%d", &q); for( i = 0 ; i < q ; i++ ){ scanf("%d", &key); if( binarySearch(S, key, n) ) cont++; } printf("%d\n", cont); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185274/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185274/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(ptr nocapture noundef readonly %S, i32 noundef %key, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp25 = icmp sgt i32 %n, 0 br i1 %cmp25, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.027 = phi i32 [ %right.1, %if.end ], [ %n, %entry ] %left.026 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.027, %left.026 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %S, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %0, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.027 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.026 %right.1 = select i1 %cmp4, i32 %right.027, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] 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: 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 %S = alloca [1000000 x i32], align 16 %q = alloca i32, align 4 %key = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr %S, 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %cont.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %key, align 4, !tbaa !5 %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp25.i = icmp sgt i32 %5, 0 br i1 %cmp25.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.027.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.026.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.026.i, %right.027.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.027.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.026.i %right.1.i = select i1 %cmp4.i, i32 %right.027.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %cont.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %cont.025, %for.body5 ], [ %cont.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %cont.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cont.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %S) #4 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(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int binarySearch(int A[],int n,int key){ int left=0; int right=n; int mid; while(left<right){ mid=(left+right)/2; if(key==A[mid])return 1; if(key>A[mid])left=mid+1; if(key<A[mid])right=mid; } return 0; } int main(){ int n,S[100000],q,T,i,sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T); if(binarySearch(S,n,T)==1)sum++; } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185317/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185317/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(ptr nocapture noundef readonly %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 { entry: %cmp25 = icmp sgt i32 %n, 0 br i1 %cmp25, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.027 = phi i32 [ %right.1, %if.end ], [ %n, %entry ] %left.026 = phi i32 [ %spec.select, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.027, %left.026 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %spec.select = select i1 %cmp4, i32 %add6, i32 %left.026 %cmp10 = icmp sgt i32 %0, %key %right.1 = select i1 %cmp10, i32 %div, i32 %right.027 %cmp = icmp slt i32 %spec.select, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] 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: 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 %S = alloca [100000 x i32], align 16 %q = alloca i32, align 4 %T = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #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 %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp424 = icmp sgt i32 %3, 0 br i1 %cmp424, label %for.body5, label %for.end12 for.body5: ; preds = %for.end, %for.cond3 %sum.026 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.125 = phi i32 [ %inc11, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %T, align 4, !tbaa !5 %cmp25.i = icmp sgt i32 %4, 0 br i1 %cmp25.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.027.i = phi i32 [ %right.1.i, %if.end.i ], [ %4, %for.body5 ] %left.026.i = phi i32 [ %spec.select.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.026.i, %right.027.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %5 %add6.i = add nsw i32 %div.i, 1 %spec.select.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.026.i %cmp10.i = icmp sgt i32 %6, %5 %right.1.i = select i1 %cmp10.i, i32 %div.i, i32 %right.027.i %cmp.i = icmp slt i32 %spec.select.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc9 = add nsw i32 %sum.026, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc9, %binarySearch.exit ], [ %sum.026, %for.body5 ], [ %sum.026, %if.end.i ] %inc11 = add nuw nsw i32 %i.125, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc11, %8 br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12 for.end12: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call13 = 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 %T) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 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(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main(){ int n,q,s[100000],t[50000],i,left,right,mid,count=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&s[i]); scanf("%d",&q); for(i=0;i<q;i++) scanf("%d",&t[i]); for(i=0;i<q;i++){ left=0; right=n; mid=(left+right)/2; while(left<right){ if(t[i]>s[mid]) left=mid+1; else if(t[i]<s[mid]) right=mid; else{ count++; break; } mid=(left+right)/2; } } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185360/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185360/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 %q = alloca i32, align 4 %s = alloca [100000 x i32], align 16 %t = alloca [50000 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 %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 200000, 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 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %s, 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp457 = icmp sgt i32 %3, 0 br i1 %cmp457, label %for.body5, label %for.end35 for.cond12.preheader: ; preds = %for.body5 %cmp1364 = icmp sgt i32 %7, 0 br i1 %cmp1364, label %for.body14.lr.ph, label %for.end35 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1560 = icmp sgt i32 %4, 0 br i1 %cmp1560, label %for.body14.us.preheader, label %for.end35 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc33.us %indvars.iv75 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next76, %for.inc33.us ] %count.067.us = phi i32 [ 0, %for.body14.us.preheader ], [ %count.1.us, %for.inc33.us ] %arrayidx17.us = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv75 %5 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.end30.us %mid.063.us.in = phi i32 [ %4, %for.body14.us ], [ %add31.us, %if.end30.us ] %right.062.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end30.us ] %left.061.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end30.us ] %mid.063.us = sdiv i32 %mid.063.us.in, 2 %idxprom18.us = sext i32 %mid.063.us to i64 %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %idxprom18.us %6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 %cmp20.us = icmp sgt i32 %5, %6 br i1 %cmp20.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp26.us = icmp slt i32 %5, %6 br i1 %cmp26.us, label %if.end30.us, label %if.else28.us if.else28.us: ; preds = %if.else.us %inc29.us = add nsw i32 %count.067.us, 1 br label %for.inc33.us for.inc33.us: ; preds = %if.end30.us, %if.else28.us %count.1.us = phi i32 [ %inc29.us, %if.else28.us ], [ %count.067.us, %if.end30.us ] %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %exitcond.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count br i1 %exitcond.not, label %for.end35, label %for.body14.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %add21.us = add nsw i32 %mid.063.us, 1 br label %if.end30.us if.end30.us: ; preds = %if.then.us, %if.else.us %left.1.us = phi i32 [ %add21.us, %if.then.us ], [ %left.061.us, %if.else.us ] %right.1.us = phi i32 [ %right.062.us, %if.then.us ], [ %mid.063.us, %if.else.us ] %add31.us = add nsw i32 %right.1.us, %left.1.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc33.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv72 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next73, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end35: ; preds = %for.inc33.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc33.us ] %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #define N 100000 int main(void){ int n, q, C=0, i, j; int S[N], T[N]; int left=0, right, mid, key; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(j=0;j<q;j++){ scanf("%d",&T[j]); } for(j=0;j<q;j++){ key = T[j]; right = n; left = 0; while(left<right){ mid = (left+right)/2; if(S[mid] == key){ C++; break;} if(S[mid] != key && S[mid] < key){ left = mid+1;} if(S[mid] != key && S[mid] > key){ right = mid;} } } printf("%d\n", C); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185403/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185403/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 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = 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 %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 400000, 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 %cmp66 = icmp sgt i32 %0, 0 br i1 %cmp66, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp468 = icmp sgt i32 %3, 0 br i1 %cmp468, label %for.body5, label %for.end42 for.cond12.preheader: ; preds = %for.body5 %cmp1373 = icmp sgt i32 %7, 0 br i1 %cmp1373, label %for.body14.lr.ph, label %for.end42 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1770 = icmp sgt i32 %4, 0 br i1 %cmp1770, label %for.body14.us.preheader, label %for.end42 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc40.us %indvars.iv83 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next84, %for.inc40.us ] %C.075.us = phi i32 [ 0, %for.body14.us.preheader ], [ %C.1.us, %for.inc40.us ] %arrayidx16.us = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv83 %5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %land.lhs.true.us %right.072.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %land.lhs.true.us ] %left.071.us = phi i32 [ 0, %for.body14.us ], [ %spec.select.us, %land.lhs.true.us ] %add.us = add nsw i32 %right.072.us, %left.071.us %div.us = sdiv i32 %add.us, 2 %idxprom18.us = sext i32 %div.us to i64 %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom18.us %6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %6, %5 br i1 %cmp20.us, label %if.then.us, label %land.lhs.true.us land.lhs.true.us: ; preds = %while.body.us %cmp27.us = icmp slt i32 %6, %5 %add29.us = add nsw i32 %div.us, 1 %spec.select.us = select i1 %cmp27.us, i32 %add29.us, i32 %left.071.us %cmp37.us = icmp sgt i32 %6, %5 %right.1.us = select i1 %cmp37.us, i32 %div.us, i32 %right.072.us %cmp17.us = icmp slt i32 %spec.select.us, %right.1.us br i1 %cmp17.us, label %while.body.us, label %for.inc40.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %C.075.us, 1 br label %for.inc40.us for.inc40.us: ; preds = %land.lhs.true.us, %if.then.us %C.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %C.075.us, %land.lhs.true.us ] %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %exitcond.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count br i1 %exitcond.not, label %for.end42, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv80 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next81, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end42: ; preds = %for.inc40.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %C.1.us, %for.inc40.us ] %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> double s[100000], t[50000]; void intAryScan(double b[], int size) { int i; for(i = 0; i < size; i++){ scanf("%lf", &b[i]); } return; } int main() { int c, i, j, mid, n, q; scanf("%d", &n); intAryScan(s, n); scanf("%d", &q); intAryScan(t, q); c = 0; for(i = 0; i < q; i++){ mid = n/2; if(s[mid] < t[i]){ for(j = mid + 1; (j < n) && (s[j] < t[i]); j++) ; if(j < n && t[i] == s[j]){ c++; } }else if(t[i] < s[mid]){ for(j = 0; (j < mid) && (s[j] < t[i]); j++) ; if(j < mid && t[i] == s[j]){ c++; } }else if(s[mid] == t[i]){ c++; } } printf("%d\n", c); return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185461/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185461/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 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @s = dso_local global [100000 x double] zeroinitializer, align 16 @t = dso_local global [50000 x double] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @intAryScan(ptr noundef %b, i32 noundef %size) local_unnamed_addr #0 { entry: %cmp3 = icmp sgt i32 %size, 0 br i1 %cmp3, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %size to i64 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 ] %arrayidx = getelementptr inbounds double, ptr %b, i64 %indvars.iv %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %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 !5 for.end: ; preds = %for.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) #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 uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !7 %cmp3.i = icmp sgt i32 %0, 0 br i1 %cmp3.i, label %for.body.preheader.i, label %intAryScan.exit for.body.preheader.i: ; preds = %entry %wide.trip.count.i = zext i32 %0 to i64 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ] %arrayidx.i = getelementptr inbounds double, ptr @s, i64 %indvars.iv.i %call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i) %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 %intAryScan.exit, label %for.body.i, !llvm.loop !5 intAryScan.exit: ; preds = %for.body.i, %entry %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q) %1 = load i32, ptr %q, align 4, !tbaa !7 %cmp3.i91 = icmp sgt i32 %1, 0 br i1 %cmp3.i91, label %for.body.preheader.i92, label %for.end63 for.body.preheader.i92: ; preds = %intAryScan.exit %wide.trip.count.i93 = zext i32 %1 to i64 br label %for.body.i94 for.body.i94: ; preds = %for.body.i94, %for.body.preheader.i92 %indvars.iv.i95 = phi i64 [ 0, %for.body.preheader.i92 ], [ %indvars.iv.next.i98, %for.body.i94 ] %arrayidx.i96 = getelementptr inbounds double, ptr @t, i64 %indvars.iv.i95 %call.i97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i96) %indvars.iv.next.i98 = add nuw nsw i64 %indvars.iv.i95, 1 %exitcond.not.i99 = icmp eq i64 %indvars.iv.next.i98, %wide.trip.count.i93 br i1 %exitcond.not.i99, label %intAryScan.exit100, label %for.body.i94, !llvm.loop !5 intAryScan.exit100: ; preds = %for.body.i94 %.pre = load i32, ptr %q, align 4, !tbaa !7 %cmp105 = icmp sgt i32 %.pre, 0 br i1 %cmp105, label %for.body.lr.ph, label %for.end63 for.body.lr.ph: ; preds = %intAryScan.exit100 %2 = load i32, ptr %n, align 4, !tbaa !7 %.fr = freeze i32 %2 %div = sdiv i32 %.fr, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %idxprom %3 = load double, ptr %arrayidx, align 8, !tbaa !11 %cmp28103 = icmp sgt i32 %.fr, 1 %wide.trip.count128 = zext i32 %.pre to i64 br i1 %cmp28103, label %for.body.us.preheader, label %for.body.preheader for.body.preheader: ; preds = %for.body.lr.ph %4 = sext i32 %.fr to i64 br label %for.body for.body.us.preheader: ; preds = %for.body.lr.ph %5 = zext i32 %.fr to i64 %wide.trip.count120 = zext i32 %div to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.preheader, %for.inc61.us %indvars.iv125 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next126, %for.inc61.us ] %c.0107.us = phi i32 [ 0, %for.body.us.preheader ], [ %c.1.us, %for.inc61.us ] %arrayidx3.us = getelementptr inbounds [50000 x double], ptr @t, i64 0, i64 %indvars.iv125 %6 = load double, ptr %arrayidx3.us, align 8, !tbaa !11 %cmp4.us = fcmp olt double %3, %6 br i1 %cmp4.us, label %for.cond5.us, label %if.else.us if.else.us: ; preds = %for.body.us %cmp25.us = fcmp olt double %6, %3 br i1 %cmp25.us, label %land.rhs29.us, label %if.else50.us if.else50.us: ; preds = %if.else.us %cmp55.us = fcmp oeq double %3, %6 br i1 %cmp55.us, label %if.then56.us, label %for.inc61.us if.then56.us: ; preds = %if.else50.us %inc57.us = add nsw i32 %c.0107.us, 1 br label %for.inc61.us for.cond27.us: ; preds = %land.rhs29.us %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120 br i1 %exitcond121.not, label %for.inc61.us, label %land.rhs29.us, !llvm.loop !13 land.rhs29.us: ; preds = %if.else.us, %for.cond27.us %indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.cond27.us ], [ 0, %if.else.us ] %arrayidx31.us = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %indvars.iv117 %7 = load double, ptr %arrayidx31.us, align 8, !tbaa !11 %cmp34.us = fcmp olt double %7, %6 br i1 %cmp34.us, label %for.cond27.us, label %land.lhs.true41.us land.lhs.true41.us: ; preds = %land.rhs29.us %cmp46.us = fcmp oeq double %6, %7 br i1 %cmp46.us, label %if.then47.us, label %for.inc61.us if.then47.us: ; preds = %land.lhs.true41.us %inc48.us = add nsw i32 %c.0107.us, 1 br label %for.inc61.us for.cond5.us: ; preds = %for.body.us, %land.rhs.us %indvars.iv122 = phi i64 [ %indvars.iv.next123, %land.rhs.us ], [ %idxprom, %for.body.us ] %indvars.iv.next123 = add nsw i64 %indvars.iv122, 1 %cmp6.us = icmp slt i64 %indvars.iv.next123, %5 br i1 %cmp6.us, label %land.rhs.us, label %for.inc61.us land.rhs.us: ; preds = %for.cond5.us %arrayidx8.us = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %indvars.iv.next123 %8 = load double, ptr %arrayidx8.us, align 8, !tbaa !11 %cmp11.us = fcmp olt double %8, %6 br i1 %cmp11.us, label %for.cond5.us, label %land.lhs.true.us, !llvm.loop !14 land.lhs.true.us: ; preds = %land.rhs.us %sext130 = shl i64 %indvars.iv.next123, 32 %idxprom16.us = ashr exact i64 %sext130, 32 %arrayidx17.us = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %idxprom16.us %9 = load double, ptr %arrayidx17.us, align 8, !tbaa !11 %cmp18.us = fcmp oeq double %6, %9 br i1 %cmp18.us, label %if.then19.us, label %for.inc61.us if.then19.us: ; preds = %land.lhs.true.us %inc20.us = add nsw i32 %c.0107.us, 1 br label %for.inc61.us for.inc61.us: ; preds = %for.cond27.us, %for.cond5.us, %if.then19.us, %land.lhs.true.us, %if.then47.us, %land.lhs.true41.us, %if.then56.us, %if.else50.us %c.1.us = phi i32 [ %inc20.us, %if.then19.us ], [ %c.0107.us, %land.lhs.true.us ], [ %inc48.us, %if.then47.us ], [ %c.0107.us, %land.lhs.true41.us ], [ %inc57.us, %if.then56.us ], [ %c.0107.us, %if.else50.us ], [ %c.0107.us, %for.cond5.us ], [ %c.0107.us, %for.cond27.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.end63, label %for.body.us, !llvm.loop !15 for.body: ; preds = %for.body.preheader, %for.inc61 %indvars.iv114 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next115, %for.inc61 ] %c.0107 = phi i32 [ 0, %for.body.preheader ], [ %c.1, %for.inc61 ] %arrayidx3 = getelementptr inbounds [50000 x double], ptr @t, i64 0, i64 %indvars.iv114 %10 = load double, ptr %arrayidx3, align 8, !tbaa !11 %cmp4 = fcmp olt double %3, %10 br i1 %cmp4, label %for.cond5, label %if.else for.cond5: ; preds = %for.body, %land.rhs %indvars.iv = phi i64 [ %indvars.iv.next, %land.rhs ], [ %idxprom, %for.body ] %indvars.iv.next = add nsw i64 %indvars.iv, 1 %cmp6 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp6, label %land.rhs, label %for.inc61 land.rhs: ; preds = %for.cond5 %arrayidx8 = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %indvars.iv.next %11 = load double, ptr %arrayidx8, align 8, !tbaa !11 %cmp11 = fcmp olt double %11, %10 br i1 %cmp11, label %for.cond5, label %land.lhs.true, !llvm.loop !14 land.lhs.true: ; preds = %land.rhs %sext = shl i64 %indvars.iv.next, 32 %idxprom16 = ashr exact i64 %sext, 32 %arrayidx17 = getelementptr inbounds [100000 x double], ptr @s, i64 0, i64 %idxprom16 %12 = load double, ptr %arrayidx17, align 8, !tbaa !11 %cmp18 = fcmp oeq double %10, %12 br i1 %cmp18, label %if.then19, label %for.inc61 if.then19: ; preds = %land.lhs.true %inc20 = add nsw i32 %c.0107, 1 br label %for.inc61 if.else: ; preds = %for.body %or.cond = fcmp oeq double %10, %3 %inc57 = zext i1 %or.cond to i32 %spec.select = add nsw i32 %c.0107, %inc57 br label %for.inc61 for.inc61: ; preds = %for.cond5, %if.else, %if.then19, %land.lhs.true %c.1 = phi i32 [ %inc20, %if.then19 ], [ %c.0107, %land.lhs.true ], [ %spec.select, %if.else ], [ %c.0107, %for.cond5 ] %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1 %exitcond.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count128 br i1 %exitcond.not, label %for.end63, label %for.body, !llvm.loop !15 for.end63: ; preds = %for.inc61, %for.inc61.us, %intAryScan.exit, %intAryScan.exit100 %c.0.lcssa = phi i32 [ 0, %intAryScan.exit100 ], [ 0, %intAryScan.exit ], [ %c.1.us, %for.inc61.us ], [ %c.1, %for.inc61 ] %call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; 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 = 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 = !{!"double", !9, i64 0} !13 = distinct !{!13, !6} !14 = distinct !{!14, !6} !15 = distinct !{!15, !6}
#include <stdio.h> int main(){ int n,m,i,a[100000],b[50000],k,j,x,y,z; m=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } scanf("%d",&k); for(i=0;i<k;i++){ scanf("%d",&b[i]); x=n; y=0; while(x>y){ z=(x+y)/2; if(a[z]==b[i]){ m++; break; } if(a[z]>b[i]){ x=z; } else if(a[z]<b[i]){ y=z+1; } } } printf("%d\n",m); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185504/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185504/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 [100000 x i32], align 16 %b = alloca [50000 x i32], align 16 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %b) #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) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %for.end 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, 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %3 = load i32, ptr %k, align 4, !tbaa !5 %cmp456 = icmp sgt i32 %3, 0 br i1 %cmp456, label %for.body5, label %for.end33 for.body5: ; preds = %for.end, %for.inc31 %indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc31 ], [ 0, %for.end ] %m.058 = phi i32 [ %m.1, %for.inc31 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %b, i64 0, i64 %indvars.iv60 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp953 = icmp sgt i32 %4, 0 br i1 %cmp953, label %while.body.lr.ph, label %for.inc31 while.body.lr.ph: ; preds = %for.body5 %5 = load i32, ptr %arrayidx7, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.end %y.055 = phi i32 [ 0, %while.body.lr.ph ], [ %y.1, %if.end ] %x.054 = phi i32 [ %4, %while.body.lr.ph ], [ %x.1, %if.end ] %add = add nsw i32 %y.055, %x.054 %div = sdiv i32 %add, 2 %idxprom10 = sext i32 %div to i64 %arrayidx11 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom10 %6 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp14 = icmp eq i32 %6, %5 br i1 %cmp14, label %if.then, label %if.end if.then: ; preds = %while.body %inc15 = add nsw i32 %m.058, 1 br label %for.inc31 if.end: ; preds = %while.body %cmp20 = icmp sgt i32 %6, %5 %cmp26 = icmp slt i32 %6, %5 %add28 = add nsw i32 %div, 1 %spec.select = select i1 %cmp26, i32 %add28, i32 %y.055 %x.1 = select i1 %cmp20, i32 %div, i32 %x.054 %y.1 = select i1 %cmp20, i32 %y.055, i32 %spec.select %cmp9 = icmp sgt i32 %x.1, %y.1 br i1 %cmp9, label %while.body, label %for.inc31, !llvm.loop !11 for.inc31: ; preds = %if.end, %for.body5, %if.then %m.1 = phi i32 [ %inc15, %if.then ], [ %m.058, %for.body5 ], [ %m.058, %if.end ] %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1 %7 = load i32, ptr %k, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next61, %8 br i1 %cmp4, label %for.body5, label %for.end33, !llvm.loop !12 for.end33: ; preds = %for.inc31, %for.end %m.0.lcssa = phi i32 [ 0, %for.end ], [ %m.1, %for.inc31 ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #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} !12 = distinct !{!12, !10}
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--){ int n,i; scanf("%d",&n); for(i=1;i<=n;i++){ printf("%d ",i); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18557/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18557/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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec8 = add nsw i32 %0, -1 store i32 %dec8, ptr %t, align 4, !tbaa !5 %tobool.not9 = icmp eq i32 %0, 0 br i1 %tobool.not9, label %while.end, label %while.body while.body: ; preds = %entry, %for.end 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 %cmp.not6 = icmp slt i32 %1, 1 br i1 %cmp.not6, label %for.end, label %for.body for.body: ; preds = %while.body, %for.body %i.07 = phi i32 [ %inc, %for.body ], [ 1, %while.body ] %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.07) %inc = add nuw nsw i32 %i.07, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.07, %2 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %while.body %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %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 !11 while.end: ; preds = %for.end, %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 @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> #include <stdlib.h> int search(int *array, int n, int x) { int pl = 0; int pr = n - 1; while(pl <= pr) { int pc = (pl + pr) / 2; if(array[pc] == x) { return pc; } else if(array[pc] < x) { pl = pc + 1; } else if(x < array[pc]) { pr = pc - 1; } } return -1; } int main(void) { int n; scanf("%d", &n); int *s = malloc(n * sizeof(int)); if(s == NULL) { return 1; } for(int i = 0; i < n; i++) { scanf("%d", &s[i]); } int q; scanf("%d", &q); int *t = malloc(q * sizeof(int)); if(t == NULL) { return 1; } for(int i = 0; i < q; i++) { scanf("%d", &t[i]); } int cnt = 0; for(int i = 0; i < q; i++) { if(search(s, n, t[i]) != -1) { cnt++; } } printf("%d\n", cnt); free(s); free(t); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185612/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185612/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @search(ptr nocapture noundef readonly %array, i32 noundef %n, i32 noundef %x) local_unnamed_addr #0 { entry: %cmp.not31 = icmp slt i32 %n, 1 br i1 %cmp.not31, label %cleanup15, label %while.body.preheader while.body.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 br label %while.body while.body: ; preds = %while.body.preheader, %if.else %pr.033 = phi i32 [ %pr.2, %if.else ], [ %sub, %while.body.preheader ] %pl.032 = phi i32 [ %pl.2, %if.else ], [ 0, %while.body.preheader ] %add = add nsw i32 %pr.033, %pl.032 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1.not = icmp eq i32 %0, %x br i1 %cmp1.not, label %cleanup15, label %if.else if.else: ; preds = %while.body %cmp4 = icmp slt i32 %0, %x %add6 = add nsw i32 %div, 1 %cmp10 = icmp sgt i32 %0, %x %sub12 = add nsw i32 %div, -1 %spec.select = select i1 %cmp10, i32 %sub12, i32 %pr.033 %pl.2 = select i1 %cmp4, i32 %add6, i32 %pl.032 %pr.2 = select i1 %cmp4, i32 %pr.033, i32 %spec.select %cmp.not = icmp sgt i32 %pl.2, %pr.2 br i1 %cmp.not, label %cleanup15, label %while.body cleanup15: ; preds = %if.else, %while.body, %entry %retval.2 = phi i32 [ -1, %entry ], [ %div, %while.body ], [ -1, %if.else ] ret i32 %retval.2 } ; 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: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp = icmp eq ptr %call1, null br i1 %cmp, label %cleanup45, label %for.cond.preheader for.cond.preheader: ; preds = %entry %cmp365 = icmp sgt i32 %0, 0 br i1 %cmp365, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %for.cond.preheader call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %1 = load i32, ptr %q, align 4, !tbaa !5 %conv7 = sext i32 %1 to i64 %mul8 = shl nsw i64 %conv7, 2 %call9 = call noalias ptr @malloc(i64 noundef %mul8) #7 %cmp10 = icmp eq ptr %call9, null br i1 %cmp10, label %cleanup, label %for.cond15.preheader for.cond15.preheader: ; preds = %for.cond.cleanup %cmp1667 = icmp sgt i32 %1, 0 br i1 %cmp1667, label %for.body19, label %for.cond.cleanup30 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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 %cmp3 = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp3, label %for.body, label %for.cond.cleanup, !llvm.loop !9 for.cond27.preheader: ; preds = %for.body19 %cmp2869 = icmp sgt i32 %5, 0 br i1 %cmp2869, label %for.body31.lr.ph, label %for.cond.cleanup30 for.body31.lr.ph: ; preds = %for.cond27.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not31.i = icmp slt i32 %4, 1 %sub.i = add nsw i32 %4, -1 br i1 %cmp.not31.i, label %for.cond.cleanup30, label %for.body31.preheader for.body31.preheader: ; preds = %for.body31.lr.ph %wide.trip.count = zext i32 %5 to i64 br label %for.body31 for.body19: ; preds = %for.cond15.preheader, %for.body19 %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body19 ], [ 0, %for.cond15.preheader ] %arrayidx21 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv78 %call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx21) %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %5 = load i32, ptr %q, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp16 = icmp slt i64 %indvars.iv.next79, %6 br i1 %cmp16, label %for.body19, label %for.cond27.preheader, !llvm.loop !11 for.cond.cleanup30: ; preds = %for.cond27, %for.cond15.preheader, %for.body31.lr.ph, %for.cond27.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ 0, %for.body31.lr.ph ], [ 0, %for.cond15.preheader ], [ %9, %for.cond27 ] %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @free(ptr noundef %call1) #6 call void @free(ptr noundef %call9) #6 br label %cleanup for.body31: ; preds = %for.body31.preheader, %for.cond27 %indvars.iv81 = phi i64 [ 0, %for.body31.preheader ], [ %indvars.iv.next82, %for.cond27 ] %cnt.070 = phi i32 [ 0, %for.body31.preheader ], [ %9, %for.cond27 ] %arrayidx33 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv81 %7 = load i32, ptr %arrayidx33, align 4, !tbaa !5 br label %while.body.i while.body.i: ; preds = %if.else.i, %for.body31 %pr.033.i = phi i32 [ %pr.2.i, %if.else.i ], [ %sub.i, %for.body31 ] %pl.032.i = phi i32 [ %pl.2.i, %if.else.i ], [ 0, %for.body31 ] %add.i = add nsw i32 %pl.032.i, %pr.033.i %add.i.fr = freeze i32 %add.i %div.i = sdiv i32 %add.i.fr, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.not.i = icmp eq i32 %8, %7 br i1 %cmp1.not.i, label %search.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %8, %7 %add6.i = add nsw i32 %div.i, 1 %cmp10.i = icmp sgt i32 %8, %7 %sub12.i = add nsw i32 %div.i, -1 %spec.select.i = select i1 %cmp10.i, i32 %sub12.i, i32 %pr.033.i %pl.2.i = select i1 %cmp4.i, i32 %add6.i, i32 %pl.032.i %pr.2.i = select i1 %cmp4.i, i32 %pr.033.i, i32 %spec.select.i %cmp.not.i = icmp sgt i32 %pl.2.i, %pr.2.i br i1 %cmp.not.i, label %search.exit.thread, label %while.body.i search.exit: ; preds = %while.body.i %add.i.off = add i32 %add.i.fr, 3 %cmp35.not = icmp ult i32 %add.i.off, 2 %inc38 = add nsw i32 %cnt.070, 1 br i1 %cmp35.not, label %search.exit.thread, label %for.cond27 search.exit.thread: ; preds = %if.else.i, %search.exit br label %for.cond27 for.cond27: ; preds = %search.exit, %search.exit.thread %9 = phi i32 [ %cnt.070, %search.exit.thread ], [ %inc38, %search.exit ] %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup30, label %for.body31, !llvm.loop !12 cleanup: ; preds = %for.cond.cleanup, %for.cond.cleanup30 %retval.0 = phi i32 [ 0, %for.cond.cleanup30 ], [ 1, %for.cond.cleanup ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6 br label %cleanup45 cleanup45: ; preds = %entry, %cleanup %retval.1 = phi i32 [ %retval.0, %cleanup ], [ 1, %entry ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 %retval.1 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5 attributes #0 = { nofree norecurse nosync nounwind 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #define N 100000 #define Q 50000 int binarySearch(int); int S[N], n; int main() { int i, C=0, result, q, T[Q]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ result=binarySearch(T[i]); if(result==1) C++; } printf("%d\n",C); return 0; } int binarySearch(int key) { int left=0, right=n, mid; while(left<right){ mid=(left+right)/2; if(S[mid]==key) return 1; else if(key<S[mid]) right=mid; else left=mid+1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185663/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185663/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 @n = dso_local global i32 0, align 4 @S = dso_local global [100000 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: %q = alloca i32, align 4 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %0, 0 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %indvars.iv %call1 = tail 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp438 = icmp sgt i32 %3, 0 br i1 %cmp438, label %for.body5, label %for.end22 for.cond12.preheader: ; preds = %for.body5 %cmp1340 = icmp sgt i32 %8, 0 br i1 %cmp1340, label %for.body14.lr.ph, label %for.end22 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr @n, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %4, 0 br i1 %cmp17.i, label %for.body14.us.preheader, label %for.end22 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %8 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.cond12.us %indvars.iv51 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next52, %for.cond12.us ] %C.041.us = phi i32 [ 0, %for.body14.us.preheader ], [ %7, %for.cond12.us ] %arrayidx16.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv51 %5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body14.us, %if.else.i.us %right.019.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %4, %for.body14.us ] %left.018.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body14.us ] %add.i.us = add nsw i32 %left.018.i.us, %right.019.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom.i.us %6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %6, %5 br i1 %cmp1.i.us, label %binarySearch.exit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %6, %5 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.018.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.019.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %for.cond12.us, !llvm.loop !11 binarySearch.exit.us: ; preds = %while.body.i.us %inc19.us = add nsw i32 %C.041.us, 1 br label %for.cond12.us for.cond12.us: ; preds = %if.else.i.us, %binarySearch.exit.us %7 = phi i32 [ %inc19.us, %binarySearch.exit.us ], [ %C.041.us, %if.else.i.us ] %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1 %exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count br i1 %exitcond.not, label %for.end22, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv48 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp4 = icmp slt i64 %indvars.iv.next49, %9 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end22: ; preds = %for.cond12.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %7, %for.cond12.us ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #3 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.019 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.018, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.019 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse 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 #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 = distinct !{!13, !10}
#include <stdio.h> int A[1000000],n; int B_search(int key){ int left = 0; int right = n; int mid; while(left < right){ mid = (left + right) / 2; if(key == A[mid])return 1; if(key > A[mid])left = mid + 1; if(key < A[mid])right = mid; } return 0; } int main(){ int i, q, key, sum = 0; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &A[i]); } scanf("%d", &q); for(i = 0; i < q; i++){ scanf("%d", &key); if(B_search(key))sum++; } printf("%d\n", sum); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185706/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185706/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" @n = dso_local global i32 0, align 4 @A = dso_local 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @B_search(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.024 = phi i32 [ %spec.select, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.025, %left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %spec.select = select i1 %cmp4, i32 %add6, i32 %left.024 %cmp10 = icmp sgt i32 %1, %key %right.1 = select i1 %cmp10, i32 %div, i32 %right.025 %cmp = icmp slt i32 %spec.select, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %key = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %key, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.024.i = phi i32 [ %spec.select.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.024.i, %right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %B_search.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %spec.select.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i %cmp10.i = icmp sgt i32 %6, %4 %right.1.i = select i1 %cmp10.i, i32 %div.i, i32 %right.025.i %cmp.i = icmp slt i32 %spec.select.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 B_search.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %B_search.exit %7 = phi i32 [ %inc8, %B_search.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = 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 %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #include <string.h> int main() { int n, k, i, j, t; int c[100]; int v[100]; scanf("%d %d", &n, &k); if (n < k) { printf("NO"); return 0; } memset(c, 0, sizeof(c)); v[0] = 1; for (i = 0, t = 0; n > 0; i++) { v[i + 1] = v[i] * 2; if (n & 1) { c[i] = 1; t++; } n >>= 1; } if (t > k) printf("NO\n"); else { for (i = 32; i >= 0 && t < k; i--) { while (c[i] > 0 && t < k) { c[i]--; c[i - 1] += 2; t++; } } printf("YES\n"); for (i = 0; i < 32; i++) { for (j = 0; j < c[i]; j++) printf("%d ", v[i]); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18575/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18575/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.4 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @str = private unnamed_addr constant [4 x i8] c"YES\00", align 1 @str.5 = 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 %k = alloca i32, align 4 %c = alloca [100 x i32], align 16 %v = alloca [100 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 void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #6 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %v) #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 = load i32, ptr %k, align 4 %cmp = icmp slt i32 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @str.5) br label %cleanup if.end: ; preds = %entry call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %c, i8 0, i64 400, i1 false) store i32 1, ptr %v, align 16, !tbaa !5 %cmp276 = icmp sgt i32 %0, 0 br i1 %cmp276, label %for.body, label %for.end for.body: ; preds = %if.end, %if.end9 %2 = phi i32 [ %mul, %if.end9 ], [ 1, %if.end ] %indvars.iv = phi i64 [ %indvars.iv.next, %if.end9 ], [ 0, %if.end ] %t.078 = phi i32 [ %t.1, %if.end9 ], [ 0, %if.end ] %3 = phi i32 [ %shr, %if.end9 ], [ %0, %if.end ] %mul = shl nsw i32 %2, 1 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx5 = getelementptr inbounds [100 x i32], ptr %v, i64 0, i64 %indvars.iv.next store i32 %mul, ptr %arrayidx5, align 4, !tbaa !5 %and = and i32 %3, 1 %tobool.not = icmp eq i32 %and, 0 br i1 %tobool.not, label %if.end9, label %if.then6 if.then6: ; preds = %for.body %arrayidx8 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv store i32 1, ptr %arrayidx8, align 4, !tbaa !5 %inc = add nsw i32 %t.078, 1 br label %if.end9 if.end9: ; preds = %if.then6, %for.body %t.1 = phi i32 [ %inc, %if.then6 ], [ %t.078, %for.body ] %shr = lshr i32 %3, 1 %cmp2.not = icmp ult i32 %3, 2 br i1 %cmp2.not, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !9 for.cond.for.end_crit_edge: ; preds = %if.end9 store i32 %shr, ptr %n, align 4, !tbaa !5 br label %for.end for.end: ; preds = %for.cond.for.end_crit_edge, %if.end %t.0.lcssa = phi i32 [ %t.1, %for.cond.for.end_crit_edge ], [ 0, %if.end ] %cmp11 = icmp sgt i32 %t.0.lcssa, %1 br i1 %cmp11, label %if.then12, label %for.cond14.preheader for.cond14.preheader: ; preds = %for.end %cmp1686 = icmp slt i32 %t.0.lcssa, %1 br i1 %cmp1686, label %while.cond.preheader, label %for.end32 if.then12: ; preds = %for.end %puts75 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5) br label %cleanup while.cond.preheader: ; preds = %for.cond14.preheader, %for.inc30 %indvars.iv93 = phi i64 [ %4, %for.inc30 ], [ 32, %for.cond14.preheader ] %t.288 = phi i32 [ %t.3.lcssa, %for.inc30 ], [ %t.0.lcssa, %for.cond14.preheader ] %arrayidx19 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv93 %arrayidx19.promoted = load i32, ptr %arrayidx19, align 4, !tbaa !5 %cmp2080 = icmp sgt i32 %arrayidx19.promoted, 0 %4 = add nsw i64 %indvars.iv93, -1 br i1 %cmp2080, label %while.body.lr.ph, label %for.inc30 while.body.lr.ph: ; preds = %while.cond.preheader %arrayidx27 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %4 %arrayidx27.promoted = load i32, ptr %arrayidx27, align 4, !tbaa !5 %5 = add nsw i32 %arrayidx19.promoted, -1 %6 = add nsw i32 %t.288, 1 %smax = call i32 @llvm.smax.i32(i32 %1, i32 %6) %7 = xor i32 %t.288, -1 %8 = add i32 %smax, %7 %9 = freeze i32 %8 %umin = call i32 @llvm.umin.i32(i32 %9, i32 %5) %10 = sub nsw i32 %5, %umin %11 = shl nuw i32 %umin, 1 %12 = add i32 %arrayidx27.promoted, 2 %13 = add i32 %12, %11 %14 = add i32 %6, %umin store i32 %13, ptr %arrayidx27, align 4, !tbaa !5 br label %for.inc30 for.inc30: ; preds = %while.cond.preheader, %while.body.lr.ph %dec79.lcssa = phi i32 [ %10, %while.body.lr.ph ], [ %arrayidx19.promoted, %while.cond.preheader ] %t.3.lcssa = phi i32 [ %14, %while.body.lr.ph ], [ %t.288, %while.cond.preheader ] store i32 %dec79.lcssa, ptr %arrayidx19, align 4, !tbaa !5 %cmp15 = icmp ne i64 %indvars.iv93, 0 %cmp16 = icmp slt i32 %t.3.lcssa, %1 %15 = select i1 %cmp15, i1 %cmp16, i1 false br i1 %15, label %while.cond.preheader, label %for.end32, !llvm.loop !11 for.end32: ; preds = %for.inc30, %for.cond14.preheader %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.cond37.preheader for.cond37.preheader: ; preds = %for.end32, %for.inc48 %indvars.iv97 = phi i64 [ 0, %for.end32 ], [ %indvars.iv.next98, %for.inc48 ] %arrayidx39 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv97 %16 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %cmp4089 = icmp sgt i32 %16, 0 br i1 %cmp4089, label %for.body41.lr.ph, label %for.inc48 for.body41.lr.ph: ; preds = %for.cond37.preheader %arrayidx43 = getelementptr inbounds [100 x i32], ptr %v, i64 0, i64 %indvars.iv97 %17 = load i32, ptr %arrayidx43, align 4, !tbaa !5 br label %for.body41 for.body41: ; preds = %for.body41.lr.ph, %for.body41 %j.090 = phi i32 [ 0, %for.body41.lr.ph ], [ %inc46, %for.body41 ] %call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %17) %inc46 = add nuw nsw i32 %j.090, 1 %exitcond.not = icmp eq i32 %inc46, %16 br i1 %exitcond.not, label %for.inc48, label %for.body41, !llvm.loop !12 for.inc48: ; preds = %for.body41, %for.cond37.preheader %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1 %exitcond100.not = icmp eq i64 %indvars.iv.next98, 32 br i1 %exitcond100.not, label %cleanup, label %for.cond37.preheader, !llvm.loop !13 cleanup: ; preds = %for.inc48, %if.then12, %if.then call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %v) #6 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #6 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: nofree nounwind declare noundef i32 @printf(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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.umin.i32(i32, 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 nounwind willreturn memory(argmem: write) } 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} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int binarySearch(int n, int key, int A[]){ int i, left = 0, right = n, mid; while(left < right){ mid = ((left + right)/2); if(A[mid] == key)return 1; else if(key < A[mid])right = mid; else left = (mid + 1); } return 0; } int main(){ int i, n, q, key, sum = 0; int S[100000]; scanf("%d",&n); for(i = 0; i < n; i++) scanf("%d",&S[i]); scanf("%d",&q); for(i = 0; i < q; i++){ scanf("%d",&key); sum += binarySearch(n, key, S); } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185793/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185793/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(i32 noundef %n, i32 noundef %key, ptr nocapture noundef readonly %A) local_unnamed_addr #0 { entry: %cmp19 = icmp sgt i32 %n, 0 br i1 %cmp19, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.021 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.020 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.021, %left.020 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.020, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.021 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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 %key = alloca i32, align 4 %S = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp419 = icmp sgt i32 %3, 0 br i1 %cmp419, label %for.body5, label %for.end10 for.body5: ; preds = %for.end, %binarySearch.exit %sum.021 = phi i32 [ %add, %binarySearch.exit ], [ 0, %for.end ] %i.120 = phi i32 [ %inc9, %binarySearch.exit ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %key, align 4, !tbaa !5 %cmp19.i = icmp sgt i32 %4, 0 br i1 %cmp19.i, label %while.body.i, label %binarySearch.exit while.body.i: ; preds = %for.body5, %if.else.i %right.021.i = phi i32 [ %right.1.i, %if.else.i ], [ %4, %for.body5 ] %left.020.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.020.i, %right.021.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %5 %add7.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %left.020.i, i32 %add7.i %right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.021.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %binarySearch.exit, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i, %if.else.i, %for.body5 %retval.0.i = phi i32 [ 0, %for.body5 ], [ 1, %while.body.i ], [ 0, %if.else.i ] %add = add nuw nsw i32 %retval.0.i, %sum.021 %inc9 = add nuw nsw i32 %i.120, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc9, %7 br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12 for.end10: ; preds = %binarySearch.exit, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %binarySearch.exit ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 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(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int Search(int *,int,int); int main(){ int i,n,a[100000],q,t,sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&t); sum+=Search(a,n,t); } printf("%d\n",sum); return 0; } int Search(int *a,int n,int t){ int mid,F,L; F=0; L=n; while(F<L){ mid=(F+L)/2; if(a[mid]==t)return 1; else if(a[mid]>t){ L=mid; }else F=mid+1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185836/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185836/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 [100000 x i32], align 16 %q = alloca i32, align 4 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #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 %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %for.body, label %for.end 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, 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp419 = icmp sgt i32 %3, 0 br i1 %cmp419, label %for.body5, label %for.end10 for.body5: ; preds = %for.end, %Search.exit %sum.021 = phi i32 [ %add, %Search.exit ], [ 0, %for.end ] %i.120 = phi i32 [ %inc9, %Search.exit ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %t, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %4, 0 br i1 %cmp18.i, label %while.body.i, label %Search.exit while.body.i: ; preds = %for.body5, %if.else.i %L.020.i = phi i32 [ %L.1.i, %if.else.i ], [ %4, %for.body5 ] %F.019.i = phi i32 [ %F.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %F.019.i, %L.020.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %Search.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %5 %add7.i = add nsw i32 %div.i, 1 %F.1.i = select i1 %cmp4.i, i32 %F.019.i, i32 %add7.i %L.1.i = select i1 %cmp4.i, i32 %div.i, i32 %L.020.i %cmp.i = icmp slt i32 %F.1.i, %L.1.i br i1 %cmp.i, label %while.body.i, label %Search.exit, !llvm.loop !11 Search.exit: ; preds = %while.body.i, %if.else.i, %for.body5 %retval.0.i = phi i32 [ 0, %for.body5 ], [ 1, %while.body.i ], [ 0, %if.else.i ] %add = add nuw nsw i32 %retval.0.i, %sum.021 %inc9 = add nuw nsw i32 %i.120, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc9, %7 br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12 for.end10: ; preds = %Search.exit, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %Search.exit ] %call11 = 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 %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 400000, 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 norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @Search(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %t) local_unnamed_addr #3 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %L.020 = phi i32 [ %L.1, %if.else ], [ %n, %entry ] %F.019 = phi i32 [ %F.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %L.020, %F.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %t br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %t %add7 = add nsw i32 %div, 1 %F.1 = select i1 %cmp4, i32 %F.019, i32 %add7 %L.1 = select i1 %cmp4, i32 %div, i32 %L.020 %cmp = icmp slt i32 %F.1, %L.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse nosync nounwind 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 = { 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> int Binary_Search( int , int, int* ); int main( void ){ int i, n, q, count; scanf("%d", &n ); int s[n+1]; for( i = 0; i < n; i++ ){ scanf("%d", &s[i] ); } scanf("%d", &q ); int t[q]; for( i = 0; i < q; i++ ){ scanf("%d", &t[i] ); } count = 0; for( i = 0; i < q; i++ ){ count += Binary_Search( n, t[i], s); } printf("%d\n", count ); return 0; } int Binary_Search( int n, int key, int* s){ int left, right, mid; left = 0; right = n; while( left < right ){ mid = (left + right)/2; if( s[mid] == key ){ return 1; } else if( key < s[mid] ){ right = mid; } else{ left = mid + 1; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185887/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185887/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 %q = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp33 = icmp sgt i32 %3, 0 br i1 %cmp33, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %6 = load i32, ptr %q, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %vla3 = alloca i32, i64 %7, align 16 %cmp535 = icmp sgt i32 %6, 0 br i1 %cmp535, label %for.body6, label %for.end22 for.cond13.preheader: ; preds = %for.body6 %cmp1437 = icmp sgt i32 %11, 0 br i1 %cmp1437, label %for.body15.lr.ph, label %for.end22 for.body15.lr.ph: ; preds = %for.cond13.preheader %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %8, 0 br i1 %cmp18.i, label %for.body15.us.preheader, label %for.end22 for.body15.us.preheader: ; preds = %for.body15.lr.ph %wide.trip.count = zext i32 %11 to i64 br label %for.body15.us for.body15.us: ; preds = %for.body15.us.preheader, %Binary_Search.exit.loopexit.us %indvars.iv47 = phi i64 [ 0, %for.body15.us.preheader ], [ %indvars.iv.next48, %Binary_Search.exit.loopexit.us ] %count.038.us = phi i32 [ 0, %for.body15.us.preheader ], [ %add19.us, %Binary_Search.exit.loopexit.us ] %arrayidx17.us = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv47 %9 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body15.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %8, %for.body15.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body15.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i.us %10 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %10, %9 br i1 %cmp1.i.us, label %Binary_Search.exit.loopexit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %10, %9 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %Binary_Search.exit.loopexit.us, !llvm.loop !11 Binary_Search.exit.loopexit.us: ; preds = %if.else.i.us, %while.body.i.us %retval.0.i.ph.us = phi i32 [ 1, %while.body.i.us ], [ 0, %if.else.i.us ] %add19.us = add nuw nsw i32 %retval.0.i.ph.us, %count.038.us %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1 %exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count br i1 %exitcond.not, label %for.end22, label %for.body15.us, !llvm.loop !12 for.body6: ; preds = %for.end, %for.body6 %indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body6 ], [ 0, %for.end ] %arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv44 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8) %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %11 = load i32, ptr %q, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp5 = icmp slt i64 %indvars.iv.next45, %12 br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !13 for.end22: ; preds = %Binary_Search.exit.loopexit.us, %for.end, %for.body15.lr.ph, %for.cond13.preheader %count.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.body15.lr.ph ], [ 0, %for.end ], [ %add19.us, %Binary_Search.exit.loopexit.us ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) 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 } ; 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 norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @Binary_Search(i32 noundef %n, i32 noundef %key, ptr nocapture noundef readonly %s) local_unnamed_addr #4 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; scanf("%d",&n); char s[n+5],d[n+5]; int i,k=0; scanf("%s",s); for(i=0;i<n;i+=k) { d[k++]=s[i]; } d[k]='\0'; printf("%s",d); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18593/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18593/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local 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 %add = add nsw i32 %0, 5 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %add1 = add nsw i32 %3, 5 %4 = zext i32 %add1 to i64 %vla2 = alloca i8, i64 %4, align 16 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp14 = icmp sgt i32 %5, 0 br i1 %cmp14, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %i.015 = phi i32 [ %add6, %for.body ], [ 0, %entry ] %idxprom = zext i32 %i.015 to i64 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom %6 = load i8, ptr %arrayidx, align 1, !tbaa !9 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx5 = getelementptr inbounds i8, ptr %vla2, i64 %indvars.iv store i8 %6, ptr %arrayidx5, align 1, !tbaa !9 %7 = trunc i64 %indvars.iv.next to i32 %add6 = add nuw nsw i32 %i.015, %7 %cmp = icmp slt i32 %add6, %5 br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !10 for.end.loopexit: ; preds = %for.body %8 = and i64 %indvars.iv.next, 4294967295 br label %for.end for.end: ; preds = %for.end.loopexit, %entry %k.0.lcssa = phi i64 [ 0, %entry ], [ %8, %for.end.loopexit ] %arrayidx8 = getelementptr inbounds i8, ptr %vla2, i64 %k.0.lcssa store i8 0, ptr %arrayidx8, align 1, !tbaa !9 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %vla2) call void @llvm.stackrestore.p0(ptr %2) 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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int binarysearch(int a[], int n, int key) { int r = 0; int l = n; int i; while (l - r >= 1) { i = (r + l) / 2; if (a[i] == key) return 1; else if (a[i] < key) r = i + 1; else l = i; } return 0; } int main() { int n, q; int s[100000]; int t[50000]; int sum = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &s[i]); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &t[i]); if (binarysearch(s, n, t[i])) sum++; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185973/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185973/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarysearch(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %l.020 = phi i32 [ %l.1, %if.else ], [ %n, %entry ] %r.019 = phi i32 [ %r.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %l.020, %r.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %r.1 = select i1 %cmp4, i32 %add6, i32 %r.019 %l.1 = select i1 %cmp4, i32 %l.020, i32 %div %cmp = icmp sgt i32 %l.1, %r.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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 %s = alloca [100000 x i32], align 16 %t = alloca [50000 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 %q) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp28 = icmp sgt i32 %0, 0 br i1 %cmp28, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %1 = load i32, ptr %q, align 4, !tbaa !5 %cmp530 = icmp sgt i32 %1, 0 br i1 %cmp530, label %for.body7, label %for.cond.cleanup6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %s, 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 %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 !11 for.cond.cleanup6: ; preds = %for.cond4, %for.cond.cleanup %sum.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %7, %for.cond4 ] %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 for.body7: ; preds = %for.cond.cleanup, %for.cond4 %indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.cond4 ], [ 0, %for.cond.cleanup ] %sum.031 = phi i32 [ %7, %for.cond4 ], [ 0, %for.cond.cleanup ] %arrayidx9 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv34 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %4, 0 br i1 %cmp18.i, label %while.body.i, label %for.cond4 while.body.i: ; preds = %for.body7, %if.else.i %l.020.i = phi i32 [ %l.1.i, %if.else.i ], [ %4, %for.body7 ] %r.019.i = phi i32 [ %r.1.i, %if.else.i ], [ 0, %for.body7 ] %add.i = add nsw i32 %r.019.i, %l.020.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %s, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %binarysearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %5 %add6.i = add nsw i32 %div.i, 1 %r.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %r.019.i %l.1.i = select i1 %cmp4.i, i32 %l.020.i, i32 %div.i %cmp.i = icmp sgt i32 %l.1.i, %r.1.i br i1 %cmp.i, label %while.body.i, label %for.cond4, !llvm.loop !9 binarysearch.exit: ; preds = %while.body.i %inc14 = add nsw i32 %sum.031, 1 br label %for.cond4 for.cond4: ; preds = %if.else.i, %for.body7, %binarysearch.exit %7 = phi i32 [ %inc14, %binarysearch.exit ], [ %sum.031, %for.body7 ], [ %sum.031, %if.else.i ] %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp5 = icmp slt i64 %indvars.iv.next35, %9 br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !12 } ; 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(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> #include<stdlib.h> int main(){ int n,q; int *S,*T,B[1000000]; int i,u; int l,m,r; int count=0,flag,key; scanf("%d",&n); S=(int *)malloc(n*sizeof(int)); for(i=0;i<n;i++) scanf("%d",&S[i]); scanf("%d",&q); T=(int *)malloc(q*sizeof(int)); for(i=0;i<q;i++) scanf("%d",&T[i]); for(i=0;i<q;i++){ key=T[i]; l=0; r=n+2; m=(r+l)/2; flag=0; for(u=0;u<count;u++){ if(B[u]==key){ flag=1; break; } } while(r>l){ if(flag==1) break; if(key==S[m]){ B[count++]=key; break; } else if(key<S[m]){ r=m; m=(r+l)/2; }else if(key>S[m]){ l=m+1; m=(r+l)/2; } } } printf("%d\n",count); free(S); free(T); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186015/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186015/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %B = alloca [1000000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %B) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 %cmp106 = icmp sgt i32 %0, 0 br i1 %cmp106, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #6 %cmp9108 = icmp sgt i32 %3, 0 br i1 %cmp9108, label %for.body11, label %for.end71 for.cond18.preheader: ; preds = %for.body11 %cmp19120 = icmp sgt i32 %5, 0 br i1 %cmp19120, label %for.body21.lr.ph, label %for.end71 for.body21.lr.ph: ; preds = %for.cond18.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %.fr = freeze i32 %4 %add = add nsw i32 %.fr, 2 %div = sdiv i32 %add, 2 %cmp36115 = icmp slt i32 %.fr, -1 br i1 %cmp36115, label %for.end71, label %for.body21.preheader for.body21.preheader: ; preds = %for.body21.lr.ph %wide.trip.count135 = zext i32 %5 to i64 br label %for.body21 for.body11: ; preds = %for.end, %for.body11 %indvars.iv127 = phi i64 [ %indvars.iv.next128, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv127 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %5 = load i32, ptr %q, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp9 = icmp slt i64 %indvars.iv.next128, %6 br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !11 for.body21: ; preds = %for.body21.preheader, %for.inc69 %indvars.iv132 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next133, %for.inc69 ] %count.0121 = phi i32 [ 0, %for.body21.preheader ], [ %count.1, %for.inc69 ] %arrayidx23 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv132 %7 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %cmp26110 = icmp sgt i32 %count.0121, 0 br i1 %cmp26110, label %for.body28.preheader, label %if.end41.preheader for.body28.preheader: ; preds = %for.body21 %8 = zext i32 %count.0121 to i64 %wide.trip.count = zext i32 %count.0121 to i64 %9 = load i32, ptr %B, align 16, !tbaa !5 %cmp31140 = icmp eq i32 %9, %7 br i1 %cmp31140, label %for.inc69, label %for.cond25 for.cond25: ; preds = %for.body28.preheader, %for.body28 %indvars.iv130141 = phi i64 [ %indvars.iv.next131, %for.body28 ], [ 0, %for.body28.preheader ] %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130141, 1 %exitcond.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count br i1 %exitcond.not, label %for.end35, label %for.body28, !llvm.loop !12 for.body28: ; preds = %for.cond25 %arrayidx30 = getelementptr inbounds [1000000 x i32], ptr %B, i64 0, i64 %indvars.iv.next131 %10 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %cmp31 = icmp eq i32 %10, %7 br i1 %cmp31, label %for.end35, label %for.cond25, !llvm.loop !12 for.end35: ; preds = %for.body28, %for.cond25 %cmp26.le = icmp ult i64 %indvars.iv.next131, %8 br i1 %cmp26.le, label %for.inc69, label %if.end41.preheader if.end41.preheader: ; preds = %for.body21, %for.end35 br label %if.end41 if.end41: ; preds = %if.end41.preheader, %if.end68 %r.0119 = phi i32 [ %r.1, %if.end68 ], [ %add, %if.end41.preheader ] %m.0118 = phi i32 [ %m.1, %if.end68 ], [ %div, %if.end41.preheader ] %l.0117 = phi i32 [ %l.1, %if.end68 ], [ 0, %if.end41.preheader ] %idxprom42 = sext i32 %m.0118 to i64 %arrayidx43 = getelementptr inbounds i32, ptr %call1, i64 %idxprom42 %11 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %cmp44 = icmp eq i32 %7, %11 br i1 %cmp44, label %if.then46, label %if.else if.then46: ; preds = %if.end41 %inc47 = add nsw i32 %count.0121, 1 %idxprom48 = sext i32 %count.0121 to i64 %arrayidx49 = getelementptr inbounds [1000000 x i32], ptr %B, i64 0, i64 %idxprom48 store i32 %7, ptr %arrayidx49, align 4, !tbaa !5 br label %for.inc69 if.else: ; preds = %if.end41 %cmp52 = icmp slt i32 %7, %11 br i1 %cmp52, label %if.then54, label %if.else57 if.then54: ; preds = %if.else %add55 = add nsw i32 %m.0118, %l.0117 %div56 = sdiv i32 %add55, 2 br label %if.end68 if.else57: ; preds = %if.else %cmp60 = icmp sgt i32 %7, %11 br i1 %cmp60, label %if.then62, label %if.end68 if.then62: ; preds = %if.else57 %add63 = add nsw i32 %m.0118, 1 %add64 = add nsw i32 %r.0119, %add63 %div65 = sdiv i32 %add64, 2 br label %if.end68 if.end68: ; preds = %if.then54, %if.then62, %if.else57 %l.1 = phi i32 [ %l.0117, %if.then54 ], [ %add63, %if.then62 ], [ %l.0117, %if.else57 ] %m.1 = phi i32 [ %div56, %if.then54 ], [ %div65, %if.then62 ], [ %m.0118, %if.else57 ] %r.1 = phi i32 [ %m.0118, %if.then54 ], [ %r.0119, %if.then62 ], [ %r.0119, %if.else57 ] %cmp36.not = icmp sgt i32 %r.1, %l.1 br i1 %cmp36.not, label %if.end41, label %for.inc69, !llvm.loop !13 for.inc69: ; preds = %if.end68, %for.body28.preheader, %for.end35, %if.then46 %count.1 = phi i32 [ %inc47, %if.then46 ], [ %count.0121, %for.end35 ], [ %count.0121, %for.body28.preheader ], [ %count.0121, %if.end68 ] %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1 %exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135 br i1 %exitcond136.not, label %for.end71, label %for.body21, !llvm.loop !14 for.end71: ; preds = %for.inc69, %for.end, %for.body21.lr.ph, %for.cond18.preheader %count.0.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ 0, %for.body21.lr.ph ], [ 0, %for.end ], [ %count.1, %for.inc69 ] %call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @free(ptr noundef %call1) #5 call void @free(ptr noundef %call7) #5 call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %B) #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 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind } attributes #6 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include<stdio.h> int A[100000],n; int binarySearch(int); int main(){ int i,q,k,sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&A[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&k); if(binarySearch(k)==k) sum++; } printf("%d\n",sum); return 0; } int binarySearch(int key){ int left=0,right=n,mid; while(left<right){ mid=(left+right)/2; if(key==A[mid]) return A[mid]; if(key>A[mid]) left=mid+1; else if(key<A[mid]) right=mid; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186059/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186059/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 @n = dso_local global i32 0, align 4 @A = dso_local global [100000 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: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp19 = icmp sgt i32 %0, 0 br i1 %cmp19, label %for.body, label %for.end 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 = tail 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, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp421 = icmp sgt i32 %3, 0 br i1 %cmp421, label %for.body5, label %for.end12 for.body5: ; preds = %for.end, %binarySearch.exit %sum.023 = phi i32 [ %spec.select, %binarySearch.exit ], [ 0, %for.end ] %i.122 = phi i32 [ %inc11, %binarySearch.exit ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp26.i = icmp sgt i32 %5, 0 br i1 %cmp26.i, label %while.body.i, label %binarySearch.exit while.body.i: ; preds = %for.body5, %if.end.i %right.028.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.027.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.027.i, %right.028.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp6.i = icmp slt i32 %6, %4 %add8.i = add nsw i32 %div.i, 1 %cmp11.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp11.i, i32 %div.i, i32 %right.028.i %left.1.i = select i1 %cmp6.i, i32 %add8.i, i32 %left.027.i %right.1.i = select i1 %cmp6.i, i32 %right.028.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %binarySearch.exit, !llvm.loop !11 binarySearch.exit: ; preds = %while.body.i, %if.end.i, %for.body5 %retval.0.i = phi i32 [ 0, %for.body5 ], [ %4, %while.body.i ], [ 0, %if.end.i ] %cmp8 = icmp eq i32 %retval.0.i, %4 %inc9 = zext i1 %cmp8 to i32 %spec.select = add nuw nsw i32 %sum.023, %inc9 %inc11 = add nuw nsw i32 %i.122, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc11, %7 br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12 for.end12: ; preds = %binarySearch.exit, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %binarySearch.exit ] %call13 = 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) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #3 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp26 = icmp sgt i32 %0, 0 br i1 %cmp26, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.028 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.027 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.028, %left.027 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp6 = icmp slt i32 %1, %key %add8 = add nsw i32 %div, 1 %cmp11 = icmp sgt i32 %1, %key %spec.select = select i1 %cmp11, i32 %div, i32 %right.028 %left.1 = select i1 %cmp6, i32 %add8, i32 %left.027 %right.1 = select i1 %cmp6, i32 %right.028, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ %key, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse 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 #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<stdlib.h> int binSearch(int*, int, int); int main() { int i; int n, q, C=0; int *S, *T; scanf("%d", &n); S = (int*)malloc(n * sizeof(int)); if(S == NULL) { printf("malloc failed\n");exit(1); } for(i=0;i<n;i++) { scanf("%d", &S[i]); } scanf("%d", &q); T = (int*)malloc(q * sizeof(int)); if(T == NULL) { printf("malloc failed\n");exit(2); } for(i=0;i<q;i++) { scanf("%d", &T[i]); } for(i=0;i<q;i++) { if(binSearch(S, n, T[i]))C++; } printf("%d\n", C); free(S); free(T); return 0; } int binSearch(int *S, int n, int key) { int left = 0, right = n, mid; while(left < right) { mid = (left + right)/2; if(S[mid] == key)return 1; else if(key < S[mid])right = mid; else left = mid + 1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186101/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186101/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"%d\0A\00", align 1 @str.3 = private unnamed_addr constant [14 x i8] c"malloc failed\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #9 %cmp = icmp eq ptr %call1, null br i1 %cmp, label %if.then, label %for.cond.preheader for.cond.preheader: ; preds = %entry %cmp459 = icmp sgt i32 %0, 0 br i1 %cmp459, label %for.body, label %for.end if.then: ; preds = %entry %puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) call void @exit(i32 noundef 1) #10 unreachable for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call6 = 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 %cmp4 = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %for.cond.preheader %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv8 = sext i32 %3 to i64 %mul9 = shl nsw i64 %conv8, 2 %call10 = call noalias ptr @malloc(i64 noundef %mul9) #9 %cmp11 = icmp eq ptr %call10, null br i1 %cmp11, label %if.then13, label %for.cond16.preheader for.cond16.preheader: ; preds = %for.end %cmp1761 = icmp sgt i32 %3, 0 br i1 %cmp1761, label %for.body19, label %for.end38 if.then13: ; preds = %for.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) call void @exit(i32 noundef 2) #10 unreachable for.cond26.preheader: ; preds = %for.body19 %cmp2763 = icmp sgt i32 %8, 0 br i1 %cmp2763, label %for.body29.lr.ph, label %for.end38 for.body29.lr.ph: ; preds = %for.cond26.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %4, 0 br i1 %cmp18.i, label %for.body29.us.preheader, label %for.end38 for.body29.us.preheader: ; preds = %for.body29.lr.ph %wide.trip.count = zext i32 %8 to i64 br label %for.body29.us for.body29.us: ; preds = %for.body29.us.preheader, %for.cond26.us %indvars.iv74 = phi i64 [ 0, %for.body29.us.preheader ], [ %indvars.iv.next75, %for.cond26.us ] %C.064.us = phi i32 [ 0, %for.body29.us.preheader ], [ %7, %for.cond26.us ] %arrayidx31.us = getelementptr inbounds i32, ptr %call10, i64 %indvars.iv74 %5 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body29.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %4, %for.body29.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body29.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom.i.us %6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %6, %5 br i1 %cmp1.i.us, label %binSearch.exit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %6, %5 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %for.cond26.us, !llvm.loop !11 binSearch.exit.us: ; preds = %while.body.i.us %inc34.us = add nsw i32 %C.064.us, 1 br label %for.cond26.us for.cond26.us: ; preds = %if.else.i.us, %binSearch.exit.us %7 = phi i32 [ %inc34.us, %binSearch.exit.us ], [ %C.064.us, %if.else.i.us ] %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count br i1 %exitcond.not, label %for.end38, label %for.body29.us, !llvm.loop !12 for.body19: ; preds = %for.cond16.preheader, %for.body19 %indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body19 ], [ 0, %for.cond16.preheader ] %arrayidx21 = getelementptr inbounds i32, ptr %call10, i64 %indvars.iv71 %call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx21) %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp17 = icmp slt i64 %indvars.iv.next72, %9 br i1 %cmp17, label %for.body19, label %for.cond26.preheader, !llvm.loop !13 for.end38: ; preds = %for.cond26.us, %for.cond16.preheader, %for.body29.lr.ph, %for.cond26.preheader %C.0.lcssa = phi i32 [ 0, %for.cond26.preheader ], [ 0, %for.body29.lr.ph ], [ 0, %for.cond16.preheader ], [ %7, %for.cond26.us ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %C.0.lcssa) call void @free(ptr noundef %call1) #8 call void @free(ptr noundef %call10) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #4 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binSearch(ptr nocapture noundef readonly %S, i32 noundef %n, i32 noundef %key) local_unnamed_addr #5 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %S, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6 ; 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 #7 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree norecurse nosync nounwind 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 #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { nofree nounwind } attributes #8 = { nounwind } attributes #9 = { nounwind allocsize(0) } attributes #10 = { noreturn nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int n, S[100000]; int binarySearch(int key) { int left = 0, right = n, mid; while (left < right) { mid = (left + right) / 2; if (S[mid] == key) { return 1; } else if (key < S[mid]) { right = mid; } else { left = mid + 1; } } return 0; } int main() { int q, key, ans = 0; int i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &key); if (binarySearch(key)) { ans++; } } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186145/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186145/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" @n = dso_local global i32 0, align 4 @S = dso_local global [100000 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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.019 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.018, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.019 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] 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: 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: %q = alloca i32, align 4 %key = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %indvars.iv %call1 = tail 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 !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %i.125 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %ans.024 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %key, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %5, 0 br i1 %cmp17.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.else.i %right.019.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.018.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.018.i, %right.019.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %add7.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %left.018.i, i32 %add7.i %right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.019.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %ans.024, 1 br label %for.cond3 for.cond3: ; preds = %if.else.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %ans.024, %for.body5 ], [ %ans.024, %if.else.i ] %inc10 = add nuw nsw i32 %i.125, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %ans.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> #include<string.h> int main() { int len,i,j,d; char s1[99]; scanf("%s",&s1); len = strlen(s1); char s2[len+1]; for(i=0,j=len-1;j>=0;i++,j--) { s2[i] = s1[j]; } s2[i]='\0'; d=strcmp(s1,s2); if(d==0) { char s3[(len/2)+1],s[(len/2)+1]; for(i=0,j=0;j<=(len/2)-1;i++,j++) { s3[i] = s1[j]; } s3[i]='\0'; for(i=0,j=(len/2)-1;j>=0;i++,j--) { s[i]=s3[j]; } s[i]='\0'; int e = strcmp(s,s3); if(e==0) { for(i=0,j=(len/2)+1;j<=len-1;i++,j++) { s3[i]=s1[j]; } s3[i]='\0'; for(i=0,j=(len/2)-1;j>=0;i++,j--) { s[i]=s3[j]; } s[i]='\0'; e = strcmp(s,s3); if(e==0) { printf("Yes"); } else printf("No"); } else{ printf("No"); } } else{ printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186202/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186202/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 [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: %s1 = alloca [99 x i8], align 16 call void @llvm.lifetime.start.p0(i64 99, ptr nonnull %s1) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1) %call1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s1) #7 %conv = trunc i64 %call1 to i32 %add = add i64 %call1, 1 %0 = and i64 %add, 4294967295 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %0, align 16 %cmp135 = icmp sgt i32 %conv, 0 br i1 %cmp135, label %iter.check, label %for.end iter.check: ; preds = %entry %2 = and i64 %call1, 4294967295 %min.iters.check = icmp ult i64 %2, 8 br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check %3 = add nsw i64 %2, -1 %4 = add i32 %conv, -1 %5 = trunc i64 %3 to i32 %6 = icmp ult i32 %4, %5 %7 = icmp ugt i64 %3, 4294967295 %8 = or i1 %6, %7 br i1 %8, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.scevcheck %min.iters.check198 = icmp ult i64 %2, 32 br i1 %min.iters.check198, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.mod.vf = and i64 %call1, 31 %n.vec = sub nsw i64 %2, %n.mod.vf br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %9 = xor i64 %index, -1 %10 = add i64 %call1, %9 %11 = and i64 %10, 4294967295 %12 = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %11 %13 = getelementptr inbounds i8, ptr %12, i64 -15 %wide.load = load <16 x i8>, ptr %13, 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> %14 = getelementptr inbounds i8, ptr %12, i64 -31 %wide.load199 = load <16 x i8>, ptr %14, align 1, !tbaa !5 %reverse200 = shufflevector <16 x i8> %wide.load199, <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> %15 = getelementptr inbounds i8, ptr %vla, i64 %index store <16 x i8> %reverse, ptr %15, align 16, !tbaa !5 %16 = getelementptr inbounds i8, ptr %15, i64 16 store <16 x i8> %reverse200, ptr %16, align 16, !tbaa !5 %index.next = add nuw i64 %index, 32 %17 = icmp eq i64 %index.next, %n.vec br i1 %17, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.mod.vf, 0 br i1 %cmp.n, label %for.end.loopexit, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8 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.mod.vf201 = and i64 %call1, 7 %n.vec202 = sub nsw i64 %2, %n.mod.vf201 %invariant.gep = getelementptr i8, ptr %s1, i64 -7 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index206 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next210, %vec.epilog.vector.body ] %18 = xor i64 %index206, -1 %19 = add i64 %call1, %18 %20 = and i64 %19, 4294967295 %gep = getelementptr [99 x i8], ptr %invariant.gep, i64 0, i64 %20 %wide.load208 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse209 = shufflevector <8 x i8> %wide.load208, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %21 = getelementptr inbounds i8, ptr %vla, i64 %index206 store <8 x i8> %reverse209, ptr %21, align 1, !tbaa !5 %index.next210 = add nuw i64 %index206, 8 %22 = icmp eq i64 %index.next210, %n.vec202 br i1 %22, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n205 = icmp eq i64 %n.mod.vf201, 0 br i1 %cmp.n205, label %for.end.loopexit, label %for.body.preheader for.body.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv154.ph = phi i64 [ %2, %iter.check ], [ %2, %vector.scevcheck ], [ %n.mod.vf, %vec.epilog.iter.check ], [ %n.mod.vf201, %vec.epilog.middle.block ] %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec202, %vec.epilog.middle.block ] %23 = sub i64 %call1, %indvars.iv.ph %24 = xor i64 %indvars.iv.ph, -1 %25 = add nsw i64 %2, %24 %xtraiter = and i64 %23, 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.iv154.prol = phi i64 [ %indvars.iv.next155.prol, %for.body.prol ], [ %indvars.iv154.ph, %for.body.preheader ] %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 ] %indvars.iv.next155.prol = add nsw i64 %indvars.iv154.prol, -1 %idxprom.prol = and i64 %indvars.iv.next155.prol, 4294967295 %arrayidx.prol = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %idxprom.prol %26 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5 %arrayidx4.prol = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.prol store i8 %26, ptr %arrayidx4.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 !13 for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader %indvars.iv154.unr = phi i64 [ %indvars.iv154.ph, %for.body.preheader ], [ %indvars.iv.next155.prol, %for.body.prol ] %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ] %27 = icmp ult i64 %25, 3 br i1 %27, label %for.end.loopexit, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.prol.loopexit %invariant.gep287 = getelementptr i8, ptr %vla, i64 1 %invariant.gep289 = getelementptr i8, ptr %vla, i64 2 %invariant.gep291 = getelementptr i8, ptr %vla, i64 3 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv154 = phi i64 [ %indvars.iv154.unr, %for.body.preheader.new ], [ %indvars.iv.next155.3, %for.body ] %indvars.iv = phi i64 [ %indvars.iv.unr, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %indvars.iv.next155 = add i64 %indvars.iv154, 4294967295 %idxprom = and i64 %indvars.iv.next155, 4294967295 %arrayidx = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %idxprom %28 = load i8, ptr %arrayidx, align 1, !tbaa !5 %arrayidx4 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv store i8 %28, ptr %arrayidx4, align 1, !tbaa !5 %indvars.iv.next155.1 = add i64 %indvars.iv154, 4294967294 %idxprom.1 = and i64 %indvars.iv.next155.1, 4294967295 %arrayidx.1 = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %idxprom.1 %29 = load i8, ptr %arrayidx.1, align 1, !tbaa !5 %gep288 = getelementptr i8, ptr %invariant.gep287, i64 %indvars.iv store i8 %29, ptr %gep288, align 1, !tbaa !5 %indvars.iv.next155.2 = add i64 %indvars.iv154, 4294967293 %idxprom.2 = and i64 %indvars.iv.next155.2, 4294967295 %arrayidx.2 = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %idxprom.2 %30 = load i8, ptr %arrayidx.2, align 1, !tbaa !5 %gep290 = getelementptr i8, ptr %invariant.gep289, i64 %indvars.iv store i8 %30, ptr %gep290, align 1, !tbaa !5 %indvars.iv.next155.3 = add nsw i64 %indvars.iv154, -4 %idxprom.3 = and i64 %indvars.iv.next155.3, 4294967295 %arrayidx.3 = getelementptr inbounds [99 x i8], ptr %s1, i64 0, i64 %idxprom.3 %31 = load i8, ptr %arrayidx.3, align 1, !tbaa !5 %gep292 = getelementptr i8, ptr %invariant.gep291, i64 %indvars.iv store i8 %31, ptr %gep292, 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, %2 br i1 %exitcond.not.3, label %for.end.loopexit, label %for.body, !llvm.loop !15 for.end.loopexit: ; preds = %for.body.prol.loopexit, %for.body, %vec.epilog.middle.block, %middle.block %32 = and i64 %call1, 4294967295 br label %for.end for.end: ; preds = %entry, %for.end.loopexit %i.0.lcssa = phi i64 [ %32, %for.end.loopexit ], [ 0, %entry ] %arrayidx6 = getelementptr inbounds i8, ptr %vla, i64 %i.0.lcssa store i8 0, ptr %arrayidx6, align 1, !tbaa !5 %call8 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s1, ptr noundef nonnull dereferenceable(1) %vla) #7 %cmp9 = icmp eq i32 %call8, 0 br i1 %cmp9, label %if.then, label %if.else95 if.then: ; preds = %for.end %div = sdiv i32 %conv, 2 %add11 = add nsw i32 %div, 1 %33 = zext i32 %add11 to i64 %34 = call ptr @llvm.stacksave.p0() %vla13 = alloca i8, i64 %33, align 16 %vla16 = alloca i8, i64 %33, align 16 %cmp20.not.not138 = icmp sgt i32 %conv, 1 %35 = add nsw i32 %div, -1 br i1 %cmp20.not.not138, label %iter.check214, label %for.end30.for.end46_crit_edge for.end30.for.end46_crit_edge: ; preds = %if.then store i8 0, ptr %vla13, align 16, !tbaa !5 br label %for.end46 iter.check214: ; preds = %if.then %36 = zext i32 %35 to i64 %37 = add nuw nsw i64 %36, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla13, ptr noundef nonnull align 16 dereferenceable(1) %s1, i64 %37, i1 false), !tbaa !5 %38 = and i64 %37, 4294967295 %arrayidx32195 = getelementptr inbounds i8, ptr %vla13, i64 %38 store i8 0, ptr %arrayidx32195, align 1, !tbaa !5 %39 = zext i32 %35 to i64 %wide.trip.count173 = zext i32 %div to i64 %min.iters.check212 = icmp ult i32 %div, 8 br i1 %min.iters.check212, label %for.body38.preheader, label %vector.main.loop.iter.check216 vector.main.loop.iter.check216: ; preds = %iter.check214 %min.iters.check215 = icmp ult i32 %div, 32 br i1 %min.iters.check215, label %vec.epilog.ph232, label %vector.ph217 vector.ph217: ; preds = %vector.main.loop.iter.check216 %n.vec219 = and i64 %wide.trip.count173, 4294967264 br label %vector.body221 vector.body221: ; preds = %vector.body221, %vector.ph217 %index222 = phi i64 [ 0, %vector.ph217 ], [ %index.next228, %vector.body221 ] %offset.idx223 = sub i64 %39, %index222 %40 = getelementptr inbounds i8, ptr %vla13, i64 %offset.idx223 %41 = getelementptr inbounds i8, ptr %40, i64 -15 %wide.load224 = load <16 x i8>, ptr %41, align 1, !tbaa !5 %reverse225 = shufflevector <16 x i8> %wide.load224, <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> %42 = getelementptr inbounds i8, ptr %40, i64 -31 %wide.load226 = load <16 x i8>, ptr %42, align 1, !tbaa !5 %reverse227 = shufflevector <16 x i8> %wide.load226, <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> %43 = getelementptr inbounds i8, ptr %vla16, i64 %index222 store <16 x i8> %reverse225, ptr %43, align 16, !tbaa !5 %44 = getelementptr inbounds i8, ptr %43, i64 16 store <16 x i8> %reverse227, ptr %44, align 16, !tbaa !5 %index.next228 = add nuw i64 %index222, 32 %45 = icmp eq i64 %index.next228, %n.vec219 br i1 %45, label %middle.block211, label %vector.body221, !llvm.loop !16 middle.block211: ; preds = %vector.body221 %cmp.n220 = icmp eq i64 %n.vec219, %wide.trip.count173 br i1 %cmp.n220, label %for.end46.loopexit, label %vec.epilog.iter.check231 vec.epilog.iter.check231: ; preds = %middle.block211 %ind.end239 = sub nsw i64 %39, %n.vec219 %n.vec.remaining233 = and i64 %wide.trip.count173, 24 %min.epilog.iters.check234 = icmp eq i64 %n.vec.remaining233, 0 br i1 %min.epilog.iters.check234, label %for.body38.preheader, label %vec.epilog.ph232 vec.epilog.ph232: ; preds = %vector.main.loop.iter.check216, %vec.epilog.iter.check231 %vec.epilog.resume.val235 = phi i64 [ %n.vec219, %vec.epilog.iter.check231 ], [ 0, %vector.main.loop.iter.check216 ] %n.vec237 = and i64 %wide.trip.count173, 4294967288 %ind.end238 = sub nsw i64 %39, %n.vec237 %invariant.gep293 = getelementptr i8, ptr %vla13, i64 -7 br label %vec.epilog.vector.body243 vec.epilog.vector.body243: ; preds = %vec.epilog.vector.body243, %vec.epilog.ph232 %index244 = phi i64 [ %vec.epilog.resume.val235, %vec.epilog.ph232 ], [ %index.next248, %vec.epilog.vector.body243 ] %offset.idx245 = sub i64 %39, %index244 %gep294 = getelementptr i8, ptr %invariant.gep293, i64 %offset.idx245 %wide.load246 = load <8 x i8>, ptr %gep294, align 1, !tbaa !5 %reverse247 = shufflevector <8 x i8> %wide.load246, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %46 = getelementptr inbounds i8, ptr %vla16, i64 %index244 store <8 x i8> %reverse247, ptr %46, align 8, !tbaa !5 %index.next248 = add nuw i64 %index244, 8 %47 = icmp eq i64 %index.next248, %n.vec237 br i1 %47, label %vec.epilog.middle.block229, label %vec.epilog.vector.body243, !llvm.loop !17 vec.epilog.middle.block229: ; preds = %vec.epilog.vector.body243 %cmp.n242 = icmp eq i64 %n.vec237, %wide.trip.count173 br i1 %cmp.n242, label %for.end46.loopexit, label %for.body38.preheader for.body38.preheader: ; preds = %iter.check214, %vec.epilog.iter.check231, %vec.epilog.middle.block229 %indvars.iv168.ph = phi i64 [ %39, %iter.check214 ], [ %ind.end239, %vec.epilog.iter.check231 ], [ %ind.end238, %vec.epilog.middle.block229 ] %indvars.iv166.ph = phi i64 [ 0, %iter.check214 ], [ %n.vec219, %vec.epilog.iter.check231 ], [ %n.vec237, %vec.epilog.middle.block229 ] br label %for.body38 for.body38: ; preds = %for.body38.preheader, %for.body38 %indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.body38 ], [ %indvars.iv168.ph, %for.body38.preheader ] %indvars.iv166 = phi i64 [ %indvars.iv.next167, %for.body38 ], [ %indvars.iv166.ph, %for.body38.preheader ] %arrayidx40 = getelementptr inbounds i8, ptr %vla13, i64 %indvars.iv168 %48 = load i8, ptr %arrayidx40, align 1, !tbaa !5 %arrayidx42 = getelementptr inbounds i8, ptr %vla16, i64 %indvars.iv166 store i8 %48, ptr %arrayidx42, align 1, !tbaa !5 %indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1 %indvars.iv.next169 = add nsw i64 %indvars.iv168, -1 %exitcond174.not = icmp eq i64 %indvars.iv.next167, %wide.trip.count173 br i1 %exitcond174.not, label %for.end46.loopexit, label %for.body38, !llvm.loop !18 for.end46.loopexit: ; preds = %for.body38, %vec.epilog.middle.block229, %middle.block211 %49 = zext i32 %div to i64 br label %for.end46 for.end46: ; preds = %for.end30.for.end46_crit_edge, %for.end46.loopexit %i.2.lcssa = phi i64 [ 0, %for.end30.for.end46_crit_edge ], [ %49, %for.end46.loopexit ] %arrayidx48 = getelementptr inbounds i8, ptr %vla16, i64 %i.2.lcssa store i8 0, ptr %arrayidx48, align 1, !tbaa !5 %call49 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %vla16, ptr noundef nonnull dereferenceable(1) %vla13) #7 %cmp50 = icmp eq i32 %call49, 0 br i1 %cmp50, label %for.cond55.preheader, label %if.end94 for.cond55.preheader: ; preds = %for.end46 %cmp57.not.not146 = icmp slt i32 %add11, %conv br i1 %cmp57.not.not146, label %for.body59.preheader, label %for.end67 for.body59.preheader: ; preds = %for.cond55.preheader %narrow = add nsw i32 %div, 1 %50 = sext i32 %narrow to i64 %scevgep = getelementptr i8, ptr %s1, i64 %50 %51 = add i32 %conv, -2 %52 = sub i32 %51, %div %53 = zext i32 %52 to i64 %54 = add nuw nsw i64 %53, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla13, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %54, i1 false), !tbaa !5 %55 = and i64 %54, 4294967295 br label %for.end67 for.end67: ; preds = %for.body59.preheader, %for.cond55.preheader %i.3.lcssa = phi i64 [ 0, %for.cond55.preheader ], [ %55, %for.body59.preheader ] %arrayidx69 = getelementptr inbounds i8, ptr %vla13, i64 %i.3.lcssa store i8 0, ptr %arrayidx69, align 1, !tbaa !5 br i1 %cmp20.not.not138, label %iter.check252, label %for.end83 iter.check252: ; preds = %for.end67 %56 = zext i32 %35 to i64 %wide.trip.count191 = zext i32 %div to i64 %min.iters.check250 = icmp ult i32 %div, 8 br i1 %min.iters.check250, label %for.body75.preheader, label %vector.main.loop.iter.check254 vector.main.loop.iter.check254: ; preds = %iter.check252 %min.iters.check253 = icmp ult i32 %div, 32 br i1 %min.iters.check253, label %vec.epilog.ph270, label %vector.ph255 vector.ph255: ; preds = %vector.main.loop.iter.check254 %n.vec257 = and i64 %wide.trip.count191, 4294967264 br label %vector.body259 vector.body259: ; preds = %vector.body259, %vector.ph255 %index260 = phi i64 [ 0, %vector.ph255 ], [ %index.next266, %vector.body259 ] %offset.idx261 = sub i64 %56, %index260 %57 = getelementptr inbounds i8, ptr %vla13, i64 %offset.idx261 %58 = getelementptr inbounds i8, ptr %57, i64 -15 %wide.load262 = load <16 x i8>, ptr %58, align 1, !tbaa !5 %reverse263 = shufflevector <16 x i8> %wide.load262, <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> %59 = getelementptr inbounds i8, ptr %57, i64 -31 %wide.load264 = load <16 x i8>, ptr %59, align 1, !tbaa !5 %reverse265 = shufflevector <16 x i8> %wide.load264, <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> %60 = getelementptr inbounds i8, ptr %vla16, i64 %index260 store <16 x i8> %reverse263, ptr %60, align 16, !tbaa !5 %61 = getelementptr inbounds i8, ptr %60, i64 16 store <16 x i8> %reverse265, ptr %61, align 16, !tbaa !5 %index.next266 = add nuw i64 %index260, 32 %62 = icmp eq i64 %index.next266, %n.vec257 br i1 %62, label %middle.block249, label %vector.body259, !llvm.loop !19 middle.block249: ; preds = %vector.body259 %cmp.n258 = icmp eq i64 %n.vec257, %wide.trip.count191 br i1 %cmp.n258, label %for.end83.loopexit, label %vec.epilog.iter.check269 vec.epilog.iter.check269: ; preds = %middle.block249 %ind.end277 = sub nsw i64 %56, %n.vec257 %n.vec.remaining271 = and i64 %wide.trip.count191, 24 %min.epilog.iters.check272 = icmp eq i64 %n.vec.remaining271, 0 br i1 %min.epilog.iters.check272, label %for.body75.preheader, label %vec.epilog.ph270 vec.epilog.ph270: ; preds = %vector.main.loop.iter.check254, %vec.epilog.iter.check269 %vec.epilog.resume.val273 = phi i64 [ %n.vec257, %vec.epilog.iter.check269 ], [ 0, %vector.main.loop.iter.check254 ] %n.vec275 = and i64 %wide.trip.count191, 4294967288 %ind.end276 = sub nsw i64 %56, %n.vec275 %invariant.gep295 = getelementptr i8, ptr %vla13, i64 -7 br label %vec.epilog.vector.body281 vec.epilog.vector.body281: ; preds = %vec.epilog.vector.body281, %vec.epilog.ph270 %index282 = phi i64 [ %vec.epilog.resume.val273, %vec.epilog.ph270 ], [ %index.next286, %vec.epilog.vector.body281 ] %offset.idx283 = sub i64 %56, %index282 %gep296 = getelementptr i8, ptr %invariant.gep295, i64 %offset.idx283 %wide.load284 = load <8 x i8>, ptr %gep296, align 1, !tbaa !5 %reverse285 = shufflevector <8 x i8> %wide.load284, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %63 = getelementptr inbounds i8, ptr %vla16, i64 %index282 store <8 x i8> %reverse285, ptr %63, align 8, !tbaa !5 %index.next286 = add nuw i64 %index282, 8 %64 = icmp eq i64 %index.next286, %n.vec275 br i1 %64, label %vec.epilog.middle.block267, label %vec.epilog.vector.body281, !llvm.loop !20 vec.epilog.middle.block267: ; preds = %vec.epilog.vector.body281 %cmp.n280 = icmp eq i64 %n.vec275, %wide.trip.count191 br i1 %cmp.n280, label %for.end83.loopexit, label %for.body75.preheader for.body75.preheader: ; preds = %iter.check252, %vec.epilog.iter.check269, %vec.epilog.middle.block267 %indvars.iv186.ph = phi i64 [ %56, %iter.check252 ], [ %ind.end277, %vec.epilog.iter.check269 ], [ %ind.end276, %vec.epilog.middle.block267 ] %indvars.iv184.ph = phi i64 [ 0, %iter.check252 ], [ %n.vec257, %vec.epilog.iter.check269 ], [ %n.vec275, %vec.epilog.middle.block267 ] br label %for.body75 for.body75: ; preds = %for.body75.preheader, %for.body75 %indvars.iv186 = phi i64 [ %indvars.iv.next187, %for.body75 ], [ %indvars.iv186.ph, %for.body75.preheader ] %indvars.iv184 = phi i64 [ %indvars.iv.next185, %for.body75 ], [ %indvars.iv184.ph, %for.body75.preheader ] %arrayidx77 = getelementptr inbounds i8, ptr %vla13, i64 %indvars.iv186 %65 = load i8, ptr %arrayidx77, align 1, !tbaa !5 %arrayidx79 = getelementptr inbounds i8, ptr %vla16, i64 %indvars.iv184 store i8 %65, ptr %arrayidx79, align 1, !tbaa !5 %indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1 %indvars.iv.next187 = add nsw i64 %indvars.iv186, -1 %exitcond192.not = icmp eq i64 %indvars.iv.next185, %wide.trip.count191 br i1 %exitcond192.not, label %for.end83.loopexit, label %for.body75, !llvm.loop !21 for.end83.loopexit: ; preds = %for.body75, %vec.epilog.middle.block267, %middle.block249 %66 = zext i32 %div to i64 br label %for.end83 for.end83: ; preds = %for.end67, %for.end83.loopexit %i.4.lcssa = phi i64 [ %66, %for.end83.loopexit ], [ 0, %for.end67 ] %arrayidx85 = getelementptr inbounds i8, ptr %vla16, i64 %i.4.lcssa store i8 0, ptr %arrayidx85, align 1, !tbaa !5 %call86 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %vla16, ptr noundef nonnull dereferenceable(1) %vla13) #7 %cmp87 = icmp eq i32 %call86, 0 %.str.1..str.2 = select i1 %cmp87, ptr @.str.1, ptr @.str.2 br label %if.end94 if.end94: ; preds = %for.end46, %for.end83 %.str.1.sink = phi ptr [ %.str.1..str.2, %for.end83 ], [ @.str.2, %for.end46 ] %call90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.stackrestore.p0(ptr %34) br label %if.end97 if.else95: ; preds = %for.end %call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end97 if.end97: ; preds = %if.else95, %if.end94 call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 99, ptr nonnull %s1) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #4 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #6 = { nounwind } attributes #7 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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, !9, !11, !10} !19 = distinct !{!19, !9, !10, !11} !20 = distinct !{!20, !9, !10, !11} !21 = distinct !{!21, !9, !11, !10}
#include <stdio.h> #include <string.h> int isP(char ch[]) { int l, i, flag=1, tmp, j, tmp2; l=strlen(ch); for (i=0; i<l/2; i++) { if (ch[i]!=ch[l-i-1]) { flag=0; break; } } tmp=(l-1)/2; for (i=0; i<tmp; i++) { if (ch[i]!=ch[tmp-i-1]) flag=0; break; } tmp=(l+3)/2; tmp2=l-tmp+1; j=0; for (i=tmp; i<tmp2/2; i++) { if (ch[i]!=ch[l-(j)-1]) flag=0;j++; break; } return flag; } int main() { char ch[100]; int flag; scanf("%s", ch); flag=isP(ch); if (flag) puts("Yes"); else puts("No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186246/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186246/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 [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 memory(argmem: read) uwtable define dso_local i32 @isP(ptr nocapture noundef readonly %ch) local_unnamed_addr #0 { entry: %call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #5 %conv = trunc i64 %call to i32 %cmp80 = icmp sgt i32 %conv, 1 br i1 %cmp80, label %for.body.preheader, label %for.end.thread for.end.thread: ; preds = %entry %sub985 = add nsw i32 %conv, -1 br label %for.end29 for.body.preheader: ; preds = %entry %div8889 = lshr i64 %call, 1 %wide.trip.count = and i64 %div8889, 2147483647 br label %for.body for.cond: ; preds = %for.body %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 !5 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds i8, ptr %ch, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !7 %1 = xor i64 %indvars.iv, -1 %sub3 = add i64 %call, %1 %sext = shl i64 %sub3, 32 %idxprom4 = ashr exact i64 %sext, 32 %arrayidx5 = getelementptr inbounds i8, ptr %ch, i64 %idxprom4 %2 = load i8, ptr %arrayidx5, align 1, !tbaa !7 %cmp7.not = icmp eq i8 %0, %2 br i1 %cmp7.not, label %for.cond, label %for.end for.end: ; preds = %for.cond, %for.body %flag.0 = phi i32 [ 1, %for.cond ], [ 0, %for.body ] %sub9 = add nsw i32 %conv, -1 %cmp12 = icmp sgt i32 %conv, 2 br i1 %cmp12, label %for.body14, label %for.end29 for.body14: ; preds = %for.end %div107879 = lshr i32 %sub9, 1 %3 = load i8, ptr %ch, align 1, !tbaa !7 %sub19 = add nsw i32 %div107879, -1 %idxprom20 = zext i32 %sub19 to i64 %arrayidx21 = getelementptr inbounds i8, ptr %ch, i64 %idxprom20 %4 = load i8, ptr %arrayidx21, align 1, !tbaa !7 %cmp23.not = icmp eq i8 %3, %4 %spec.select = select i1 %cmp23.not, i32 %flag.0, i32 0 br label %for.end29 for.end29: ; preds = %for.end.thread, %for.body14, %for.end %sub987 = phi i32 [ %sub9, %for.end ], [ %sub9, %for.body14 ], [ %sub985, %for.end.thread ] %flag.1 = phi i32 [ %flag.0, %for.end ], [ %spec.select, %for.body14 ], [ 1, %for.end.thread ] %add = add nsw i32 %conv, 3 %div30 = sdiv i32 %add, 2 %sub31 = add i32 %conv, 1 %add32 = sub i32 %sub31, %div30 %div34 = sdiv i32 %add32, 2 %cmp35 = icmp slt i32 %div30, %div34 br i1 %cmp35, label %for.body37, label %for.end53 for.body37: ; preds = %for.end29 %idxprom38 = sext i32 %div30 to i64 %arrayidx39 = getelementptr inbounds i8, ptr %ch, i64 %idxprom38 %5 = load i8, ptr %arrayidx39, align 1, !tbaa !7 %idxprom43 = sext i32 %sub987 to i64 %arrayidx44 = getelementptr inbounds i8, ptr %ch, i64 %idxprom43 %6 = load i8, ptr %arrayidx44, align 1, !tbaa !7 %cmp46.not = icmp eq i8 %5, %6 %spec.select77 = select i1 %cmp46.not, i32 %flag.1, i32 0 br label %for.end53 for.end53: ; preds = %for.body37, %for.end29 %flag.3 = phi i32 [ %spec.select77, %for.body37 ], [ %flag.1, %for.end29 ] ret i32 %flag.3 } ; 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: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %ch = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %ch) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch) %call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #5 %conv.i = trunc i64 %call.i to i32 %cmp80.i = icmp sgt i32 %conv.i, 1 br i1 %cmp80.i, label %for.body.preheader.i, label %for.end.thread.i for.end.thread.i: ; preds = %entry %sub985.i = add nsw i32 %conv.i, -1 br label %for.end29.i for.body.preheader.i: ; preds = %entry %div8889.i = lshr i64 %call.i, 1 %wide.trip.count.i = and i64 %div8889.i, 2147483647 br label %for.body.i for.cond.i: ; preds = %for.body.i %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 !5 for.body.i: ; preds = %for.cond.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ] %arrayidx.i = getelementptr inbounds i8, ptr %ch, i64 %indvars.iv.i %0 = load i8, ptr %arrayidx.i, align 1, !tbaa !7 %1 = xor i64 %indvars.iv.i, -1 %sub3.i = add i64 %call.i, %1 %sext.i = shl i64 %sub3.i, 32 %idxprom4.i = ashr exact i64 %sext.i, 32 %arrayidx5.i = getelementptr inbounds i8, ptr %ch, i64 %idxprom4.i %2 = load i8, ptr %arrayidx5.i, align 1, !tbaa !7 %cmp7.not.i = icmp eq i8 %0, %2 br i1 %cmp7.not.i, label %for.cond.i, label %for.end.i for.end.i: ; preds = %for.body.i, %for.cond.i %flag.0.i = phi i32 [ 1, %for.cond.i ], [ 0, %for.body.i ] %sub9.i = add nsw i32 %conv.i, -1 %cmp12.i = icmp sgt i32 %conv.i, 2 br i1 %cmp12.i, label %for.body14.i, label %for.end29.i for.body14.i: ; preds = %for.end.i %div107879.i = lshr i32 %sub9.i, 1 %3 = load i8, ptr %ch, align 16, !tbaa !7 %sub19.i = add nsw i32 %div107879.i, -1 %idxprom20.i = zext i32 %sub19.i to i64 %arrayidx21.i = getelementptr inbounds i8, ptr %ch, i64 %idxprom20.i %4 = load i8, ptr %arrayidx21.i, align 1, !tbaa !7 %cmp23.not.i = icmp eq i8 %3, %4 %spec.select.i = select i1 %cmp23.not.i, i32 %flag.0.i, i32 0 br label %for.end29.i for.end29.i: ; preds = %for.body14.i, %for.end.i, %for.end.thread.i %sub987.i = phi i32 [ %sub9.i, %for.end.i ], [ %sub9.i, %for.body14.i ], [ %sub985.i, %for.end.thread.i ] %flag.1.i = phi i32 [ %flag.0.i, %for.end.i ], [ %spec.select.i, %for.body14.i ], [ 1, %for.end.thread.i ] %add.i = add nsw i32 %conv.i, 3 %div30.i = sdiv i32 %add.i, 2 %sub31.i = add i32 %conv.i, 1 %add32.i = sub i32 %sub31.i, %div30.i %div34.i = sdiv i32 %add32.i, 2 %cmp35.i = icmp slt i32 %div30.i, %div34.i br i1 %cmp35.i, label %for.body37.i, label %isP.exit for.body37.i: ; preds = %for.end29.i %idxprom38.i = sext i32 %div30.i to i64 %arrayidx39.i = getelementptr inbounds i8, ptr %ch, i64 %idxprom38.i %5 = load i8, ptr %arrayidx39.i, align 1, !tbaa !7 %idxprom43.i = sext i32 %sub987.i to i64 %arrayidx44.i = getelementptr inbounds i8, ptr %ch, i64 %idxprom43.i %6 = load i8, ptr %arrayidx44.i, align 1, !tbaa !7 %cmp46.not.i = icmp ne i8 %5, %6 %tobool.not = icmp eq i32 %flag.1.i, 0 %or.cond = select i1 %cmp46.not.i, i1 true, i1 %tobool.not br i1 %or.cond, label %if.else, label %if.end isP.exit: ; preds = %for.end29.i %tobool.not.old = icmp eq i32 %flag.1.i, 0 br i1 %tobool.not.old, label %if.else, label %if.end if.else: ; preds = %for.body37.i, %isP.exit br label %if.end if.end: ; preds = %isP.exit, %for.body37.i, %if.else %.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %for.body37.i ], [ @.str.1, %isP.exit ] %call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %ch) #6 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { nofree nounwind 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 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 = { 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 willreturn memory(read) } 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int n,p=1,i; scanf("%d",&n); char str[n+1]; scanf("%s",str); for(i=0;i<n;) { p++; printf("%c",str[i]); i=i+p; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18629/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18629/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %1, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp7 = icmp sgt i32 %3, 0 br i1 %cmp7, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %i.08 = phi i32 [ %add3, %for.body ], [ 0, %entry ] %indvars.iv.next = add nuw i64 %indvars.iv, 1 %idxprom = zext i32 %i.08 to i64 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom %4 = load i8, ptr %arrayidx, align 1, !tbaa !9 %conv = sext i8 %4 to i32 %putchar = call i32 @putchar(i32 %conv) %5 = trunc i64 %indvars.iv.next to i32 %add3 = add nuw nsw i32 %i.08, %5 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %add3, %6 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.body, %entry 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 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 @putchar(i32 noundef) 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 = !{!"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"}
// ABC 159-B // 2020.3.24 bal4u #include <stdio.h> #include <string.h> int isPalin(char *s, int n) { int i = 0, j = n - 1; while (i < j) { if (s[i] != s[j]) return 0; i++, j--; } return 1; } char S[105]; int N; int main() { int t; scanf("%s", S); N = strlen(S); t = (N+3)/2-1; puts((isPalin(S, N) && isPalin(S, (N-1)/2) && isPalin(S+t, N-t))? "Yes": "No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186332/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186332/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 @S = dso_local global [105 x i8] zeroinitializer, align 16 @N = dso_local local_unnamed_addr global i32 0, align 4 @.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 norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @isPalin(ptr nocapture noundef readonly %s, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp13 = icmp sgt i32 %n, 1 br i1 %cmp13, label %while.body.preheader, label %cleanup while.body.preheader: ; preds = %entry %0 = zext i32 %n to i64 %1 = add nsw i64 %0, -1 br label %while.body while.cond: ; preds = %while.body %indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1 %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp = icmp slt i64 %indvars.iv.next18, %indvars.iv.next br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !5 while.body: ; preds = %while.body.preheader, %while.cond %indvars.iv17 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next18, %while.cond ] %indvars.iv = phi i64 [ %1, %while.body.preheader ], [ %indvars.iv.next, %while.cond ] %arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv17 %2 = load i8, ptr %arrayidx, align 1, !tbaa !7 %arrayidx2 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv %3 = load i8, ptr %arrayidx2, align 1, !tbaa !7 %cmp4.not = icmp eq i8 %2, %3 br i1 %cmp4.not, label %while.cond, label %cleanup cleanup: ; preds = %while.body, %while.cond, %entry %retval.0 = phi i32 [ 1, %entry ], [ 1, %while.cond ], [ 0, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @S) %call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @S) #4 %conv = trunc i64 %call1 to i32 store i32 %conv, ptr @N, align 4, !tbaa !10 %add = add nsw i32 %conv, 3 %div = sdiv i32 %add, 2 %sub = add nsw i32 %div, -1 %cmp13.i = icmp sgt i32 %conv, 1 br i1 %cmp13.i, label %while.body.preheader.i, label %land.rhs while.body.preheader.i: ; preds = %entry %0 = and i64 %call1, 4294967295 %1 = add nsw i64 %0, -1 br label %while.body.i while.cond.i: ; preds = %while.body.i %indvars.iv.next18.i = add nuw nsw i64 %indvars.iv17.i, 1 %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %cmp.i = icmp slt i64 %indvars.iv.next18.i, %indvars.iv.next.i br i1 %cmp.i, label %while.body.i, label %land.lhs.true, !llvm.loop !5 while.body.i: ; preds = %while.cond.i, %while.body.preheader.i %indvars.iv17.i = phi i64 [ 0, %while.body.preheader.i ], [ %indvars.iv.next18.i, %while.cond.i ] %indvars.iv.i = phi i64 [ %1, %while.body.preheader.i ], [ %indvars.iv.next.i, %while.cond.i ] %arrayidx.i = getelementptr inbounds i8, ptr @S, i64 %indvars.iv17.i %2 = load i8, ptr %arrayidx.i, align 1, !tbaa !7 %arrayidx2.i = getelementptr inbounds i8, ptr @S, i64 %indvars.iv.i %3 = load i8, ptr %arrayidx2.i, align 1, !tbaa !7 %cmp4.not.i = icmp eq i8 %2, %3 br i1 %cmp4.not.i, label %while.cond.i, label %land.end land.lhs.true: ; preds = %while.cond.i %cmp13.i12 = icmp sgt i32 %conv, 4 br i1 %cmp13.i12, label %while.body.preheader.i14, label %land.rhs while.body.preheader.i14: ; preds = %land.lhs.true %sub3 = add i64 %call1, 4294967295 %div45154 = lshr i64 %sub3, 1 %4 = and i64 %div45154, 2147483647 %5 = add nsw i64 %4, -1 br label %while.body.i15 while.cond.i21: ; preds = %while.body.i15 %indvars.iv.next18.i22 = add nuw nsw i64 %indvars.iv17.i16, 1 %indvars.iv.next.i23 = add nsw i64 %indvars.iv.i17, -1 %cmp.i24 = icmp slt i64 %indvars.iv.next18.i22, %indvars.iv.next.i23 br i1 %cmp.i24, label %while.body.i15, label %land.rhs, !llvm.loop !5 while.body.i15: ; preds = %while.cond.i21, %while.body.preheader.i14 %indvars.iv17.i16 = phi i64 [ 0, %while.body.preheader.i14 ], [ %indvars.iv.next18.i22, %while.cond.i21 ] %indvars.iv.i17 = phi i64 [ %5, %while.body.preheader.i14 ], [ %indvars.iv.next.i23, %while.cond.i21 ] %arrayidx.i18 = getelementptr inbounds i8, ptr @S, i64 %indvars.iv17.i16 %6 = load i8, ptr %arrayidx.i18, align 1, !tbaa !7 %arrayidx2.i19 = getelementptr inbounds i8, ptr @S, i64 %indvars.iv.i17 %7 = load i8, ptr %arrayidx2.i19, align 1, !tbaa !7 %cmp4.not.i20 = icmp eq i8 %6, %7 br i1 %cmp4.not.i20, label %while.cond.i21, label %land.end land.rhs: ; preds = %while.cond.i21, %entry, %land.lhs.true %idx.ext = sext i32 %sub to i64 %add.ptr = getelementptr inbounds i8, ptr @S, i64 %idx.ext %sub7 = sub nsw i32 %conv, %sub %cmp13.i26 = icmp sgt i32 %sub7, 1 br i1 %cmp13.i26, label %while.body.preheader.i28, label %land.end while.body.preheader.i28: ; preds = %land.rhs %8 = zext i32 %sub7 to i64 %9 = add nsw i64 %8, -1 br label %while.body.i29 while.cond.i35: ; preds = %while.body.i29 %indvars.iv.next18.i36 = add nuw nsw i64 %indvars.iv17.i30, 1 %indvars.iv.next.i37 = add nsw i64 %indvars.iv.i31, -1 %cmp.i38 = icmp slt i64 %indvars.iv.next18.i36, %indvars.iv.next.i37 br i1 %cmp.i38, label %while.body.i29, label %land.end, !llvm.loop !5 while.body.i29: ; preds = %while.cond.i35, %while.body.preheader.i28 %indvars.iv17.i30 = phi i64 [ 0, %while.body.preheader.i28 ], [ %indvars.iv.next18.i36, %while.cond.i35 ] %indvars.iv.i31 = phi i64 [ %9, %while.body.preheader.i28 ], [ %indvars.iv.next.i37, %while.cond.i35 ] %arrayidx.i32 = getelementptr inbounds i8, ptr %add.ptr, i64 %indvars.iv17.i30 %10 = load i8, ptr %arrayidx.i32, align 1, !tbaa !7 %arrayidx2.i33 = getelementptr inbounds i8, ptr %add.ptr, i64 %indvars.iv.i31 %11 = load i8, ptr %arrayidx2.i33, align 1, !tbaa !7 %cmp4.not.i34 = icmp eq i8 %10, %11 br i1 %cmp4.not.i34, label %while.cond.i35, label %land.end land.end: ; preds = %while.body.i, %while.body.i15, %while.cond.i35, %while.body.i29, %land.rhs %cond = phi ptr [ @.str.1, %land.rhs ], [ @.str.1, %while.cond.i35 ], [ @.str.2, %while.body.i29 ], [ @.str.2, %while.body.i15 ], [ @.str.2, %while.body.i ] %call10 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond) ret i32 0 } ; 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2 attributes #0 = { nofree norecurse nosync nounwind 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 = { 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 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 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!11, !11, i64 0} !11 = !{!"int", !8, i64 0}
#include <stdio.h> int main() { int i=0,j; char S[101]; int flag = 0; int count = 0; scanf("%s",S); while(S[i]!='\0') { count = count + 1; i++; } count = count -1; for(i = 0,j = count;i < count/2;i++,j--) { if(S[i] != S[j]) { flag = 1; break; } } if(flag == 1) { printf("No\n"); return 0; } for(i = 0,j = (count - 1)/2; i<=(count-1)/2;i++,j--) { if(S[i] != S[j]) { flag = 1; break; } } if(flag == 1) { printf("No\n"); return 0; } for(i = (count+3)/2,j=count; i<=count*3/4;i++,j--) { if(S[i] != S[j]) { flag = 1; break; } } if(flag == 0) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186390/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186390/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.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @str.5 = 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: %S = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %S) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S) %0 = load i8, ptr %S, align 16, !tbaa !5 %cmp.not105 = icmp eq i8 %0, 0 br i1 %cmp.not105, label %if.end44, label %while.body while.body: ; preds = %entry, %while.body %indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv.next %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %1, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8 while.end: ; preds = %while.body %indvars = trunc i64 %indvars.iv.next to i32 %sub = add nsw i32 %indvars, -1 %cmp2108 = icmp sgt i32 %indvars, 2 br i1 %cmp2108, label %for.body.preheader, label %if.end17 for.body.preheader: ; preds = %while.end %div158159 = lshr i32 %sub, 1 %2 = and i64 %indvars.iv.next, 4294967295 %wide.trip.count = zext i32 %div158159 to i64 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %indvars.iv122 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next123, %for.inc ] %indvars.iv120.in = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv120, %for.inc ] %indvars.iv120 = add nsw i64 %indvars.iv120.in, -1 %arrayidx5 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv122 %3 = load i8, ptr %arrayidx5, align 1, !tbaa !5 %arrayidx8 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv120 %4 = load i8, ptr %arrayidx8, align 1, !tbaa !5 %cmp10.not = icmp eq i8 %3, %4 br i1 %cmp10.not, label %for.inc, label %cleanup for.inc: ; preds = %for.body %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1 %exitcond.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count br i1 %exitcond.not, label %if.end17, label %for.body, !llvm.loop !10 if.end17: ; preds = %for.inc, %while.end %cmp23.not.not111 = icmp slt i32 %indvars, 1 br i1 %cmp23.not.not111, label %if.end44, label %for.body25.preheader for.body25.preheader: ; preds = %if.end17 %sub18 = add nsw i32 %indvars, -2 %div19 = sdiv i32 %sub18, 2 %5 = zext i32 %div19 to i64 %6 = add nuw nsw i32 %div19, 1 %wide.trip.count137 = zext i32 %6 to i64 br label %for.body25 for.body25: ; preds = %for.body25.preheader, %for.inc36 %indvars.iv130 = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next131, %for.inc36 ] %indvars.iv128 = phi i64 [ %5, %for.body25.preheader ], [ %indvars.iv.next129, %for.inc36 ] %arrayidx27 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv130 %7 = load i8, ptr %arrayidx27, align 1, !tbaa !5 %arrayidx30 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv128 %8 = load i8, ptr %arrayidx30, align 1, !tbaa !5 %cmp32.not = icmp eq i8 %7, %8 br i1 %cmp32.not, label %for.inc36, label %cleanup for.inc36: ; preds = %for.body25 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %indvars.iv.next129 = add nsw i64 %indvars.iv128, -1 %exitcond138.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count137 br i1 %exitcond138.not, label %if.end44, label %for.body25, !llvm.loop !11 if.end44: ; preds = %for.inc36, %entry, %if.end17 %count.0.lcssa151157 = phi i32 [ %indvars, %if.end17 ], [ 0, %entry ], [ %indvars, %for.inc36 ] %sub152156 = phi i32 [ %sub, %if.end17 ], [ -1, %entry ], [ %sub, %for.inc36 ] %add45 = add nuw nsw i32 %count.0.lcssa151157, 2 %div46101 = lshr i32 %add45, 1 %mul = mul nsw i32 %sub152156, 3 %div48 = sdiv i32 %mul, 4 %cmp49.not114 = icmp sgt i32 %div46101, %div48 br i1 %cmp49.not114, label %cleanup, label %for.body51.preheader for.body51.preheader: ; preds = %if.end44 %9 = zext i32 %count.0.lcssa151157 to i64 %10 = add nuw nsw i64 %9, 2 %11 = lshr i64 %10, 1 %12 = trunc i64 %11 to i32 %13 = add i32 %div48, %12 %14 = add i32 %13, 1 %15 = sub i32 %14, %div46101 %wide.trip.count146 = zext i32 %15 to i64 br label %for.body51 for.body51: ; preds = %for.body51.preheader, %for.inc62 %indvars.iv141 = phi i64 [ %11, %for.body51.preheader ], [ %indvars.iv.next142, %for.inc62 ] %indvars.iv139.in = phi i64 [ %9, %for.body51.preheader ], [ %indvars.iv139, %for.inc62 ] %indvars.iv139 = add nsw i64 %indvars.iv139.in, -1 %arrayidx53 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv141 %16 = load i8, ptr %arrayidx53, align 1, !tbaa !5 %arrayidx56 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv139 %17 = load i8, ptr %arrayidx56, align 1, !tbaa !5 %cmp58.not = icmp eq i8 %16, %17 br i1 %cmp58.not, label %for.inc62, label %cleanup for.inc62: ; preds = %for.body51 %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1 %exitcond147.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count146 br i1 %exitcond147.not, label %cleanup, label %for.body51, !llvm.loop !12 cleanup: ; preds = %for.body, %for.body25, %for.body51, %for.inc62, %if.end44 %str.3.sink = phi ptr [ @str.3, %if.end44 ], [ @str.3, %for.inc62 ], [ @str.5, %for.body51 ], [ @str.5, %for.body25 ], [ @str.5, %for.body ] %puts102 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) call void @llvm.lifetime.end.p0(i64 101, 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 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9} !11 = distinct !{!11, !9} !12 = distinct !{!12, !9}