Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> int main(void) { /* int n; int *a; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a++); for (int i = 0; i < n; i++) a--; for (int i = 0; i < n; i++) { if (*a++ % 2 == 0) { if (*a % 3 != 0 && *a % 5 != 0) printf("DENIED\n"); break; } } printf("APPROVED\n"); return 0; */ int n; scanf("%d", &n); int a[n]; for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < n; i++) { if (a[i] % 2 == 0) { if (a[i]%3 != 0 && a[i]%5 != 0) { printf("DENIED\n"); break; } } if (i == n-1) printf("APPROVED\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280407/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280407/source.c" target datalayout = "e-m:e-p270: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 [9 x i8] c"APPROVED\00", align 1 @str.3 = private unnamed_addr constant [7 x i8] c"DENIED\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 %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 %cmp39 = icmp sgt i32 %3, 0 br i1 %cmp39, label %for.body, label %cleanup for.cond3.preheader: ; preds = %for.body %cmp441 = icmp sgt i32 %4, 0 br i1 %cmp441, label %for.body6, label %cleanup 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.cond3.preheader, !llvm.loop !9 for.body6: ; preds = %for.cond3.preheader, %for.inc25 %6 = phi i32 [ %10, %for.inc25 ], [ %4, %for.cond3.preheader ] %indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.inc25 ], [ 0, %for.cond3.preheader ] %arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv44 %7 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %8 = and i32 %7, 1 %cmp9 = icmp ne i32 %8, 0 %rem12 = srem i32 %7, 3 %cmp13.not = icmp eq i32 %rem12, 0 %or.cond = or i1 %cmp9, %cmp13.not %rem16 = srem i32 %7, 5 %cmp17.not = icmp eq i32 %rem16, 0 %or.cond38 = or i1 %cmp17.not, %or.cond br i1 %or.cond38, label %if.end20, label %if.then18 if.then18: ; preds = %for.body6 %puts37 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.end20: ; preds = %for.body6 %sub = add nsw i32 %6, -1 %9 = zext i32 %sub to i64 %cmp21 = icmp eq i64 %indvars.iv44, %9 br i1 %cmp21, label %if.then22, label %for.inc25 if.then22: ; preds = %if.end20 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc25 for.inc25: ; preds = %if.end20, %if.then22 %10 = phi i32 [ %6, %if.end20 ], [ %.pre, %if.then22 ] %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %11 = sext i32 %10 to i64 %cmp4 = icmp slt i64 %indvars.iv.next45, %11 br i1 %cmp4, label %for.body6, label %cleanup, !llvm.loop !11 cleanup: ; preds = %for.inc25, %entry, %for.cond3.preheader, %if.then18 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: 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}
#include <stdio.h> #define max 100 int main() { int N, str[max], i, flag=0, num=0; scanf("%d", &N); for(i=0; i<N; i++){ scanf("%d", &str[i]); } for (i=0; i<N; i++) { if(str[i]%2==0){ num++; if(str[i]%3==0||str[i]%5==0) flag++; } } if(flag==num) printf("APPROVED"); else printf("DENIED"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280472/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280472/source.c" target datalayout = "e-m:e-p270: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"APPROVED\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %str = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %str) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body, label %if.end27 for.cond2.preheader: ; preds = %for.body %cmp339 = icmp sgt i32 %24, 0 br i1 %cmp339, label %for.body4.preheader, label %if.end27 for.body4.preheader: ; preds = %for.cond2.preheader %wide.trip.count = zext i32 %24 to i64 %min.iters.check = icmp ult i32 %24, 8 br i1 %min.iters.check, label %for.body4.preheader66, label %vector.ph vector.ph: ; preds = %for.body4.preheader %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi61, %vector.body ] %vec.phi56 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi62, %vector.body ] %vec.phi57 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi, %vector.body ] %vec.phi58 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi60, %vector.body ] %1 = getelementptr inbounds [100 x i32], ptr %str, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 %wide.load59 = load <4 x i32>, ptr %2, align 16, !tbaa !5 %3 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1> %4 = and <4 x i32> %wide.load59, <i32 1, i32 1, i32 1, i32 1> %5 = icmp eq <4 x i32> %3, zeroinitializer %6 = icmp eq <4 x i32> %4, zeroinitializer %7 = srem <4 x i32> %wide.load, <i32 3, i32 3, i32 3, i32 3> %8 = srem <4 x i32> %wide.load59, <i32 3, i32 3, i32 3, i32 3> %9 = icmp eq <4 x i32> %7, zeroinitializer %10 = icmp eq <4 x i32> %8, zeroinitializer %11 = srem <4 x i32> %wide.load, <i32 5, i32 5, i32 5, i32 5> %12 = srem <4 x i32> %wide.load59, <i32 5, i32 5, i32 5, i32 5> %13 = icmp eq <4 x i32> %11, zeroinitializer %14 = icmp eq <4 x i32> %12, zeroinitializer %15 = or <4 x i1> %9, %13 %16 = or <4 x i1> %10, %14 %narrow = select <4 x i1> %5, <4 x i1> %15, <4 x i1> zeroinitializer %17 = zext <4 x i1> %narrow to <4 x i32> %predphi = add <4 x i32> %vec.phi57, %17 %narrow65 = select <4 x i1> %6, <4 x i1> %16, <4 x i1> zeroinitializer %18 = zext <4 x i1> %narrow65 to <4 x i32> %predphi60 = add <4 x i32> %vec.phi58, %18 %19 = xor <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1> %predphi61 = add <4 x i32> %vec.phi, %19 %20 = xor <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1> %predphi62 = add <4 x i32> %vec.phi56, %20 %index.next = add nuw i64 %index, 8 %21 = icmp eq i64 %index.next, %n.vec br i1 %21, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx63 = add <4 x i32> %predphi60, %predphi %22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx63) %bin.rdx = add <4 x i32> %predphi62, %predphi61 %23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end22, label %for.body4.preheader66 for.body4.preheader66: ; preds = %for.body4.preheader, %middle.block %indvars.iv47.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ] %num.042.ph = phi i32 [ 0, %for.body4.preheader ], [ %23, %middle.block ] %flag.041.ph = phi i32 [ 0, %for.body4.preheader ], [ %22, %middle.block ] br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %str, 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 %24 = load i32, ptr %N, align 4, !tbaa !5 %25 = sext i32 %24 to i64 %cmp = icmp slt i64 %indvars.iv.next, %25 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13 for.body4: ; preds = %for.body4.preheader66, %for.inc20 %indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.inc20 ], [ %indvars.iv47.ph, %for.body4.preheader66 ] %num.042 = phi i32 [ %num.1, %for.inc20 ], [ %num.042.ph, %for.body4.preheader66 ] %flag.041 = phi i32 [ %flag.1, %for.inc20 ], [ %flag.041.ph, %for.body4.preheader66 ] %arrayidx6 = getelementptr inbounds [100 x i32], ptr %str, i64 0, i64 %indvars.iv47 %26 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %27 = and i32 %26, 1 %cmp7 = icmp eq i32 %27, 0 br i1 %cmp7, label %if.then, label %for.inc20 if.then: ; preds = %for.body4 %inc8 = add nsw i32 %num.042, 1 %rem11 = srem i32 %26, 3 %cmp12 = icmp eq i32 %rem11, 0 %rem15 = srem i32 %26, 5 %cmp16 = icmp eq i32 %rem15, 0 %or.cond = or i1 %cmp12, %cmp16 %inc18 = zext i1 %or.cond to i32 %spec.select = add nsw i32 %flag.041, %inc18 br label %for.inc20 for.inc20: ; preds = %if.then, %for.body4 %flag.1 = phi i32 [ %flag.041, %for.body4 ], [ %spec.select, %if.then ] %num.1 = phi i32 [ %num.042, %for.body4 ], [ %inc8, %if.then ] %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.body4, !llvm.loop !14 for.end22: ; preds = %for.inc20, %middle.block %flag.1.lcssa = phi i32 [ %22, %middle.block ], [ %flag.1, %for.inc20 ] %num.1.lcssa = phi i32 [ %23, %middle.block ], [ %num.1, %for.inc20 ] %cmp23 = icmp eq i32 %flag.1.lcssa, %num.1.lcssa %spec.select55 = select i1 %cmp23, ptr @.str.1, ptr @.str.2 br label %if.end27 if.end27: ; preds = %for.end22, %for.cond2.preheader, %entry %.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.cond2.preheader ], [ %spec.select55, %for.end22 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %str) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11}
#include <stdio.h> #define N_MAX 110 int main(){ int N, A[N_MAX]; //標準入力から読み込み scanf("%d", &N); for ( int i=0; i<N; i++ ){ scanf("%d",&A[i]); } for ( int i=0; i<N; i++ ){ if ( A[i] % 2 == 0 ){ if ( A[i] % 3 != 0 && A[i] % 5 != 0 ){ printf("DENIED\n"); return 0; } } } printf("APPROVED\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280515/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280515/source.c" target datalayout = "e-m:e-p270: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 [7 x i8] c"DENIED\00", align 1 @str.3 = private unnamed_addr constant [9 x i8] c"APPROVED\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 [110 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp35 = icmp sgt i32 %0, 0 br i1 %cmp35, label %for.body, label %cleanup25 for.cond3.preheader: ; preds = %for.body %cmp4.not37 = icmp sgt i32 %1, 0 br i1 %cmp4.not37, label %for.body6.preheader, label %cleanup25 for.body6.preheader: ; preds = %for.cond3.preheader %wide.trip.count = zext i32 %1 to i64 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [110 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.cond3.preheader, !llvm.loop !9 for.cond3: ; preds = %for.body6 %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1 %exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count br i1 %exitcond.not, label %cleanup25, label %for.body6, !llvm.loop !11 for.body6: ; preds = %for.body6.preheader, %for.cond3 %indvars.iv41 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next42, %for.cond3 ] %arrayidx8 = getelementptr inbounds [110 x i32], ptr %A, i64 0, i64 %indvars.iv41 %3 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %4 = and i32 %3, 1 %cmp9 = icmp ne i32 %4, 0 %rem12 = srem i32 %3, 3 %cmp13.not = icmp eq i32 %rem12, 0 %or.cond = or i1 %cmp9, %cmp13.not %rem16 = srem i32 %3, 5 %cmp17.not = icmp eq i32 %rem16, 0 %or.cond34 = or i1 %cmp17.not, %or.cond br i1 %or.cond34, label %for.cond3, label %cleanup25 cleanup25: ; preds = %for.cond3, %for.body6, %for.cond3.preheader, %entry %str.sink = phi ptr [ @str.3, %entry ], [ @str.3, %for.cond3.preheader ], [ @str, %for.body6 ], [ @str.3, %for.cond3 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 440, 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: 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(void) { int N; int a[1001]; int flag = 0; scanf("%d ", &N); for (int i = 0; i < N; i++) { scanf("%d ", &a[i]); } for (int i = 0; i < N; i++) { if (a[i] % 2 == 0) { if (a[i] % 3 != 0 && a[i] % 5 != 0) { flag = 1; } } } if (flag == 0) { printf("APPROVED"); } if (flag == 1) { printf("DENIED"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280559/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280559/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\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 [1001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp39 = icmp sgt i32 %0, 0 br i1 %cmp39, label %for.body, label %if.end30.sink.split for.cond3.preheader: ; preds = %for.body %cmp441 = icmp sgt i32 %1, 0 br i1 %cmp441, label %for.body6.preheader, label %if.end30.sink.split for.body6.preheader: ; preds = %for.cond3.preheader %wide.trip.count = zext i32 %1 to i64 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1001 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.cond3.preheader, !llvm.loop !9 for.cond.cleanup5: ; preds = %for.body6 switch i32 %flag.1, label %if.end30 [ i32 0, label %if.end30.sink.split i32 1, label %if.then28 ] for.body6: ; preds = %for.body6.preheader, %for.body6 %indvars.iv47 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next48, %for.body6 ] %flag.042 = phi i32 [ 0, %for.body6.preheader ], [ %flag.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv47 %3 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %4 = and i32 %3, 1 %cmp9 = icmp ne i32 %4, 0 %rem12 = srem i32 %3, 3 %cmp13.not = icmp eq i32 %rem12, 0 %or.cond = or i1 %cmp9, %cmp13.not %rem16 = srem i32 %3, 5 %cmp17.not = icmp eq i32 %rem16, 0 %or.cond38 = or i1 %cmp17.not, %or.cond %flag.1 = select i1 %or.cond38, i32 %flag.042, i32 1 %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.cond.cleanup5, label %for.body6, !llvm.loop !11 if.then28: ; preds = %for.cond.cleanup5 br label %if.end30.sink.split if.end30.sink.split: ; preds = %for.cond.cleanup5, %for.cond3.preheader, %entry, %if.then28 %.str.1.sink = phi ptr [ @.str.2, %if.then28 ], [ @.str.1, %entry ], [ @.str.1, %for.cond3.preheader ], [ @.str.1, %for.cond.cleanup5 ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink) br label %if.end30 if.end30: ; preds = %if.end30.sink.split, %for.cond.cleanup5 call void @llvm.lifetime.end.p0(i64 4004, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <unistd.h> int main() { int N, i, r; int nums[1001]; i = 0; scanf("%d\n", &N); while (i >= 0) { r = scanf("%d ", &nums[i]); if (r == EOF) break ; i++; } nums[i] = 0; i = 0; while (nums[i]) { if (nums[i] % 2 == 0 && nums[i] % 3 != 0 && nums[i] % 5 != 0) { printf("DENIED\n"); return (0); } i++; } printf("APPROVED\n"); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280601/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280601/source.c" target datalayout = "e-m:e-p270: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 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1 @str.4 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %nums = alloca [1001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %nums) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) br label %while.cond while.cond: ; preds = %while.cond, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1001 x i32], ptr %nums, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %cmp2 = icmp eq i32 %call1, -1 %indvars.iv.next = add nuw i64 %indvars.iv, 1 br i1 %cmp2, label %while.end, label %while.cond, !llvm.loop !5 while.end: ; preds = %while.cond store i32 0, ptr %arrayidx, align 4, !tbaa !7 %0 = load i32, ptr %nums, align 16, !tbaa !7 %tobool.not40 = icmp eq i32 %0, 0 br i1 %tobool.not40, label %cleanup, label %while.body8 while.cond5: ; preds = %while.body8 %indvars.iv.next44 = add nuw i64 %indvars.iv43, 1 %arrayidx7 = getelementptr inbounds [1001 x i32], ptr %nums, i64 0, i64 %indvars.iv.next44 %1 = load i32, ptr %arrayidx7, align 4, !tbaa !7 %tobool.not = icmp eq i32 %1, 0 br i1 %tobool.not, label %cleanup, label %while.body8, !llvm.loop !11 while.body8: ; preds = %while.end, %while.cond5 %indvars.iv43 = phi i64 [ %indvars.iv.next44, %while.cond5 ], [ 0, %while.end ] %2 = phi i32 [ %1, %while.cond5 ], [ %0, %while.end ] %3 = and i32 %2, 1 %cmp11 = icmp ne i32 %3, 0 %rem14 = srem i32 %2, 3 %cmp15.not = icmp eq i32 %rem14, 0 %or.cond = or i1 %cmp11, %cmp15.not %rem19 = srem i32 %2, 5 %cmp20.not = icmp eq i32 %rem19, 0 %or.cond39 = or i1 %cmp20.not, %or.cond br i1 %or.cond39, label %while.cond5, label %cleanup cleanup: ; preds = %while.cond5, %while.body8, %while.end %str.sink = phi ptr [ @str, %while.end ], [ @str.4, %while.body8 ], [ @str, %while.cond5 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %nums) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @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 = 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}
#include<stdio.h> int main(void){ int n = 0; scanf("%d", &n); int i = 0; int a[n]; for(i=0;i<n;i++){ scanf("%d", &a[i]); } for(i=0;i<n;i++){ if (a[i] % 2 == 0){ if(a[i] % 3 == 0 || a[i]%5==0){ }else{ printf("DENIED"); return 0; } } } printf("APPROVED"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280645/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280645/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"APPROVED\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 i32 0, ptr %n, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %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 %cmp33 = icmp sgt i32 %3, 0 br i1 %cmp33, label %for.body, label %cleanup for.cond2.preheader: ; preds = %for.body %cmp335 = icmp sgt i32 %4, 0 br i1 %cmp335, label %for.body4.preheader, label %cleanup for.body4.preheader: ; preds = %for.cond2.preheader %wide.trip.count = zext i32 %4 to i64 br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds 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.cond2.preheader, !llvm.loop !9 for.cond2: ; preds = %for.body4 %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1 %exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count br i1 %exitcond.not, label %cleanup, label %for.body4, !llvm.loop !11 for.body4: ; preds = %for.body4.preheader, %for.cond2 %indvars.iv39 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next40, %for.cond2 ] %arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39 %6 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %7 = and i32 %6, 1 %cmp7 = icmp ne i32 %7, 0 %rem10 = srem i32 %6, 3 %cmp11 = icmp eq i32 %rem10, 0 %or.cond = or i1 %cmp7, %cmp11 %rem14 = srem i32 %6, 5 %cmp15 = icmp eq i32 %rem14, 0 %or.cond32 = or i1 %cmp15, %or.cond br i1 %or.cond32, label %for.cond2, label %cleanup cleanup: ; preds = %for.cond2, %for.body4, %for.cond2.preheader, %entry %.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.cond2.preheader ], [ @.str.1, %for.body4 ], [ @.str.2, %for.cond2 ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) 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 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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int main(void){ int n; int a; int flg = 1; scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d", &a); if(a%2==0){ if(a%3!=0 && a%5!=0){ flg = 0; } } } if(flg == 1){ printf("APPROVED\n"); } else{ printf("DENIED\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280689/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280689/source.c" target datalayout = "e-m:e-p270: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 [7 x i8] c"DENIED\00", align 1 @str.3 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #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 %if.end13 for.cond.cleanup: ; preds = %for.body %1 = icmp eq i32 %flg.1, 1 %spec.select = select i1 %1, ptr @str.3, ptr @str br label %if.end13 for.body: ; preds = %entry, %for.body %i.019 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %flg.018 = phi i32 [ %flg.1, %for.body ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = and i32 %2, 1 %cmp2 = icmp ne i32 %3, 0 %rem3 = srem i32 %2, 3 %cmp4.not = icmp eq i32 %rem3, 0 %or.cond = or i1 %cmp2, %cmp4.not %rem5 = srem i32 %2, 5 %cmp6.not = icmp eq i32 %rem5, 0 %or.cond16 = or i1 %cmp6.not, %or.cond %flg.1 = select i1 %or.cond16, i32 %flg.018, i32 0 %inc = add nuw nsw i32 %i.019, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 if.end13: ; preds = %for.cond.cleanup, %entry %str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %for.cond.cleanup ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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 <string.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> #define LL long long #define DB double #define INF 1145141919810364364 #define PI 3.14159265358979 #define MIN(x,y) ((x)<(y)?(x):(y)) #define MAX(x,y) ((x)<(y)?(y):(x)) #define FOR(i,a,n) for(i=a;i<n;i++) #define MOD 1000000007 //#define MOD 998244353 #define ERR 0.00000001 #define NUM 200010 void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;} void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");} LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;} LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;} LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;} LL LCM(LL a,LL b){return a*b/GCD(a,b);} int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;} int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;} int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;} int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;} int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);} int scmpr(const void* a,const void* b){return strcmp(*(char**)b,*(char**)a);} LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;} LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);} LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;} LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;} LL fact[NUM],finv[NUM],inv[NUM]; void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}} LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;} int main(){ LL N,i,ans=0; scanf("%lld",&N); LL A[N]; FOR(i,0,N)scanf("%lld",&A[i]); FOR(i,0,N)if(A[i]%2==0&&A[i]%3!=0&&A[i]%5!=0)ans=1; if(ans==1)printf("DENIED"); else printf("APPROVED"); //printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280731/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280731/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @fact = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16 @finv = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16 @inv = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1 @.str.4 = private unnamed_addr constant [9 x i8] c"APPROVED\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: 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 %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 store i64 %1, ptr %a, align 8, !tbaa !5 store i64 %0, ptr %b, 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: nofree nounwind uwtable define dso_local void @YN(i32 noundef %a) local_unnamed_addr #2 { entry: switch i32 %a, label %if.end4 [ i32 1, label %if.end4.sink.split i32 0, label %if.then2 ] if.then2: ; preds = %entry br label %if.end4.sink.split if.end4.sink.split: ; preds = %entry, %if.then2 %str.sink = phi ptr [ @str.5, %if.then2 ], [ @str, %entry ] %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) br label %if.end4 if.end4: ; preds = %if.end4.sink.split, %entry ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable define dso_local i64 @lpow(i64 noundef %a, i64 noundef %n) local_unnamed_addr #4 { entry: %conv = sitofp i64 %a to double %conv1 = sitofp i64 %n to double %call = tail call double @pow(double noundef %conv, double noundef %conv1) #17 %mul = fmul double %call, 1.000000e+01 %conv2 = fptosi double %mul to i64 %rem = srem i64 %conv2, 10 %cmp = icmp sgt i64 %rem, 4 %div = sdiv i64 %conv2, 10 %add = zext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %add ret i64 %retval.0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @pow(double noundef, double noundef) local_unnamed_addr #5 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @dup(i64 noundef %a, i64 noundef %d) local_unnamed_addr #6 { entry: %rem = srem i64 %a, %d %cmp = icmp ne i64 %rem, 0 %div = sdiv i64 %a, %d %add = zext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %add ret i64 %retval.0 } ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i64 @GCD(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) %cond5 = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) br label %while.body while.body: ; preds = %entry, %while.body %a.addr.019 = phi i64 [ %cond, %entry ], [ %b.addr.018, %while.body ] %b.addr.018 = phi i64 [ %cond5, %entry ], [ %rem, %while.body ] %rem = srem i64 %a.addr.019, %b.addr.018 %cmp6.not = icmp eq i64 %rem, 0 br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body ret i64 %b.addr.018 } ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i64 @LCM(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 { entry: %cond.i = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) %cond5.i = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) br label %while.body.i while.body.i: ; preds = %while.body.i, %entry %a.addr.019.i = phi i64 [ %cond.i, %entry ], [ %b.addr.018.i, %while.body.i ] %b.addr.018.i = phi i64 [ %cond5.i, %entry ], [ %rem.i, %while.body.i ] %rem.i = srem i64 %a.addr.019.i, %b.addr.018.i %cmp6.not.i = icmp eq i64 %rem.i, 0 br i1 %cmp6.not.i, label %GCD.exit, label %while.body.i, !llvm.loop !9 GCD.exit: ; preds = %while.body.i %mul = mul nsw i64 %b, %a %div = sdiv i64 %mul, %b.addr.018.i ret i64 %div } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @lcmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #8 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp sgt i64 %0, %1 %cmp1 = icmp slt 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 @lcmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #8 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp sgt i64 %0, %1 %cmp1 = icmp slt i64 %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @ccmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #8 { entry: %0 = load i8, ptr %a, align 1, !tbaa !11 %conv = sext i8 %0 to i32 %1 = load i8, ptr %b, align 1, !tbaa !11 %conv1 = sext i8 %1 to i32 %sub = sub nsw i32 %conv, %conv1 ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @ccmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #8 { entry: %0 = load i8, ptr %b, align 1, !tbaa !11 %conv = sext i8 %0 to i32 %1 = load i8, ptr %a, align 1, !tbaa !11 %conv1 = sext i8 %1 to i32 %sub = sub nsw i32 %conv, %conv1 ret i32 %sub } ; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable define dso_local i32 @scmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 { entry: %0 = load ptr, ptr %a, align 8, !tbaa !12 %1 = load ptr, ptr %b, align 8, !tbaa !12 %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #18 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #10 ; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable define dso_local i32 @scmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 { entry: %0 = load ptr, ptr %b, align 8, !tbaa !12 %1 = load ptr, ptr %a, align 8, !tbaa !12 %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #18 ret i32 %call } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @mod(i64 noundef %a, i64 noundef %m) local_unnamed_addr #6 { entry: %cmp = icmp slt i64 %a, 0 %rem = srem i64 %a, %m %add = select i1 %cmp, i64 %m, i64 0 %retval.0 = add nsw i64 %rem, %add ret i64 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @DIV(i64 noundef %a, i64 noundef %d) local_unnamed_addr #11 { entry: br label %while.body while.body: ; preds = %entry, %while.body %y.018 = phi i64 [ 0, %entry ], [ %sub2, %while.body ] %x.017 = phi i64 [ 1, %entry ], [ %y.018, %while.body ] %m.016 = phi i64 [ 1000000007, %entry ], [ %sub.recomposed, %while.body ] %d.addr.015 = phi i64 [ %d, %entry ], [ %m.016, %while.body ] %div = sdiv i64 %d.addr.015, %m.016 %mul = mul nsw i64 %div, %m.016 %sub.recomposed = srem i64 %d.addr.015, %m.016 %mul1 = mul nsw i64 %div, %y.018 %sub2 = sub nsw i64 %x.017, %mul1 %tobool.not = icmp eq i64 %sub.recomposed, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body %cmp.i = icmp slt i64 %y.018, 0 %rem.i = srem i64 %y.018, 1000000007 %add.i = select i1 %cmp.i, i64 1000000007, i64 0 %retval.0.i = add nsw i64 %add.i, %rem.i %mul3 = mul nsw i64 %retval.0.i, %a %cmp.i6 = icmp slt i64 %mul3, 0 %rem.i7 = srem i64 %mul3, 1000000007 %add.i8 = select i1 %cmp.i6, i64 1000000007, i64 0 %retval.0.i9 = add nsw i64 %add.i8, %rem.i7 ret i64 %retval.0.i9 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @FAC(i64 noundef %a) local_unnamed_addr #11 { entry: %cmp.not7 = icmp slt i64 %a, 1 br i1 %cmp.not7, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %a, 1 %0 = icmp eq i64 %a, 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 %a, -2 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %ans.09 = phi i64 [ 1, %for.body.preheader.new ], [ %ans.1.1, %for.body ] %i.08 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %mul = mul nsw i64 %ans.09, %i.08 %cmp1 = icmp sgt i64 %mul, 1000000007 %rem = urem i64 %mul, 1000000007 %ans.1 = select i1 %cmp1, i64 %rem, i64 %mul %inc = add nuw i64 %i.08, 1 %mul.1 = mul nsw i64 %ans.1, %inc %cmp1.1 = icmp sgt i64 %mul.1, 1000000007 %rem.1 = urem i64 %mul.1, 1000000007 %ans.1.1 = select i1 %cmp1.1, i64 %rem.1, i64 %mul.1 %inc.1 = add nuw i64 %i.08, 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 !15 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %ans.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %ans.1.1, %for.body ] %ans.09.unr = phi i64 [ 1, %for.body.preheader ], [ %ans.1.1, %for.body ] %i.08.unr = phi i64 [ 1, %for.body.preheader ], [ %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 %mul.epil = mul nsw i64 %ans.09.unr, %i.08.unr %cmp1.epil = icmp sgt i64 %mul.epil, 1000000007 %rem.epil = urem i64 %mul.epil, 1000000007 %ans.1.epil = select i1 %cmp1.epil, i64 %rem.epil, i64 %mul.epil br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body.epil ] ret i64 %ans.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @POW(i64 noundef %a, i64 noundef %n) local_unnamed_addr #11 { entry: %cmp8 = icmp sgt i64 %n, 0 br i1 %cmp8, label %while.body, label %while.end while.body: ; preds = %entry, %if.end %ans.011 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ] %n.addr.010 = phi i64 [ %shr, %if.end ], [ %n, %entry ] %a.addr.09 = phi i64 [ %rem2, %if.end ], [ %a, %entry ] %and = and i64 %n.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 %ans.011, %a.addr.09 %rem = srem i64 %mul, 1000000007 br label %if.end if.end: ; preds = %if.then, %while.body %ans.1 = phi i64 [ %rem, %if.then ], [ %ans.011, %while.body ] %mul1 = mul nsw i64 %a.addr.09, %a.addr.09 %rem2 = urem i64 %mul1, 1000000007 %shr = lshr i64 %n.addr.010, 1 %cmp.not = icmp ult i64 %n.addr.010, 2 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16 while.end: ; preds = %if.end, %entry %ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1, %if.end ] ret i64 %ans.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @comi() local_unnamed_addr #12 { entry: store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @fact, i64 0, i64 1), align 8, !tbaa !5 store i64 1, ptr @fact, align 16, !tbaa !5 store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !5 store i64 1, ptr @finv, align 16, !tbaa !5 store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5 br label %for.body for.body: ; preds = %entry, %for.body %0 = phi i64 [ 1, %entry ], [ %rem12, %for.body ] %1 = phi i64 [ 1, %entry ], [ %rem, %for.body ] %i.026 = phi i64 [ 2, %entry ], [ %inc, %for.body ] %mul = mul nsw i64 %1, %i.026 %rem = srem i64 %mul, 1000000007 %arrayidx1 = getelementptr inbounds [200010 x i64], ptr @fact, i64 0, i64 %i.026 store i64 %rem, ptr %arrayidx1, align 8, !tbaa !5 %rem2.rhs.trunc = trunc i64 %i.026 to i32 %rem224 = urem i32 1000000007, %rem2.rhs.trunc %rem2.zext = zext i32 %rem224 to i64 %arrayidx3 = getelementptr inbounds [200010 x i64], ptr @inv, i64 0, i64 %rem2.zext %2 = load i64, ptr %arrayidx3, align 8, !tbaa !5 %div25 = udiv i32 1000000007, %rem2.rhs.trunc %div.zext = zext i32 %div25 to i64 %mul4 = mul nsw i64 %2, %div.zext %rem5 = srem i64 %mul4, 1000000007 %sub6 = sub nsw i64 1000000007, %rem5 %arrayidx7 = getelementptr inbounds [200010 x i64], ptr @inv, i64 0, i64 %i.026 store i64 %sub6, ptr %arrayidx7, align 8, !tbaa !5 %mul11 = mul nuw nsw i64 %sub6, %0 %rem12 = urem i64 %mul11, 1000000007 %arrayidx13 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %i.026 store i64 %rem12, ptr %arrayidx13, align 8, !tbaa !5 %inc = add nuw nsw i64 %i.026, 1 %exitcond.not = icmp eq i64 %inc, 200010 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17 for.end: ; preds = %for.body ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @com(i64 noundef %n, i64 noundef %k) local_unnamed_addr #13 { entry: %cmp = icmp slt i64 %n, %k %0 = or i64 %k, %n %1 = icmp slt i64 %0, 0 %or.cond8 = or i1 %cmp, %1 br i1 %or.cond8, label %return, label %if.end if.end: ; preds = %entry %arrayidx = getelementptr inbounds [200010 x i64], ptr @fact, i64 0, i64 %n %2 = load i64, ptr %arrayidx, align 8, !tbaa !5 %arrayidx4 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %k %3 = load i64, ptr %arrayidx4, align 8, !tbaa !5 %sub = sub nsw i64 %n, %k %arrayidx5 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %sub %4 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %mul = mul nsw i64 %4, %3 %rem = srem i64 %mul, 1000000007 %mul6 = mul nsw i64 %rem, %2 %rem7 = srem i64 %mul6, 1000000007 br label %return return: ; preds = %entry, %if.end %retval.0 = phi i64 [ %rem7, %if.end ], [ 0, %entry ] ret i64 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %N = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #17 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N) %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 %cmp30 = icmp sgt i64 %2, 0 br i1 %cmp30, label %for.body, label %if.else for.cond2.preheader: ; preds = %for.body %cmp332 = icmp sgt i64 %3, 0 br i1 %cmp332, label %for.body4, label %if.else for.body: ; preds = %entry, %for.body %i.031 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.031 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.031, 1 %3 = load i64, ptr %N, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %3 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !18 for.body4: ; preds = %for.cond2.preheader, %for.body4 %i.134 = phi i64 [ %inc15, %for.body4 ], [ 0, %for.cond2.preheader ] %ans.033 = phi i64 [ %ans.1, %for.body4 ], [ 0, %for.cond2.preheader ] %arrayidx5 = getelementptr inbounds i64, ptr %vla, i64 %i.134 %4 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %5 = and i64 %4, 1 %cmp6 = icmp ne i64 %5, 0 %rem8 = srem i64 %4, 3 %cmp9.not = icmp eq i64 %rem8, 0 %or.cond = or i1 %cmp6, %cmp9.not %rem12 = srem i64 %4, 5 %cmp13.not = icmp eq i64 %rem12, 0 %or.cond29 = or i1 %cmp13.not, %or.cond %ans.1 = select i1 %or.cond29, i64 %ans.033, i64 1 %inc15 = add nuw nsw i64 %i.134, 1 %exitcond.not = icmp eq i64 %inc15, %3 br i1 %exitcond.not, label %for.end16, label %for.body4, !llvm.loop !19 for.end16: ; preds = %for.body4 %6 = icmp eq i64 %ans.1, 1 br i1 %6, label %if.end21, label %if.else if.else: ; preds = %entry, %for.cond2.preheader, %for.end16 br label %if.end21 if.end21: ; preds = %for.end16, %if.else %.str.4.sink = phi ptr [ @.str.4, %if.else ], [ @.str.3, %for.end16 ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink) call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #17 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #14 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #14 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #16 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #16 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 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 #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { 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 #7 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { 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 #9 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #10 = { 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 #11 = { 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 #12 = { 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 #13 = { 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 #14 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #15 = { nofree nounwind } attributes #16 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #17 = { nounwind } attributes #18 = { 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 = !{!"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 = !{!7, !7, i64 0} !12 = !{!13, !13, i64 0} !13 = !{!"any pointer", !7, i64 0} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10}
#include <stdio.h> int h, w; char maze[21][21]; int dist[20][20]; int qx[100000], qy[100000], head, tail; int vx[4] = {0, 1, 0, -1}; int vy[4] = {1, 0, -1, 0}; void bfs(int stx, int sty) { dist[sty][stx] = 0; head = tail = 0; qx[tail] = stx; qy[tail] = sty; tail++; while (head != tail) { for (int i = 0; i < 4; i++) { int nx = qx[head] + vx[i]; int ny = qy[head] + vy[i]; if (0 <= nx && nx < w && 0 <= ny && ny <= h && dist[ny][nx] == -1 && maze[ny][nx] == '.') { dist[ny][nx] = dist[qy[head]][qx[head]] + 1; qx[tail] = nx; qy[tail] = ny; tail++; } } head++; } } int main() { int max = 0, cnt = 0; scanf("%d%d", &h, &w); for (int i = 0; i < h; i++) { scanf("%s", maze[i]); } for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (maze[i][j] == '#') continue; for (int k = 0; k < h; k++) { for (int l = 0; l < w; l++) { dist[k][l] = -1; } } bfs(j, i); for (int k = 0; k < h; k++) { for (int l = 0; l < w; l++) { if (maze[k][l] == '#') continue; cnt = dist[k][l]; if (cnt > max) { max = cnt; } } } } } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280775/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280775/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @vx = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16 @vy = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16 @dist = dso_local local_unnamed_addr global [20 x [20 x i32]] zeroinitializer, align 16 @tail = dso_local local_unnamed_addr global i32 0, align 4 @head = dso_local local_unnamed_addr global i32 0, align 4 @qx = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16 @qy = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16 @w = dso_local global i32 0, align 4 @h = dso_local global i32 0, align 4 @maze = dso_local global [21 x [21 x i8]] zeroinitializer, align 16 @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @bfs(i32 noundef %stx, i32 noundef %sty) local_unnamed_addr #0 { for.cond.preheader.lr.ph: %idxprom = sext i32 %sty to i64 %idxprom1 = sext i32 %stx to i64 %arrayidx2 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom, i64 %idxprom1 store i32 0, ptr %arrayidx2, align 4, !tbaa !5 store i32 0, ptr @head, align 4, !tbaa !5 store i32 %stx, ptr @qx, align 16, !tbaa !5 store i32 %sty, ptr @qy, align 16, !tbaa !5 store i32 1, ptr @tail, align 4, !tbaa !5 %0 = load i32, ptr @w, align 4 %1 = load i32, ptr @h, align 4 %.pre = load i32, ptr @vx, align 16, !tbaa !5 %.pre87 = load i32, ptr @vy, align 16, !tbaa !5 %2 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vx, i64 0, i64 1), align 4, !tbaa !5 %3 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vy, i64 0, i64 1), align 4, !tbaa !5 %4 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vx, i64 0, i64 2), align 8, !tbaa !5 %5 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vy, i64 0, i64 2), align 8, !tbaa !5 %6 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vx, i64 0, i64 3), align 4, !tbaa !5 %7 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @vy, i64 0, i64 3), align 4, !tbaa !5 br label %for.cond.preheader for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %if.end.3 %indvars.iv = phi i64 [ 0, %for.cond.preheader.lr.ph ], [ %indvars.iv.next, %if.end.3 ] %tail.promoted8183 = phi i32 [ 1, %for.cond.preheader.lr.ph ], [ %tail.promoted79.3, %if.end.3 ] %arrayidx9 = getelementptr inbounds [100000 x i32], ptr @qx, i64 0, i64 %indvars.iv %arrayidx13 = getelementptr inbounds [100000 x i32], ptr @qy, i64 0, i64 %indvars.iv %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %add = add nsw i32 %.pre, %8 %9 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %add16 = add nsw i32 %.pre87, %9 %cmp17 = icmp sgt i32 %add, -1 br i1 %cmp17, label %land.lhs.true, label %if.end land.lhs.true: ; preds = %for.cond.preheader %cmp18 = icmp sge i32 %add, %0 %cmp20 = icmp slt i32 %add16, 0 %or.cond.not72 = select i1 %cmp18, i1 true, i1 %cmp20 %cmp22.not = icmp sgt i32 %add16, %1 %or.cond71 = select i1 %or.cond.not72, i1 true, i1 %cmp22.not br i1 %or.cond71, label %if.end, label %land.lhs.true23 land.lhs.true23: ; preds = %land.lhs.true %idxprom24 = zext i32 %add16 to i64 %idxprom26 = zext i32 %add to i64 %arrayidx27 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom24, i64 %idxprom26 %10 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %cmp28 = icmp eq i32 %10, -1 br i1 %cmp28, label %land.lhs.true29, label %if.end land.lhs.true29: ; preds = %land.lhs.true23 %arrayidx33 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %idxprom24, i64 %idxprom26 %11 = load i8, ptr %arrayidx33, align 1, !tbaa !9 %cmp34 = icmp eq i8 %11, 46 br i1 %cmp34, label %if.then, label %if.end if.then: ; preds = %land.lhs.true29 %idxprom38 = sext i32 %9 to i64 %idxprom42 = sext i32 %8 to i64 %arrayidx43 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom38, i64 %idxprom42 %12 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %add44 = add nsw i32 %12, 1 store i32 %add44, ptr %arrayidx27, align 4, !tbaa !5 %idxprom49 = sext i32 %tail.promoted8183 to i64 %arrayidx50 = getelementptr inbounds [100000 x i32], ptr @qx, i64 0, i64 %idxprom49 store i32 %add, ptr %arrayidx50, align 4, !tbaa !5 %arrayidx52 = getelementptr inbounds [100000 x i32], ptr @qy, i64 0, i64 %idxprom49 store i32 %add16, ptr %arrayidx52, align 4, !tbaa !5 %inc53 = add nsw i32 %tail.promoted8183, 1 store i32 %inc53, ptr @tail, align 4, !tbaa !5 %.pre88 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %.pre89 = load i32, ptr %arrayidx13, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %land.lhs.true29, %land.lhs.true23, %land.lhs.true, %for.cond.preheader %13 = phi i32 [ %.pre89, %if.then ], [ %9, %land.lhs.true29 ], [ %9, %land.lhs.true23 ], [ %9, %land.lhs.true ], [ %9, %for.cond.preheader ] %14 = phi i32 [ %.pre88, %if.then ], [ %8, %land.lhs.true29 ], [ %8, %land.lhs.true23 ], [ %8, %land.lhs.true ], [ %8, %for.cond.preheader ] %tail.promoted79 = phi i32 [ %inc53, %if.then ], [ %tail.promoted8183, %land.lhs.true29 ], [ %tail.promoted8183, %land.lhs.true23 ], [ %tail.promoted8183, %land.lhs.true ], [ %tail.promoted8183, %for.cond.preheader ] %add.1 = add nsw i32 %2, %14 %add16.1 = add nsw i32 %3, %13 %cmp17.1 = icmp sgt i32 %add.1, -1 br i1 %cmp17.1, label %land.lhs.true.1, label %if.end.1 land.lhs.true.1: ; preds = %if.end %cmp18.1 = icmp sge i32 %add.1, %0 %cmp20.1 = icmp slt i32 %add16.1, 0 %or.cond.not72.1 = select i1 %cmp18.1, i1 true, i1 %cmp20.1 %cmp22.not.1 = icmp sgt i32 %add16.1, %1 %or.cond71.1 = select i1 %or.cond.not72.1, i1 true, i1 %cmp22.not.1 br i1 %or.cond71.1, label %if.end.1, label %land.lhs.true23.1 land.lhs.true23.1: ; preds = %land.lhs.true.1 %idxprom24.1 = zext i32 %add16.1 to i64 %idxprom26.1 = zext i32 %add.1 to i64 %arrayidx27.1 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom24.1, i64 %idxprom26.1 %15 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5 %cmp28.1 = icmp eq i32 %15, -1 br i1 %cmp28.1, label %land.lhs.true29.1, label %if.end.1 land.lhs.true29.1: ; preds = %land.lhs.true23.1 %arrayidx33.1 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %idxprom24.1, i64 %idxprom26.1 %16 = load i8, ptr %arrayidx33.1, align 1, !tbaa !9 %cmp34.1 = icmp eq i8 %16, 46 br i1 %cmp34.1, label %if.then.1, label %if.end.1 if.then.1: ; preds = %land.lhs.true29.1 %idxprom38.1 = sext i32 %13 to i64 %idxprom42.1 = sext i32 %14 to i64 %arrayidx43.1 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom38.1, i64 %idxprom42.1 %17 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5 %add44.1 = add nsw i32 %17, 1 store i32 %add44.1, ptr %arrayidx27.1, align 4, !tbaa !5 %idxprom49.1 = sext i32 %tail.promoted79 to i64 %arrayidx50.1 = getelementptr inbounds [100000 x i32], ptr @qx, i64 0, i64 %idxprom49.1 store i32 %add.1, ptr %arrayidx50.1, align 4, !tbaa !5 %arrayidx52.1 = getelementptr inbounds [100000 x i32], ptr @qy, i64 0, i64 %idxprom49.1 store i32 %add16.1, ptr %arrayidx52.1, align 4, !tbaa !5 %inc53.1 = add nsw i32 %tail.promoted79, 1 store i32 %inc53.1, ptr @tail, align 4, !tbaa !5 %.pre90 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %.pre91 = load i32, ptr %arrayidx13, align 4, !tbaa !5 br label %if.end.1 if.end.1: ; preds = %if.then.1, %land.lhs.true29.1, %land.lhs.true23.1, %land.lhs.true.1, %if.end %18 = phi i32 [ %.pre91, %if.then.1 ], [ %13, %land.lhs.true29.1 ], [ %13, %land.lhs.true23.1 ], [ %13, %land.lhs.true.1 ], [ %13, %if.end ] %19 = phi i32 [ %.pre90, %if.then.1 ], [ %14, %land.lhs.true29.1 ], [ %14, %land.lhs.true23.1 ], [ %14, %land.lhs.true.1 ], [ %14, %if.end ] %tail.promoted79.1 = phi i32 [ %inc53.1, %if.then.1 ], [ %tail.promoted79, %land.lhs.true29.1 ], [ %tail.promoted79, %land.lhs.true23.1 ], [ %tail.promoted79, %land.lhs.true.1 ], [ %tail.promoted79, %if.end ] %add.2 = add nsw i32 %4, %19 %add16.2 = add nsw i32 %5, %18 %cmp17.2 = icmp sgt i32 %add.2, -1 br i1 %cmp17.2, label %land.lhs.true.2, label %if.end.2 land.lhs.true.2: ; preds = %if.end.1 %cmp18.2 = icmp sge i32 %add.2, %0 %cmp20.2 = icmp slt i32 %add16.2, 0 %or.cond.not72.2 = select i1 %cmp18.2, i1 true, i1 %cmp20.2 %cmp22.not.2 = icmp sgt i32 %add16.2, %1 %or.cond71.2 = select i1 %or.cond.not72.2, i1 true, i1 %cmp22.not.2 br i1 %or.cond71.2, label %if.end.2, label %land.lhs.true23.2 land.lhs.true23.2: ; preds = %land.lhs.true.2 %idxprom24.2 = zext i32 %add16.2 to i64 %idxprom26.2 = zext i32 %add.2 to i64 %arrayidx27.2 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom24.2, i64 %idxprom26.2 %20 = load i32, ptr %arrayidx27.2, align 4, !tbaa !5 %cmp28.2 = icmp eq i32 %20, -1 br i1 %cmp28.2, label %land.lhs.true29.2, label %if.end.2 land.lhs.true29.2: ; preds = %land.lhs.true23.2 %arrayidx33.2 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %idxprom24.2, i64 %idxprom26.2 %21 = load i8, ptr %arrayidx33.2, align 1, !tbaa !9 %cmp34.2 = icmp eq i8 %21, 46 br i1 %cmp34.2, label %if.then.2, label %if.end.2 if.then.2: ; preds = %land.lhs.true29.2 %idxprom38.2 = sext i32 %18 to i64 %idxprom42.2 = sext i32 %19 to i64 %arrayidx43.2 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom38.2, i64 %idxprom42.2 %22 = load i32, ptr %arrayidx43.2, align 4, !tbaa !5 %add44.2 = add nsw i32 %22, 1 store i32 %add44.2, ptr %arrayidx27.2, align 4, !tbaa !5 %idxprom49.2 = sext i32 %tail.promoted79.1 to i64 %arrayidx50.2 = getelementptr inbounds [100000 x i32], ptr @qx, i64 0, i64 %idxprom49.2 store i32 %add.2, ptr %arrayidx50.2, align 4, !tbaa !5 %arrayidx52.2 = getelementptr inbounds [100000 x i32], ptr @qy, i64 0, i64 %idxprom49.2 store i32 %add16.2, ptr %arrayidx52.2, align 4, !tbaa !5 %inc53.2 = add nsw i32 %tail.promoted79.1, 1 store i32 %inc53.2, ptr @tail, align 4, !tbaa !5 %.pre92 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %.pre93 = load i32, ptr %arrayidx13, align 4, !tbaa !5 br label %if.end.2 if.end.2: ; preds = %if.then.2, %land.lhs.true29.2, %land.lhs.true23.2, %land.lhs.true.2, %if.end.1 %23 = phi i32 [ %.pre93, %if.then.2 ], [ %18, %land.lhs.true29.2 ], [ %18, %land.lhs.true23.2 ], [ %18, %land.lhs.true.2 ], [ %18, %if.end.1 ] %24 = phi i32 [ %.pre92, %if.then.2 ], [ %19, %land.lhs.true29.2 ], [ %19, %land.lhs.true23.2 ], [ %19, %land.lhs.true.2 ], [ %19, %if.end.1 ] %tail.promoted79.2 = phi i32 [ %inc53.2, %if.then.2 ], [ %tail.promoted79.1, %land.lhs.true29.2 ], [ %tail.promoted79.1, %land.lhs.true23.2 ], [ %tail.promoted79.1, %land.lhs.true.2 ], [ %tail.promoted79.1, %if.end.1 ] %add.3 = add nsw i32 %6, %24 %add16.3 = add nsw i32 %7, %23 %cmp17.3 = icmp sgt i32 %add.3, -1 br i1 %cmp17.3, label %land.lhs.true.3, label %if.end.3 land.lhs.true.3: ; preds = %if.end.2 %cmp18.3 = icmp sge i32 %add.3, %0 %cmp20.3 = icmp slt i32 %add16.3, 0 %or.cond.not72.3 = select i1 %cmp18.3, i1 true, i1 %cmp20.3 %cmp22.not.3 = icmp sgt i32 %add16.3, %1 %or.cond71.3 = select i1 %or.cond.not72.3, i1 true, i1 %cmp22.not.3 br i1 %or.cond71.3, label %if.end.3, label %land.lhs.true23.3 land.lhs.true23.3: ; preds = %land.lhs.true.3 %idxprom24.3 = zext i32 %add16.3 to i64 %idxprom26.3 = zext i32 %add.3 to i64 %arrayidx27.3 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom24.3, i64 %idxprom26.3 %25 = load i32, ptr %arrayidx27.3, align 4, !tbaa !5 %cmp28.3 = icmp eq i32 %25, -1 br i1 %cmp28.3, label %land.lhs.true29.3, label %if.end.3 land.lhs.true29.3: ; preds = %land.lhs.true23.3 %arrayidx33.3 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %idxprom24.3, i64 %idxprom26.3 %26 = load i8, ptr %arrayidx33.3, align 1, !tbaa !9 %cmp34.3 = icmp eq i8 %26, 46 br i1 %cmp34.3, label %if.then.3, label %if.end.3 if.then.3: ; preds = %land.lhs.true29.3 %idxprom38.3 = sext i32 %23 to i64 %idxprom42.3 = sext i32 %24 to i64 %arrayidx43.3 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %idxprom38.3, i64 %idxprom42.3 %27 = load i32, ptr %arrayidx43.3, align 4, !tbaa !5 %add44.3 = add nsw i32 %27, 1 store i32 %add44.3, ptr %arrayidx27.3, align 4, !tbaa !5 %idxprom49.3 = sext i32 %tail.promoted79.2 to i64 %arrayidx50.3 = getelementptr inbounds [100000 x i32], ptr @qx, i64 0, i64 %idxprom49.3 store i32 %add.3, ptr %arrayidx50.3, align 4, !tbaa !5 %arrayidx52.3 = getelementptr inbounds [100000 x i32], ptr @qy, i64 0, i64 %idxprom49.3 store i32 %add16.3, ptr %arrayidx52.3, align 4, !tbaa !5 %inc53.3 = add nsw i32 %tail.promoted79.2, 1 store i32 %inc53.3, ptr @tail, align 4, !tbaa !5 br label %if.end.3 if.end.3: ; preds = %if.then.3, %land.lhs.true29.3, %land.lhs.true23.3, %land.lhs.true.3, %if.end.2 %tail.promoted79.3 = phi i32 [ %inc53.3, %if.then.3 ], [ %tail.promoted79.2, %land.lhs.true29.3 ], [ %tail.promoted79.2, %land.lhs.true23.3 ], [ %tail.promoted79.2, %land.lhs.true.3 ], [ %tail.promoted79.2, %if.end.2 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %28 = zext i32 %tail.promoted79.3 to i64 %cmp.not = icmp eq i64 %indvars.iv.next, %28 br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !10 while.end: ; preds = %if.end.3 %29 = trunc i64 %indvars.iv.next to i32 store i32 %29, ptr @head, align 4, !tbaa !5 ret void } ; 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 @h, ptr noundef nonnull @w) %0 = load i32, ptr @h, align 4, !tbaa !5 %cmp99 = icmp sgt i32 %0, 0 br i1 %cmp99, label %for.body, label %for.cond.cleanup5 for.cond3.preheader: ; preds = %for.body %cmp4115 = icmp sgt i32 %3, 0 %1 = load i32, ptr @w, align 4 %2 = icmp sgt i32 %1, 0 %or.cond149 = select i1 %cmp4115, i1 %2, i1 false br i1 %or.cond149, label %for.cond7.preheader, label %for.cond.cleanup5 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr @h, 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.cond3.preheader, !llvm.loop !12 for.cond7.preheader: ; preds = %for.cond3.preheader, %for.cond.cleanup9 %5 = phi i32 [ %9, %for.cond.cleanup9 ], [ %3, %for.cond3.preheader ] %6 = phi i32 [ %10, %for.cond.cleanup9 ], [ %1, %for.cond3.preheader ] %7 = phi i32 [ %11, %for.cond.cleanup9 ], [ %1, %for.cond3.preheader ] %indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.cond.cleanup9 ], [ 0, %for.cond3.preheader ] %max.0116 = phi i32 [ %max.1.lcssa, %for.cond.cleanup9 ], [ 0, %for.cond3.preheader ] %cmp8112 = icmp sgt i32 %7, 0 br i1 %cmp8112, label %for.body10.lr.ph, label %for.cond.cleanup9 for.body10.lr.ph: ; preds = %for.cond7.preheader %8 = trunc i64 %indvars.iv141 to i32 br label %for.body10 for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader %max.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %max.1.lcssa, %for.cond.cleanup9 ] %call78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa) ret i32 0 for.cond.cleanup9: ; preds = %for.inc72, %for.cond7.preheader %9 = phi i32 [ %5, %for.cond7.preheader ], [ %40, %for.inc72 ] %10 = phi i32 [ %6, %for.cond7.preheader ], [ %41, %for.inc72 ] %11 = phi i32 [ %7, %for.cond7.preheader ], [ %41, %for.inc72 ] %max.1.lcssa = phi i32 [ %max.0116, %for.cond7.preheader ], [ %max.5, %for.inc72 ] %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1 %12 = sext i32 %9 to i64 %cmp4 = icmp slt i64 %indvars.iv.next142, %12 br i1 %cmp4, label %for.cond7.preheader, label %for.cond.cleanup5, !llvm.loop !13 for.body10: ; preds = %for.body10.lr.ph, %for.inc72 %13 = phi i32 [ %5, %for.body10.lr.ph ], [ %40, %for.inc72 ] %14 = phi i32 [ %6, %for.body10.lr.ph ], [ %41, %for.inc72 ] %15 = phi i32 [ %5, %for.body10.lr.ph ], [ %42, %for.inc72 ] %indvars.iv138 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next139, %for.inc72 ] %16 = phi i32 [ %7, %for.body10.lr.ph ], [ %41, %for.inc72 ] %max.1113 = phi i32 [ %max.0116, %for.body10.lr.ph ], [ %max.5, %for.inc72 ] %arrayidx14 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %indvars.iv141, i64 %indvars.iv138 %17 = load i8, ptr %arrayidx14, align 1, !tbaa !9 %cmp15 = icmp eq i8 %17, 35 br i1 %cmp15, label %for.inc72, label %for.cond17.preheader for.cond17.preheader: ; preds = %for.body10 %cmp18103 = icmp sgt i32 %15, 0 %cmp23101 = icmp sgt i32 %16, 0 %or.cond = and i1 %cmp18103, %cmp23101 br i1 %or.cond, label %for.cond22.preheader.us.preheader, label %for.cond.cleanup20 for.cond22.preheader.us.preheader: ; preds = %for.cond17.preheader %18 = zext i32 %16 to i64 %19 = shl nuw nsw i64 %18, 2 %wide.trip.count = zext i32 %15 to i64 %xtraiter = and i64 %wide.trip.count, 7 %20 = icmp ult i32 %15, 8 br i1 %20, label %for.cond.cleanup20.loopexit.unr-lcssa, label %for.cond22.preheader.us.preheader.new for.cond22.preheader.us.preheader.new: ; preds = %for.cond22.preheader.us.preheader %unroll_iter = and i64 %wide.trip.count, 4294967288 br label %for.cond22.preheader.us for.cond22.preheader.us: ; preds = %for.cond22.preheader.us, %for.cond22.preheader.us.preheader.new %indvar = phi i64 [ 0, %for.cond22.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond22.preheader.us ] %niter = phi i64 [ 0, %for.cond22.preheader.us.preheader.new ], [ %niter.next.7, %for.cond22.preheader.us ] %21 = mul nuw nsw i64 %indvar, 80 %scevgep = getelementptr i8, ptr @dist, i64 %21 tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 -1, i64 %19, i1 false), !tbaa !5 %22 = mul nuw i64 %indvar, 80 %23 = or i64 %22, 80 %scevgep.1 = getelementptr i8, ptr @dist, i64 %23 tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.1, i8 -1, i64 %19, i1 false), !tbaa !5 %24 = mul nuw i64 %indvar, 80 %gep = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 160), i64 %24 tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 -1, i64 %19, i1 false), !tbaa !5 %25 = mul nuw i64 %indvar, 80 %gep162 = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 240), i64 %25 tail call void @llvm.memset.p0.i64(ptr align 16 %gep162, i8 -1, i64 %19, i1 false), !tbaa !5 %26 = mul nuw i64 %indvar, 80 %gep163 = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 320), i64 %26 tail call void @llvm.memset.p0.i64(ptr align 16 %gep163, i8 -1, i64 %19, i1 false), !tbaa !5 %27 = mul nuw i64 %indvar, 80 %gep164 = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 400), i64 %27 tail call void @llvm.memset.p0.i64(ptr align 16 %gep164, i8 -1, i64 %19, i1 false), !tbaa !5 %28 = mul nuw i64 %indvar, 80 %gep165 = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 480), i64 %28 tail call void @llvm.memset.p0.i64(ptr align 16 %gep165, i8 -1, i64 %19, i1 false), !tbaa !5 %29 = mul nuw i64 %indvar, 80 %gep166 = getelementptr i8, ptr getelementptr (i8, ptr @dist, i64 560), i64 %29 tail call void @llvm.memset.p0.i64(ptr align 16 %gep166, i8 -1, i64 %19, i1 false), !tbaa !5 %indvar.next.7 = add nuw nsw i64 %indvar, 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.cond.cleanup20.loopexit.unr-lcssa, label %for.cond22.preheader.us, !llvm.loop !15 for.cond.cleanup20.loopexit.unr-lcssa: ; preds = %for.cond22.preheader.us, %for.cond22.preheader.us.preheader %indvar.unr = phi i64 [ 0, %for.cond22.preheader.us.preheader ], [ %indvar.next.7, %for.cond22.preheader.us ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup20, label %for.cond22.preheader.us.epil for.cond22.preheader.us.epil: ; preds = %for.cond.cleanup20.loopexit.unr-lcssa, %for.cond22.preheader.us.epil %indvar.epil = phi i64 [ %indvar.next.epil, %for.cond22.preheader.us.epil ], [ %indvar.unr, %for.cond.cleanup20.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.cond22.preheader.us.epil ], [ 0, %for.cond.cleanup20.loopexit.unr-lcssa ] %30 = mul nuw nsw i64 %indvar.epil, 80 %scevgep.epil = getelementptr i8, ptr @dist, i64 %30 tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 -1, i64 %19, i1 false), !tbaa !5 %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup20, label %for.cond22.preheader.us.epil, !llvm.loop !16 for.cond.cleanup20: ; preds = %for.cond.cleanup20.loopexit.unr-lcssa, %for.cond22.preheader.us.epil, %for.cond17.preheader %31 = trunc i64 %indvars.iv138 to i32 tail call void @bfs(i32 noundef %31, i32 noundef %8) %32 = load i32, ptr @h, align 4, !tbaa !5 %cmp39108 = icmp sgt i32 %32, 0 %.pre = load i32, ptr @w, align 4, !tbaa !5 %cmp45105 = icmp sgt i32 %.pre, 0 %or.cond147 = select i1 %cmp39108, i1 %cmp45105, i1 false br i1 %or.cond147, label %for.cond44.preheader.us.preheader, label %for.inc72 for.cond44.preheader.us.preheader: ; preds = %for.cond.cleanup20 %wide.trip.count136 = zext i32 %32 to i64 %wide.trip.count131 = zext i32 %.pre to i64 %xtraiter154 = and i64 %wide.trip.count131, 1 %33 = icmp eq i32 %.pre, 1 %unroll_iter158 = and i64 %wide.trip.count131, 4294967294 %lcmp.mod156.not = icmp eq i64 %xtraiter154, 0 br label %for.cond44.preheader.us for.cond44.preheader.us: ; preds = %for.cond44.preheader.us.preheader, %for.cond44.for.cond.cleanup47_crit_edge.us %indvars.iv133 = phi i64 [ 0, %for.cond44.preheader.us.preheader ], [ %indvars.iv.next134, %for.cond44.for.cond.cleanup47_crit_edge.us ] %max.2109.us = phi i32 [ %max.1113, %for.cond44.preheader.us.preheader ], [ %max.4.us.lcssa, %for.cond44.for.cond.cleanup47_crit_edge.us ] br i1 %33, label %for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa, label %for.body48.us for.body48.us: ; preds = %for.cond44.preheader.us, %for.inc66.us.1 %indvars.iv128 = phi i64 [ %indvars.iv.next129.1, %for.inc66.us.1 ], [ 0, %for.cond44.preheader.us ] %max.3106.us = phi i32 [ %max.4.us.1, %for.inc66.us.1 ], [ %max.2109.us, %for.cond44.preheader.us ] %niter159 = phi i64 [ %niter159.next.1, %for.inc66.us.1 ], [ 0, %for.cond44.preheader.us ] %arrayidx52.us = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %indvars.iv133, i64 %indvars.iv128 %34 = load i8, ptr %arrayidx52.us, align 1, !tbaa !9 %cmp54.us = icmp eq i8 %34, 35 br i1 %cmp54.us, label %for.inc66.us, label %if.end57.us if.end57.us: ; preds = %for.body48.us %arrayidx61.us = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %indvars.iv133, i64 %indvars.iv128 %35 = load i32, ptr %arrayidx61.us, align 8, !tbaa !5 %spec.select.us = tail call i32 @llvm.smax.i32(i32 %35, i32 %max.3106.us) br label %for.inc66.us for.inc66.us: ; preds = %if.end57.us, %for.body48.us %max.4.us = phi i32 [ %max.3106.us, %for.body48.us ], [ %spec.select.us, %if.end57.us ] %indvars.iv.next129 = or i64 %indvars.iv128, 1 %arrayidx52.us.1 = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %indvars.iv133, i64 %indvars.iv.next129 %36 = load i8, ptr %arrayidx52.us.1, align 1, !tbaa !9 %cmp54.us.1 = icmp eq i8 %36, 35 br i1 %cmp54.us.1, label %for.inc66.us.1, label %if.end57.us.1 if.end57.us.1: ; preds = %for.inc66.us %arrayidx61.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %indvars.iv133, i64 %indvars.iv.next129 %37 = load i32, ptr %arrayidx61.us.1, align 4, !tbaa !5 %spec.select.us.1 = tail call i32 @llvm.smax.i32(i32 %37, i32 %max.4.us) br label %for.inc66.us.1 for.inc66.us.1: ; preds = %if.end57.us.1, %for.inc66.us %max.4.us.1 = phi i32 [ %max.4.us, %for.inc66.us ], [ %spec.select.us.1, %if.end57.us.1 ] %indvars.iv.next129.1 = add nuw nsw i64 %indvars.iv128, 2 %niter159.next.1 = add i64 %niter159, 2 %niter159.ncmp.1 = icmp eq i64 %niter159.next.1, %unroll_iter158 br i1 %niter159.ncmp.1, label %for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa, label %for.body48.us, !llvm.loop !18 for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa: ; preds = %for.inc66.us.1, %for.cond44.preheader.us %max.4.us.lcssa.ph = phi i32 [ undef, %for.cond44.preheader.us ], [ %max.4.us.1, %for.inc66.us.1 ] %indvars.iv128.unr = phi i64 [ 0, %for.cond44.preheader.us ], [ %indvars.iv.next129.1, %for.inc66.us.1 ] %max.3106.us.unr = phi i32 [ %max.2109.us, %for.cond44.preheader.us ], [ %max.4.us.1, %for.inc66.us.1 ] br i1 %lcmp.mod156.not, label %for.cond44.for.cond.cleanup47_crit_edge.us, label %for.body48.us.epil for.body48.us.epil: ; preds = %for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa %arrayidx52.us.epil = getelementptr inbounds [21 x [21 x i8]], ptr @maze, i64 0, i64 %indvars.iv133, i64 %indvars.iv128.unr %38 = load i8, ptr %arrayidx52.us.epil, align 1, !tbaa !9 %cmp54.us.epil = icmp eq i8 %38, 35 br i1 %cmp54.us.epil, label %for.cond44.for.cond.cleanup47_crit_edge.us, label %if.end57.us.epil if.end57.us.epil: ; preds = %for.body48.us.epil %arrayidx61.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr @dist, i64 0, i64 %indvars.iv133, i64 %indvars.iv128.unr %39 = load i32, ptr %arrayidx61.us.epil, align 4, !tbaa !5 %spec.select.us.epil = tail call i32 @llvm.smax.i32(i32 %39, i32 %max.3106.us.unr) br label %for.cond44.for.cond.cleanup47_crit_edge.us for.cond44.for.cond.cleanup47_crit_edge.us: ; preds = %for.body48.us.epil, %if.end57.us.epil, %for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa %max.4.us.lcssa = phi i32 [ %max.4.us.lcssa.ph, %for.cond44.for.cond.cleanup47_crit_edge.us.unr-lcssa ], [ %max.3106.us.unr, %for.body48.us.epil ], [ %spec.select.us.epil, %if.end57.us.epil ] %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1 %exitcond137.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count136 br i1 %exitcond137.not, label %for.inc72, label %for.cond44.preheader.us, !llvm.loop !19 for.inc72: ; preds = %for.cond44.for.cond.cleanup47_crit_edge.us, %for.cond.cleanup20, %for.body10 %40 = phi i32 [ %13, %for.body10 ], [ %32, %for.cond.cleanup20 ], [ %32, %for.cond44.for.cond.cleanup47_crit_edge.us ] %41 = phi i32 [ %14, %for.body10 ], [ %.pre, %for.cond.cleanup20 ], [ %.pre, %for.cond44.for.cond.cleanup47_crit_edge.us ] %42 = phi i32 [ %15, %for.body10 ], [ %32, %for.cond.cleanup20 ], [ %32, %for.cond44.for.cond.cleanup47_crit_edge.us ] %max.5 = phi i32 [ %max.1113, %for.body10 ], [ %max.1113, %for.cond.cleanup20 ], [ %max.4.us.lcssa, %for.cond44.for.cond.cleanup47_crit_edge.us ] %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1 %43 = sext i32 %41 to i64 %cmp8 = icmp slt i64 %indvars.iv.next139, %43 br i1 %cmp8, label %for.body10, label %for.cond.cleanup9, !llvm.loop !20 } ; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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} !14 = !{!"llvm.loop.unswitch.partial.disable"} !15 = distinct !{!15, !11} !16 = distinct !{!16, !17} !17 = !{!"llvm.loop.unroll.disable"} !18 = distinct !{!18, !11} !19 = distinct !{!19, !11} !20 = distinct !{!20, !11}
#include <stdio.h> long long int gcd(long long int a, long long int b){ long long int r; while((r=a%b)!=0){ a=b; b=r; } return b; } int main(void){ long long int a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); long long int l=c*d/gcd(c, d); long long int ans=(b-b/c-b/d+b/l)-(a-1-(a-1)/c-(a-1)/d+(a-1)/l); printf("%lld\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280825/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280825/source.c" target datalayout = "e-m:e-p270: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 norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: br label %while.cond while.cond: ; preds = %while.cond, %entry %b.addr.0 = phi i64 [ %b, %entry ], [ %rem, %while.cond ] %a.addr.0 = phi i64 [ %a, %entry ], [ %b.addr.0, %while.cond ] %rem = srem i64 %a.addr.0, %b.addr.0 %cmp.not = icmp eq i64 %rem, 0 br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !5 while.end: ; preds = %while.cond ret i64 %b.addr.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 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 %c, align 8, !tbaa !7 %1 = load i64, ptr %d, align 8, !tbaa !7 br label %while.cond.i while.cond.i: ; preds = %while.cond.i, %entry %b.addr.0.i = phi i64 [ %1, %entry ], [ %rem.i, %while.cond.i ] %a.addr.0.i = phi i64 [ %0, %entry ], [ %b.addr.0.i, %while.cond.i ] %rem.i = srem i64 %a.addr.0.i, %b.addr.0.i %cmp.not.i = icmp eq i64 %rem.i, 0 br i1 %cmp.not.i, label %gcd.exit, label %while.cond.i, !llvm.loop !5 gcd.exit: ; preds = %while.cond.i %mul = mul nsw i64 %1, %0 %div = sdiv i64 %mul, %b.addr.0.i %2 = load i64, ptr %b, align 8, !tbaa !7 %div2 = sdiv i64 %2, %0 %div3 = sdiv i64 %2, %1 %div5 = sdiv i64 %2, %div %3 = load i64, ptr %a, align 8, !tbaa !7 %sub6 = add nsw i64 %3, -1 %div8 = sdiv i64 %sub6, %0 %div11 = sdiv i64 %sub6, %1 %div14 = sdiv i64 %sub6, %div %4 = add i64 %div2, %div3 %sub12.neg = sub i64 %2, %4 %add15.neg = add i64 %sub12.neg, %div5 %.neg19 = add i64 %add15.neg, %div8 %reass.sub = sub i64 %.neg19, %3 %.neg = add i64 %reass.sub, 1 %5 = add i64 %.neg, %div11 %sub16 = sub i64 %5, %div14 %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub16) 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> long gcd(long a,long b){ return b?gcd(b,a%b):a; } long lcm(long a,long b){ return a/gcd(a,b)*b; } int main(void){ long a,b,c,d,l,ans; scanf("%ld%ld%ld%ld",&a,&b,&c,&d); l = lcm(c,d); ans = (b-a+1) - ( b/c - (a-1)/c + b/d - (a-1)/d - b/l + (a-1)/l ); printf("%ld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280869/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280869/source.c" target datalayout = "e-m:e-p270: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"%ld%ld%ld%ld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %tobool.not4 = icmp eq i64 %b, 0 br i1 %tobool.not4, label %cond.end, label %cond.true cond.true: ; preds = %entry, %cond.true %b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ] %a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ] %rem = srem i64 %a.tr5, %b.tr6 %tobool.not = icmp eq i64 %rem, 0 br i1 %tobool.not, label %cond.end, label %cond.true cond.end: ; preds = %cond.true, %entry %a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ] ret i64 %a.tr.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %tobool.not4.i = icmp eq i64 %b, 0 br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i cond.true.i: ; preds = %entry, %cond.true.i %b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ] %a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ] %rem.i = srem i64 %a.tr5.i, %b.tr6.i %tobool.not.i = icmp eq i64 %rem.i, 0 br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i gcd.exit: ; preds = %cond.true.i, %entry %a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ] %div = sdiv i64 %a, %a.tr.lcssa.i %mul = mul nsw i64 %div, %b ret i64 %mul } ; 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) #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 %c, align 8, !tbaa !5 %1 = load i64, ptr %d, align 8, !tbaa !5 %tobool.not4.i.i = icmp eq i64 %1, 0 br i1 %tobool.not4.i.i, label %lcm.exit, label %cond.true.i.i cond.true.i.i: ; preds = %entry, %cond.true.i.i %b.tr6.i.i = phi i64 [ %rem.i.i, %cond.true.i.i ], [ %1, %entry ] %a.tr5.i.i = phi i64 [ %b.tr6.i.i, %cond.true.i.i ], [ %0, %entry ] %rem.i.i = srem i64 %a.tr5.i.i, %b.tr6.i.i %tobool.not.i.i = icmp eq i64 %rem.i.i, 0 br i1 %tobool.not.i.i, label %lcm.exit, label %cond.true.i.i lcm.exit: ; preds = %cond.true.i.i, %entry %a.tr.lcssa.i.i = phi i64 [ %0, %entry ], [ %b.tr6.i.i, %cond.true.i.i ] %div.i = sdiv i64 %0, %a.tr.lcssa.i.i %mul.i = mul nsw i64 %div.i, %1 %2 = load i64, ptr %b, align 8, !tbaa !5 %3 = load i64, ptr %a, align 8, !tbaa !5 %div = sdiv i64 %2, %0 %sub2 = add nsw i64 %3, -1 %div3 = sdiv i64 %sub2, %0 %div5 = sdiv i64 %2, %1 %div8 = sdiv i64 %sub2, %1 %div10 = sdiv i64 %2, %mul.i %div13 = sdiv i64 %sub2, %mul.i %.neg.neg = add i64 %2, 1 %4 = add i64 %3, %div %5 = add i64 %.neg.neg, %div3 %6 = add i64 %4, %div5 %add14.neg = sub i64 %5, %6 %.neg = add i64 %add14.neg, %div8 %7 = add i64 %.neg, %div10 %sub15 = sub i64 %7, %div13 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub15) 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) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 attributes #0 = { nofree 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> long long int gcd(long long int x,long long int y) { if(x<y)return gcd(y,x); else return ((x%y==0) ? y : gcd(y,x%y)); } int main() { long long int a,b,c,d,g,lcm; long long int n,m,o=0; //nは[a,b]区間中のcで割り切れる整数の個数 //mは[a,b]区間中のdで割り切れる整数の個数 scanf("%lld %lld %lld %lld",&a,&b,&c,&d); a--; g=gcd(c,d); n=(b/c)-(a/c); m=(b/d)-(a/d); lcm=c*d/g; o=(b/lcm)-(a/lcm); //printf("%lld,%lld,%lld,%lld\n",lcm,n,m,o); printf("%lld",((b-a)-n-m+o)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280911/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280911/source.c" target datalayout = "e-m:e-p270: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 norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ] %y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ] %cmp = icmp slt i64 %x.tr, %y.tr br i1 %cmp, label %tailrecurse.backedge, label %if.else tailrecurse.backedge: ; preds = %tailrecurse, %if.else %y.tr.be = phi i64 [ %x.tr, %tailrecurse ], [ %rem, %if.else ] br label %tailrecurse if.else: ; preds = %tailrecurse %rem = srem i64 %x.tr, %y.tr %cmp1 = icmp eq i64 %rem, 0 br i1 %cmp1, label %return, label %tailrecurse.backedge return: ; preds = %if.else ret i64 %y.tr } ; 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) #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 %dec = add nsw i64 %0, -1 store i64 %dec, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %2 = load i64, ptr %d, align 8, !tbaa !5 br label %tailrecurse.i tailrecurse.i: ; preds = %tailrecurse.i.backedge, %entry %x.tr.i = phi i64 [ %1, %entry ], [ %y.tr.i, %tailrecurse.i.backedge ] %y.tr.i = phi i64 [ %2, %entry ], [ %y.tr.i.be, %tailrecurse.i.backedge ] %cmp.i = icmp slt i64 %x.tr.i, %y.tr.i br i1 %cmp.i, label %tailrecurse.i.backedge, label %if.else.i if.else.i: ; preds = %tailrecurse.i %rem.i = srem i64 %x.tr.i, %y.tr.i %cmp1.i = icmp eq i64 %rem.i, 0 br i1 %cmp1.i, label %gcd.exit, label %tailrecurse.i.backedge tailrecurse.i.backedge: ; preds = %if.else.i, %tailrecurse.i %y.tr.i.be = phi i64 [ %rem.i, %if.else.i ], [ %x.tr.i, %tailrecurse.i ] br label %tailrecurse.i gcd.exit: ; preds = %if.else.i %3 = load i64, ptr %b, align 8, !tbaa !5 %div = sdiv i64 %3, %1 %div2 = sdiv i64 %dec, %1 %div3 = sdiv i64 %3, %2 %div4 = sdiv i64 %dec, %2 %mul = mul nsw i64 %2, %1 %div6 = sdiv i64 %mul, %y.tr.i %div7 = sdiv i64 %3, %div6 %div8 = sdiv i64 %dec, %div6 %4 = add i64 %3, 1 %5 = add i64 %0, %div %6 = add i64 %4, %div2 %7 = add i64 %5, %div3 %sub10 = sub i64 %6, %7 %sub11 = add i64 %sub10, %div4 %sub12 = add i64 %sub11, %div7 %add = sub i64 %sub12, %div8 %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add) 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) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 attributes #0 = { nofree 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdint.h> #include <inttypes.h> #include <stdlib.h> #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) #define ABS(a) ((a)>(0)?(a):-(a)) typedef unsigned long long int uint64; typedef long long int int64; void get_abcd (int64 *a, int64 *b,int64 *c,int64 *d) { int cnt; cnt = scanf("%lld %lld %lld %lld", a, b, c, d); return; } int64 gcd(int64 a,int64 b){int64 c;while(b!=0){c=a%b;a=b;b=c;}return a;} int64 lcm(int64 a,int64 b){int64 c=gcd(a,b);a/=c;return a*b;}; int main() { int64 A, B, C, D; int64 i; int64 num = 0; int64 min, max; int64 min_num = 0; int64 max_num = 0; int64 lcm_num = 0; int64 lcm_val; get_abcd(&A, &B, &C, &D); min = MIN(C, D); max = MAX(C, D); min_num = B/min - ((A-1)/min); max_num = B/max - ((A-1)/max); lcm_val = lcm(min, max); lcm_num = B/lcm_val - ((A-1)/lcm_val); num = (B - A + 1); num -= min_num; num -= max_num; num += lcm_num; printf("%lld", num); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280955/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280955/source.c" target datalayout = "e-m:e-p270: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 void @get_abcd(ptr noundef %a, ptr noundef %b, ptr noundef %c, ptr noundef %d) local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %a, ptr noundef %b, ptr noundef %c, ptr noundef %d) 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 norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 { entry: %cmp.not4 = icmp eq i64 %b, 0 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ] %b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ] %rem = srem i64 %a.addr.06, %b.addr.05 %cmp.not = icmp eq i64 %rem, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %entry %a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ] ret i64 %a.addr.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 { entry: %cmp.not4.i = icmp eq i64 %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 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 %gcd.exit, label %while.body.i, !llvm.loop !5 gcd.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 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) #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.i = 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 %C, align 8 %1 = load i64, ptr %D, align 8 %cond = call i64 @llvm.smin.i64(i64 %0, i64 %1) %cond5 = call i64 @llvm.smax.i64(i64 %0, i64 %1) %2 = load i64, ptr %B, align 8, !tbaa !7 %3 = load i64, ptr %A, align 8, !tbaa !7 %cmp.not4.i.i = icmp eq i64 %cond5, 0 br i1 %cmp.not4.i.i, label %lcm.exit, label %while.body.i.i while.body.i.i: ; preds = %entry, %while.body.i.i %a.addr.06.i.i = phi i64 [ %b.addr.05.i.i, %while.body.i.i ], [ %cond, %entry ] %b.addr.05.i.i = phi i64 [ %rem.i.i, %while.body.i.i ], [ %cond5, %entry ] %rem.i.i = srem i64 %a.addr.06.i.i, %b.addr.05.i.i %cmp.not.i.i = icmp eq i64 %rem.i.i, 0 br i1 %cmp.not.i.i, label %lcm.exit, label %while.body.i.i, !llvm.loop !5 lcm.exit: ; preds = %while.body.i.i, %entry %a.addr.0.lcssa.i.i = phi i64 [ %cond, %entry ], [ %b.addr.05.i.i, %while.body.i.i ] %sub = add nsw i64 %3, -1 %div10 = sdiv i64 %sub, %cond5 %div8 = sdiv i64 %2, %cond5 %div6 = sdiv i64 %sub, %cond %div = sdiv i64 %2, %cond %div.i = sdiv i64 %cond, %a.addr.0.lcssa.i.i %mul.i = mul nsw i64 %div.i, %cond5 %div12 = sdiv i64 %2, %mul.i %div14 = sdiv i64 %sub, %mul.i %sub15 = add i64 %2, 1 %4 = add i64 %sub15, %div10 %5 = add i64 %3, %div8 %6 = add i64 %4, %div6 %7 = add i64 %5, %div %8 = add i64 %6, %div12 %9 = add i64 %7, %div14 %add19 = sub i64 %8, %9 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add19) 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.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 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 = { 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #define MOD 1000000007 #define MAX(a,b) (a>b?a:b) #define MAX3(a,b,c) MAX(a,MAX(b,c)) #define MIN(a,b) (a<b?a:b) #define MIN3(a,b,c) MIN(a, MIN(b,c)) typedef long long lli; lli GCD(lli a, lli b) { while(a%b) { lli temp = b; b = a; a = temp%b; } return b; } lli LCM(lli a, lli b) { return a*b/GCD(a,b); } int main() { lli i, a, b, c, d; scanf("%lld%lld%lld%lld",&a,&b,&c,&d); a -= 1; lli ans = b-a; ans -= b/c; ans -= b/d; ans += b/LCM(c,d); ans += a/c; ans += a/d; ans -= a/LCM(c,d); printf("%lld\n",ans); // printf("GCD=%lld",LCM(4,8)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280999/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280999/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @GCD(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %rem6 = srem i64 %a, %b %tobool.not7 = icmp eq i64 %rem6, 0 br i1 %tobool.not7, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.09 = phi i64 [ %rem1, %while.body ], [ %a, %entry ] %b.addr.08 = phi i64 [ %a.addr.09, %while.body ], [ %b, %entry ] %rem1 = srem i64 %b.addr.08, %a.addr.09 %tobool.not = icmp eq i64 %rem1, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %entry %b.addr.0.lcssa = phi i64 [ %b, %entry ], [ %a.addr.09, %while.body ] ret i64 %b.addr.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @LCM(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %rem6.i = srem i64 %a, %b %tobool.not7.i = icmp eq i64 %rem6.i, 0 br i1 %tobool.not7.i, label %GCD.exit, label %while.body.i while.body.i: ; preds = %entry, %while.body.i %a.addr.09.i = phi i64 [ %rem1.i, %while.body.i ], [ %a, %entry ] %b.addr.08.i = phi i64 [ %a.addr.09.i, %while.body.i ], [ %b, %entry ] %rem1.i = srem i64 %b.addr.08.i, %a.addr.09.i %tobool.not.i = icmp eq i64 %rem1.i, 0 br i1 %tobool.not.i, label %GCD.exit, label %while.body.i, !llvm.loop !5 GCD.exit: ; preds = %while.body.i, %entry %b.addr.0.lcssa.i = phi i64 [ %b, %entry ], [ %a.addr.09.i, %while.body.i ] %mul = mul nsw i64 %b, %a %div = sdiv i64 %mul, %b.addr.0.lcssa.i ret i64 %div } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %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 !7 %sub = add nsw i64 %0, -1 store i64 %sub, ptr %a, align 8, !tbaa !7 %1 = load i64, ptr %b, align 8, !tbaa !7 %2 = load i64, ptr %c, align 8, !tbaa !7 %3 = load i64, ptr %d, align 8, !tbaa !7 %rem6.i.i = srem i64 %2, %3 %tobool.not7.i.i = icmp eq i64 %rem6.i.i, 0 br i1 %tobool.not7.i.i, label %LCM.exit31, label %while.body.i.i while.body.i.i: ; preds = %entry, %while.body.i.i %a.addr.09.i.i = phi i64 [ %rem1.i.i, %while.body.i.i ], [ %2, %entry ] %b.addr.08.i.i = phi i64 [ %a.addr.09.i.i, %while.body.i.i ], [ %3, %entry ] %rem1.i.i = srem i64 %b.addr.08.i.i, %a.addr.09.i.i %tobool.not.i.i = icmp eq i64 %rem1.i.i, 0 br i1 %tobool.not.i.i, label %LCM.exit, label %while.body.i.i, !llvm.loop !5 LCM.exit: ; preds = %while.body.i.i br i1 %tobool.not7.i.i, label %LCM.exit31, label %while.body.i.i23 while.body.i.i23: ; preds = %LCM.exit, %while.body.i.i23 %a.addr.09.i.i24 = phi i64 [ %rem1.i.i26, %while.body.i.i23 ], [ %2, %LCM.exit ] %b.addr.08.i.i25 = phi i64 [ %a.addr.09.i.i24, %while.body.i.i23 ], [ %3, %LCM.exit ] %rem1.i.i26 = srem i64 %b.addr.08.i.i25, %a.addr.09.i.i24 %tobool.not.i.i27 = icmp eq i64 %rem1.i.i26, 0 br i1 %tobool.not.i.i27, label %LCM.exit31, label %while.body.i.i23, !llvm.loop !5 LCM.exit31: ; preds = %while.body.i.i23, %entry, %LCM.exit %b.addr.0.lcssa.i.i34 = phi i64 [ %a.addr.09.i.i, %LCM.exit ], [ %3, %entry ], [ %a.addr.09.i.i, %while.body.i.i23 ] %b.addr.0.lcssa.i.i28 = phi i64 [ %3, %LCM.exit ], [ %3, %entry ], [ %a.addr.09.i.i24, %while.body.i.i23 ] %div = sdiv i64 %1, %2 %div3 = sdiv i64 %1, %3 %mul.i = mul nsw i64 %3, %2 %div.i = sdiv i64 %mul.i, %b.addr.0.lcssa.i.i34 %div6 = sdiv i64 %1, %div.i %div7 = sdiv i64 %sub, %2 %div9 = sdiv i64 %sub, %3 %div.i30 = sdiv i64 %mul.i, %b.addr.0.lcssa.i.i28 %div12 = sdiv i64 %sub, %div.i30 %4 = add i64 %1, 1 %5 = add i64 %0, %div %6 = add i64 %5, %div3 %sub4 = sub i64 %4, %6 %add = add nsw i64 %sub4, %div6 %add8 = add nsw i64 %add, %div7 %add10 = add nsw i64 %add8, %div9 %sub13 = sub i64 %add10, %div12 %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub13) 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<stdbool.h> #include<math.h> #include<limits.h> #define MAX 30 int N,M; int graph[MAX][MAX]; void solve(int *ans,int *stamp,int k){ int f = 1; stamp[k] = 1; for(int i=1;i<=N;i++){ if(stamp[i] == 0){ f = 0; break; } } if(f){ (*ans)++; return; } for(int i=1;i<=N;i++){ if(stamp[i] == 0 && (graph[k][i] || graph[i][k])){ solve(ans,stamp,i); stamp[i] = 0; } } } int main(){ int a[MAX],b[MAX]; int stamp[MAX]={0}; memset(graph,0,sizeof(graph)); scanf("%d %d",&N,&M); for(int i=1;i<=M;i++){ scanf("%d %d",a+i,b+i); graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1; } int ans = 0; solve(&ans,stamp,1); printf("%d",ans); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281048/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281048/source.c" target datalayout = "e-m:e-p270: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 @graph = dso_local local_unnamed_addr global [30 x [30 x i32]] zeroinitializer, align 16 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @M = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable define dso_local void @solve(ptr nocapture noundef %ans, ptr nocapture noundef %stamp, i32 noundef %k) local_unnamed_addr #0 { entry: %idxprom = sext i32 %k to i64 %arrayidx = getelementptr inbounds i32, ptr %stamp, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 %0 = load i32, ptr @N, align 4, !tbaa !5 %cmp.not.not49 = icmp slt i32 %0, 1 br i1 %cmp.not.not49, label %if.then4, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 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 %if.then4, label %for.body, !llvm.loop !9 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx2 = getelementptr inbounds i32, ptr %stamp, i64 %indvars.iv %2 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp3 = icmp eq i32 %2, 0 br i1 %cmp3, label %for.body11, label %for.cond if.then4: ; preds = %for.cond, %entry %3 = load i32, ptr %ans, align 4, !tbaa !5 %inc5 = add nsw i32 %3, 1 store i32 %inc5, ptr %ans, align 4, !tbaa !5 br label %cleanup33 for.body11: ; preds = %for.body, %for.inc29 %4 = phi i32 [ %9, %for.inc29 ], [ %0, %for.body ] %indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.inc29 ], [ 1, %for.body ] %arrayidx13 = getelementptr inbounds i32, ptr %stamp, i64 %indvars.iv54 %5 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp eq i32 %5, 0 br i1 %cmp14, label %land.lhs.true, label %for.inc29 land.lhs.true: ; preds = %for.body11 %arrayidx18 = getelementptr inbounds [30 x [30 x i32]], ptr @graph, i64 0, i64 %idxprom, i64 %indvars.iv54 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %tobool19.not = icmp eq i32 %6, 0 br i1 %tobool19.not, label %lor.lhs.false, label %if.then25 lor.lhs.false: ; preds = %land.lhs.true %arrayidx23 = getelementptr inbounds [30 x [30 x i32]], ptr @graph, i64 0, i64 %indvars.iv54, i64 %idxprom %7 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %tobool24.not = icmp eq i32 %7, 0 br i1 %tobool24.not, label %for.inc29, label %if.then25 if.then25: ; preds = %lor.lhs.false, %land.lhs.true %8 = trunc i64 %indvars.iv54 to i32 tail call void @solve(ptr noundef %ans, ptr noundef nonnull %stamp, i32 noundef %8) store i32 0, ptr %arrayidx13, align 4, !tbaa !5 %.pre = load i32, ptr @N, align 4, !tbaa !5 br label %for.inc29 for.inc29: ; preds = %for.body11, %lor.lhs.false, %if.then25 %9 = phi i32 [ %4, %for.body11 ], [ %4, %lor.lhs.false ], [ %.pre, %if.then25 ] %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1 %10 = sext i32 %9 to i64 %cmp9.not.not = icmp slt i64 %indvars.iv54, %10 br i1 %cmp9.not.not, label %for.body11, label %cleanup33, !llvm.loop !11 cleanup33: ; preds = %for.inc29, %if.then4 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %a = alloca [30 x i32], align 16 %b = alloca [30 x i32], align 16 %stamp = alloca [30 x i32], align 16 %ans = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %stamp) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %stamp, i8 0, i64 120, i1 false) tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3600) @graph, i8 0, i64 3600, i1 false) %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M) %0 = load i32, ptr @M, align 4, !tbaa !5 %cmp.not28 = icmp slt i32 %0, 1 br i1 %cmp.not28, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.body, %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ans) #5 store i32 0, ptr %ans, align 4, !tbaa !5 call void @solve(ptr noundef nonnull %ans, ptr noundef nonnull %stamp, i32 noundef 1) %1 = load i32, ptr %ans, align 4, !tbaa !5 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ans) #5 call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %stamp) #5 call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %a) #5 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 %a, i64 %indvars.iv %add.ptr3 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3) %2 = load i32, ptr %add.ptr3, align 4, !tbaa !5 %idxprom5 = sext i32 %2 to i64 %3 = load i32, ptr %add.ptr, align 4, !tbaa !5 %idxprom9 = sext i32 %3 to i64 %arrayidx10 = getelementptr inbounds [30 x [30 x i32]], ptr @graph, i64 0, i64 %idxprom5, i64 %idxprom9 store i32 1, ptr %arrayidx10, align 4, !tbaa !5 %arrayidx18 = getelementptr inbounds [30 x [30 x i32]], ptr @graph, i64 0, i64 %idxprom9, i64 %idxprom5 store i32 1, ptr %arrayidx18, align 4, !tbaa !5 %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.not.not = icmp slt i64 %indvars.iv, %5 br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !12 } ; 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 attributes #0 = { nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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 g[9][9]={}; int visit[9]={},n; int dfs(int p){ visit[p]=1; int flag=1,cnt=0; for(int i=1;i<=n;i++) flag*=visit[i]; if(flag){ visit[p]=0; return 1; } for(int i=2;i<=n;i++) if(g[p][i]==1&&visit[i]==0) cnt+=dfs(i); visit[p]=0; return cnt; } int main(){ int m,a,b; scanf("%d %d",&n,&m); for(int i=0;i<m;i++){ scanf("%d %d",&a,&b); g[a][b]=g[b][a]=1; } printf("%d\n",dfs(1)); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281091/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281091/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @g = dso_local local_unnamed_addr global [9 x [9 x i32]] zeroinitializer, align 16 @visit = dso_local local_unnamed_addr global [9 x i32] zeroinitializer, align 16 @n = dso_local global i32 0, align 4 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @dfs(i32 noundef %p) local_unnamed_addr #0 { entry: %idxprom = sext i32 %p to i64 %arrayidx = getelementptr inbounds [9 x i32], ptr @visit, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not37 = icmp slt i32 %0, 1 br i1 %cmp.not37, label %cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader51, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %2, -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> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %5, %vector.body ] %vec.phi49 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %6, %vector.body ] %offset.idx = or i64 %index, 1 %3 = getelementptr inbounds [9 x i32], ptr @visit, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 %wide.load50 = load <4 x i32>, ptr %4, align 4, !tbaa !5 %5 = mul <4 x i32> %wide.load, %vec.phi %6 = mul <4 x i32> %wide.load50, %vec.phi49 %index.next = add nuw i64 %index, 8 %7 = icmp eq i64 %index.next, %n.vec br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %6, %5 %8 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %2, %n.vec br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader51 for.body.preheader51: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] %flag.038.ph = phi i32 [ 1, %for.body.preheader ], [ %8, %middle.block ] br label %for.body for.cond.cleanup: ; preds = %for.body, %middle.block %mul.lcssa = phi i32 [ %8, %middle.block ], [ %mul, %for.body ] %9 = icmp eq i32 %mul.lcssa, 0 br i1 %9, label %for.cond6.preheader, label %cleanup for.cond6.preheader: ; preds = %for.cond.cleanup %cmp7.not40 = icmp slt i32 %0, 2 br i1 %cmp7.not40, label %cleanup, label %for.body9 for.body: ; preds = %for.body.preheader51, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader51 ] %flag.038 = phi i32 [ %mul, %for.body ], [ %flag.038.ph, %for.body.preheader51 ] %arrayidx2 = getelementptr inbounds [9 x i32], ptr @visit, i64 0, i64 %indvars.iv %10 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %mul = mul nsw i32 %10, %flag.038 %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.cond.cleanup, label %for.body, !llvm.loop !13 for.body9: ; preds = %for.cond6.preheader, %for.inc20 %11 = phi i32 [ %15, %for.inc20 ], [ %0, %for.cond6.preheader ] %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc20 ], [ 2, %for.cond6.preheader ] %cnt.041 = phi i32 [ %cnt.1, %for.inc20 ], [ 0, %for.cond6.preheader ] %arrayidx13 = getelementptr inbounds [9 x [9 x i32]], ptr @g, i64 0, i64 %idxprom, i64 %indvars.iv45 %12 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp eq i32 %12, 1 br i1 %cmp14, label %land.lhs.true, label %for.inc20 land.lhs.true: ; preds = %for.body9 %arrayidx16 = getelementptr inbounds [9 x i32], ptr @visit, i64 0, i64 %indvars.iv45 %13 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp17 = icmp eq i32 %13, 0 br i1 %cmp17, label %if.then18, label %for.inc20 if.then18: ; preds = %land.lhs.true %14 = trunc i64 %indvars.iv45 to i32 %call = tail call i32 @dfs(i32 noundef %14) %add = add nsw i32 %call, %cnt.041 %.pre = load i32, ptr @n, align 4, !tbaa !5 br label %for.inc20 for.inc20: ; preds = %for.body9, %land.lhs.true, %if.then18 %15 = phi i32 [ %.pre, %if.then18 ], [ %11, %land.lhs.true ], [ %11, %for.body9 ] %cnt.1 = phi i32 [ %add, %if.then18 ], [ %cnt.041, %land.lhs.true ], [ %cnt.041, %for.body9 ] %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %16 = sext i32 %15 to i64 %cmp7.not.not = icmp slt i64 %indvars.iv45, %16 br i1 %cmp7.not.not, label %for.body9, label %cleanup, !llvm.loop !14 cleanup: ; preds = %for.inc20, %entry, %for.cond6.preheader, %for.cond.cleanup %retval.0 = phi i32 [ 1, %for.cond.cleanup ], [ 0, %for.cond6.preheader ], [ 1, %entry ], [ %cnt.1, %for.inc20 ] store i32 0, ptr %arrayidx, align 4, !tbaa !5 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: %m = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %m) %0 = load i32, ptr %m, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %0, 0 br i1 %cmp11, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %call8 = call i32 @dfs(i32 noundef 1) %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call8) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 ret i32 0 for.body: ; preds = %entry, %for.body %i.012 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %1 = load i32, ptr %b, align 4, !tbaa !5 %idxprom = sext i32 %1 to i64 %2 = load i32, ptr %a, align 4, !tbaa !5 %idxprom2 = sext i32 %2 to i64 %arrayidx3 = getelementptr inbounds [9 x [9 x i32]], ptr @g, i64 0, i64 %idxprom, i64 %idxprom2 store i32 1, ptr %arrayidx3, align 4, !tbaa !5 %arrayidx7 = getelementptr inbounds [9 x [9 x i32]], ptr @g, i64 0, i64 %idxprom2, i64 %idxprom store i32 1, ptr %arrayidx7, align 4, !tbaa !5 %inc = add nuw nsw i32 %i.012, 1 %3 = load i32, ptr %m, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #4 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10}
#include<stdio.h> int N,M; int edge[28][2]; void solve(void); int search(int node,int *state); int main(void){ int i; scanf("%d%d",&N,&M); for(i=0;i<M;i++){ scanf("%d%d",&edge[i][0],&edge[i][1]); } solve(); return 0; } void solve(void){ int array[8]={0}; printf("%d\n",search(1,array)); } int search(int node,int *state){ int i,j,k; int ret=0; //printf("start node=%d\n",node); if(state[node-1]!=0) return 0; state[node-1]=1; for(i=k=0;i<N;i++) k+=state[i]; if(k==N){ state[node-1]=0; return 1; } for(i=0;i<M;i++){ if(edge[i][0]!=node && edge[i][1]!=node) continue; k=edge[i][0]+edge[i][1]-node; //printf("\t in %d\n",k); ret+=search(k,state); } state[node-1]=0; return ret; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281134/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281134/source.c" target datalayout = "e-m:e-p270: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 @N = dso_local global i32 0, align 4 @M = dso_local global i32 0, align 4 @edge = dso_local global [28 x [2 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: %array.i = alloca [8 x i32], align 16 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M) %0 = load i32, ptr @M, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %0, 0 br i1 %cmp9, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [28 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv %arrayidx4 = getelementptr inbounds [28 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv, i64 1 %call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @M, 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 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %array.i) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %array.i, i8 0, i64 32, i1 false) %call.i = call i32 @search(i32 noundef 1, ptr noundef nonnull %array.i) %call1.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call.i) call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %array.i) #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 uwtable define dso_local void @solve() local_unnamed_addr #0 { entry: %array = alloca [8 x i32], align 16 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %array) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %array, i8 0, i64 32, i1 false) %call = call i32 @search(i32 noundef 1, ptr noundef nonnull %array) %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call) call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %array) #6 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 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: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable define dso_local i32 @search(i32 noundef %node, ptr nocapture noundef %state) local_unnamed_addr #4 { entry: %sub = add nsw i32 %node, -1 %idxprom = sext i32 %sub to i64 %arrayidx = getelementptr inbounds i32, ptr %state, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp.not = icmp eq i32 %0, 0 br i1 %cmp.not, label %if.end, label %cleanup if.end: ; preds = %entry store i32 1, ptr %arrayidx, align 4, !tbaa !5 %1 = load i32, ptr @N, align 4, !tbaa !5 %cmp466 = icmp sgt i32 %1, 0 br i1 %cmp466, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %if.end %wide.trip.count = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 8 br i1 %min.iters.check, label %for.body.preheader81, 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.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ] %vec.phi79 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %2 = getelementptr inbounds i32, ptr %state, i64 %index %wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 %wide.load80 = load <4 x i32>, ptr %3, align 4, !tbaa !5 %4 = add <4 x i32> %wide.load, %vec.phi %5 = add <4 x i32> %wide.load80, %vec.phi79 %index.next = add nuw i64 %index, 8 %6 = icmp eq i64 %index.next, %n.vec br i1 %6, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %5, %4 %7 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %for.body.preheader81 for.body.preheader81: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] %k.068.ph = phi i32 [ 0, %for.body.preheader ], [ %7, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader81, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader81 ] %k.068 = phi i32 [ %add, %for.body ], [ %k.068.ph, %for.body.preheader81 ] %arrayidx6 = getelementptr inbounds i32, ptr %state, i64 %indvars.iv %8 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %add = add nsw i32 %8, %k.068 %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 !14 for.end: ; preds = %for.body, %middle.block, %if.end %k.0.lcssa = phi i32 [ 0, %if.end ], [ %7, %middle.block ], [ %add, %for.body ] %cmp7 = icmp eq i32 %k.0.lcssa, %1 br i1 %cmp7, label %cleanup.sink.split, label %for.cond13.preheader for.cond13.preheader: ; preds = %for.end %9 = load i32, ptr @M, align 4, !tbaa !5 %cmp1470 = icmp sgt i32 %9, 0 br i1 %cmp1470, label %for.body15, label %cleanup.sink.split for.body15: ; preds = %for.cond13.preheader, %for.inc35 %10 = phi i32 [ %13, %for.inc35 ], [ %9, %for.cond13.preheader ] %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc35 ], [ 0, %for.cond13.preheader ] %ret.072 = phi i32 [ %ret.1, %for.inc35 ], [ 0, %for.cond13.preheader ] %arrayidx17 = getelementptr inbounds [28 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv75 %11 = load i32, ptr %arrayidx17, align 8, !tbaa !5 %cmp19.not = icmp eq i32 %11, %node %arrayidx31.phi.trans.insert = getelementptr inbounds [28 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv75, i64 1 %.pre = load i32, ptr %arrayidx31.phi.trans.insert, align 4, !tbaa !5 br i1 %cmp19.not, label %if.end25, label %land.lhs.true land.lhs.true: ; preds = %for.body15 %cmp23.not = icmp eq i32 %.pre, %node br i1 %cmp23.not, label %if.end25, label %for.inc35 if.end25: ; preds = %for.body15, %land.lhs.true %12 = phi i32 [ %node, %land.lhs.true ], [ %.pre, %for.body15 ] %add32 = sub i32 %11, %node %sub33 = add i32 %add32, %12 %call = tail call i32 @search(i32 noundef %sub33, ptr noundef %state) %add34 = add nsw i32 %call, %ret.072 %.pre78 = load i32, ptr @M, align 4, !tbaa !5 br label %for.inc35 for.inc35: ; preds = %land.lhs.true, %if.end25 %13 = phi i32 [ %10, %land.lhs.true ], [ %.pre78, %if.end25 ] %ret.1 = phi i32 [ %ret.072, %land.lhs.true ], [ %add34, %if.end25 ] %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %14 = sext i32 %13 to i64 %cmp14 = icmp slt i64 %indvars.iv.next76, %14 br i1 %cmp14, label %for.body15, label %cleanup.sink.split, !llvm.loop !15 cleanup.sink.split: ; preds = %for.inc35, %for.cond13.preheader, %for.end %retval.0.ph = phi i32 [ 1, %for.end ], [ 0, %for.cond13.preheader ], [ %ret.1, %for.inc35 ] store i32 0, ptr %arrayidx, align 4, !tbaa !5 br label %cleanup cleanup: ; preds = %cleanup.sink.split, %entry %retval.0 = phi i32 [ 0, %entry ], [ %retval.0.ph, %cleanup.sink.split ] ret i32 %retval.0 } ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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, !13, !12} !15 = distinct !{!15, !10}
#include<stdio.h> #include<math.h> int larger(int a,int b){ return (a<=b)? b:a;} int main(){ int n; scanf("%d",&n); int a[n],x[n][n-1],y[n][n-1]; int l,m; for(l=0;l<n;l++){ scanf("%d ",&a[l]); for(m=0;m<a[l];m++){ scanf("%d%d ",&x[l][m],&y[l][m]); }} int b,sb,sc,cnt=0,ans=0,ok=1; for(b=0;b<(1<<n);b++){ //正直者の数を仮定 cnt=0;ok=1; for(sb=0;sb<n&ok;sb++){ if(b&(1<<sb)){//正直者とされたsb人目の証言について吟味 //printf("b=%d a[sb]=%d\n",b,a[sb]); cnt++; for(sc=0;sc<a[sb];sc++){//sc個目の証言について吟味 //printf("b=%d sb=%d sc=%d cnt=%d\n",b,sb,sc,cnt); //printf("x[sb][sc]=%d y[sb][sc]=%d\n",x[sb][sc],y[sb][sc]); if((b&(1<<(x[sb][sc]-1)))!=(y[sb][sc]<<(x[sb][sc]-1))){ ok=0;/*puts("NG");*/break;} }}} if(ok==1){ //printf("b=%d cnt=%d\n",b,cnt); ans=larger(ans,cnt);} } printf("%d\n",ans); return 0;}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281192/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281192/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%d%d \00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @larger(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = zext i32 %3 to i64 %sub = add nsw i32 %3, -1 %5 = zext i32 %sub to i64 %6 = mul nuw i64 %5, %4 %vla1 = alloca i32, i64 %6, align 16 %vla3 = alloca i32, i64 %6, align 16 %cmp101 = icmp sgt i32 %3, 0 br i1 %cmp101, label %for.body, label %for.end72 for.cond22.preheader: ; preds = %for.inc19 %cmp23113.not = icmp eq i32 %12, 31 %cmp26107 = icmp slt i32 %12, 1 %or.cond = or i1 %cmp23113.not, %cmp26107 br i1 %or.cond, label %for.end72, label %for.cond25.preheader.preheader for.cond25.preheader.preheader: ; preds = %for.cond22.preheader %shl = shl nuw i32 1, %12 %7 = zext i32 %12 to i64 %smax = call i32 @llvm.smax.i32(i32 %shl, i32 1) br label %for.cond25.preheader for.body: ; preds = %entry, %for.inc19 %indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.inc19 ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv120 %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %8 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp899 = icmp sgt i32 %8, 0 br i1 %cmp899, label %for.body9.lr.ph, label %for.inc19 for.body9.lr.ph: ; preds = %for.body %9 = mul nuw nsw i64 %indvars.iv120, %5 %arrayidx11 = getelementptr inbounds i32, ptr %vla1, i64 %9 %arrayidx15 = getelementptr inbounds i32, ptr %vla3, i64 %9 br label %for.body9 for.body9: ; preds = %for.body9.lr.ph, %for.body9 %indvars.iv = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next, %for.body9 ] %arrayidx13 = getelementptr inbounds i32, ptr %arrayidx11, i64 %indvars.iv %arrayidx17 = getelementptr inbounds i32, ptr %arrayidx15, i64 %indvars.iv %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx13, ptr noundef nonnull %arrayidx17) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %10 = load i32, ptr %arrayidx, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp8 = icmp slt i64 %indvars.iv.next, %11 br i1 %cmp8, label %for.body9, label %for.inc19, !llvm.loop !9 for.inc19: ; preds = %for.body9, %for.body %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %12 = load i32, ptr %n, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp = icmp slt i64 %indvars.iv.next121, %13 br i1 %cmp, label %for.body, label %for.cond22.preheader, !llvm.loop !11 for.cond25.preheader: ; preds = %for.cond25.preheader.preheader, %for.cond25.for.end64_crit_edge.thread %ans.0115 = phi i32 [ %19, %for.cond25.for.end64_crit_edge.thread ], [ 0, %for.cond25.preheader.preheader ] %b.0114 = phi i32 [ %inc71, %for.cond25.for.end64_crit_edge.thread ], [ 0, %for.cond25.preheader.preheader ] br label %for.body27 for.body27: ; preds = %for.cond25.preheader, %for.inc62 %indvars.iv126 = phi i64 [ 0, %for.cond25.preheader ], [ %indvars.iv.next127, %for.inc62 ] %cnt.0109 = phi i32 [ 0, %for.cond25.preheader ], [ %cnt.1, %for.inc62 ] %14 = trunc i64 %indvars.iv126 to i32 %shl28 = shl nuw i32 1, %14 %and29 = and i32 %shl28, %b.0114 %tobool30.not = icmp eq i32 %and29, 0 br i1 %tobool30.not, label %for.inc62, label %if.then if.then: ; preds = %for.body27 %inc31 = add nsw i32 %cnt.0109, 1 %15 = mul nuw nsw i64 %indvars.iv126, %5 %arrayidx39 = getelementptr inbounds i32, ptr %vla1, i64 %15 %arrayidx34 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv126 %16 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %cmp35103 = icmp sgt i32 %16, 0 br i1 %cmp35103, label %for.body37.lr.ph, label %for.inc62 for.body37.lr.ph: ; preds = %if.then %arrayidx46 = getelementptr inbounds i32, ptr %vla3, i64 %15 %wide.trip.count = zext i32 %16 to i64 br label %for.body37 for.cond32: ; preds = %for.body37 %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1 %exitcond.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count br i1 %exitcond.not, label %for.inc62, label %for.body37, !llvm.loop !12 for.body37: ; preds = %for.body37.lr.ph, %for.cond32 %indvars.iv123 = phi i64 [ 0, %for.body37.lr.ph ], [ %indvars.iv.next124, %for.cond32 ] %arrayidx41 = getelementptr inbounds i32, ptr %arrayidx39, i64 %indvars.iv123 %17 = load i32, ptr %arrayidx41, align 4, !tbaa !5 %sub42 = add nsw i32 %17, -1 %shl43 = shl nuw i32 1, %sub42 %and44 = and i32 %shl43, %b.0114 %arrayidx48 = getelementptr inbounds i32, ptr %arrayidx46, i64 %indvars.iv123 %18 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %shl54 = shl i32 %18, %sub42 %cmp55.not = icmp eq i32 %and44, %shl54 br i1 %cmp55.not, label %for.cond32, label %for.cond25.for.end64_crit_edge.thread for.inc62: ; preds = %for.cond32, %if.then, %for.body27 %cnt.1 = phi i32 [ %cnt.0109, %for.body27 ], [ %inc31, %if.then ], [ %inc31, %for.cond32 ] %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1 %cmp26.not = icmp ult i64 %indvars.iv.next127, %7 br i1 %cmp26.not, label %for.body27, label %for.cond25.for.end64_crit_edge, !llvm.loop !13 for.cond25.for.end64_crit_edge: ; preds = %for.inc62 %cond.i = call i32 @llvm.smax.i32(i32 %ans.0115, i32 %cnt.1) br label %for.cond25.for.end64_crit_edge.thread for.cond25.for.end64_crit_edge.thread: ; preds = %for.body37, %for.cond25.for.end64_crit_edge %19 = phi i32 [ %cond.i, %for.cond25.for.end64_crit_edge ], [ %ans.0115, %for.body37 ] %inc71 = add nuw nsw i32 %b.0114, 1 %exitcond129.not = icmp eq i32 %inc71, %smax br i1 %exitcond129.not, label %for.end72, label %for.cond25.preheader, !llvm.loop !14 for.end72: ; preds = %for.cond25.for.end64_crit_edge.thread, %entry, %for.cond22.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %entry ], [ %19, %for.cond25.for.end64_crit_edge.thread ] %call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %ans.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #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: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn } 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} !14 = distinct !{!14, !10}
#include <stdio.h> int n; int a[15]; int x[14][15]; int y[14][15]; int numofbits(long bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff); } //整合性チェック 0=正しい/1=矛盾した int checkCorrectness(int b) { for ( int i = 0 ; i < n ; i++ ) { int bb; if ( b & ( 1<<i ) ) { bb = 0; //他の人が自分を不親切な人としていないかチェック } else { bb = 1; //他の人が自分を正直な人としていないかチェック } for ( int j = 0 ; j < n ; j++ ) { if ( i != j ) { if ( b & ( 1<<j ) ) { for ( int k = 0 ; k < a[j] ; k++ ) { if ( ( x[k][j] == i ) && ( y[k][j] == bb ) ) { return 1; } } } } } } return 0; } int main() { scanf( "%u", &n ); for ( int i = 0 ; i < n ; i++ ) { scanf( "%u", &(a[i]) ); for ( int j = 0 ; j < a[i] ; j++ ) { scanf( "%u", &(x[j][i]) ); // 1~ x[j][i]--; // 0~ scanf( "%u", &(y[j][i]) ); } } int err = 1; int imax = 1 << n; for ( int c = n ; c > 0 ; c-- ) { //正直な人の数が多い順 for ( int b = 1 ; b < imax ; b++ ) { if ( numofbits(b) == c ) { //正直な人の数 err = checkCorrectness(b); //整合性チェック 0=正しい/1=矛盾した if (!err) { printf("%i",c); break; } } } if (!err) break; } if (err) { printf("%i",0); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281235/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281235/source.c" target datalayout = "e-m:e-p270: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 [15 x i32] zeroinitializer, align 16 @x = dso_local global [14 x [15 x i32]] zeroinitializer, align 16 @y = dso_local global [14 x [15 x i32]] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%u\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%i\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @numofbits(i64 noundef %bits) local_unnamed_addr #0 { entry: %and = and i64 %bits, 1431655765 %shr = lshr i64 %bits, 1 %and1 = and i64 %shr, 1431655765 %add = add nuw nsw i64 %and1, %and %and2 = and i64 %add, 858993459 %shr3 = lshr i64 %add, 2 %and4 = and i64 %shr3, 858993459 %add5 = add nuw nsw i64 %and4, %and2 %and6 = and i64 %add5, 117901063 %shr7 = lshr i64 %add5, 4 %and8 = and i64 %shr7, 117901063 %add9 = add nuw nsw i64 %and8, %and6 %and10 = and i64 %add9, 983055 %shr11 = lshr i64 %add9, 8 %and12 = and i64 %shr11, 983055 %add13 = add nuw nsw i64 %and12, %and10 %and14 = and i64 %add13, 31 %shr15 = lshr i64 %add13, 16 %add17 = add nuw nsw i64 %and14, %shr15 %conv = trunc i64 %add17 to i32 ret i32 %conv } ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @checkCorrectness(i32 noundef %b) local_unnamed_addr #1 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not71 = icmp sgt i32 %0, 0 br i1 %cmp.not71, label %for.body.lr.ph, label %cleanup38 for.body.lr.ph: ; preds = %entry %1 = xor i32 %b, -1 %2 = zext i32 %0 to i64 %wide.trip.count85 = zext i32 %0 to i64 br label %for.body.us for.body.us: ; preds = %for.cond1.for.inc36_crit_edge.us, %for.body.lr.ph %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.cond1.for.inc36_crit_edge.us ], [ 0, %for.body.lr.ph ] %cmp.not73.us = phi i1 [ %cmp.not.us, %for.cond1.for.inc36_crit_edge.us ], [ true, %for.body.lr.ph ] %3 = trunc i64 %indvars.iv83 to i32 %4 = lshr i32 %1, %3 %..us = and i32 %4, 1 br label %for.body4.us for.body4.us: ; preds = %for.body.us, %for.inc29.us %indvars.iv78 = phi i64 [ 0, %for.body.us ], [ %indvars.iv.next79, %for.inc29.us ] %cmp5.not.us = icmp eq i64 %indvars.iv83, %indvars.iv78 br i1 %cmp5.not.us, label %for.inc29.us, label %if.then6.us if.then6.us: ; preds = %for.body4.us %5 = trunc i64 %indvars.iv78 to i32 %shl7.us = shl nuw i32 1, %5 %and8.us = and i32 %shl7.us, %b %tobool9.not.us = icmp eq i32 %and8.us, 0 br i1 %tobool9.not.us, label %for.inc29.us, label %for.cond11.preheader.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc.us %indvars.iv = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next, %for.inc.us ] %arrayidx18.us = getelementptr inbounds [14 x [15 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 %indvars.iv78 %6 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %cmp19.us = icmp eq i64 %indvars.iv83, %7 br i1 %cmp19.us, label %land.lhs.true.us, label %for.inc.us land.lhs.true.us: ; preds = %for.body14.us %arrayidx23.us = getelementptr inbounds [14 x [15 x i32]], ptr @y, i64 0, i64 %indvars.iv, i64 %indvars.iv78 %8 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5 %cmp24.us = icmp eq i32 %8, %..us br i1 %cmp24.us, label %cleanup38, label %for.inc.us for.inc.us: ; preds = %land.lhs.true.us, %for.body14.us %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.inc29.us, label %for.body14.us, !llvm.loop !9 for.inc29.us: ; preds = %for.inc.us, %for.cond11.preheader.us, %if.then6.us, %for.body4.us %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count85 br i1 %exitcond82.not, label %for.cond1.for.inc36_crit_edge.us, label %for.body4.us, !llvm.loop !11 for.cond11.preheader.us: ; preds = %if.then6.us %arrayidx.us = getelementptr inbounds [15 x i32], ptr @a, i64 0, i64 %indvars.iv78 %9 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %cmp12.not67.us = icmp sgt i32 %9, 0 br i1 %cmp12.not67.us, label %for.body14.us.preheader, label %for.inc29.us for.body14.us.preheader: ; preds = %for.cond11.preheader.us %wide.trip.count = zext i32 %9 to i64 br label %for.body14.us for.cond1.for.inc36_crit_edge.us: ; preds = %for.inc29.us %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %cmp.not.us = icmp ult i64 %indvars.iv.next84, %2 %exitcond86.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count85 br i1 %exitcond86.not, label %cleanup38, label %for.body.us, !llvm.loop !12 cleanup38: ; preds = %for.cond1.for.inc36_crit_edge.us, %land.lhs.true.us, %entry %cmp.not66 = phi i1 [ false, %entry ], [ %cmp.not73.us, %land.lhs.true.us ], [ %cmp.not.us, %for.cond1.for.inc36_crit_edge.us ] %spec.select = zext i1 %cmp.not66 to i32 ret i32 %spec.select } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4 %cmp80 = icmp sgt i32 %0, 0 br i1 %cmp80, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond.cleanup6, %entry %1 = phi i32 [ %0, %entry ], [ %12, %for.cond.cleanup6 ] %.fr = freeze i32 %1 %shl = shl nuw i32 1, %.fr %cmp2687 = icmp sgt i32 %.fr, 0 br i1 %cmp2687, label %for.cond29.preheader.lr.ph, label %if.end53 for.cond29.preheader.lr.ph: ; preds = %for.cond.cleanup %cmp3082 = icmp sgt i32 %shl, 1 %2 = zext i32 %.fr to i64 br i1 %cmp3082, label %for.cond29.preheader.us.us, label %if.end53 for.cond29.preheader.us.us: ; preds = %for.cond29.preheader.lr.ph, %for.cond29.for.inc46_crit_edge.split.us.us.us %c.088.us.us = phi i32 [ %dec47.us.us, %for.cond29.for.inc46_crit_edge.split.us.us.us ], [ %.fr, %for.cond29.preheader.lr.ph ] br label %for.body32.us.us.us for.body32.us.us.us: ; preds = %for.inc40.us.us.us, %for.cond29.preheader.us.us %b.083.us.us.us = phi i32 [ 1, %for.cond29.preheader.us.us ], [ %inc41.us.us.us, %for.inc40.us.us.us ] %and.i.us.us.us = and i32 %b.083.us.us.us, 1431655765 %shr.i.us.us.us = lshr i32 %b.083.us.us.us, 1 %and1.i.us.us.us = and i32 %shr.i.us.us.us, 357913941 %add.i.us.us.us = add nuw nsw i32 %and1.i.us.us.us, %and.i.us.us.us %and2.i.us.us.us = and i32 %add.i.us.us.us, 858993459 %shr3.i.us.us.us = lshr i32 %add.i.us.us.us, 2 %and4.i.us.us.us = and i32 %shr3.i.us.us.us, 322122547 %add5.i.us.us.us = add nuw nsw i32 %and4.i.us.us.us, %and2.i.us.us.us %and6.i.us.us.us = and i32 %add5.i.us.us.us, 117901063 %shr7.i.us.us.us = lshr i32 %add5.i.us.us.us, 4 %and8.i.us.us.us = and i32 %shr7.i.us.us.us, 117901063 %add9.i.us.us.us = add nuw nsw i32 %and8.i.us.us.us, %and6.i.us.us.us %and10.i.us.us.us = and i32 %add9.i.us.us.us, 983055 %shr11.i.us.us.us = lshr i32 %add9.i.us.us.us, 8 %and12.i.us.us.us = and i32 %shr11.i.us.us.us, 983055 %add13.i.us.us.us = add nuw nsw i32 %and12.i.us.us.us, %and10.i.us.us.us %and14.i.us.us.us = and i32 %add13.i.us.us.us, 31 %shr15.i.us.us.us = lshr i32 %add13.i.us.us.us, 16 %add17.i.us.us.us = add nuw nsw i32 %and14.i.us.us.us, %shr15.i.us.us.us %cmp34.us.us.us = icmp eq i32 %c.088.us.us, %add17.i.us.us.us br i1 %cmp34.us.us.us, label %if.then.us.us.us, label %for.inc40.us.us.us if.then.us.us.us: ; preds = %for.body32.us.us.us %3 = xor i32 %b.083.us.us.us, -1 br label %for.body.us.i.us.us.us for.body.us.i.us.us.us: ; preds = %for.cond1.for.inc36_crit_edge.us.i.us.us.us, %if.then.us.us.us %indvars.iv83.i.us.us.us = phi i64 [ %indvars.iv.next84.i.us.us.us, %for.cond1.for.inc36_crit_edge.us.i.us.us.us ], [ 0, %if.then.us.us.us ] %cmp.not73.us.i.us.us.us = phi i1 [ %cmp.not.us.i.us.us.us, %for.cond1.for.inc36_crit_edge.us.i.us.us.us ], [ true, %if.then.us.us.us ] %4 = trunc i64 %indvars.iv83.i.us.us.us to i32 %5 = lshr i32 %3, %4 %..us.i.us.us.us = and i32 %5, 1 br label %for.body4.us.i.us.us.us for.body4.us.i.us.us.us: ; preds = %for.inc29.us.i.us.us.us, %for.body.us.i.us.us.us %indvars.iv78.i.us.us.us = phi i64 [ 0, %for.body.us.i.us.us.us ], [ %indvars.iv.next79.i.us.us.us, %for.inc29.us.i.us.us.us ] %cmp5.not.us.i.us.us.us = icmp eq i64 %indvars.iv83.i.us.us.us, %indvars.iv78.i.us.us.us br i1 %cmp5.not.us.i.us.us.us, label %for.inc29.us.i.us.us.us, label %if.then6.us.i.us.us.us if.then6.us.i.us.us.us: ; preds = %for.body4.us.i.us.us.us %6 = trunc i64 %indvars.iv78.i.us.us.us to i32 %shl7.us.i.us.us.us = shl nuw i32 1, %6 %and8.us.i.us.us.us = and i32 %shl7.us.i.us.us.us, %b.083.us.us.us %tobool9.not.us.i.us.us.us = icmp eq i32 %and8.us.i.us.us.us, 0 br i1 %tobool9.not.us.i.us.us.us, label %for.inc29.us.i.us.us.us, label %for.cond11.preheader.us.i.us.us.us for.cond11.preheader.us.i.us.us.us: ; preds = %if.then6.us.i.us.us.us %arrayidx.us.i.us.us.us = getelementptr inbounds [15 x i32], ptr @a, i64 0, i64 %indvars.iv78.i.us.us.us %7 = load i32, ptr %arrayidx.us.i.us.us.us, align 4, !tbaa !5 %cmp12.not67.us.i.us.us.us = icmp sgt i32 %7, 0 br i1 %cmp12.not67.us.i.us.us.us, label %for.body14.us.preheader.i.us.us.us, label %for.inc29.us.i.us.us.us for.body14.us.preheader.i.us.us.us: ; preds = %for.cond11.preheader.us.i.us.us.us %wide.trip.count.i.us.us.us = zext i32 %7 to i64 br label %for.body14.us.i.us.us.us for.body14.us.i.us.us.us: ; preds = %for.inc.us.i.us.us.us, %for.body14.us.preheader.i.us.us.us %indvars.iv.i.us.us.us = phi i64 [ 0, %for.body14.us.preheader.i.us.us.us ], [ %indvars.iv.next.i.us.us.us, %for.inc.us.i.us.us.us ] %arrayidx18.us.i.us.us.us = getelementptr inbounds [14 x [15 x i32]], ptr @x, i64 0, i64 %indvars.iv.i.us.us.us, i64 %indvars.iv78.i.us.us.us %8 = load i32, ptr %arrayidx18.us.i.us.us.us, align 4, !tbaa !5 %9 = zext i32 %8 to i64 %cmp19.us.i.us.us.us = icmp eq i64 %indvars.iv83.i.us.us.us, %9 br i1 %cmp19.us.i.us.us.us, label %land.lhs.true.us.i.us.us.us, label %for.inc.us.i.us.us.us land.lhs.true.us.i.us.us.us: ; preds = %for.body14.us.i.us.us.us %arrayidx23.us.i.us.us.us = getelementptr inbounds [14 x [15 x i32]], ptr @y, i64 0, i64 %indvars.iv.i.us.us.us, i64 %indvars.iv78.i.us.us.us %10 = load i32, ptr %arrayidx23.us.i.us.us.us, align 4, !tbaa !5 %cmp24.us.i.us.us.us = icmp eq i32 %10, %..us.i.us.us.us br i1 %cmp24.us.i.us.us.us, label %checkCorrectness.exit.us.us.us, label %for.inc.us.i.us.us.us for.inc.us.i.us.us.us: ; preds = %land.lhs.true.us.i.us.us.us, %for.body14.us.i.us.us.us %indvars.iv.next.i.us.us.us = add nuw nsw i64 %indvars.iv.i.us.us.us, 1 %exitcond.not.i.us.us.us = icmp eq i64 %indvars.iv.next.i.us.us.us, %wide.trip.count.i.us.us.us br i1 %exitcond.not.i.us.us.us, label %for.inc29.us.i.us.us.us, label %for.body14.us.i.us.us.us, !llvm.loop !9 for.inc29.us.i.us.us.us: ; preds = %for.inc.us.i.us.us.us, %for.cond11.preheader.us.i.us.us.us, %if.then6.us.i.us.us.us, %for.body4.us.i.us.us.us %indvars.iv.next79.i.us.us.us = add nuw nsw i64 %indvars.iv78.i.us.us.us, 1 %exitcond82.not.i.us.us.us = icmp eq i64 %indvars.iv.next79.i.us.us.us, %2 br i1 %exitcond82.not.i.us.us.us, label %for.cond1.for.inc36_crit_edge.us.i.us.us.us, label %for.body4.us.i.us.us.us, !llvm.loop !11 for.cond1.for.inc36_crit_edge.us.i.us.us.us: ; preds = %for.inc29.us.i.us.us.us %indvars.iv.next84.i.us.us.us = add nuw nsw i64 %indvars.iv83.i.us.us.us, 1 %cmp.not.us.i.us.us.us = icmp ult i64 %indvars.iv.next84.i.us.us.us, %2 %exitcond86.not.i.us.us.us = icmp eq i64 %indvars.iv.next84.i.us.us.us, %2 br i1 %exitcond86.not.i.us.us.us, label %checkCorrectness.exit.us.us.us, label %for.body.us.i.us.us.us, !llvm.loop !12 checkCorrectness.exit.us.us.us: ; preds = %for.cond1.for.inc36_crit_edge.us.i.us.us.us, %land.lhs.true.us.i.us.us.us %cmp.not66.i.us.us.us = phi i1 [ %cmp.not73.us.i.us.us.us, %land.lhs.true.us.i.us.us.us ], [ %cmp.not.us.i.us.us.us, %for.cond1.for.inc36_crit_edge.us.i.us.us.us ] br i1 %cmp.not66.i.us.us.us, label %for.inc40.us.us.us, label %if.end53 for.inc40.us.us.us: ; preds = %checkCorrectness.exit.us.us.us, %for.body32.us.us.us %inc41.us.us.us = add nuw nsw i32 %b.083.us.us.us, 1 %exitcond132.not = icmp eq i32 %inc41.us.us.us, %shl br i1 %exitcond132.not, label %for.cond29.for.inc46_crit_edge.split.us.us.us, label %for.body32.us.us.us, !llvm.loop !13 for.cond29.for.inc46_crit_edge.split.us.us.us: ; preds = %for.inc40.us.us.us %dec47.us.us = add nsw i32 %c.088.us.us, -1 %cmp26.us.us = icmp sgt i32 %c.088.us.us, 1 br i1 %cmp26.us.us, label %for.cond29.preheader.us.us, label %if.end53, !llvm.loop !14 for.body: ; preds = %entry, %for.cond.cleanup6 %indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.cond.cleanup6 ], [ 0, %entry ] %arrayidx = getelementptr inbounds [15 x i32], ptr @a, i64 0, i64 %indvars.iv129 %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %11 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp578 = icmp sgt i32 %11, 0 br i1 %cmp578, label %for.body7, label %for.cond.cleanup6 for.cond.cleanup6: ; preds = %for.body7, %for.body %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1 %12 = load i32, ptr @n, align 4 %13 = sext i32 %12 to i64 %cmp = icmp slt i64 %indvars.iv.next130, %13 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15 for.body7: ; preds = %for.body, %for.body7 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 0, %for.body ] %arrayidx11 = getelementptr inbounds [14 x [15 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 %indvars.iv129 %call12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx11) %14 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %dec = add nsw i32 %14, -1 store i32 %dec, ptr %arrayidx11, align 4, !tbaa !5 %arrayidx20 = getelementptr inbounds [14 x [15 x i32]], ptr @y, i64 0, i64 %indvars.iv, i64 %indvars.iv129 %call21 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx20) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %15 = load i32, ptr %arrayidx, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp5 = icmp slt i64 %indvars.iv.next, %16 br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !16 if.end53: ; preds = %for.cond29.for.inc46_crit_edge.split.us.us.us, %checkCorrectness.exit.us.us.us, %for.cond.cleanup, %for.cond29.preheader.lr.ph %c.088.us.us.lcssa.sink = phi i32 [ 0, %for.cond29.preheader.lr.ph ], [ 0, %for.cond.cleanup ], [ %c.088.us.us, %checkCorrectness.exit.us.us.us ], [ 0, %for.cond29.for.inc46_crit_edge.split.us.us.us ] %call38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.088.us.us.lcssa.sink) 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { 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 #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" } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include <stdio.h> int main(void){ int cnt_same; int cnt_str; char S[26]; scanf("%s", S); cnt_same = 0; cnt_str = 0; for(int i=0; S[i]; i++){ for(int j=0; S[j]; j++){ if(S[i] == S[j]) cnt_same++; } cnt_str++; } if(cnt_str == cnt_same) printf("yes\n"); else printf("no\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281286/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281286/source.c" target datalayout = "e-m:e-p270: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 = 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: %S = alloca [26 x i8], align 16 call void @llvm.lifetime.start.p0(i64 26, 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 %tobool.not34 = icmp eq i8 %0, 0 br i1 %tobool.not34, label %if.end23, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %for.cond1.for.cond.cleanup5_crit_edge %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.cond1.for.cond.cleanup5_crit_edge ], [ 0, %entry ] %1 = phi i8 [ %2, %for.cond1.for.cond.cleanup5_crit_edge ], [ %0, %entry ] %i.037 = phi i32 [ %inc16, %for.cond1.for.cond.cleanup5_crit_edge ], [ 0, %entry ] %cnt_same.035 = phi i32 [ %spec.select, %for.cond1.for.cond.cleanup5_crit_edge ], [ 0, %entry ] br label %for.body6 for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup5_crit_edge %cmp18 = icmp eq i32 %inc16, %spec.select %spec.select52 = select i1 %cmp18, ptr @str.3, ptr @str br label %if.end23 for.cond1.for.cond.cleanup5_crit_edge: ; preds = %for.body6 %inc16 = add nuw nsw i32 %i.037, 1 %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 %arrayidx = getelementptr inbounds [26 x i8], ptr %S, i64 0, i64 %indvars.iv.next43 %2 = load i8, ptr %arrayidx, align 1, !tbaa !5 %tobool.not = icmp eq i8 %2, 0 br i1 %tobool.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !8 for.body6: ; preds = %for.cond1.preheader, %for.body6 %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body6 ] %3 = phi i8 [ %0, %for.cond1.preheader ], [ %4, %for.body6 ] %cnt_same.132 = phi i32 [ %cnt_same.035, %for.cond1.preheader ], [ %spec.select, %for.body6 ] %cmp = icmp eq i8 %1, %3 %inc = zext i1 %cmp to i32 %spec.select = add nsw i32 %cnt_same.132, %inc %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx3 = getelementptr inbounds [26 x i8], ptr %S, i64 0, i64 %indvars.iv.next %4 = load i8, ptr %arrayidx3, align 1, !tbaa !5 %tobool4.not = icmp eq i8 %4, 0 br i1 %tobool4.not, label %for.cond1.for.cond.cleanup5_crit_edge, label %for.body6, !llvm.loop !10 if.end23: ; preds = %for.cond.cleanup, %entry %str.sink = phi ptr [ @str.3, %entry ], [ %spec.select52, %for.cond.cleanup ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 26, 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}
#include <stdio.h> int main(void){ char s[1000]; scanf("%s",s); int judge = 0; for(int i=0;;i++){ if(s[i] == '\0'){ break; } for(int j=i+1;;j++){ if(s[i] == s[j]){ judge = 1; break; } if(s[j] == '\0'){ break; } } } if(judge==1){ printf("no\n"); }else{ printf("yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281329/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281329/source.c" target datalayout = "e-m:e-p270: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 = 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: %s = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1000, 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 %cmp43 = icmp eq i8 %0, 0 br i1 %cmp43, label %if.else, label %if.end if.then: ; preds = %cleanup %1 = icmp eq i32 %judge.1.ph, 1 br i1 %1, label %if.end29, label %if.else if.end: ; preds = %entry, %if.end.backedge %indvars.iv48 = phi i64 [ %indvars.iv.next49, %if.end.backedge ], [ 0, %entry ] %indvars.iv = phi i64 [ %indvars.iv.be, %if.end.backedge ], [ 1, %entry ] %2 = phi i8 [ %3, %if.end.backedge ], [ %0, %entry ] %judge.044 = phi i32 [ %judge.044.be, %if.end.backedge ], [ 0, %entry ] %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %arrayidx739 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next49 %3 = load i8, ptr %arrayidx739, align 1, !tbaa !5 %cmp940 = icmp eq i8 %2, %3 br i1 %cmp940, label %cleanup.thread, label %if.end12 for.cond2: ; preds = %if.end12 %indvars.iv.next47 = add nuw i64 %indvars.iv46, 1 %arrayidx7 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next47 %4 = load i8, ptr %arrayidx7, align 1, !tbaa !5 %cmp9 = icmp eq i8 %2, %4 br i1 %cmp9, label %cleanup, label %if.end12 if.end12: ; preds = %if.end, %for.cond2 %indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.cond2 ], [ %indvars.iv, %if.end ] %5 = phi i8 [ %4, %for.cond2 ], [ %3, %if.end ] %cmp16 = icmp eq i8 %5, 0 br i1 %cmp16, label %cleanup, label %for.cond2 cleanup: ; preds = %for.cond2, %if.end12 %judge.1.ph = phi i32 [ 1, %for.cond2 ], [ %judge.044, %if.end12 ] %cmp = icmp eq i8 %3, 0 br i1 %cmp, label %if.then, label %if.end.backedge if.end.backedge: ; preds = %cleanup, %cleanup.thread %judge.044.be = phi i32 [ %judge.1.ph, %cleanup ], [ 1, %cleanup.thread ] %indvars.iv.be = add nuw i64 %indvars.iv, 1 br label %if.end cleanup.thread: ; preds = %if.end %cmp52 = icmp eq i8 %3, 0 br i1 %cmp52, label %if.end29, label %if.end.backedge if.else: ; preds = %entry, %if.then br label %if.end29 if.end29: ; preds = %cleanup.thread, %if.then, %if.else %str.sink = phi ptr [ @str, %if.else ], [ @str.3, %if.then ], [ @str.3, %cleanup.thread ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 1000, 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"}
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[27]; scanf("%s", s); int n = strlen(s); int flag = 0; for(int i = 1; i < n; i++){ for(int j = 0; j < i; j++){ if(s[i] == s[j]){ flag++; break; } } if(flag > 0){ break; } } if(flag > 0){ printf("no\n"); } else{ printf("yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281372/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281372/source.c" target datalayout = "e-m:e-p270: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 = 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %s = alloca [27 x i8], align 16 call void @llvm.lifetime.start.p0(i64 27, ptr nonnull %s) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6 %conv = trunc i64 %call2 to i32 %cmp42 = icmp sgt i32 %conv, 1 br i1 %cmp42, label %for.cond4.preheader.preheader, label %if.end29 for.cond4.preheader.preheader: ; preds = %entry %wide.trip.count48 = and i64 %call2, 4294967295 br label %for.cond4.preheader for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc20 %indvars.iv45 = phi i64 [ 1, %for.cond4.preheader.preheader ], [ %indvars.iv.next46, %for.inc20 ] %arrayidx = getelementptr inbounds [27 x i8], ptr %s, i64 0, i64 %indvars.iv45 %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 br label %for.body8 for.cond4: ; preds = %for.body8 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv45 br i1 %exitcond.not, label %for.inc20, label %for.body8, !llvm.loop !8 for.body8: ; preds = %for.cond4.preheader, %for.cond4 %indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next, %for.cond4 ] %arrayidx11 = getelementptr inbounds [27 x i8], ptr %s, i64 0, i64 %indvars.iv %1 = load i8, ptr %arrayidx11, align 1, !tbaa !5 %cmp13 = icmp eq i8 %0, %1 br i1 %cmp13, label %if.end29, label %for.cond4 for.inc20: ; preds = %for.cond4 %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %exitcond49.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count48 br i1 %exitcond49.not, label %if.end29, label %for.cond4.preheader, !llvm.loop !10 if.end29: ; preds = %for.inc20, %for.body8, %entry %str.sink = phi ptr [ @str, %entry ], [ @str.3, %for.body8 ], [ @str, %for.inc20 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 27, ptr nonnull %s) #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(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress 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 = { nofree nounwind } attributes #5 = { nounwind } attributes #6 = { 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} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9}
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> typedef long long int int64; static void printInt(int64 n){ if(n<0){putchar('-');n=-n;} if(n==0){putchar('0');return;} int s[20];int len=0; while(n>0){s[len++]=n%10+'0';n/=10;} while(len>0){putchar(s[--len]);} } static int64 readInt(void){ int prev='\0';int c=getchar(); while(!('0'<=c && c<='9')){prev=c;c=getchar();} int64 res=0; while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();} return prev=='-'?-res:res; } #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define ABS(a) ((a)>(0)?(a):-(a)) void solve(const int ang){ for(int i=3;;i++){ for(int j=1;j<=i-2;j++){ if(180*j%i==0 && 180*j/i==ang){ printInt(i); putchar('\n'); return; } } } } void run(void){ int t=readInt(); while(t--){ int ang=readInt(); solve(ang); } } int main(void){ run(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28143/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28143/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdout = external local_unnamed_addr global ptr, align 8 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local void @solve(i32 noundef %ang) local_unnamed_addr #0 { entry: %s.i = alloca [20 x i32], align 16 br label %for.body.preheader for.body.preheader: ; preds = %entry, %for.inc5 %indvars.iv = phi i32 [ %indvars.iv.next, %for.inc5 ], [ 2, %entry ] %i.0 = phi i32 [ %inc6, %for.inc5 ], [ 3, %entry ] br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %j.016 = phi i32 [ %inc, %for.inc ], [ 1, %for.body.preheader ] %mul = mul nuw nsw i32 %j.016, 180 %rem = urem i32 %mul, %i.0 %div = udiv i32 %mul, %i.0 %cmp2 = icmp eq i32 %rem, 0 %cmp4 = icmp eq i32 %div, %ang %or.cond = and i1 %cmp2, %cmp4 br i1 %or.cond, label %if.then, label %for.inc if.then: ; preds = %for.body %conv = zext i32 %i.0 to i64 call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i) #3 br label %while.body.i while.cond6.preheader.i: ; preds = %while.body.i %0 = trunc i64 %indvars.iv.next.i to i32 %cmp729.i = icmp sgt i32 %0, 0 br i1 %cmp729.i, label %while.body9.preheader.i, label %cleanup7 while.body9.preheader.i: ; preds = %while.cond6.preheader.i %1 = and i64 %indvars.iv.next.i, 4294967295 br label %while.body9.i while.body.i: ; preds = %while.body.i, %if.then %indvars.iv.i = phi i64 [ 0, %if.then ], [ %indvars.iv.next.i, %while.body.i ] %n.addr.127.i = phi i64 [ %conv, %if.then ], [ %div.i, %while.body.i ] %rem.i = urem i64 %n.addr.127.i, 10 %2 = trunc i64 %rem.i to i32 %conv.i = or i32 %2, 48 %indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1 %arrayidx.i = getelementptr inbounds [20 x i32], ptr %s.i, i64 0, i64 %indvars.iv.i store i32 %conv.i, ptr %arrayidx.i, align 4, !tbaa !5 %div.i = udiv i64 %n.addr.127.i, 10 %cmp5.not.i = icmp ult i64 %n.addr.127.i, 10 br i1 %cmp5.not.i, label %while.cond6.preheader.i, label %while.body.i, !llvm.loop !9 while.body9.i: ; preds = %while.body9.i, %while.body9.preheader.i %indvars.iv32.i = phi i64 [ %1, %while.body9.preheader.i ], [ %indvars.iv.next33.i, %while.body9.i ] %indvars.iv.next33.i = add nsw i64 %indvars.iv32.i, -1 %idxprom10.i = and i64 %indvars.iv.next33.i, 4294967295 %arrayidx11.i = getelementptr inbounds [20 x i32], ptr %s.i, i64 0, i64 %idxprom10.i %3 = load i32, ptr %arrayidx11.i, align 4, !tbaa !5 %4 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i22.i = tail call i32 @putc(i32 noundef %3, ptr noundef %4) %cmp7.i = icmp ugt i64 %indvars.iv32.i, 1 br i1 %cmp7.i, label %while.body9.i, label %cleanup7, !llvm.loop !13 for.inc: ; preds = %for.body %inc = add nuw i32 %j.016, 1 %exitcond.not = icmp eq i32 %inc, %indvars.iv br i1 %exitcond.not, label %for.inc5, label %for.body, !llvm.loop !14 for.inc5: ; preds = %for.inc %inc6 = add nuw nsw i32 %i.0, 1 %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 br label %for.body.preheader cleanup7: ; preds = %while.body9.i, %while.cond6.preheader.i call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i) #3 %5 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %5) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local void @run() local_unnamed_addr #0 { entry: %s.i.i = alloca [20 x i32], align 16 %0 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i.i = tail call i32 @getc(ptr noundef %0) %1 = add i32 %call.i.i, -58 %2 = icmp ult i32 %1, -10 br i1 %2, label %while.body.i, label %while.body8.preheader.i while.cond3.preheader.loopexit.i: ; preds = %while.body.i %3 = icmp eq i32 %c.023.i, 45 br label %while.body8.preheader.i while.body8.preheader.i: ; preds = %while.cond3.preheader.loopexit.i, %entry %prev.0.lcssa.i = phi i1 [ false, %entry ], [ %3, %while.cond3.preheader.loopexit.i ] %c.0.lcssa.i = phi i32 [ %call.i.i, %entry ], [ %call.i21.i, %while.cond3.preheader.loopexit.i ] br label %while.body8.i while.body.i: ; preds = %entry, %while.body.i %c.023.i = phi i32 [ %call.i21.i, %while.body.i ], [ %call.i.i, %entry ] %4 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i21.i = tail call i32 @getc(ptr noundef %4) %5 = add i32 %call.i21.i, -58 %6 = icmp ult i32 %5, -10 br i1 %6, label %while.body.i, label %while.cond3.preheader.loopexit.i, !llvm.loop !15 while.body8.i: ; preds = %while.body8.i, %while.body8.preheader.i %res.026.i = phi i32 [ %sub.i, %while.body8.i ], [ 0, %while.body8.preheader.i ] %c.125.i = phi i32 [ %call.i22.i, %while.body8.i ], [ %c.0.lcssa.i, %while.body8.preheader.i ] %mul.i = mul i32 %res.026.i, 10 %add.i = add nsw i32 %c.125.i, -48 %sub.i = add i32 %add.i, %mul.i %7 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i22.i = tail call i32 @getc(ptr noundef %7) %8 = add i32 %call.i22.i, -48 %9 = icmp ult i32 %8, 10 br i1 %9, label %while.body8.i, label %readInt.exit, !llvm.loop !16 readInt.exit: ; preds = %while.body8.i %sub13.i = sub i32 0, %sub.i %cond.i = select i1 %prev.0.lcssa.i, i32 %sub13.i, i32 %sub.i %tobool.not25 = icmp eq i32 %cond.i, 0 br i1 %tobool.not25, label %while.end, label %while.body while.body: ; preds = %readInt.exit, %solve.exit %t.026 = phi i32 [ %dec, %solve.exit ], [ %cond.i, %readInt.exit ] %dec = add nsw i32 %t.026, -1 %10 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i.i3 = tail call i32 @getc(ptr noundef %10) %11 = add i32 %call.i.i3, -58 %12 = icmp ult i32 %11, -10 br i1 %12, label %while.body.i17, label %while.body8.preheader.i4 while.cond3.preheader.loopexit.i20: ; preds = %while.body.i17 %13 = icmp eq i32 %c.023.i18, 45 br label %while.body8.preheader.i4 while.body8.preheader.i4: ; preds = %while.cond3.preheader.loopexit.i20, %while.body %prev.0.lcssa.i5 = phi i1 [ false, %while.body ], [ %13, %while.cond3.preheader.loopexit.i20 ] %c.0.lcssa.i6 = phi i32 [ %call.i.i3, %while.body ], [ %call.i21.i19, %while.cond3.preheader.loopexit.i20 ] br label %while.body8.i7 while.body.i17: ; preds = %while.body, %while.body.i17 %c.023.i18 = phi i32 [ %call.i21.i19, %while.body.i17 ], [ %call.i.i3, %while.body ] %14 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i21.i19 = tail call i32 @getc(ptr noundef %14) %15 = add i32 %call.i21.i19, -58 %16 = icmp ult i32 %15, -10 br i1 %16, label %while.body.i17, label %while.cond3.preheader.loopexit.i20, !llvm.loop !15 while.body8.i7: ; preds = %while.body8.i7, %while.body8.preheader.i4 %res.026.i8 = phi i32 [ %sub.i13, %while.body8.i7 ], [ 0, %while.body8.preheader.i4 ] %c.125.i9 = phi i32 [ %call.i22.i14, %while.body8.i7 ], [ %c.0.lcssa.i6, %while.body8.preheader.i4 ] %mul.i10 = mul i32 %res.026.i8, 10 %add.i12 = add nsw i32 %c.125.i9, -48 %sub.i13 = add i32 %add.i12, %mul.i10 %17 = load ptr, ptr @stdin, align 8, !tbaa !11 %call.i22.i14 = tail call i32 @getc(ptr noundef %17) %18 = add i32 %call.i22.i14, -48 %19 = icmp ult i32 %18, 10 br i1 %19, label %while.body8.i7, label %readInt.exit21, !llvm.loop !16 readInt.exit21: ; preds = %while.body8.i7 %sub13.i15 = sub i32 0, %sub.i13 %cond.i16 = select i1 %prev.0.lcssa.i5, i32 %sub13.i15, i32 %sub.i13 br label %for.body.preheader.i for.body.preheader.i: ; preds = %for.inc5.i, %readInt.exit21 %indvars.iv.i = phi i32 [ %indvars.iv.next.i, %for.inc5.i ], [ 2, %readInt.exit21 ] %i.0.i = phi i32 [ %inc6.i, %for.inc5.i ], [ 3, %readInt.exit21 ] br label %for.body.i for.body.i: ; preds = %for.inc.i, %for.body.preheader.i %j.016.i = phi i32 [ %inc.i, %for.inc.i ], [ 1, %for.body.preheader.i ] %mul.i22 = mul nuw nsw i32 %j.016.i, 180 %rem.i = urem i32 %mul.i22, %i.0.i %div.i = udiv i32 %mul.i22, %i.0.i %cmp2.i = icmp eq i32 %rem.i, 0 %cmp4.i = icmp eq i32 %div.i, %cond.i16 %or.cond = select i1 %cmp2.i, i1 %cmp4.i, i1 false br i1 %or.cond, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body.i %conv.i23 = zext i32 %i.0.i to i64 call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i.i) #3 br label %while.body.i.i while.cond6.preheader.i.i: ; preds = %while.body.i.i %20 = trunc i64 %indvars.iv.next.i.i to i32 %cmp729.i.i = icmp sgt i32 %20, 0 br i1 %cmp729.i.i, label %while.body9.preheader.i.i, label %solve.exit while.body9.preheader.i.i: ; preds = %while.cond6.preheader.i.i %21 = and i64 %indvars.iv.next.i.i, 4294967295 br label %while.body9.i.i while.body.i.i: ; preds = %while.body.i.i, %if.then.i %indvars.iv.i.i = phi i64 [ 0, %if.then.i ], [ %indvars.iv.next.i.i, %while.body.i.i ] %n.addr.127.i.i = phi i64 [ %conv.i23, %if.then.i ], [ %div.i.i, %while.body.i.i ] %rem.i.i = urem i64 %n.addr.127.i.i, 10 %22 = trunc i64 %rem.i.i to i32 %conv.i.i = or i32 %22, 48 %indvars.iv.next.i.i = add nuw i64 %indvars.iv.i.i, 1 %arrayidx.i.i = getelementptr inbounds [20 x i32], ptr %s.i.i, i64 0, i64 %indvars.iv.i.i store i32 %conv.i.i, ptr %arrayidx.i.i, align 4, !tbaa !5 %div.i.i = udiv i64 %n.addr.127.i.i, 10 %cmp5.not.i.i = icmp ult i64 %n.addr.127.i.i, 10 br i1 %cmp5.not.i.i, label %while.cond6.preheader.i.i, label %while.body.i.i, !llvm.loop !9 while.body9.i.i: ; preds = %while.body9.i.i, %while.body9.preheader.i.i %indvars.iv32.i.i = phi i64 [ %21, %while.body9.preheader.i.i ], [ %indvars.iv.next33.i.i, %while.body9.i.i ] %indvars.iv.next33.i.i = add nsw i64 %indvars.iv32.i.i, -1 %idxprom10.i.i = and i64 %indvars.iv.next33.i.i, 4294967295 %arrayidx11.i.i = getelementptr inbounds [20 x i32], ptr %s.i.i, i64 0, i64 %idxprom10.i.i %23 = load i32, ptr %arrayidx11.i.i, align 4, !tbaa !5 %24 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i22.i.i = tail call i32 @putc(i32 noundef %23, ptr noundef %24) %cmp7.i.i = icmp ugt i64 %indvars.iv32.i.i, 1 br i1 %cmp7.i.i, label %while.body9.i.i, label %solve.exit, !llvm.loop !13 for.inc.i: ; preds = %for.body.i %inc.i = add nuw i32 %j.016.i, 1 %exitcond.not.i = icmp eq i32 %inc.i, %indvars.iv.i br i1 %exitcond.not.i, label %for.inc5.i, label %for.body.i, !llvm.loop !14 for.inc5.i: ; preds = %for.inc.i %inc6.i = add nuw nsw i32 %i.0.i, 1 %indvars.iv.next.i = add nuw nsw i32 %indvars.iv.i, 1 br label %for.body.preheader.i solve.exit: ; preds = %while.body9.i.i, %while.cond6.preheader.i.i call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i.i) #3 %25 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i.i24 = tail call i32 @putc(i32 noundef 10, ptr noundef %25) %tobool.not = icmp eq i32 %dec, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !17 while.end: ; preds = %solve.exit, %readInt.exit ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: tail call void @run() ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!12, !12, i64 0} !12 = !{!"any pointer", !7, i64 0} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10}
#include <stdio.h> #include <string.h> int main(void) { int i,t,lon,count=0; char s[27]; scanf("%s",s); lon=strlen(s); for(i=0;i<lon;i++){ for(t=i+1;t<lon;t++){ if(s[i]==s[t]){ count++; } } } if(count!=0){ printf("no\n"); } else{ printf("yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281495/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281495/source.c" target datalayout = "e-m:e-p270: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 = 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: %s = alloca [27 x i8], align 16 call void @llvm.lifetime.start.p0(i64 27, ptr nonnull %s) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7 %conv = trunc i64 %call2 to i32 %cmp35 = icmp sgt i32 %conv, 0 br i1 %cmp35, label %for.body.preheader, label %if.else for.body.preheader: ; preds = %entry %sext = shl i64 %call2, 32 %0 = ashr exact i64 %sext, 32 %wide.trip.count45 = and i64 %call2, 4294967295 br label %for.body for.cond.loopexit: ; preds = %for.body7, %middle.block, %for.body %count.1.lcssa = phi i32 [ %count.037, %for.body ], [ %14, %middle.block ], [ %spec.select, %for.body7 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond46.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count45 br i1 %exitcond46.not, label %for.end17, label %for.body, !llvm.loop !5 for.body: ; preds = %for.body.preheader, %for.cond.loopexit %indvars.iv42 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next43, %for.cond.loopexit ] %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond.loopexit ] %count.037 = phi i32 [ 0, %for.body.preheader ], [ %count.1.lcssa, %for.cond.loopexit ] %1 = xor i64 %indvars.iv42, -1 %2 = add nsw i64 %wide.trip.count45, %1 %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 %cmp532 = icmp slt i64 %indvars.iv.next43, %0 br i1 %cmp532, label %for.body7.lr.ph, label %for.cond.loopexit for.body7.lr.ph: ; preds = %for.body %arrayidx = getelementptr inbounds [27 x i8], ptr %s, i64 0, i64 %indvars.iv42 %3 = load i8, ptr %arrayidx, align 1, !tbaa !7 %min.iters.check = icmp ult i64 %2, 8 br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph vector.ph: ; preds = %for.body7.lr.ph %n.vec = and i64 %2, -8 %ind.end = add i64 %indvars.iv, %n.vec %4 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.037, i64 0 %broadcast.splatinsert = insertelement <4 x i8> poison, i8 %3, i64 0 %broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ %4, %vector.ph ], [ %11, %vector.body ] %vec.phi48 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %offset.idx = add i64 %indvars.iv, %index %5 = getelementptr inbounds [27 x i8], ptr %s, i64 0, i64 %offset.idx %wide.load = load <4 x i8>, ptr %5, align 1, !tbaa !7 %6 = getelementptr inbounds i8, ptr %5, i64 4 %wide.load49 = load <4 x i8>, ptr %6, align 1, !tbaa !7 %7 = icmp eq <4 x i8> %broadcast.splat, %wide.load %8 = icmp eq <4 x i8> %broadcast.splat, %wide.load49 %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 !10 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 %2, %n.vec br i1 %cmp.n, label %for.cond.loopexit, label %for.body7.preheader for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block %indvars.iv39.ph = phi i64 [ %indvars.iv, %for.body7.lr.ph ], [ %ind.end, %middle.block ] %count.134.ph = phi i32 [ %count.037, %for.body7.lr.ph ], [ %14, %middle.block ] br label %for.body7 for.body7: ; preds = %for.body7.preheader, %for.body7 %indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body7 ], [ %indvars.iv39.ph, %for.body7.preheader ] %count.134 = phi i32 [ %spec.select, %for.body7 ], [ %count.134.ph, %for.body7.preheader ] %arrayidx10 = getelementptr inbounds [27 x i8], ptr %s, i64 0, i64 %indvars.iv39 %15 = load i8, ptr %arrayidx10, align 1, !tbaa !7 %cmp12 = icmp eq i8 %3, %15 %inc = zext i1 %cmp12 to i32 %spec.select = add nsw i32 %count.134, %inc %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1 %exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count45 br i1 %exitcond.not, label %for.cond.loopexit, label %for.body7, !llvm.loop !13 for.end17: ; preds = %for.cond.loopexit %16 = icmp eq i32 %count.1.lcssa, 0 br i1 %16, label %if.else, label %if.end23 if.else: ; preds = %entry, %for.end17 br label %if.end23 if.end23: ; preds = %for.end17, %if.else %str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.end17 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 27, ptr nonnull %s) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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.vector.reduce.add.v4i32(<4 x i32>) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress 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 = { nofree nounwind } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = distinct !{!10, !6, !11, !12} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !6, !12, !11}
#include <stdio.h> #define MAX 100 int main(){ int n,a[MAX],ans = 0,i,j,tmp; scanf("%d" ,&n); for(i = 0 ; i < n ; i++){ scanf("%d" ,a+i); } for(i = 0 ; i < n ; i++){ for(j = n-1 ; j > i ; j--){ if(a[j] < a[j-1]){ tmp = a[j]; a[j] = a[j-1]; a[j-1] = tmp; ans++; } } } for(i = 0 ; i < n ; i++){ if(i != n-1){ printf("%d " ,a[i]); }else{ printf("%d\n%d\n" ,a[i],ans); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281567/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281567/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp65 = icmp sgt i32 %0, 0 br i1 %cmp65, label %for.body, label %for.end43 for.cond2.preheader: ; preds = %for.body %cmp373 = icmp sgt i32 %4, 0 br i1 %cmp373, label %for.cond5.preheader.lr.ph, label %for.end43 for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader %j.067 = add nsw i32 %4, -1 %1 = zext i32 %4 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.067 to i64 %wide.trip.count = zext i32 %4 to i64 br label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %add.ptr = getelementptr inbounds i32, ptr %a, 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 %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.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc25 %indvars.iv89 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next90, %for.inc25 ] %ans.075 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %ans.1.lcssa, %for.inc25 ] %cmp668 = icmp ult i64 %indvars.iv89, %3 br i1 %cmp668, label %for.body7, label %for.inc25 for.cond28.preheader: ; preds = %for.inc25 br i1 %cmp373, label %for.body30, label %for.end43 for.body7: ; preds = %for.cond5.preheader, %for.inc23 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc23 ], [ %1, %for.cond5.preheader ] %indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.inc23 ], [ %2, %for.cond5.preheader ] %ans.170 = phi i32 [ %ans.2, %for.inc23 ], [ %ans.075, %for.cond5.preheader ] %indvars.iv.next84 = add nsw i64 %indvars.iv83, -1 %arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv81 %6 = load i32, ptr %arrayidx, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv83, -2 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %7 %8 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11 = icmp slt i32 %6, %8 br i1 %cmp11, label %if.then, label %for.inc23 if.then: ; preds = %for.body7 store i32 %8, ptr %arrayidx, align 4, !tbaa !5 store i32 %6, ptr %arrayidx10, align 4, !tbaa !5 %inc22 = add nsw i32 %ans.170, 1 br label %for.inc23 for.inc23: ; preds = %for.body7, %if.then %ans.2 = phi i32 [ %inc22, %if.then ], [ %ans.170, %for.body7 ] %indvars.iv.next82 = add nsw i64 %indvars.iv81, -1 %cmp6 = icmp sgt i64 %indvars.iv.next82, %indvars.iv89 br i1 %cmp6, label %for.body7, label %for.inc25, !llvm.loop !11 for.inc25: ; preds = %for.inc23, %for.cond5.preheader %ans.1.lcssa = phi i32 [ %ans.075, %for.cond5.preheader ], [ %ans.2, %for.inc23 ] %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 %for.cond28.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body30: ; preds = %for.cond28.preheader, %for.inc41 %indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.inc41 ], [ 0, %for.cond28.preheader ] %9 = phi i32 [ %12, %for.inc41 ], [ %4, %for.cond28.preheader ] %sub31 = add nsw i32 %9, -1 %10 = zext i32 %sub31 to i64 %cmp32.not = icmp eq i64 %indvars.iv92, %10 %arrayidx38 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv92 %11 = load i32, ptr %arrayidx38, align 4, !tbaa !5 br i1 %cmp32.not, label %if.else, label %if.then33 if.then33: ; preds = %for.body30 %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11) br label %for.inc41 if.else: ; preds = %for.body30 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %ans.1.lcssa) br label %for.inc41 for.inc41: ; preds = %if.then33, %if.else %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1 %12 = load i32, ptr %n, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp29 = icmp slt i64 %indvars.iv.next93, %13 br i1 %cmp29, label %for.body30, label %for.end43, !llvm.loop !13 for.end43: ; preds = %for.inc41, %entry, %for.cond2.preheader, %for.cond28.preheader call void @llvm.lifetime.end.p0(i64 400, 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} !13 = distinct !{!13, !10}
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int a[100001], in[100001], f[100001]; int main() { int i, n,x,y; scanf("%d", &n); for(i=0; i<n; i++) { scanf("%d%d", &x, &y); printf("%d %d\n", x, x*2); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28161/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28161/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @a = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16 @in = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16 @f = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %y = 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 %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp4 = icmp sgt i32 %0, 0 br i1 %cmp4, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.05 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %1 = load i32, ptr %x, align 4, !tbaa !5 %mul = shl nsw i32 %1, 1 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %mul) %inc = add nuw nsw i32 %i.05, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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"}
#include<stdio.h> int main(){ int length; int A[100]; int i=0,j=0; int flag=0; int key; scanf("%d",&length); while(i < length){ scanf("%d",&A[i]); i++; } for(i = 0;i < length-1;i++){ for(j = length-1;j >= 1;j--){ if(A[j] < A[j-1]){ key = A[j-1]; A[j-1] = A[j]; A[j] = key; flag++; } } } for(i = 0;i < length-1;i++){ //表示 printf("%d ",A[i]); } printf("%d\n",A[i]); printf("%d\n",flag); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281668/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281668/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %length = alloca i32, align 4 %A = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length) %0 = load i32, ptr %length, align 4, !tbaa !5 %cmp58 = icmp sgt i32 %0, 0 br i1 %cmp58, label %while.body, label %for.end36 for.cond.preheader: ; preds = %while.body %sub = add i32 %4, -1 %cmp264 = icmp sgt i32 %4, 1 br i1 %cmp264, label %for.cond4.preheader.us.preheader, label %for.end36 for.cond4.preheader.us.preheader: ; preds = %for.cond.preheader %1 = zext i32 %sub to i64 br label %for.cond4.preheader.us for.cond4.preheader.us: ; preds = %for.cond4.preheader.us.preheader, %for.cond4.for.inc24_crit_edge.us %i.166.us = phi i32 [ %inc25.us, %for.cond4.for.inc24_crit_edge.us ], [ 0, %for.cond4.preheader.us.preheader ] %flag.065.us = phi i32 [ %flag.2.us, %for.cond4.for.inc24_crit_edge.us ], [ 0, %for.cond4.preheader.us.preheader ] br label %for.body6.us for.body6.us: ; preds = %for.cond4.preheader.us, %for.inc.us %indvars.iv74 = phi i64 [ %1, %for.cond4.preheader.us ], [ %indvars.iv.next75, %for.inc.us ] %flag.162.us = phi i32 [ %flag.065.us, %for.cond4.preheader.us ], [ %flag.2.us, %for.inc.us ] %arrayidx8.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv74 %2 = load i32, ptr %arrayidx8.us, align 4, !tbaa !5 %indvars.iv.next75 = add nsw i64 %indvars.iv74, -1 %idxprom10.us = and i64 %indvars.iv.next75, 4294967295 %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom10.us %3 = load i32, ptr %arrayidx11.us, align 4, !tbaa !5 %cmp12.us = icmp slt i32 %2, %3 br i1 %cmp12.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body6.us store i32 %2, ptr %arrayidx11.us, align 4, !tbaa !5 store i32 %3, ptr %arrayidx8.us, align 4, !tbaa !5 %inc23.us = add nsw i32 %flag.162.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body6.us %flag.2.us = phi i32 [ %inc23.us, %if.then.us ], [ %flag.162.us, %for.body6.us ] %cmp5.us = icmp sgt i64 %indvars.iv74, 1 br i1 %cmp5.us, label %for.body6.us, label %for.cond4.for.inc24_crit_edge.us, !llvm.loop !9 for.cond4.for.inc24_crit_edge.us: ; preds = %for.inc.us %inc25.us = add nuw nsw i32 %i.166.us, 1 %exitcond.not = icmp eq i32 %inc25.us, %sub br i1 %exitcond.not, label %for.cond27.preheader, label %for.cond4.preheader.us, !llvm.loop !11 while.body: ; preds = %entry, %while.body %indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %4 = load i32, ptr %length, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %while.body, label %for.cond.preheader, !llvm.loop !12 for.cond27.preheader: ; preds = %for.cond4.for.inc24_crit_edge.us br i1 %cmp264, label %for.body30, label %for.end36 for.body30: ; preds = %for.cond27.preheader, %for.body30 %indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body30 ], [ 0, %for.cond27.preheader ] %arrayidx32 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv77 %6 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1 %7 = load i32, ptr %length, align 4, !tbaa !5 %sub28 = add nsw i32 %7, -1 %8 = sext i32 %sub28 to i64 %cmp29 = icmp slt i64 %indvars.iv.next78, %8 br i1 %cmp29, label %for.body30, label %for.end36.loopexit, !llvm.loop !13 for.end36.loopexit: ; preds = %for.body30 %9 = and i64 %indvars.iv.next78, 4294967295 br label %for.end36 for.end36: ; preds = %entry, %for.cond.preheader, %for.end36.loopexit, %for.cond27.preheader %flag.0.lcssa86 = phi i32 [ %flag.2.us, %for.cond27.preheader ], [ %flag.2.us, %for.end36.loopexit ], [ 0, %for.cond.preheader ], [ 0, %entry ] %i.2.lcssa = phi i64 [ 0, %for.cond27.preheader ], [ %9, %for.end36.loopexit ], [ 0, %for.cond.preheader ], [ 0, %entry ] %arrayidx38 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %i.2.lcssa %10 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10) %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %flag.0.lcssa86) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #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}
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__) #define dpri(x) dbg(#x ": %d\n", x) #define dprs(x) dbg(#x ": %s\n", x) #include <stdio.h> typedef long long ll; const int MYINF = 1e9+7; static int A[128]; int N, swap_count; void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; swap_count++; } void bubble_sort() { int i, j; for (i = 0; i < N; i++) { for (j = N - 1; j > i; j--) { if (A[j] < A[j-1]) swap(A+j, A+j-1); } } } int main(int argc, char **argv) { int i; const char *sp = ""; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d", &A[i]); } bubble_sort(); for (i = 0; i < N; i++) { printf("%s%d", sp, A[i]); sp = " "; } putchar('\n'); printf("%d\n", swap_count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281718/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281718/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @MYINF = dso_local local_unnamed_addr constant i32 1000000007, align 4 @swap_count = dso_local local_unnamed_addr global i32 0, align 4 @N = dso_local global i32 0, align 4 @A = internal global [128 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%s%d\00", align 1 @.str.3 = private unnamed_addr constant [2 x i8] c" \00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr @swap_count, align 4, !tbaa !5 %inc = add nsw i32 %2, 1 store i32 %inc, ptr @swap_count, align 4, !tbaa !5 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @bubble_sort() local_unnamed_addr #1 { entry: %0 = load i32, ptr @N, align 4, !tbaa !5 %cmp32 = icmp sgt i32 %0, 0 br i1 %cmp32, label %for.cond1.preheader.lr.ph, label %for.end12 for.cond1.preheader.lr.ph: ; preds = %entry %swap_count.promoted27 = load i32, ptr @swap_count, align 4, !tbaa !5 %j.022 = add nsw i32 %0, -1 %1 = zext i32 %0 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.022 to i64 %wide.trip.count = zext i32 %0 to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc11 %indvars.iv41 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next42, %for.inc11 ] %swap_count.promoted3133 = phi i32 [ %swap_count.promoted27, %for.cond1.preheader.lr.ph ], [ %swap_count.promoted28, %for.inc11 ] %cmp223 = icmp ult i64 %indvars.iv41, %3 br i1 %cmp223, label %for.body3, label %for.inc11 for.body3: ; preds = %for.cond1.preheader, %for.inc %indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.inc ], [ %1, %for.cond1.preheader ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %2, %for.cond1.preheader ] %swap_count.promoted30 = phi i32 [ %swap_count.promoted29, %for.inc ], [ %swap_count.promoted3133, %for.cond1.preheader ] %inc.i2124 = phi i32 [ %inc.i20, %for.inc ], [ %swap_count.promoted3133, %for.cond1.preheader ] %indvars.iv.next36 = add nsw i64 %indvars.iv35, -1 %arrayidx = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %indvars.iv %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %5 = add nsw i64 %indvars.iv35, -2 %arrayidx6 = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %5 %6 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %cmp7 = icmp slt i32 %4, %6 br i1 %cmp7, label %if.then, label %for.inc if.then: ; preds = %for.body3 %add.ptr10 = getelementptr inbounds i32, ptr %arrayidx, i64 -1 %7 = load i32, ptr %add.ptr10, align 4, !tbaa !5 store i32 %7, ptr %arrayidx, align 4, !tbaa !5 store i32 %4, ptr %add.ptr10, align 4, !tbaa !5 %inc.i = add nsw i32 %inc.i2124, 1 store i32 %inc.i, ptr @swap_count, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body3, %if.then %swap_count.promoted29 = phi i32 [ %swap_count.promoted30, %for.body3 ], [ %inc.i, %if.then ] %inc.i20 = phi i32 [ %inc.i2124, %for.body3 ], [ %inc.i, %if.then ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv41 br i1 %cmp2, label %for.body3, label %for.inc11, !llvm.loop !9 for.inc11: ; preds = %for.inc, %for.cond1.preheader %swap_count.promoted28 = phi i32 [ %swap_count.promoted3133, %for.cond1.preheader ], [ %swap_count.promoted29, %for.inc ] %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1 %exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count br i1 %exitcond.not, label %for.end12, label %for.cond1.preheader, !llvm.loop !11 for.end12: ; preds = %for.inc11, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @N) %0 = load i32, ptr @N, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %0, 0 br i1 %cmp18, label %for.body, label %for.end10 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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 !12 for.end: ; preds = %for.body %cmp32.i = icmp sgt i32 %1, 0 br i1 %cmp32.i, label %for.cond1.preheader.lr.ph.i, label %for.end10 for.cond1.preheader.lr.ph.i: ; preds = %for.end %swap_count.promoted27.i = load i32, ptr @swap_count, align 4, !tbaa !5 %j.022.i = add nsw i32 %1, -1 %3 = zext i32 %1 to i64 %4 = add nsw i64 %3, -1 %5 = zext i32 %j.022.i to i64 br label %for.cond1.preheader.i for.cond1.preheader.i: ; preds = %for.inc11.i, %for.cond1.preheader.lr.ph.i %indvars.iv41.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next42.i, %for.inc11.i ] %swap_count.promoted3133.i = phi i32 [ %swap_count.promoted27.i, %for.cond1.preheader.lr.ph.i ], [ %swap_count.promoted28.i, %for.inc11.i ] %cmp223.i = icmp ult i64 %indvars.iv41.i, %5 br i1 %cmp223.i, label %for.body3.i, label %for.inc11.i for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i %indvars.iv35.i = phi i64 [ %indvars.iv.next36.i, %for.inc.i ], [ %3, %for.cond1.preheader.i ] %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %4, %for.cond1.preheader.i ] %swap_count.promoted30.i = phi i32 [ %swap_count.promoted29.i, %for.inc.i ], [ %swap_count.promoted3133.i, %for.cond1.preheader.i ] %inc.i2124.i = phi i32 [ %inc.i20.i, %for.inc.i ], [ %swap_count.promoted3133.i, %for.cond1.preheader.i ] %indvars.iv.next36.i = add nsw i64 %indvars.iv35.i, -1 %arrayidx.i = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %indvars.iv.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv35.i, -2 %arrayidx6.i = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %7 %8 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5 %cmp7.i = icmp slt i32 %6, %8 br i1 %cmp7.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body3.i %add.ptr10.i = getelementptr inbounds i32, ptr %arrayidx.i, i64 -1 %9 = load i32, ptr %add.ptr10.i, align 4, !tbaa !5 store i32 %9, ptr %arrayidx.i, align 4, !tbaa !5 store i32 %6, ptr %add.ptr10.i, align 4, !tbaa !5 %inc.i.i = add nsw i32 %inc.i2124.i, 1 store i32 %inc.i.i, ptr @swap_count, align 4, !tbaa !5 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body3.i %swap_count.promoted29.i = phi i32 [ %swap_count.promoted30.i, %for.body3.i ], [ %inc.i.i, %if.then.i ] %inc.i20.i = phi i32 [ %inc.i2124.i, %for.body3.i ], [ %inc.i.i, %if.then.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv41.i br i1 %cmp2.i, label %for.body3.i, label %for.inc11.i, !llvm.loop !9 for.inc11.i: ; preds = %for.inc.i, %for.cond1.preheader.i %swap_count.promoted28.i = phi i32 [ %swap_count.promoted3133.i, %for.cond1.preheader.i ], [ %swap_count.promoted29.i, %for.inc.i ] %indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next42.i, %3 br i1 %exitcond.not.i, label %bubble_sort.exit, label %for.cond1.preheader.i, !llvm.loop !11 bubble_sort.exit: ; preds = %for.inc11.i br i1 %cmp32.i, label %for.body4.preheader, label %for.end10 for.body4.preheader: ; preds = %bubble_sort.exit %10 = load i32, ptr @A, align 16, !tbaa !5 %call7.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull @.str, i32 noundef %10) %11 = load i32, ptr @N, align 4, !tbaa !5 %cmp3.peel = icmp sgt i32 %11, 1 br i1 %cmp3.peel, label %for.body4, label %for.end10 for.body4: ; preds = %for.body4.preheader, %for.body4 %indvars.iv25 = phi i64 [ %indvars.iv.next26, %for.body4 ], [ 1, %for.body4.preheader ] %arrayidx6 = getelementptr inbounds [128 x i32], ptr @A, i64 0, i64 %indvars.iv25 %12 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull @.str.3, i32 noundef %12) %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1 %13 = load i32, ptr @N, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp3 = icmp slt i64 %indvars.iv.next26, %14 br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !13 for.end10: ; preds = %for.body4, %entry, %for.end, %for.body4.preheader, %bubble_sort.exit %15 = load ptr, ptr @stdout, align 8, !tbaa !15 %call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %15) %16 = load i32, ptr @swap_count, align 4, !tbaa !5 %call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %16) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #3 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { 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 #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" } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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} !14 = !{!"llvm.loop.peeled.count", i32 1} !15 = !{!16, !16, i64 0} !16 = !{!"any pointer", !7, i64 0}
#include<stdio.h> #include<stdlib.h> #define MAX 100 int main() { int N; int A[MAX]; int temp,i,j,flag=1,count=0; scanf("%d",&N); if( N < 1 || MAX < N ) exit(2); for( i = 0 ; i < N ; i++ ) { scanf("%d",&A[i]); if( A[i] < 0 || MAX < A[i] ) exit(3); } i = 0; while( flag != 0 ) { flag = 0; for( j = N-1 ; j >= i+1 ; j-- ) { if( A[j] < A[j-1] ) { temp = A[j]; A[j] = A[j-1]; A[j-1] = temp; flag = 1; count++; } } i++; } for( i = 0 ; i < N-1 ; i++ ) printf("%d ",A[i]); printf("%d\n%d\n",A[i],count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281761/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281761/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %A = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4 %1 = add i32 %0, -101 %or.cond = icmp ult i32 %1, -100 br i1 %or.cond, label %if.then, label %for.body if.then: ; preds = %entry call void @exit(i32 noundef 2) #5 unreachable for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr %N, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp2, label %for.body, label %while.cond.preheader, !llvm.loop !9 while.cond.preheader: ; preds = %for.cond %4 = icmp sgt i32 %2, 1 br label %for.cond14.preheader for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %5 = load i32, ptr %arrayidx, align 4, !tbaa !5 %or.cond72 = icmp ugt i32 %5, 100 br i1 %or.cond72, label %if.then11, label %for.cond if.then11: ; preds = %for.body call void @exit(i32 noundef 3) #5 unreachable while.cond.loopexit: ; preds = %for.inc36 %cmp13.not = icmp eq i32 %flag.2, 0 br i1 %cmp13.not, label %for.cond39.preheader, label %for.cond14.preheader, !llvm.loop !11 for.cond14.preheader: ; preds = %while.cond.preheader, %while.cond.loopexit %indvars.iv97 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next98, %while.cond.loopexit ] %count.086 = phi i32 [ 0, %while.cond.preheader ], [ %count.2, %while.cond.loopexit ] %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1 %cmp15.not.not77 = icmp slt i64 %indvars.iv.next98, %3 br i1 %cmp15.not.not77, label %for.body16, label %for.cond39.preheader for.cond39.preheader: ; preds = %for.cond14.preheader, %while.cond.loopexit %count.1.lcssa106 = phi i32 [ %count.2, %while.cond.loopexit ], [ %count.086, %for.cond14.preheader ] br i1 %4, label %for.body42, label %for.end48 for.body16: ; preds = %for.cond14.preheader, %for.inc36 %indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.inc36 ], [ %3, %for.cond14.preheader ] %count.180 = phi i32 [ %count.2, %for.inc36 ], [ %count.086, %for.cond14.preheader ] %flag.179 = phi i32 [ %flag.2, %for.inc36 ], [ 0, %for.cond14.preheader ] %indvars.iv.next94 = add nsw i64 %indvars.iv93, -1 %arrayidx18 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next94 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv93, -2 %arrayidx21 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %7 %8 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %cmp22 = icmp slt i32 %6, %8 br i1 %cmp22, label %if.then23, label %for.inc36 if.then23: ; preds = %for.body16 store i32 %8, ptr %arrayidx18, align 4, !tbaa !5 store i32 %6, ptr %arrayidx21, align 4, !tbaa !5 %inc34 = add nsw i32 %count.180, 1 br label %for.inc36 for.inc36: ; preds = %for.body16, %if.then23 %flag.2 = phi i32 [ 1, %if.then23 ], [ %flag.179, %for.body16 ] %count.2 = phi i32 [ %inc34, %if.then23 ], [ %count.180, %for.body16 ] %cmp15.not.not = icmp sgt i64 %indvars.iv.next94, %indvars.iv.next98 br i1 %cmp15.not.not, label %for.body16, label %while.cond.loopexit, !llvm.loop !12 for.body42: ; preds = %for.cond39.preheader, %for.body42 %indvars.iv100 = phi i64 [ %indvars.iv.next101, %for.body42 ], [ 0, %for.cond39.preheader ] %arrayidx44 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv100 %9 = load i32, ptr %arrayidx44, align 4, !tbaa !5 %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1 %10 = load i32, ptr %N, align 4, !tbaa !5 %sub40 = add nsw i32 %10, -1 %11 = sext i32 %sub40 to i64 %cmp41 = icmp slt i64 %indvars.iv.next101, %11 br i1 %cmp41, label %for.body42, label %for.end48.loopexit, !llvm.loop !13 for.end48.loopexit: ; preds = %for.body42 %12 = and i64 %indvars.iv.next101, 4294967295 br label %for.end48 for.end48: ; preds = %for.end48.loopexit, %for.cond39.preheader %i.2.lcssa = phi i64 [ 0, %for.cond39.preheader ], [ %12, %for.end48.loopexit ] %arrayidx50 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %i.2.lcssa %13 = load i32, ptr %arrayidx50, align 4, !tbaa !5 %call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13, i32 noundef %count.1.lcssa106) call void @llvm.lifetime.end.p0(i64 400, 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: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { 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> #define N 100 int main(){ int n, i, j, A[N]; int swap, count=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&A[i]); for(i=0;i<n-1;i++) for(j=n-1;j>i;j--) if(A[j]<A[j-1]){ swap = A[j]; A[j] = A[j-1]; A[j-1] = swap; count++; } printf("%d",A[0]); for(i=1;i<n;i++) printf(" %d",A[i]); printf("\n%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281811/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281811/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end30 for.cond2.preheader: ; preds = %for.body %cmp364 = icmp sgt i32 %3, 1 br i1 %cmp364, label %for.cond6.preheader.preheader, label %for.end30 for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %3, -1 %1 = zext i32 %3 to i64 %2 = add nsw i64 %1, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx10.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %2 br label %for.cond6.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28 %indvars.iv75 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next76, %for.inc28 ] %count.066 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc28 ] %.pre = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5 br label %for.body8 for.body8: ; preds = %for.cond6.preheader, %for.inc26 %5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc26 ] %indvars.iv72 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next73, %for.inc26 ] %count.163 = phi i32 [ %count.066, %for.cond6.preheader ], [ %count.2, %for.inc26 ] %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next73 %6 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp slt i32 %5, %6 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body8 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv72 store i32 %6, ptr %arrayidx10, align 4, !tbaa !5 store i32 %5, ptr %arrayidx13, align 4, !tbaa !5 %inc25 = add nsw i32 %count.163, 1 br label %for.inc26 for.inc26: ; preds = %for.body8, %if.then %7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ] %count.2 = phi i32 [ %inc25, %if.then ], [ %count.163, %for.body8 ] %cmp7 = icmp sgt i64 %indvars.iv.next73, %indvars.iv75 br i1 %cmp7, label %for.body8, label %for.inc28, !llvm.loop !11 for.inc28: ; preds = %for.inc26 %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.end30, label %for.cond6.preheader, !llvm.loop !12 for.end30: ; preds = %for.inc28, %entry, %for.cond2.preheader %count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.2, %for.inc28 ] %8 = load i32, ptr %A, align 16, !tbaa !5 %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) %9 = load i32, ptr %n, align 4, !tbaa !5 %cmp3468 = icmp sgt i32 %9, 1 br i1 %cmp3468, label %for.body35, label %for.end41 for.body35: ; preds = %for.end30, %for.body35 %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body35 ], [ 1, %for.end30 ] %arrayidx37 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv78 %10 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10) %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp34 = icmp slt i64 %indvars.iv.next79, %12 br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13 for.end41: ; preds = %for.body35, %for.end30 %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 400, 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} !13 = distinct !{!13, !10}
#include <stdio.h> #define MAX 100 int main() { int i,j,k=0,a,l; int A[MAX]; scanf("%d",&l); for(i=0;i<l;i++){ scanf("%d",&A[i]); } for(i=0;i<l;i++){ for(j=l-1;j>i;j--){ a=A[j-1]; if(a>A[j]){ A[j-1]=A[j]; A[j]=a; k++; } } printf("%d",A[i]); if(i != l-1){ printf(" "); } } printf("\n%d\n",k); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281855/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281855/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %l = alloca i32, align 4 %A = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l) %0 = load i32, ptr %l, align 4, !tbaa !5 %cmp53 = icmp sgt i32 %0, 0 br i1 %cmp53, label %for.body, label %for.end34 for.cond2.preheader: ; preds = %for.body %cmp360 = icmp sgt i32 %1, 0 br i1 %cmp360, label %for.cond5.preheader, label %for.end34 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %l, 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.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc32 %indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.inc32 ], [ 0, %for.cond2.preheader ] %3 = phi i32 [ %13, %for.inc32 ], [ %1, %for.cond2.preheader ] %k.061 = phi i32 [ %k.1.lcssa, %for.inc32 ], [ 0, %for.cond2.preheader ] %j.055 = add nsw i32 %3, -1 %4 = sext i32 %j.055 to i64 %cmp656 = icmp slt i64 %indvars.iv73, %4 br i1 %cmp656, label %for.body7.preheader, label %for.end23 for.body7.preheader: ; preds = %for.cond5.preheader %5 = sext i32 %3 to i64 %6 = add nsw i64 %5, -1 br label %for.body7 for.body7: ; preds = %for.body7.preheader, %for.inc22 %indvars.iv67 = phi i64 [ %5, %for.body7.preheader ], [ %indvars.iv.next68, %for.inc22 ] %indvars.iv65 = phi i64 [ %6, %for.body7.preheader ], [ %indvars.iv.next66, %for.inc22 ] %k.158 = phi i32 [ %k.061, %for.body7.preheader ], [ %k.2, %for.inc22 ] %indvars.iv.next68 = add nsw i64 %indvars.iv67, -1 %7 = add nsw i64 %indvars.iv67, -2 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %7 %8 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %arrayidx12 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv65 %9 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %cmp13 = icmp sgt i32 %8, %9 br i1 %cmp13, label %if.then, label %for.inc22 if.then: ; preds = %for.body7 store i32 %9, ptr %arrayidx10, align 4, !tbaa !5 store i32 %8, ptr %arrayidx12, align 4, !tbaa !5 %inc21 = add nsw i32 %k.158, 1 br label %for.inc22 for.inc22: ; preds = %for.body7, %if.then %k.2 = phi i32 [ %inc21, %if.then ], [ %k.158, %for.body7 ] %indvars.iv.next66 = add nsw i64 %indvars.iv65, -1 %cmp6 = icmp sgt i64 %indvars.iv.next66, %indvars.iv73 br i1 %cmp6, label %for.body7, label %for.end23, !llvm.loop !11 for.end23: ; preds = %for.inc22, %for.cond5.preheader %k.1.lcssa = phi i32 [ %k.061, %for.cond5.preheader ], [ %k.2, %for.inc22 ] %arrayidx25 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv73 %10 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %11 = load i32, ptr %l, align 4, !tbaa !5 %sub27 = add nsw i32 %11, -1 %12 = zext i32 %sub27 to i64 %cmp28.not = icmp eq i64 %indvars.iv73, %12 br i1 %cmp28.not, label %for.inc32, label %if.then29 if.then29: ; preds = %for.end23 %putchar = call i32 @putchar(i32 32) %.pre = load i32, ptr %l, align 4, !tbaa !5 br label %for.inc32 for.inc32: ; preds = %for.end23, %if.then29 %13 = phi i32 [ %11, %for.end23 ], [ %.pre, %if.then29 ] %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %14 = sext i32 %13 to i64 %cmp3 = icmp slt i64 %indvars.iv.next74, %14 br i1 %cmp3, label %for.cond5.preheader, label %for.end34, !llvm.loop !12 for.end34: ; preds = %for.inc32, %entry, %for.cond2.preheader %k.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %k.1.lcssa, %for.inc32 ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %k.0.lcssa) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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} !12 = distinct !{!12, !10}
#include<stdio.h> int main(void){ int i,j,cnt=0,tmp,N,A[100]; scanf("%d", &N); for(i=0;i<N;i++) scanf("%d",&A[i]); for(i=N;i>0;i--){ for(j=0;j<i-1;j++){ if(A[j]>A[j+1]){ tmp=A[j]; A[j]=A[j+1]; A[j+1]=tmp; cnt++; } } } printf("%d",A[0]); for(i=1;i<N;i++) printf(" %d",A[i]); printf("\n"); printf("%d\n",cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281899/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281899/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.3 = 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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end28 for.cond2.preheader: ; preds = %for.body %cmp367 = icmp sgt i32 %4, 0 br i1 %cmp367, label %for.cond5.preheader.preheader, label %for.end28 for.cond5.preheader.preheader: ; preds = %for.cond2.preheader %1 = add i32 %4, -1 %2 = zext i32 %1 to i64 %3 = sub nsw i64 0, %2 br label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond2.loopexit.unr-lcssa: ; preds = %for.inc24.1, %for.body7.preheader %cnt.2.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %cnt.2.1, %for.inc24.1 ] %.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %13, %for.inc24.1 ] %indvars.iv75.unr = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next76.1, %for.inc24.1 ] %cnt.164.unr = phi i32 [ %cnt.068, %for.body7.preheader ], [ %cnt.2.1, %for.inc24.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond2.loopexit, label %for.body7.epil for.body7.epil: ; preds = %for.cond2.loopexit.unr-lcssa %indvars.iv.next76.epil = add nuw nsw i64 %indvars.iv75.unr, 1 %arrayidx11.epil = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next76.epil %6 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5 %cmp12.epil = icmp sgt i32 %.unr, %6 br i1 %cmp12.epil, label %if.then.epil, label %for.cond2.loopexit if.then.epil: ; preds = %for.body7.epil %arrayidx9.epil = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv75.unr store i32 %6, ptr %arrayidx9.epil, align 4, !tbaa !5 store i32 %.unr, ptr %arrayidx11.epil, align 4, !tbaa !5 %inc23.epil = add nsw i32 %cnt.164.unr, 1 br label %for.cond2.loopexit for.cond2.loopexit: ; preds = %for.body7.epil, %if.then.epil, %for.cond2.loopexit.unr-lcssa %cnt.2.lcssa = phi i32 [ %cnt.2.lcssa.ph, %for.cond2.loopexit.unr-lcssa ], [ %inc23.epil, %if.then.epil ], [ %cnt.164.unr, %for.body7.epil ] %indvars.iv.next81 = add i64 %indvars.iv80, -1 %indvar.next = add i64 %indvar, 1 br i1 %cmp662, label %for.cond5.preheader, label %for.end28, !llvm.loop !11 for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.cond2.loopexit %indvar = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %indvar.next, %for.cond2.loopexit ] %indvars.iv80 = phi i64 [ %2, %for.cond5.preheader.preheader ], [ %indvars.iv.next81, %for.cond2.loopexit ] %i.169 = phi i32 [ %4, %for.cond5.preheader.preheader ], [ %sub, %for.cond2.loopexit ] %cnt.068 = phi i32 [ 0, %for.cond5.preheader.preheader ], [ %cnt.2.lcssa, %for.cond2.loopexit ] %sub = add nsw i32 %i.169, -1 %cmp662 = icmp ugt i32 %i.169, 1 br i1 %cmp662, label %for.body7.preheader, label %for.end28 for.body7.preheader: ; preds = %for.cond5.preheader %.pre = load i32, ptr %A, align 16, !tbaa !5 %xtraiter = and i64 %indvars.iv80, 1 %7 = xor i64 %indvar, %3 %8 = icmp eq i64 %7, -1 br i1 %8, label %for.cond2.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %indvars.iv80, -2 br label %for.body7 for.body7: ; preds = %for.inc24.1, %for.body7.preheader.new %9 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %13, %for.inc24.1 ] %indvars.iv75 = phi i64 [ 0, %for.body7.preheader.new ], [ %indvars.iv.next76.1, %for.inc24.1 ] %cnt.164 = phi i32 [ %cnt.068, %for.body7.preheader.new ], [ %cnt.2.1, %for.inc24.1 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.inc24.1 ] %indvars.iv.next76 = or i64 %indvars.iv75, 1 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next76 %10 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %9, %10 br i1 %cmp12, label %if.then, label %for.inc24 if.then: ; preds = %for.body7 %arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv75 store i32 %10, ptr %arrayidx9, align 8, !tbaa !5 store i32 %9, ptr %arrayidx11, align 4, !tbaa !5 %inc23 = add nsw i32 %cnt.164, 1 br label %for.inc24 for.inc24: ; preds = %for.body7, %if.then %11 = phi i32 [ %9, %if.then ], [ %10, %for.body7 ] %cnt.2 = phi i32 [ %inc23, %if.then ], [ %cnt.164, %for.body7 ] %indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2 %arrayidx11.1 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next76.1 %12 = load i32, ptr %arrayidx11.1, align 8, !tbaa !5 %cmp12.1 = icmp sgt i32 %11, %12 br i1 %cmp12.1, label %if.then.1, label %for.inc24.1 if.then.1: ; preds = %for.inc24 %arrayidx9.1 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next76 store i32 %12, ptr %arrayidx9.1, align 4, !tbaa !5 store i32 %11, ptr %arrayidx11.1, align 8, !tbaa !5 %inc23.1 = add nsw i32 %cnt.2, 1 br label %for.inc24.1 for.inc24.1: ; preds = %if.then.1, %for.inc24 %13 = phi i32 [ %11, %if.then.1 ], [ %12, %for.inc24 ] %cnt.2.1 = phi i32 [ %inc23.1, %if.then.1 ], [ %cnt.2, %for.inc24 ] %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.cond2.loopexit.unr-lcssa, label %for.body7, !llvm.loop !12 for.end28: ; preds = %for.cond2.loopexit, %for.cond5.preheader, %entry, %for.cond2.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %cnt.068, %for.cond5.preheader ], [ %cnt.2.lcssa, %for.cond2.loopexit ] %14 = load i32, ptr %A, align 16, !tbaa !5 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14) %15 = load i32, ptr %N, align 4, !tbaa !5 %cmp3271 = icmp sgt i32 %15, 1 br i1 %cmp3271, label %for.body33, label %for.end39 for.body33: ; preds = %for.end28, %for.body33 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body33 ], [ 1, %for.end28 ] %arrayidx35 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv83 %16 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16) %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %17 = load i32, ptr %N, align 4, !tbaa !5 %18 = sext i32 %17 to i64 %cmp32 = icmp slt i64 %indvars.iv.next84, %18 br i1 %cmp32, label %for.body33, label %for.end39, !llvm.loop !13 for.end39: ; preds = %for.body33, %for.end28 %putchar = call i32 @putchar(i32 10) %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !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 A[100], tmp, N, i, j; int cnt = 0; scanf("%d", &N); for (i=0; i<N; i++) { scanf("%d", &A[i]); } for (i=0; i<N-1; i++) { for (j=0; j<N-i-1; j++) { if (A[j] > A[j+1]) { tmp = A[j]; A[j] = A[j+1]; A[j+1] = tmp; cnt++; } } } for (j=0; j<N-1; j++) { printf("%d ", A[j]); } printf("%d\n%d\n", A[N-1], cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281941/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281941/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca [100 x i32], align 16 %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3 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 %cmp63 = icmp sgt i32 %0, 0 br i1 %cmp63, label %for.body, label %for.cond2.preheader.thread for.cond2.preheader.thread: ; preds = %entry %sub90 = add i32 %0, -1 br label %for.cond32.preheader.for.end41_crit_edge for.cond2.preheader: ; preds = %for.body %sub = add i32 %1, -1 %cmp369 = icmp sgt i32 %1, 1 br i1 %cmp369, label %for.cond5.preheader, label %for.cond32.preheader.for.end41_crit_edge for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc29 %indvars.iv83 = phi i32 [ %indvars.iv.next84, %for.inc29 ], [ %sub, %for.cond2.preheader ] %cnt.071 = phi i32 [ %cnt.1.lcssa, %for.inc29 ], [ 0, %for.cond2.preheader ] %i.170 = phi i32 [ %inc30, %for.inc29 ], [ 0, %for.cond2.preheader ] %3 = zext i32 %indvars.iv83 to i64 %4 = xor i32 %i.170, -1 %sub7 = add i32 %1, %4 %cmp865 = icmp sgt i32 %sub7, 0 br i1 %cmp865, label %for.body9.preheader, label %for.inc29 for.body9.preheader: ; preds = %for.cond5.preheader %.pre = load i32, ptr %A, align 16, !tbaa !5 %xtraiter = and i64 %3, 1 %5 = icmp eq i32 %indvars.iv83, 1 br i1 %5, label %for.inc29.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %3, 4294967294 br label %for.body9 for.cond32.preheader: ; preds = %for.inc29 br i1 %cmp369, label %for.body35, label %for.cond32.preheader.for.end41_crit_edge for.cond32.preheader.for.end41_crit_edge: ; preds = %for.cond2.preheader.thread, %for.cond2.preheader, %for.cond32.preheader %cnt.0.lcssa99 = phi i32 [ %cnt.1.lcssa, %for.cond32.preheader ], [ 0, %for.cond2.preheader ], [ 0, %for.cond2.preheader.thread ] %sub9297 = phi i32 [ %sub, %for.cond32.preheader ], [ %sub, %for.cond2.preheader ], [ %sub90, %for.cond2.preheader.thread ] %.pre89 = sext i32 %sub9297 to i64 br label %for.end41 for.body9: ; preds = %for.inc26.1, %for.body9.preheader.new %6 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %10, %for.inc26.1 ] %indvars.iv80 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next81.1, %for.inc26.1 ] %cnt.167 = phi i32 [ %cnt.071, %for.body9.preheader.new ], [ %cnt.2.1, %for.inc26.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc26.1 ] %indvars.iv.next81 = or i64 %indvars.iv80, 1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next81 %7 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp sgt i32 %6, %7 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body9 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv80 store i32 %7, ptr %arrayidx11, align 8, !tbaa !5 store i32 %6, ptr %arrayidx13, align 4, !tbaa !5 %inc25 = add nsw i32 %cnt.167, 1 br label %for.inc26 for.inc26: ; preds = %for.body9, %if.then %8 = phi i32 [ %6, %if.then ], [ %7, %for.body9 ] %cnt.2 = phi i32 [ %inc25, %if.then ], [ %cnt.167, %for.body9 ] %indvars.iv.next81.1 = add nuw nsw i64 %indvars.iv80, 2 %arrayidx13.1 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next81.1 %9 = load i32, ptr %arrayidx13.1, align 8, !tbaa !5 %cmp14.1 = icmp sgt i32 %8, %9 br i1 %cmp14.1, label %if.then.1, label %for.inc26.1 if.then.1: ; preds = %for.inc26 %arrayidx11.1 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next81 store i32 %9, ptr %arrayidx11.1, align 4, !tbaa !5 store i32 %8, ptr %arrayidx13.1, align 8, !tbaa !5 %inc25.1 = add nsw i32 %cnt.2, 1 br label %for.inc26.1 for.inc26.1: ; preds = %if.then.1, %for.inc26 %10 = phi i32 [ %8, %if.then.1 ], [ %9, %for.inc26 ] %cnt.2.1 = phi i32 [ %inc25.1, %if.then.1 ], [ %cnt.2, %for.inc26 ] %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.inc29.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11 for.inc29.loopexit.unr-lcssa: ; preds = %for.inc26.1, %for.body9.preheader %cnt.2.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %cnt.2.1, %for.inc26.1 ] %.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %10, %for.inc26.1 ] %indvars.iv80.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next81.1, %for.inc26.1 ] %cnt.167.unr = phi i32 [ %cnt.071, %for.body9.preheader ], [ %cnt.2.1, %for.inc26.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.inc29, label %for.body9.epil for.body9.epil: ; preds = %for.inc29.loopexit.unr-lcssa %indvars.iv.next81.epil = add nuw nsw i64 %indvars.iv80.unr, 1 %arrayidx13.epil = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next81.epil %11 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5 %cmp14.epil = icmp sgt i32 %.unr, %11 br i1 %cmp14.epil, label %if.then.epil, label %for.inc29 if.then.epil: ; preds = %for.body9.epil %arrayidx11.epil = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv80.unr store i32 %11, ptr %arrayidx11.epil, align 4, !tbaa !5 store i32 %.unr, ptr %arrayidx13.epil, align 4, !tbaa !5 %inc25.epil = add nsw i32 %cnt.167.unr, 1 br label %for.inc29 for.inc29: ; preds = %for.inc29.loopexit.unr-lcssa, %if.then.epil, %for.body9.epil, %for.cond5.preheader %cnt.1.lcssa = phi i32 [ %cnt.071, %for.cond5.preheader ], [ %cnt.2.lcssa.ph, %for.inc29.loopexit.unr-lcssa ], [ %inc25.epil, %if.then.epil ], [ %cnt.167.unr, %for.body9.epil ] %inc30 = add nuw nsw i32 %i.170, 1 %indvars.iv.next84 = add i32 %indvars.iv83, -1 %exitcond85.not = icmp eq i32 %inc30, %sub br i1 %exitcond85.not, label %for.cond32.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body35: ; preds = %for.cond32.preheader, %for.body35 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body35 ], [ 0, %for.cond32.preheader ] %arrayidx37 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv86 %12 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %13 = load i32, ptr %N, align 4, !tbaa !5 %sub33 = add nsw i32 %13, -1 %14 = sext i32 %sub33 to i64 %cmp34 = icmp slt i64 %indvars.iv.next87, %14 br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13 for.end41: ; preds = %for.body35, %for.cond32.preheader.for.end41_crit_edge %cnt.0.lcssa98 = phi i32 [ %cnt.0.lcssa99, %for.cond32.preheader.for.end41_crit_edge ], [ %cnt.1.lcssa, %for.body35 ] %idxprom43.pre-phi = phi i64 [ %.pre89, %for.cond32.preheader.for.end41_crit_edge ], [ %14, %for.body35 ] %arrayidx44 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom43.pre-phi %15 = load i32, ptr %arrayidx44, align 4, !tbaa !5 %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15, i32 noundef %cnt.0.lcssa98) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int main(void){ int n, i, j, flag, count, temp, a[100]; scanf("%d", &n); for(i=0; i<n; i++) scanf("%d", &a[i]); flag = 1; i = 0; count = 0; while(flag){ flag = 0; for(j=n-1;j>i;j--){ if(a[j] < a[j-1]){ temp = a[j]; a[j] = a[j-1]; a[j-1] = temp; count++; flag = 1; } } i++; } for(i=0; i<n; i++){ if(i != n-1){ printf("%d ", a[i]); }else{ printf("%d\n", a[i]); } } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281985/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281985/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3 %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 %entry.while.cond.preheader_crit_edge entry.while.cond.preheader_crit_edge: ; preds = %entry %.pre = sext i32 %0 to i64 br label %while.cond.preheader while.cond.preheader: ; preds = %for.body, %entry.while.cond.preheader_crit_edge %.pre-phi = phi i64 [ %.pre, %entry.while.cond.preheader_crit_edge ], [ %5, %for.body ] %1 = phi i32 [ %0, %entry.while.cond.preheader_crit_edge ], [ %4, %for.body ] %j.063 = add nsw i32 %1, -1 %2 = add nsw i64 %.pre-phi, -1 %3 = sext i32 %j.063 to i64 br label %for.cond2.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !9 for.cond2.preheader: ; preds = %while.cond.preheader, %for.end23 %indvars.iv85 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next86, %for.end23 ] %count.071 = phi i32 [ 0, %while.cond.preheader ], [ %count.2, %for.end23 ] %cmp364 = icmp slt i64 %indvars.iv85, %3 br i1 %cmp364, label %for.body4, label %for.cond25.preheader for.cond25.preheader: ; preds = %for.cond2.preheader, %for.end23 %count.1.lcssa95 = phi i32 [ %count.2, %for.end23 ], [ %count.071, %for.cond2.preheader ] %cmp2673 = icmp sgt i32 %1, 0 br i1 %cmp2673, label %for.body27, label %for.end40 for.body4: ; preds = %for.cond2.preheader, %for.inc22 %indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.inc22 ], [ %.pre-phi, %for.cond2.preheader ] %indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.inc22 ], [ %2, %for.cond2.preheader ] %count.167 = phi i32 [ %count.2, %for.inc22 ], [ %count.071, %for.cond2.preheader ] %flag.166 = phi i32 [ %flag.2, %for.inc22 ], [ 0, %for.cond2.preheader ] %indvars.iv.next80 = add nsw i64 %indvars.iv79, -1 %arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv77 %6 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv79, -2 %arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %7 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp slt i32 %6, %8 br i1 %cmp10, label %if.then, label %for.inc22 if.then: ; preds = %for.body4 store i32 %8, ptr %arrayidx6, align 4, !tbaa !5 store i32 %6, ptr %arrayidx9, align 4, !tbaa !5 %inc21 = add nsw i32 %count.167, 1 br label %for.inc22 for.inc22: ; preds = %for.body4, %if.then %flag.2 = phi i32 [ 1, %if.then ], [ %flag.166, %for.body4 ] %count.2 = phi i32 [ %inc21, %if.then ], [ %count.167, %for.body4 ] %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1 %cmp3 = icmp sgt i64 %indvars.iv.next78, %indvars.iv85 br i1 %cmp3, label %for.body4, label %for.end23, !llvm.loop !11 for.end23: ; preds = %for.inc22 %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1 %tobool.not = icmp eq i32 %flag.2, 0 br i1 %tobool.not, label %for.cond25.preheader, label %for.cond2.preheader, !llvm.loop !12 for.body27: ; preds = %for.cond25.preheader, %for.body27 %indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.body27 ], [ 0, %for.cond25.preheader ] %9 = phi i32 [ %12, %for.body27 ], [ %1, %for.cond25.preheader ] %sub28 = add nsw i32 %9, -1 %10 = zext i32 %sub28 to i64 %cmp29.not = icmp eq i64 %indvars.iv88, %10 %arrayidx35 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv88 %11 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %.str.2..str.1 = select i1 %cmp29.not, ptr @.str.2, ptr @.str.1 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1, i32 noundef %11) %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1 %12 = load i32, ptr %n, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp26 = icmp slt i64 %indvars.iv.next89, %13 br i1 %cmp26, label %for.body27, label %for.end40, !llvm.loop !13 for.end40: ; preds = %for.body27, %for.cond25.preheader %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.1.lcssa95) call void @llvm.lifetime.end.p0(i64 400, 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} !13 = distinct !{!13, !10}
#include<stdio.h> #define N 100 int main(){ int n, flag=0, i, j; int A[N+1]; int key; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); for(j=2; j<=n; j++){ key = A[j]; i = j-1; while(i>0 && A[i]>key){ A[i+1] = A[i]; i = i-1; A[i+1] = key; flag++; } } for(i=1; i<=n; i++){ if(i>1) printf(" "); printf("%d",A[i]); } printf("\n%d\n",flag); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282027/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282027/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [101 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not53 = icmp slt i32 %0, 1 br i1 %cmp.not53, label %for.end33, label %for.body for.cond2.preheader: ; preds = %for.body %cmp3.not59 = icmp slt i32 %2, 2 br i1 %cmp3.not59, label %for.cond23.preheader, label %for.body4.preheader for.body4.preheader: ; preds = %for.cond2.preheader %1 = add nuw i32 %2, 1 %wide.trip.count = zext i32 %1 to i64 br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [101 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 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond23.preheader: ; preds = %for.inc20, %for.cond2.preheader %flag.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %flag.1.lcssa, %for.inc20 ] %cmp24.not63 = icmp slt i32 %2, 1 br i1 %cmp24.not63, label %for.end33, label %if.end.peel if.end.peel: ; preds = %for.cond23.preheader %arrayidx29.peel.phi.trans.insert = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 1 %.pre = load i32, ptr %arrayidx29.peel.phi.trans.insert, align 4, !tbaa !5 %call30.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp24.not.not.peel = icmp sgt i32 %4, 1 br i1 %cmp24.not.not.peel, label %if.end, label %for.end33 for.body4: ; preds = %for.body4.preheader, %for.inc20 %indvars.iv71 = phi i32 [ 1, %for.body4.preheader ], [ %indvars.iv.next72, %for.inc20 ] %indvars.iv67 = phi i64 [ 2, %for.body4.preheader ], [ %indvars.iv.next68, %for.inc20 ] %flag.061 = phi i32 [ 0, %for.body4.preheader ], [ %flag.1.lcssa, %for.inc20 ] %arrayidx6 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv67 %5 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %6 = add i32 %flag.061, %indvars.iv71 br label %land.rhs land.rhs: ; preds = %for.body4, %while.body %indvars.iv69 = phi i64 [ %indvars.iv67, %for.body4 ], [ %indvars.iv.next70, %while.body ] %flag.157 = phi i32 [ %flag.061, %for.body4 ], [ %inc19, %while.body ] %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1 %idxprom8 = and i64 %indvars.iv.next70, 4294967295 %arrayidx9 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom8 %7 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp sgt i32 %7, %5 br i1 %cmp10, label %while.body, label %for.inc20 while.body: ; preds = %land.rhs %arrayidx14 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv69 store i32 %7, ptr %arrayidx14, align 4, !tbaa !5 store i32 %5, ptr %arrayidx9, align 4, !tbaa !5 %inc19 = add i32 %flag.157, 1 %exitcond.not = icmp eq i32 %inc19, %6 br i1 %exitcond.not, label %for.inc20, label %land.rhs, !llvm.loop !11 for.inc20: ; preds = %land.rhs, %while.body %flag.1.lcssa = phi i32 [ %flag.157, %land.rhs ], [ %6, %while.body ] %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %indvars.iv.next72 = add nuw nsw i32 %indvars.iv71, 1 %exitcond76.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count br i1 %exitcond76.not, label %for.cond23.preheader, label %for.body4, !llvm.loop !12 if.end: ; preds = %if.end.peel, %if.end %indvars.iv77 = phi i64 [ %indvars.iv.next78, %if.end ], [ 2, %if.end.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx29 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv77 %8 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1 %9 = load i32, ptr %n, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp24.not.not = icmp slt i64 %indvars.iv77, %10 br i1 %cmp24.not.not, label %if.end, label %for.end33, !llvm.loop !13 for.end33: ; preds = %if.end, %entry, %if.end.peel, %for.cond23.preheader %flag.0.lcssa85 = phi i32 [ %flag.0.lcssa, %for.cond23.preheader ], [ %flag.0.lcssa, %if.end.peel ], [ 0, %entry ], [ %flag.0.lcssa, %if.end ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %flag.0.lcssa85) call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main() { int a[100]; int n, temp, flag = 1, count = 0; int i, j; scanf("%d", &n); for(i = 0; i < n; i++) scanf("%d", &a[i]); while(flag == 1) { flag = 0; for(j = n - 1; j > 0; j--){ if(a[j] < a[j-1]) { temp = a[j]; a[j] = a[j-1]; a[j-1] = temp; flag = 1; count++; } } } for(i = 0; i < n; i++) { printf("%d", a[i]); if(i < n - 1) printf(" "); } printf("\n"); printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282070/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282070/source.c" target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [100 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #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 %cmp57 = icmp sgt i32 %0, 0 br i1 %cmp57, label %for.body, label %for.end38 while.cond.preheader: ; preds = %for.body %cmp460 = icmp sgt i32 %4, 1 br i1 %cmp460, label %for.cond3.preheader.us.preheader, label %for.cond25.preheader for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body5.us for.body5.us: ; preds = %for.body5.us.backedge, %for.cond3.preheader.us.preheader %indvars.iv72 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv72.be, %for.body5.us.backedge ] %count.162.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %count.2.us, %for.body5.us.backedge ] %flag.161.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %flag.161.us.be, %for.body5.us.backedge ] %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1 %idxprom6.us = and i64 %indvars.iv.next73, 4294967295 %arrayidx7.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom6.us %2 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5 %sub8.us = add i64 %indvars.iv72, 4294967294 %idxprom9.us = and i64 %sub8.us, 4294967295 %arrayidx10.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom9.us %3 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5 %cmp11.us = icmp slt i32 %2, %3 br i1 %cmp11.us, label %if.then.us, label %for.inc23.us if.then.us: ; preds = %for.body5.us store i32 %3, ptr %arrayidx7.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5 %inc22.us = add nsw i32 %count.162.us, 1 br label %for.inc23.us for.inc23.us: ; preds = %if.then.us, %for.body5.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.161.us, %for.body5.us ] %count.2.us = phi i32 [ %inc22.us, %if.then.us ], [ %count.162.us, %for.body5.us ] %cmp4.us = icmp sgt i64 %indvars.iv72, 2 br i1 %cmp4.us, label %for.body5.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us for.body5.us.backedge: ; preds = %for.inc23.us, %for.cond3.while.cond.loopexit_crit_edge.us %indvars.iv72.be = phi i64 [ %indvars.iv.next73, %for.inc23.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ] %flag.161.us.be = phi i32 [ %flag.2.us, %for.inc23.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ] br label %for.body5.us, !llvm.loop !9 for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc23.us %cmp2.us = icmp eq i32 %flag.2.us, 1 br i1 %cmp2.us, label %for.body5.us.backedge, label %for.cond25.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond25.preheader: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %count.2.us, %for.cond3.while.cond.loopexit_crit_edge.us ] %cmp2668 = icmp sgt i32 %4, 0 br i1 %cmp2668, label %for.body27, label %for.end38 for.body27: ; preds = %for.cond25.preheader, %for.inc36 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc36 ], [ 0, %for.cond25.preheader ] %arrayidx29 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv75 %6 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %7 = load i32, ptr %n, align 4, !tbaa !5 %sub31 = add nsw i32 %7, -1 %8 = sext i32 %sub31 to i64 %cmp32 = icmp slt i64 %indvars.iv75, %8 br i1 %cmp32, label %if.then33, label %for.inc36 if.then33: ; preds = %for.body27 %putchar56 = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc36 for.inc36: ; preds = %for.body27, %if.then33 %9 = phi i32 [ %7, %for.body27 ], [ %.pre, %if.then33 ] %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %10 = sext i32 %9 to i64 %cmp26 = icmp slt i64 %indvars.iv.next76, %10 br i1 %cmp26, label %for.body27, label %for.end38, !llvm.loop !12 for.end38: ; preds = %for.inc36, %entry, %for.cond25.preheader %.us-phi82 = phi i32 [ %.us-phi, %for.cond25.preheader ], [ 0, %entry ], [ %.us-phi, %for.inc36 ] %putchar = call i32 @putchar(i32 10) %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi82) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 400, 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: 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} !12 = distinct !{!12, !10}
#include<stdio.h> #define N 100 void swap(int *x, int *y); int main(){ int n,i,j,count=0,a[N]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n-1;i++){ for(j=n-1;j>=i+1;j--){ if(a[j]<a[j-1]){ swap(a+j,a+(j-1)); count++; } } } for(i=0;i<n-1;i++){ printf("%d ",a[i]); } printf("%d\n",a[n-1]); printf("%d\n",count); return 0; } void swap(int *x,int *y){ int z; z= *x; *x=*y; *y=z; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282113/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282113/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.cond2.preheader.thread for.cond2.preheader.thread: ; preds = %entry %sub79 = add i32 %0, -1 br label %for.cond25.preheader.for.end34_crit_edge for.cond2.preheader: ; preds = %for.body %sub = add i32 %3, -1 %cmp358 = icmp sgt i32 %3, 1 br i1 %cmp358, label %for.cond6.preheader.preheader, label %for.cond25.preheader.for.end34_crit_edge for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %1 = zext i32 %3 to i64 %2 = add nsw i64 %1, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx10.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %2 br label %for.cond6.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc22 %indvars.iv72 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next73, %for.inc22 ] %count.060 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc22 ] %.pre = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5 br label %for.body8 for.cond25.preheader: ; preds = %for.inc22 br i1 %cmp358, label %for.body28, label %for.cond25.preheader.for.end34_crit_edge for.cond25.preheader.for.end34_crit_edge: ; preds = %for.cond2.preheader.thread, %for.cond2.preheader, %for.cond25.preheader %count.0.lcssa88 = phi i32 [ %count.2, %for.cond25.preheader ], [ 0, %for.cond2.preheader ], [ 0, %for.cond2.preheader.thread ] %sub8186 = phi i32 [ %sub, %for.cond25.preheader ], [ %sub, %for.cond2.preheader ], [ %sub79, %for.cond2.preheader.thread ] %.pre78 = sext i32 %sub8186 to i64 br label %for.end34 for.body8: ; preds = %for.cond6.preheader, %for.inc20 %5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %8, %for.inc20 ] %indvars.iv69 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next70, %for.inc20 ] %count.157 = phi i32 [ %count.060, %for.cond6.preheader ], [ %count.2, %for.inc20 ] %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next70 %6 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp slt i32 %5, %6 br i1 %cmp14, label %if.then, label %for.inc20 if.then: ; preds = %for.body8 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv69 %7 = load i32, ptr %arrayidx10, align 4, !tbaa !5 store i32 %6, ptr %arrayidx10, align 4, !tbaa !5 store i32 %7, ptr %arrayidx13, align 4, !tbaa !5 %inc19 = add nsw i32 %count.157, 1 br label %for.inc20 for.inc20: ; preds = %for.body8, %if.then %8 = phi i32 [ %7, %if.then ], [ %6, %for.body8 ] %count.2 = phi i32 [ %inc19, %if.then ], [ %count.157, %for.body8 ] %cmp7.not.not = icmp sgt i64 %indvars.iv.next70, %indvars.iv72 br i1 %cmp7.not.not, label %for.body8, label %for.inc22, !llvm.loop !11 for.inc22: ; preds = %for.inc20 %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count br i1 %exitcond.not, label %for.cond25.preheader, label %for.cond6.preheader, !llvm.loop !12 for.body28: ; preds = %for.cond25.preheader, %for.body28 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body28 ], [ 0, %for.cond25.preheader ] %arrayidx30 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv75 %9 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %sub26 = add nsw i32 %10, -1 %11 = sext i32 %sub26 to i64 %cmp27 = icmp slt i64 %indvars.iv.next76, %11 br i1 %cmp27, label %for.body28, label %for.end34, !llvm.loop !13 for.end34: ; preds = %for.body28, %for.cond25.preheader.for.end34_crit_edge %count.0.lcssa87 = phi i32 [ %count.0.lcssa88, %for.cond25.preheader.for.end34_crit_edge ], [ %count.2, %for.body28 ] %idxprom36.pre-phi = phi i64 [ %.pre78, %for.cond25.preheader.for.end34_crit_edge ], [ %11, %for.body28 ] %arrayidx37 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom36.pre-phi %12 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12) %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa87) call void @llvm.lifetime.end.p0(i64 400, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #3 { entry: %0 = load i32, ptr %x, align 4, !tbaa !5 %1 = load i32, ptr %y, align 4, !tbaa !5 store i32 %1, ptr %x, align 4, !tbaa !5 store i32 %0, ptr %y, align 4, !tbaa !5 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 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(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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> void output(int *,int ); int main(){ int i,j,n,han=1,hozon,cnt=0; scanf("%d",&n); int hai[n]; for(i=0;i<n;i++) scanf("%d",&hai[i]); while(han){ han=0; for(j=n-1;j>0;j--){ if(hai[j]<hai[j-1]){ hozon=hai[j-1]; hai[j-1]=hai[j]; hai[j]=hozon; han=1; cnt+=1; } } } output(hai,n); printf("%d\n",cnt); return 0; } void output(int *hai,int n){ int i,j; for(i=0;i<n;i++){ printf("%d",hai[i]); if(i==n-1) printf("\n"); else printf(" "); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282157/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282157/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %cmp35 = icmp sgt i32 %3, 0 br i1 %cmp35, label %for.body, label %output.exit while.cond.preheader: ; preds = %for.body %cmp338 = icmp sgt i32 %7, 1 br i1 %cmp338, label %for.cond2.preheader.us.preheader, label %while.end for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader %4 = zext i32 %7 to i64 br label %for.body4.us for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader %indvars.iv48 = phi i64 [ %4, %for.cond2.preheader.us.preheader ], [ %indvars.iv48.be, %for.body4.us.backedge ] %cnt.141.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %cnt.2.us, %for.body4.us.backedge ] %han.139.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %han.139.us.be, %for.body4.us.backedge ] %indvars.iv.next49 = add nsw i64 %indvars.iv48, -1 %idxprom5.us = and i64 %indvars.iv.next49, 4294967295 %arrayidx6.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom5.us %5 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5 %sub7.us = add i64 %indvars.iv48, 4294967294 %idxprom8.us = and i64 %sub7.us, 4294967295 %arrayidx9.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom8.us %6 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp slt i32 %5, %6 br i1 %cmp10.us, label %if.then.us, label %for.inc21.us if.then.us: ; preds = %for.body4.us store i32 %5, ptr %arrayidx9.us, align 4, !tbaa !5 store i32 %6, ptr %arrayidx6.us, align 4, !tbaa !5 %add.us = add nsw i32 %cnt.141.us, 1 br label %for.inc21.us for.inc21.us: ; preds = %if.then.us, %for.body4.us %han.2.us = phi i32 [ 1, %if.then.us ], [ %han.139.us, %for.body4.us ] %cnt.2.us = phi i32 [ %add.us, %if.then.us ], [ %cnt.141.us, %for.body4.us ] %cmp3.us = icmp sgt i64 %indvars.iv48, 2 br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us for.body4.us.backedge: ; preds = %for.inc21.us, %for.cond2.while.cond.loopexit_crit_edge.us %indvars.iv48.be = phi i64 [ %indvars.iv.next49, %for.inc21.us ], [ %4, %for.cond2.while.cond.loopexit_crit_edge.us ] %han.139.us.be = phi i32 [ %han.2.us, %for.inc21.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ] br label %for.body4.us, !llvm.loop !9 for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc21.us %tobool.not.us = icmp eq i32 %han.2.us, 0 br i1 %tobool.not.us, label %while.end, label %for.body4.us.backedge 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 %7 = load i32, ptr %n, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp = icmp slt i64 %indvars.iv.next, %8 br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11 while.end: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %cnt.2.us, %for.cond2.while.cond.loopexit_crit_edge.us ] %cmp9.i = icmp sgt i32 %7, 0 br i1 %cmp9.i, label %for.body.lr.ph.i, label %output.exit for.body.lr.ph.i: ; preds = %while.end %sub.i = add nsw i32 %7, -1 %9 = zext i32 %sub.i to i64 %wide.trip.count.i = zext i32 %7 to i64 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i %indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ] %arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i %10 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %cmp1.i = icmp eq i64 %indvars.iv.i, %9 %..i = select i1 %cmp1.i, i32 10, i32 32 %putchar8.i = call i32 @putchar(i32 %..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 %output.exit, label %for.body.i, !llvm.loop !12 output.exit: ; preds = %for.body.i, %entry, %while.end %.us-phi57 = phi i32 [ %.us-phi, %while.end ], [ 0, %entry ], [ %.us-phi, %for.body.i ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi57) 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: nofree nounwind uwtable define dso_local void @output(ptr nocapture noundef readonly %hai, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp9 = icmp sgt i32 %n, 0 br i1 %cmp9, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %entry %sub = add nsw i32 %n, -1 %0 = zext i32 %sub to i64 %wide.trip.count = zext i32 %n to i64 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.body %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds i32, ptr %hai, i64 %indvars.iv %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %cmp1 = icmp eq i64 %indvars.iv, %0 %. = select i1 %cmp1, i32 10, i32 32 %putchar8 = tail call i32 @putchar(i32 %.) %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 !12 for.end: ; preds = %for.body, %entry 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 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int main() { int t,l,r; scanf("%d",&t); while(t--) { scanf("%d%d",&l,&r); printf("%d %d\n",l,2*l); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28220/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28220/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %l = alloca i32, align 4 %r = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec3 = add nsw i32 %0, -1 store i32 %dec3, ptr %t, align 4, !tbaa !5 %tobool.not4 = icmp eq i32 %0, 0 br i1 %tobool.not4, 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 %l, ptr noundef nonnull %r) %1 = load i32, ptr %l, align 4, !tbaa !5 %mul = shl nsw i32 %1, 1 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %mul) %2 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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: 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"}
#include <stdio.h> void swap(int *,int *); int main(void){ int i,n; int count=0,flag; int a[100]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } flag=1; while(flag){ flag=0; for(i=n-1;i>0;i--){ if(a[i]<a[i-1]){ swap(&a[i],&a[i-1]); flag=1; count++; } } } for(i=0;i<n;i++){ printf("%d",a[i]); if(i<n-1) printf(" "); } printf("\n"); printf("%d\n",count); return 0; } void swap(int *px,int *py){ int tmp=*px; *px=*py; *py=tmp; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282243/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282243/source.c" target datalayout = "e-m:e-p270: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.3 = 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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp49 = icmp sgt i32 %0, 0 br i1 %cmp49, label %for.body, label %for.end32 while.cond.preheader: ; preds = %for.body %cmp352 = icmp sgt i32 %4, 1 br i1 %cmp352, label %for.cond2.preheader.us.preheader, label %for.cond19.preheader for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body4.us for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader %indvars.iv64 = phi i64 [ %1, %for.cond2.preheader.us.preheader ], [ %indvars.iv64.be, %for.body4.us.backedge ] %flag.155.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %flag.155.us.be, %for.body4.us.backedge ] %count.154.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %count.2.us, %for.body4.us.backedge ] %indvars.iv.next65 = add nsw i64 %indvars.iv64, -1 %idxprom5.us = and i64 %indvars.iv.next65, 4294967295 %arrayidx6.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom5.us %2 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5 %sub7.us = add i64 %indvars.iv64, 4294967294 %idxprom8.us = and i64 %sub7.us, 4294967295 %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom8.us %3 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp slt i32 %2, %3 br i1 %cmp10.us, label %if.then.us, label %for.inc17.us if.then.us: ; preds = %for.body4.us store i32 %3, ptr %arrayidx6.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx9.us, align 4, !tbaa !5 %inc16.us = add nsw i32 %count.154.us, 1 br label %for.inc17.us for.inc17.us: ; preds = %if.then.us, %for.body4.us %count.2.us = phi i32 [ %inc16.us, %if.then.us ], [ %count.154.us, %for.body4.us ] %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.155.us, %for.body4.us ] %cmp3.us = icmp sgt i64 %indvars.iv64, 2 br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us for.body4.us.backedge: ; preds = %for.inc17.us, %for.cond2.while.cond.loopexit_crit_edge.us %indvars.iv64.be = phi i64 [ %indvars.iv.next65, %for.inc17.us ], [ %1, %for.cond2.while.cond.loopexit_crit_edge.us ] %flag.155.us.be = phi i32 [ %flag.2.us, %for.inc17.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ] br label %for.body4.us, !llvm.loop !9 for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc17.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %for.cond19.preheader, label %for.body4.us.backedge for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond19.preheader: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %count.2.us, %for.cond2.while.cond.loopexit_crit_edge.us ] %cmp2060 = icmp sgt i32 %4, 0 br i1 %cmp2060, label %for.body21, label %for.end32 for.body21: ; preds = %for.cond19.preheader, %for.inc30 %indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.inc30 ], [ 0, %for.cond19.preheader ] %arrayidx23 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv67 %6 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %7 = load i32, ptr %n, align 4, !tbaa !5 %sub25 = add nsw i32 %7, -1 %8 = sext i32 %sub25 to i64 %cmp26 = icmp slt i64 %indvars.iv67, %8 br i1 %cmp26, label %if.then27, label %for.inc30 if.then27: ; preds = %for.body21 %putchar48 = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc30 for.inc30: ; preds = %for.body21, %if.then27 %9 = phi i32 [ %7, %for.body21 ], [ %.pre, %if.then27 ] %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %10 = sext i32 %9 to i64 %cmp20 = icmp slt i64 %indvars.iv.next68, %10 br i1 %cmp20, label %for.body21, label %for.end32, !llvm.loop !12 for.end32: ; preds = %for.inc30, %entry, %for.cond19.preheader %.us-phi74 = phi i32 [ %.us-phi, %for.cond19.preheader ], [ 0, %entry ], [ %.us-phi, %for.inc30 ] %putchar = call i32 @putchar(i32 10) %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi74) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %px, ptr nocapture noundef %py) local_unnamed_addr #3 { entry: %0 = load i32, ptr %px, align 4, !tbaa !5 %1 = load i32, ptr %py, align 4, !tbaa !5 store i32 %1, ptr %px, align 4, !tbaa !5 store i32 %0, ptr %py, align 4, !tbaa !5 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: 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 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 #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}
#include<stdio.h> int main() { int a,b,n,i,s=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&a,&b); s=a*2; if(s<=b){ printf("%d %d\n",a,s); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28233/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28233/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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 %cmp6 = icmp sgt i32 %0, 0 br i1 %cmp6, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.07 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %1 = load i32, ptr %a, align 4, !tbaa !5 %mul = shl nsw i32 %1, 1 %2 = load i32, ptr %b, align 4, !tbaa !5 %cmp2.not = icmp sgt i32 %mul, %2 br i1 %cmp2.not, label %for.inc, label %if.then if.then: ; preds = %for.body %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %mul) br label %for.inc for.inc: ; preds = %for.body, %if.then %inc = add nuw nsw i32 %i.07, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> void swap(int* a,int* b){ int p; p=*a; *a=*b; *b=p; } int main(){ int n,a[100],count=0; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=0;i<n;i++){ for(int j=n-1;j>i;j--){ if(a[j]<a[j-1]){ swap(&a[j],&a[j-1]); count++; } } } for(int i=0;i<n;i++) printf("%d%s",a[i],i!=n-1?" ":"\n"); printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282373/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282373/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1 @.str.2 = private unnamed_addr constant [2 x i8] c" \00", align 1 @.str.3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %a = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp56 = icmp sgt i32 %0, 0 br i1 %cmp56, label %for.body, label %for.cond.cleanup31 for.cond3.preheader: ; preds = %for.body %cmp464 = icmp sgt i32 %4, 0 br i1 %cmp464, label %for.cond7.preheader.lr.ph, label %for.cond.cleanup31 for.cond7.preheader.lr.ph: ; preds = %for.cond3.preheader %j.058 = add nsw i32 %4, -1 %1 = zext i32 %4 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.058 to i64 %wide.trip.count = zext i32 %4 to i64 br label %for.cond7.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond3.preheader, !llvm.loop !9 for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond.cleanup9 %indvars.iv80 = phi i64 [ 0, %for.cond7.preheader.lr.ph ], [ %indvars.iv.next81, %for.cond.cleanup9 ] %count.065 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %count.1.lcssa, %for.cond.cleanup9 ] %cmp859 = icmp ult i64 %indvars.iv80, %3 br i1 %cmp859, label %for.body10, label %for.cond.cleanup9 for.cond29.preheader: ; preds = %for.cond.cleanup9 br i1 %cmp464, label %for.body32, label %for.cond.cleanup31 for.cond.cleanup9: ; preds = %for.inc23, %for.cond7.preheader %count.1.lcssa = phi i32 [ %count.065, %for.cond7.preheader ], [ %count.2, %for.inc23 ] %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count br i1 %exitcond.not, label %for.cond29.preheader, label %for.cond7.preheader, !llvm.loop !11 for.body10: ; preds = %for.cond7.preheader, %for.inc23 %indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.inc23 ], [ %1, %for.cond7.preheader ] %indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.inc23 ], [ %2, %for.cond7.preheader ] %count.160 = phi i32 [ %count.2, %for.inc23 ], [ %count.065, %for.cond7.preheader ] %indvars.iv.next75 = add nsw i64 %indvars.iv74, -1 %arrayidx12 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv72 %6 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv74, -2 %arrayidx15 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %7 %8 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %cmp16 = icmp slt i32 %6, %8 br i1 %cmp16, label %if.then, label %for.inc23 if.then: ; preds = %for.body10 store i32 %8, ptr %arrayidx12, align 4, !tbaa !5 store i32 %6, ptr %arrayidx15, align 4, !tbaa !5 %inc22 = add nsw i32 %count.160, 1 br label %for.inc23 for.inc23: ; preds = %for.body10, %if.then %count.2 = phi i32 [ %inc22, %if.then ], [ %count.160, %for.body10 ] %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1 %cmp8 = icmp sgt i64 %indvars.iv.next73, %indvars.iv80 br i1 %cmp8, label %for.body10, label %for.cond.cleanup9, !llvm.loop !12 for.cond.cleanup31: ; preds = %for.body32, %entry, %for.cond3.preheader, %for.cond29.preheader %count.0.lcssa90 = phi i32 [ %count.1.lcssa, %for.cond29.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %count.1.lcssa, %for.body32 ] %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %count.0.lcssa90) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 for.body32: ; preds = %for.cond29.preheader, %for.body32 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body32 ], [ 0, %for.cond29.preheader ] %9 = phi i32 [ %12, %for.body32 ], [ %4, %for.cond29.preheader ] %arrayidx34 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv83 %10 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %sub35 = add nsw i32 %9, -1 %11 = zext i32 %sub35 to i64 %cmp36.not = icmp eq i64 %indvars.iv83, %11 %cond = select i1 %cmp36.not, ptr @.str.3, ptr @.str.2 %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10, ptr noundef nonnull %cond) %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %12 = load i32, ptr %n, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp30 = icmp slt i64 %indvars.iv.next84, %13 br i1 %cmp30, label %for.body32, label %for.cond.cleanup31, !llvm.loop !13 } ; 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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> #define N 100 int main() { int A[N],j,flag=1,n,a,count=0; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d",&A[j]); } while(flag!=0){ flag=0; for(j=n-1;j>=1;j--){ if(A[j]<A[j-1]){ a=A[j]; A[j]=A[j-1]; A[j-1]=a; flag=1; count++; } } } for(j=0;j<n-1;j++){ printf("%d ",A[j]); } printf("%d\n",A[n-1]); printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282416/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282416/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca [100 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3 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 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body, label %for.cond25.preheader.for.end34_crit_edge while.cond.preheader: ; preds = %for.body %cmp458 = icmp sgt i32 %4, 1 br i1 %cmp458, label %for.cond3.preheader.us.preheader, label %for.cond25.preheader.for.end34_crit_edge for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body5.us for.body5.us: ; preds = %for.body5.us.backedge, %for.cond3.preheader.us.preheader %indvars.iv73 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv73.be, %for.body5.us.backedge ] %count.161.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %count.2.us, %for.body5.us.backedge ] %flag.159.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %flag.159.us.be, %for.body5.us.backedge ] %indvars.iv.next74 = add nsw i64 %indvars.iv73, -1 %idxprom6.us = and i64 %indvars.iv.next74, 4294967295 %arrayidx7.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom6.us %2 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5 %sub8.us = add i64 %indvars.iv73, 4294967294 %idxprom9.us = and i64 %sub8.us, 4294967295 %arrayidx10.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom9.us %3 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5 %cmp11.us = icmp slt i32 %2, %3 br i1 %cmp11.us, label %if.then.us, label %for.inc23.us if.then.us: ; preds = %for.body5.us store i32 %3, ptr %arrayidx7.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5 %inc22.us = add nsw i32 %count.161.us, 1 br label %for.inc23.us for.inc23.us: ; preds = %if.then.us, %for.body5.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.159.us, %for.body5.us ] %count.2.us = phi i32 [ %inc22.us, %if.then.us ], [ %count.161.us, %for.body5.us ] %cmp4.us = icmp sgt i64 %indvars.iv73, 2 br i1 %cmp4.us, label %for.body5.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us for.body5.us.backedge: ; preds = %for.inc23.us, %for.cond3.while.cond.loopexit_crit_edge.us %indvars.iv73.be = phi i64 [ %indvars.iv.next74, %for.inc23.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ] %flag.159.us.be = phi i32 [ %flag.2.us, %for.inc23.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ] br label %for.body5.us, !llvm.loop !9 for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc23.us %cmp2.not.us = icmp eq i32 %flag.2.us, 0 br i1 %cmp2.not.us, label %for.cond25.preheader, label %for.body5.us.backedge for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond25.preheader: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us br i1 %cmp458, label %for.body28, label %for.cond25.preheader.for.end34_crit_edge for.cond25.preheader.for.end34_crit_edge: ; preds = %entry, %while.cond.preheader, %for.cond25.preheader %.us-phi85 = phi i32 [ %count.2.us, %for.cond25.preheader ], [ 0, %while.cond.preheader ], [ 0, %entry ] %6 = phi i32 [ %4, %for.cond25.preheader ], [ %4, %while.cond.preheader ], [ %0, %entry ] %sub2666 = add nsw i32 %6, -1 %.pre = sext i32 %sub2666 to i64 br label %for.end34 for.body28: ; preds = %for.cond25.preheader, %for.body28 %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body28 ], [ 0, %for.cond25.preheader ] %arrayidx30 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv76 %7 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7) %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %8 = load i32, ptr %n, align 4, !tbaa !5 %sub26 = add nsw i32 %8, -1 %9 = sext i32 %sub26 to i64 %cmp27 = icmp slt i64 %indvars.iv.next77, %9 br i1 %cmp27, label %for.body28, label %for.end34, !llvm.loop !12 for.end34: ; preds = %for.body28, %for.cond25.preheader.for.end34_crit_edge %.us-phi84 = phi i32 [ %.us-phi85, %for.cond25.preheader.for.end34_crit_edge ], [ %count.2.us, %for.body28 ] %idxprom36.pre-phi = phi i64 [ %.pre, %for.cond25.preheader.for.end34_crit_edge ], [ %9, %for.body28 ] %arrayidx37 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom36.pre-phi %10 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10) %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi84) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int main() { long long t,i,j,d; scanf("%I64d",&t); long long in[t],out[t],in1[t]; for(i=0;i<t;i++){ scanf("%I64d%I64d",&in[i],&out[i]); in1[i]=in[i]*2; } for(i=0;i<t;i++){ printf("%I64d %I64d\n",in[i],in1[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28246/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28246/source.c" target datalayout = "e-m:e-p270: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"%I64d\00", align 1 @.str.1 = private unnamed_addr constant [11 x i8] c"%I64d%I64d\00", align 1 @.str.2 = private unnamed_addr constant [13 x i8] c"%I64d %I64d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i64, ptr %t, align 8, !tbaa !5 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i64, i64 %0, align 16 %2 = load i64, ptr %t, align 8, !tbaa !5 %vla1 = alloca i64, i64 %2, align 16 %vla2 = alloca i64, i64 %2, align 16 %cmp25 = icmp sgt i64 %2, 0 br i1 %cmp25, label %for.body, label %for.end15 for.cond7.preheader: ; preds = %for.body %3 = icmp sgt i64 %5, 0 br i1 %3, label %for.body9, label %for.end15 for.body: ; preds = %entry, %for.body %i.026 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.026 %arrayidx3 = getelementptr inbounds i64, ptr %vla1, i64 %i.026 %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3) %4 = load i64, ptr %arrayidx, align 8, !tbaa !5 %mul = shl nsw i64 %4, 1 %arrayidx6 = getelementptr inbounds i64, ptr %vla2, i64 %i.026 store i64 %mul, ptr %arrayidx6, align 8, !tbaa !5 %inc = add nuw nsw i64 %i.026, 1 %5 = load i64, ptr %t, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %5 br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9 for.body9: ; preds = %for.cond7.preheader, %for.body9 %i.128 = phi i64 [ %inc14, %for.body9 ], [ 0, %for.cond7.preheader ] %arrayidx10 = getelementptr inbounds i64, ptr %vla, i64 %i.128 %6 = load i64, ptr %arrayidx10, align 8, !tbaa !5 %arrayidx11 = getelementptr inbounds i64, ptr %vla2, i64 %i.128 %7 = load i64, ptr %arrayidx11, align 8, !tbaa !5 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %6, i64 noundef %7) %inc14 = add nuw nsw i64 %i.128, 1 %8 = load i64, ptr %t, align 8, !tbaa !5 %cmp8 = icmp slt i64 %inc14, %8 br i1 %cmp8, label %for.body9, label %for.end15, !llvm.loop !11 for.end15: ; preds = %for.body9, %entry, %for.cond7.preheader call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: 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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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 bubbleSort(int A[],int N){ int c=0,j,a; int flag=1; while(flag){ flag=0; for(j=N-1;j>0;j--){ if(A[j]<A[j-1]){ a=A[j]; A[j]=A[j-1]; A[j-1]=a; flag=1; c++; } } } return c; } int main(){ int A[100],N,c,i; scanf("%d",&N); while(N<1||N>100){ scanf("%d",&N); } for(i=0;i<N;i++){ scanf("%d",&A[i]); } c=bubbleSort(A,N); for(i=0;i<N;i++){ if(i>0)printf(" "); printf("%d",A[i]); } printf("\n%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282502/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282502/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 { entry: %cmp30 = icmp sgt i32 %N, 1 br i1 %cmp30, label %for.cond.preheader.us.preheader, label %while.end for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %N to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %flag.133.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.133.us.be, %for.body.us.backedge ] %c.132.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %c.2.us, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub1.us = add i64 %indvars.iv, 4294967294 %idxprom2.us = and i64 %sub1.us, 4294967295 %arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %1, %2 br i1 %cmp4.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 %inc.us = add nsw i32 %c.132.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body.us %c.2.us = phi i32 [ %inc.us, %if.then.us ], [ %c.132.us, %for.body.us ] %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.133.us, %for.body.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.133.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !9 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %c.2.us, %for.cond.while.cond.loopexit_crit_edge.us ] ret i32 %.us-phi } ; 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 [100 x i32], align 16 %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #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 %1 = add i32 %0, -101 %2 = icmp ult i32 %1, -100 br i1 %2, label %while.body, label %for.body.preheader while.body: ; preds = %entry, %while.body %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %3 = load i32, ptr %N, align 4 %4 = add i32 %3, -101 %5 = icmp ult i32 %4, -100 br i1 %5, label %while.body, label %for.body.preheader, !llvm.loop !11 for.body.preheader: ; preds = %while.body, %entry br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] %arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %.pr = load i32, ptr %N, align 4, !tbaa !5 %6 = sext i32 %.pr to i64 %cmp3 = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !12 for.end: ; preds = %for.body %cmp30.i = icmp sgt i32 %.pr, 1 br i1 %cmp30.i, label %for.cond.preheader.us.preheader.i, label %bubbleSort.exit for.cond.preheader.us.preheader.i: ; preds = %for.end %7 = zext i32 %.pr to i64 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %7, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %flag.133.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.133.us.i.be, %for.body.us.i.backedge ] %c.132.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %c.2.us.i, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.us.i %8 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom2.us.i = and i64 %sub1.us.i, 4294967295 %arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i %9 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %8, %9 br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %9, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %8, ptr %arrayidx3.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %c.132.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i %c.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %c.132.us.i, %for.body.us.i ] %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.133.us.i, %for.body.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %7, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.133.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !9 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i %tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0 br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.body.us.i.backedge bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end %.us-phi.i = phi i32 [ 0, %for.end ], [ %c.2.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i ] %cmp728 = icmp sgt i32 %.pr, 0 br i1 %cmp728, label %if.end.peel, label %for.end16 if.end.peel: ; preds = %bubbleSort.exit %.pre = load i32, ptr %A, align 16, !tbaa !5 %call13.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %10 = load i32, ptr %N, align 4, !tbaa !5 %cmp7.peel = icmp sgt i32 %10, 1 br i1 %cmp7.peel, label %if.end, label %for.end16 if.end: ; preds = %if.end.peel, %if.end %indvars.iv32 = phi i64 [ %indvars.iv.next33, %if.end ], [ 1, %if.end.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx12 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv32 %11 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11) %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %12 = load i32, ptr %N, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp7 = icmp slt i64 %indvars.iv.next33, %13 br i1 %cmp7, label %if.end, label %for.end16, !llvm.loop !13 for.end16: ; preds = %if.end, %if.end.peel, %bubbleSort.exit %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(){ int n,i,j,tmp,flag,count=0; int A[100]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&A[i]); } for(i=0;i<n;i++) { for(j=n-1;j>i;j--) { if(A[j] < A[j-1]) { tmp = A[j-1]; A[j-1] = A[j]; A[j] = tmp; count++; } } } for(i=0;i<n;i++) { if(i>0)printf(" "); printf("%d",A[i]); } printf("\n%d\n",count); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282546/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282546/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp63 = icmp sgt i32 %0, 0 br i1 %cmp63, label %for.body, label %for.end42 for.cond2.preheader: ; preds = %for.body %cmp371 = icmp sgt i32 %4, 0 br i1 %cmp371, label %for.cond5.preheader.lr.ph, label %for.end42 for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader %j.065 = add nsw i32 %4, -1 %1 = zext i32 %4 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.065 to i64 %wide.trip.count = zext i32 %4 to i64 br label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc27 %indvars.iv87 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next88, %for.inc27 ] %count.073 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %count.1.lcssa, %for.inc27 ] %cmp666 = icmp ult i64 %indvars.iv87, %3 br i1 %cmp666, label %for.body7, label %for.inc27 for.cond30.preheader: ; preds = %for.inc27 br i1 %cmp371, label %if.end36.peel, label %for.end42 if.end36.peel: ; preds = %for.cond30.preheader %.pre = load i32, ptr %A, align 16, !tbaa !5 %call39.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp31.peel = icmp sgt i32 %6, 1 br i1 %cmp31.peel, label %if.end36, label %for.end42 for.body7: ; preds = %for.cond5.preheader, %for.inc25 %indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.inc25 ], [ %1, %for.cond5.preheader ] %indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.inc25 ], [ %2, %for.cond5.preheader ] %count.168 = phi i32 [ %count.2, %for.inc25 ], [ %count.073, %for.cond5.preheader ] %indvars.iv.next82 = add nsw i64 %indvars.iv81, -1 %arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv79 %7 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %8 = add nsw i64 %indvars.iv81, -2 %arrayidx12 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %8 %9 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %cmp13 = icmp slt i32 %7, %9 br i1 %cmp13, label %if.then, label %for.inc25 if.then: ; preds = %for.body7 store i32 %7, ptr %arrayidx12, align 4, !tbaa !5 store i32 %9, ptr %arrayidx9, align 4, !tbaa !5 %inc24 = add nsw i32 %count.168, 1 br label %for.inc25 for.inc25: ; preds = %for.body7, %if.then %count.2 = phi i32 [ %inc24, %if.then ], [ %count.168, %for.body7 ] %indvars.iv.next80 = add nsw i64 %indvars.iv79, -1 %cmp6 = icmp sgt i64 %indvars.iv.next80, %indvars.iv87 br i1 %cmp6, label %for.body7, label %for.inc27, !llvm.loop !11 for.inc27: ; preds = %for.inc25, %for.cond5.preheader %count.1.lcssa = phi i32 [ %count.073, %for.cond5.preheader ], [ %count.2, %for.inc25 ] %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1 %exitcond.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12 if.end36: ; preds = %if.end36.peel, %if.end36 %indvars.iv90 = phi i64 [ %indvars.iv.next91, %if.end36 ], [ 1, %if.end36.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx38 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv90 %10 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp31 = icmp slt i64 %indvars.iv.next91, %12 br i1 %cmp31, label %if.end36, label %for.end42, !llvm.loop !13 for.end42: ; preds = %if.end36, %entry, %for.cond2.preheader, %if.end36.peel, %for.cond30.preheader %count.0.lcssa98 = phi i32 [ %count.1.lcssa, %for.cond30.preheader ], [ %count.1.lcssa, %if.end36.peel ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1.lcssa, %if.end36 ] %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa98) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(){ unsigned long int l,r,T,n,x,y,b; scanf("%lu",&T); if(T<=1000){ for(n=0;n<T;n++){ scanf("%lu %lu",&l,&r); if(l<=998244353 && r<=998244353) for(x=l;x<r;x++){ b=r/x; y=b*x; if(y%x==0 && x!=y){ printf("%lu %lu\n",x,y); break; } } } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28259/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28259/source.c" target datalayout = "e-m:e-p270: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"%lu\00", align 1 @.str.1 = private unnamed_addr constant [8 x i8] c"%lu %lu\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"%lu %lu\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %l = alloca i64, align 8 %r = alloca i64, align 8 %T = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T) %0 = load i64, ptr %T, align 8 %1 = add i64 %0, -1 %or.cond34 = icmp ult i64 %1, 1000 br i1 %or.cond34, label %for.body, label %if.end18 for.body: ; preds = %entry, %for.inc15 %n.033 = phi i64 [ %inc16, %for.inc15 ], [ 0, %entry ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r) %2 = load i64, ptr %l, align 8, !tbaa !5 %cmp3 = icmp ult i64 %2, 998244354 %3 = load i64, ptr %r, align 8 %.fr = freeze i64 %3 %cmp4 = icmp ult i64 %.fr, 998244354 %or.cond = and i1 %cmp3, %cmp4 %cmp730 = icmp ult i64 %2, %.fr %or.cond35 = and i1 %or.cond, %cmp730 br i1 %or.cond35, label %for.body8, label %for.inc15 for.body8: ; preds = %for.body, %for.inc %x.031 = phi i64 [ %inc, %for.inc ], [ %2, %for.body ] %4 = urem i64 %.fr, %x.031 %mul = sub nuw i64 %.fr, %4 %cmp11.not = icmp eq i64 %x.031, %mul br i1 %cmp11.not, label %for.inc, label %if.then12 if.then12: ; preds = %for.body8 %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %x.031, i64 noundef %mul) br label %for.inc15 for.inc: ; preds = %for.body8 %inc = add i64 %x.031, 1 %exitcond.not = icmp eq i64 %inc, %.fr br i1 %exitcond.not, label %for.inc15, label %for.body8, !llvm.loop !9 for.inc15: ; preds = %for.inc, %for.body, %if.then12 %inc16 = add nuw i64 %n.033, 1 %5 = load i64, ptr %T, align 8, !tbaa !5 %cmp1 = icmp ult i64 %inc16, %5 br i1 %cmp1, label %for.body, label %if.end18, !llvm.loop !11 if.end18: ; preds = %for.inc15, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #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", !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> void bubbleSort(int* ,int); int count=0; int main(){ int n,a[100],i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } bubbleSort(a,n); for(i=0;i<n;i++) { printf("%d",a[i]); if(i!=n-1) printf(" "); } printf("\n%d\n",count); return 0; } void bubbleSort(int *A, int N){ // N 個の要素を含む 0-オリジンの配列 A int flag = 1,j,x; // 逆の隣接要素が存在する while (flag){ flag = 0; for(j=N-1;j>=1;j--){ if(A[j] < A[j-1]){ x=A[j]; A[j]=A[j-1]; A[j-1]=x; count++; flag=1; } } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282632/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282632/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @count = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp20 = icmp sgt i32 %0, 0 br i1 %cmp20, label %for.body, label %for.end12 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %cmp29.i = icmp sgt i32 %1, 1 br i1 %cmp29.i, label %for.cond.preheader.us.preheader.i, label %bubbleSort.exit for.cond.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 %count.promoted24 = load i32, ptr @count, align 4, !tbaa !5 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %count.promoted26 = phi i32 [ %count.promoted24, %for.cond.preheader.us.preheader.i ], [ %count.promoted25, %for.body.us.i.backedge ] %inc.us.i23 = phi i32 [ %count.promoted24, %for.cond.preheader.us.preheader.i ], [ %inc.us.i23.be, %for.body.us.i.backedge ] %indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %flag.131.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.131.us.i.be, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %a, i64 %idxprom.us.i %4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom2.us.i = and i64 %sub1.us.i, 4294967295 %arrayidx3.us.i = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us.i %5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %4, %5 br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %4, ptr %arrayidx3.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %inc.us.i23, 1 store i32 %inc.us.i, ptr @count, align 4, !tbaa !5 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i %count.promoted25 = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.promoted26, %for.body.us.i ] %inc.us.i22 = phi i32 [ %inc.us.i, %if.then.us.i ], [ %inc.us.i23, %for.body.us.i ] %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.131.us.i, %for.body.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %inc.us.i23.be = phi i32 [ %inc.us.i22, %for.inc.us.i ], [ %count.promoted25, %for.cond.while.cond.loopexit_crit_edge.us.i ] %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.131.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i %tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0 br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.body.us.i.backedge bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end %cmp328 = icmp sgt i32 %1, 0 br i1 %cmp328, label %for.body4, label %for.end12 for.body4: ; preds = %bubbleSort.exit, %for.inc10 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.inc10 ], [ 0, %bubbleSort.exit ] %arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv32 %6 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %7 = load i32, ptr %n, align 4, !tbaa !5 %sub = add nsw i32 %7, -1 %8 = zext i32 %sub to i64 %cmp8.not = icmp eq i64 %indvars.iv32, %8 br i1 %cmp8.not, label %for.inc10, label %if.then if.then: ; preds = %for.body4 %putchar = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc10 for.inc10: ; preds = %for.body4, %if.then %9 = phi i32 [ %7, %for.body4 ], [ %.pre, %if.then ] %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %10 = sext i32 %9 to i64 %cmp3 = icmp slt i64 %indvars.iv.next33, %10 br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12 for.end12: ; preds = %for.inc10, %entry, %bubbleSort.exit %11 = load i32, ptr @count, align 4, !tbaa !5 %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #3 { entry: %cmp29 = icmp sgt i32 %N, 1 br i1 %cmp29, label %for.cond.preheader.us.preheader, label %while.end for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %N to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %flag.131.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.131.us.be, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub1.us = add i64 %indvars.iv, 4294967294 %idxprom2.us = and i64 %sub1.us, 4294967295 %arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %1, %2 br i1 %cmp4.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 %3 = load i32, ptr @count, align 4, !tbaa !5 %inc.us = add nsw i32 %3, 1 store i32 %inc.us, ptr @count, align 4, !tbaa !5 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.131.us, %for.body.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.131.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry 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: 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 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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}
#include<stdio.h> #define A 100 int main(){ int b,c,d=0,e,f; int a[A]; scanf("%d",&e); for(b=0;b<e;b++){ scanf("%d",&a[b]); } for(b=0;b<e;b++){ for(c=e-1;c>b;c--){ if(a[c]<a[c-1]){ f=a[c]; a[c]=a[c-1]; a[c-1]=f; d++; } } } for(c=0;c<e;c++){ if(c==e-1) printf("%d",a[c]); else printf("%d ",a[c]); } printf("\n%d\n",d); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282676/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282676/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %e = alloca i32, align 4 %a = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e) %0 = load i32, ptr %e, align 4, !tbaa !5 %cmp68 = icmp sgt i32 %0, 0 br i1 %cmp68, label %for.body, label %for.end45 for.cond2.preheader: ; preds = %for.body %cmp376 = icmp sgt i32 %4, 0 br i1 %cmp376, label %for.cond5.preheader.lr.ph, label %for.end45 for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader %c.070 = add nsw i32 %4, -1 %1 = zext i32 %4 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %c.070 to i64 %wide.trip.count = zext i32 %4 to i64 br label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %4 = load i32, ptr %e, 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.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc27 %indvars.iv92 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next93, %for.inc27 ] %d.077 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %d.1.lcssa, %for.inc27 ] %cmp671 = icmp ult i64 %indvars.iv92, %3 br i1 %cmp671, label %for.body7, label %for.inc27 for.cond30.preheader: ; preds = %for.inc27 br i1 %cmp376, label %for.body32, label %for.end45 for.body7: ; preds = %for.cond5.preheader, %for.inc25 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.inc25 ], [ %1, %for.cond5.preheader ] %indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.inc25 ], [ %2, %for.cond5.preheader ] %d.173 = phi i32 [ %d.2, %for.inc25 ], [ %d.077, %for.cond5.preheader ] %indvars.iv.next87 = add nsw i64 %indvars.iv86, -1 %arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv84 %6 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv86, -2 %arrayidx12 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %7 %8 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %cmp13 = icmp slt i32 %6, %8 br i1 %cmp13, label %if.then, label %for.inc25 if.then: ; preds = %for.body7 store i32 %8, ptr %arrayidx9, align 4, !tbaa !5 store i32 %6, ptr %arrayidx12, align 4, !tbaa !5 %inc24 = add nsw i32 %d.173, 1 br label %for.inc25 for.inc25: ; preds = %for.body7, %if.then %d.2 = phi i32 [ %inc24, %if.then ], [ %d.173, %for.body7 ] %indvars.iv.next85 = add nsw i64 %indvars.iv84, -1 %cmp6 = icmp sgt i64 %indvars.iv.next85, %indvars.iv92 br i1 %cmp6, label %for.body7, label %for.inc27, !llvm.loop !11 for.inc27: ; preds = %for.inc25, %for.cond5.preheader %d.1.lcssa = phi i32 [ %d.077, %for.cond5.preheader ], [ %d.2, %for.inc25 ] %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1 %exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body32: ; preds = %for.cond30.preheader, %for.body32 %indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body32 ], [ 0, %for.cond30.preheader ] %9 = phi i32 [ %12, %for.body32 ], [ %4, %for.cond30.preheader ] %sub33 = add nsw i32 %9, -1 %10 = zext i32 %sub33 to i64 %cmp34 = icmp eq i64 %indvars.iv95, %10 %arrayidx37 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv95 %11 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %.str..str.1 = select i1 %cmp34, ptr @.str, ptr @.str.1 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %11) %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1 %12 = load i32, ptr %e, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp31 = icmp slt i64 %indvars.iv.next96, %13 br i1 %cmp31, label %for.body32, label %for.end45, !llvm.loop !13 for.end45: ; preds = %for.body32, %entry, %for.cond2.preheader, %for.cond30.preheader %d.0.lcssa102 = phi i32 [ %d.1.lcssa, %for.cond30.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %d.1.lcssa, %for.body32 ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %d.0.lcssa102) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #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 main(void) { int n,i,j,temp,x[100],count=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&x[i]); } for (i = 0; i < n - 1; i++) { for (j = n - 1; j > i; j--) { if (x[j - 1] > x[j]) { /* 前の要素の方が大きかったら */ temp = x[j]; /* 交換する */ x[j] = x[j - 1]; x[j - 1]= temp; count++; } } } for(i=0;i<n;i++){ if(i==n-1) printf("%d\n",x[i]); else printf("%d ",x[i]); } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282726/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282726/source.c" target datalayout = "e-m:e-p270: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 @.str.2 = 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 %x = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp68 = icmp sgt i32 %0, 0 br i1 %cmp68, label %for.body, label %for.end46 for.cond2.preheader: ; preds = %for.body %cmp372 = icmp sgt i32 %3, 1 br i1 %cmp372, label %for.cond6.preheader.preheader, label %for.cond31.preheader for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %3, -1 %1 = zext i32 %3 to i64 %2 = add nsw i64 %1, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx13.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %2 br label %for.cond6.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %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.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28 %indvars.iv83 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next84, %for.inc28 ] %count.074 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc28 ] %.pre = load i32, ptr %arrayidx13.phi.trans.insert, align 4, !tbaa !5 br label %for.body8 for.cond31.preheader: ; preds = %for.inc28, %for.cond2.preheader %count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %count.2, %for.inc28 ] %cmp3276 = icmp sgt i32 %3, 0 br i1 %cmp3276, label %for.body33, label %for.end46 for.body8: ; preds = %for.cond6.preheader, %for.inc26 %5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc26 ] %indvars.iv80 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next81, %for.inc26 ] %count.171 = phi i32 [ %count.074, %for.cond6.preheader ], [ %count.2, %for.inc26 ] %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv.next81 %6 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp14 = icmp sgt i32 %6, %5 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body8 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv80 store i32 %6, ptr %arrayidx13, align 4, !tbaa !5 store i32 %5, ptr %arrayidx11, align 4, !tbaa !5 %inc25 = add nsw i32 %count.171, 1 br label %for.inc26 for.inc26: ; preds = %for.body8, %if.then %7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ] %count.2 = phi i32 [ %inc25, %if.then ], [ %count.171, %for.body8 ] %cmp7 = icmp sgt i64 %indvars.iv.next81, %indvars.iv83 br i1 %cmp7, label %for.body8, label %for.inc28, !llvm.loop !11 for.inc28: ; preds = %for.inc26 %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.cond31.preheader, label %for.cond6.preheader, !llvm.loop !12 for.body33: ; preds = %for.cond31.preheader, %for.body33 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body33 ], [ 0, %for.cond31.preheader ] %8 = phi i32 [ %11, %for.body33 ], [ %3, %for.cond31.preheader ] %sub34 = add nsw i32 %8, -1 %9 = zext i32 %sub34 to i64 %cmp35 = icmp eq i64 %indvars.iv86, %9 %arrayidx38 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv86 %10 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %.str.1..str.2 = select i1 %cmp35, ptr @.str.1, ptr @.str.2 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %10) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp32 = icmp slt i64 %indvars.iv.next87, %12 br i1 %cmp32, label %for.body33, label %for.end46, !llvm.loop !13 for.end46: ; preds = %for.body33, %entry, %for.cond31.preheader %count.0.lcssa92 = phi i32 [ %count.0.lcssa, %for.cond31.preheader ], [ 0, %entry ], [ %count.0.lcssa, %for.body33 ] %call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa92) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #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> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } // flagを用いたバブルソート int bubbleSort(int A[],int N) { int i,j; int sw = 0; unsigned short flag = 1; for(i=0;flag;i++) { flag = 0; for(j=N-1;j>=i+1;j--) { if(A[j]<A[j-1]) { swap(&A[j],&A[j-1]); flag = 1; sw++; } } } return sw; } int main(void) { int i, A[100], N, sw; scanf("%d",&N); for(i=0;i<N;i++) scanf("%d",&A[i]); sw = bubbleSort(A,N); for(i=0;i<N;i++) { if (i) printf(" "); printf("%d",A[i]); } printf("\n%d\n",sw); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282784/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282784/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%d\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 i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #2 { entry: %0 = sext i32 %N to i64 %invariant.gep = getelementptr i32, ptr %A, i64 -2 br label %for.cond1.preheader for.cond.loopexit: ; preds = %for.inc %tobool.not = icmp eq i16 %flag.2, 0 br i1 %tobool.not, label %for.end14, label %for.cond1.preheader, !llvm.loop !9 for.cond1.preheader: ; preds = %entry, %for.cond.loopexit %indvars.iv36 = phi i64 [ 0, %entry ], [ %indvars.iv.next37, %for.cond.loopexit ] %sw.034 = phi i32 [ 0, %entry ], [ %sw.2, %for.cond.loopexit ] %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1 %cmp.not.not26 = icmp slt i64 %indvars.iv.next37, %0 br i1 %cmp.not.not26, label %for.body2, label %for.end14 for.body2: ; preds = %for.cond1.preheader, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ] %flag.129 = phi i16 [ %flag.2, %for.inc ], [ 0, %for.cond1.preheader ] %sw.128 = phi i32 [ %sw.2, %for.inc ], [ %sw.034, %for.cond1.preheader ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv %2 = load i32, ptr %gep, align 4, !tbaa !5 %cmp6 = icmp slt i32 %1, %2 br i1 %cmp6, label %if.then, label %for.inc if.then: ; preds = %for.body2 store i32 %2, ptr %arrayidx, align 4, !tbaa !5 store i32 %1, ptr %gep, align 4, !tbaa !5 %inc = add nsw i32 %sw.128, 1 br label %for.inc for.inc: ; preds = %for.body2, %if.then %sw.2 = phi i32 [ %inc, %if.then ], [ %sw.128, %for.body2 ] %flag.2 = phi i16 [ 1, %if.then ], [ %flag.129, %for.body2 ] %cmp.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next37 br i1 %cmp.not.not, label %for.body2, label %for.cond.loopexit, !llvm.loop !11 for.end14: ; preds = %for.cond1.preheader, %for.cond.loopexit %sw.1.lcssa42 = phi i32 [ %sw.2, %for.cond.loopexit ], [ %sw.034, %for.cond1.preheader ] ret i32 %sw.1.lcssa42 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %A = alloca [100 x i32], align 16 %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp20 = icmp sgt i32 %0, 0 br i1 %cmp20, label %for.body, label %entry.for.end_crit_edge entry.for.end_crit_edge: ; preds = %entry %.pre30 = sext i32 %0 to i64 br label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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.loopexit, !llvm.loop !12 for.end.loopexit: ; preds = %for.body %3 = icmp sgt i32 %1, 0 br label %for.end for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit %.pre-phi = phi i64 [ %.pre30, %entry.for.end_crit_edge ], [ %2, %for.end.loopexit ] %cmp422 = phi i1 [ false, %entry.for.end_crit_edge ], [ %3, %for.end.loopexit ] %invariant.gep.i = getelementptr i32, ptr %A, i64 -2 %smax = call i64 @llvm.smax.i64(i64 %.pre-phi, i64 1) %4 = add nsw i64 %smax, -1 br label %for.cond1.preheader.i for.cond.loopexit.i: ; preds = %for.inc.i %tobool.not.i = icmp eq i16 %flag.2.i, 0 br i1 %tobool.not.i, label %bubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !9 for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.end %indvars.iv36.i = phi i64 [ 0, %for.end ], [ %indvars.iv.next37.i, %for.cond.loopexit.i ] %sw.034.i = phi i32 [ 0, %for.end ], [ %sw.2.i, %for.cond.loopexit.i ] %indvars.iv.next37.i = add nuw nsw i64 %indvars.iv36.i, 1 %exitcond.not = icmp eq i64 %indvars.iv36.i, %4 br i1 %exitcond.not, label %bubbleSort.exit, label %for.body2.i for.body2.i: ; preds = %for.cond1.preheader.i, %for.inc.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %.pre-phi, %for.cond1.preheader.i ] %flag.129.i = phi i16 [ %flag.2.i, %for.inc.i ], [ 0, %for.cond1.preheader.i ] %sw.128.i = phi i32 [ %sw.2.i, %for.inc.i ], [ %sw.034.i, %for.cond1.preheader.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i %5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i %6 = load i32, ptr %gep.i, align 4, !tbaa !5 %cmp6.i = icmp slt i32 %5, %6 br i1 %cmp6.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body2.i store i32 %6, ptr %arrayidx.i, align 4, !tbaa !5 store i32 %5, ptr %gep.i, align 4, !tbaa !5 %inc.i = add nsw i32 %sw.128.i, 1 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body2.i %sw.2.i = phi i32 [ %inc.i, %if.then.i ], [ %sw.128.i, %for.body2.i ] %flag.2.i = phi i16 [ 1, %if.then.i ], [ %flag.129.i, %for.body2.i ] %cmp.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next37.i br i1 %cmp.not.not.i, label %for.body2.i, label %for.cond.loopexit.i, !llvm.loop !11 bubbleSort.exit: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.i %sw.1.lcssa42.i = phi i32 [ %sw.2.i, %for.cond.loopexit.i ], [ %sw.034.i, %for.cond1.preheader.i ] br i1 %cmp422, label %if.end.peel, label %for.end12 if.end.peel: ; preds = %bubbleSort.exit %.pre = load i32, ptr %A, align 16, !tbaa !5 %call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %7 = load i32, ptr %N, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %7, 1 br i1 %cmp4.peel, label %if.end, label %for.end12 if.end: ; preds = %if.end.peel, %if.end %indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx8 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv26 %8 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1 %9 = load i32, ptr %N, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp4 = icmp slt i64 %indvars.iv.next27, %10 br i1 %cmp4, label %if.end, label %for.end12, !llvm.loop !13 for.end12: ; preds = %if.end, %if.end.peel, %bubbleSort.exit %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sw.1.lcssa42.i) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #6 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree 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 #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 = { nofree nounwind } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> void sort(int A[],int n){ int tmp; int count=0; for(int i=0;i<(n-1);i++){ for(int j=(n-1);j>i;j--){ if(A[j-1]>A[j]){ count++; tmp=A[j-1]; A[j-1]=A[j]; A[j]=tmp; } } } for(int i=0;i<n;i++){ printf("%d",A[i]); if(i==(n-1)){ printf("\n"); }else{ printf(" "); } } printf("%d\n",count); } int main(){ int n; int *A; scanf("%d",&n); A=(int*)malloc(sizeof(int)*n); for(int i=0;i<n;i++){ scanf("%d",&A[i]); } sort(A,n); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282827/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282827/source.c" target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @sort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 { entry: %sub = add i32 %n, -1 %cmp66 = icmp sgt i32 %n, 1 br i1 %cmp66, label %for.cond2.preheader.preheader, label %for.cond24.preheader for.cond2.preheader.preheader: ; preds = %entry %0 = zext i32 %n to i64 %1 = add nsw i64 %0, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx8.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 %1 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.cond.cleanup4 %indvars.iv73 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next74, %for.cond.cleanup4 ] %count.067 = phi i32 [ 0, %for.cond2.preheader.preheader ], [ %count.2, %for.cond.cleanup4 ] %.pre = load i32, ptr %arrayidx8.phi.trans.insert, align 4, !tbaa !5 br label %for.body5 for.cond24.preheader: ; preds = %for.cond.cleanup4, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %count.2, %for.cond.cleanup4 ] %cmp2570 = icmp sgt i32 %n, 0 br i1 %cmp2570, label %for.body27.preheader, label %for.cond.cleanup26 for.body27.preheader: ; preds = %for.cond24.preheader %2 = zext i32 %sub to i64 %wide.trip.count79 = zext i32 %n to i64 br label %for.body27 for.cond.cleanup4: ; preds = %for.inc %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.cond24.preheader, label %for.cond2.preheader, !llvm.loop !9 for.body5: ; preds = %for.cond2.preheader, %for.inc %3 = phi i32 [ %.pre, %for.cond2.preheader ], [ %5, %for.inc ] %indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ] %count.164 = phi i32 [ %count.067, %for.cond2.preheader ], [ %count.2, %for.inc ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %4, %3 br i1 %cmp9, label %if.then, label %for.inc if.then: ; preds = %for.body5 %arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv %inc = add nsw i32 %count.164, 1 store i32 %3, ptr %arrayidx, align 4, !tbaa !5 store i32 %4, ptr %arrayidx8, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body5, %if.then %5 = phi i32 [ %3, %if.then ], [ %4, %for.body5 ] %count.2 = phi i32 [ %inc, %if.then ], [ %count.164, %for.body5 ] %cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv73 br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !11 for.cond.cleanup26: ; preds = %for.body27, %for.cond24.preheader %call39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa) ret void for.body27: ; preds = %for.body27.preheader, %for.body27 %indvars.iv76 = phi i64 [ 0, %for.body27.preheader ], [ %indvars.iv.next77, %for.body27 ] %arrayidx29 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv76 %6 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %cmp31 = icmp eq i64 %indvars.iv76, %2 %. = select i1 %cmp31, i32 10, i32 32 %putchar63 = tail call i32 @putchar(i32 %.) %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79 br i1 %exitcond80.not, label %for.cond.cleanup26, label %for.body27, !llvm.loop !12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 %cmp7 = icmp sgt i32 %0, 0 br i1 %cmp7, label %for.body, label %sort.exit for.cond.cleanup: ; preds = %for.body %sub.i = add i32 %.pr, -1 %cmp66.i = icmp sgt i32 %.pr, 1 br i1 %cmp66.i, label %for.cond2.preheader.preheader.i, label %for.cond24.preheader.i for.cond2.preheader.preheader.i: ; preds = %for.cond.cleanup %1 = zext i32 %.pr to i64 %2 = add nsw i64 %1, -1 %wide.trip.count.i = zext i32 %sub.i to i64 %arrayidx8.phi.trans.insert.i = getelementptr inbounds i32, ptr %call1, i64 %2 br label %for.cond2.preheader.i for.cond2.preheader.i: ; preds = %for.cond.cleanup4.i, %for.cond2.preheader.preheader.i %indvars.iv73.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next74.i, %for.cond.cleanup4.i ] %count.067.i = phi i32 [ 0, %for.cond2.preheader.preheader.i ], [ %count.2.i, %for.cond.cleanup4.i ] %.pre.i = load i32, ptr %arrayidx8.phi.trans.insert.i, align 4, !tbaa !5 br label %for.body5.i for.cond24.preheader.i: ; preds = %for.cond.cleanup4.i, %for.cond.cleanup %count.0.lcssa.i = phi i32 [ 0, %for.cond.cleanup ], [ %count.2.i, %for.cond.cleanup4.i ] %cmp2570.i = icmp sgt i32 %.pr, 0 br i1 %cmp2570.i, label %for.body27.preheader.i, label %sort.exit for.body27.preheader.i: ; preds = %for.cond24.preheader.i %3 = zext i32 %sub.i to i64 %wide.trip.count79.i = zext i32 %.pr to i64 br label %for.body27.i for.cond.cleanup4.i: ; preds = %for.inc.i %indvars.iv.next74.i = add nuw nsw i64 %indvars.iv73.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next74.i, %wide.trip.count.i br i1 %exitcond.not.i, label %for.cond24.preheader.i, label %for.cond2.preheader.i, !llvm.loop !9 for.body5.i: ; preds = %for.inc.i, %for.cond2.preheader.i %4 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %6, %for.inc.i ] %indvars.iv.i = phi i64 [ %2, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %count.164.i = phi i32 [ %count.067.i, %for.cond2.preheader.i ], [ %count.2.i, %for.inc.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i %5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp9.i = icmp sgt i32 %5, %4 br i1 %cmp9.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body5.i %arrayidx8.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i %inc.i = add nsw i32 %count.164.i, 1 store i32 %4, ptr %arrayidx.i, align 4, !tbaa !5 store i32 %5, ptr %arrayidx8.i, align 4, !tbaa !5 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body5.i %6 = phi i32 [ %4, %if.then.i ], [ %5, %for.body5.i ] %count.2.i = phi i32 [ %inc.i, %if.then.i ], [ %count.164.i, %for.body5.i ] %cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv73.i br i1 %cmp3.i, label %for.body5.i, label %for.cond.cleanup4.i, !llvm.loop !11 for.body27.i: ; preds = %for.body27.i, %for.body27.preheader.i %indvars.iv76.i = phi i64 [ 0, %for.body27.preheader.i ], [ %indvars.iv.next77.i, %for.body27.i ] %arrayidx29.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv76.i %7 = load i32, ptr %arrayidx29.i, align 4, !tbaa !5 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7) %cmp31.i = icmp eq i64 %indvars.iv76.i, %3 %..i = select i1 %cmp31.i, i32 10, i32 32 %putchar63.i = call i32 @putchar(i32 %..i) %indvars.iv.next77.i = add nuw nsw i64 %indvars.iv76.i, 1 %exitcond80.not.i = icmp eq i64 %indvars.iv.next77.i, %wide.trip.count79.i br i1 %exitcond80.not.i, label %sort.exit, label %for.body27.i, !llvm.loop !12 sort.exit: ; preds = %for.body27.i, %entry, %for.cond24.preheader.i %count.0.lcssa.i19 = phi i32 [ %count.0.lcssa.i, %for.cond24.preheader.i ], [ 0, %entry ], [ %count.0.lcssa.i, %for.body27.i ] %call39.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa.i19) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 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 %.pr = load i32, ptr %n, align 4, !tbaa !5 %8 = sext i32 %.pr to i64 %cmp = icmp slt i64 %indvars.iv.next, %8 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13 } ; 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 @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 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 = { nofree nounwind } 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}
#include <stdio.h> #include <stdlib.h> #define A 100 int bubbleSort(int *,int); int main(){ int a[A],n,i,count; scanf("%d",&n); if(n < 1 && n >100)exit(2); for(i = 0 ; i < n ; i++){ scanf("%d",&a[i]); } count = bubbleSort(a,n); for(i = 0 ; i < n-1 ; i++){ printf("%d ",a[i]); } printf("%d\n",a[i]); printf("%d\n",count); return 0; } int bubbleSort(int *a,int n){ int i,j; int flag = 1; int num,count=0; while(flag == 1){ flag = 0; for(j = n - 1; j >= 1 ; j--){ if(a[j] < a[j-1]){ num = a[j-1]; a[j-1] = a[j]; a[j] = num; flag = 1; count++; } i++; } } return count; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282870/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282870/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [100 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #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 %cmp224 = icmp sgt i32 %0, 0 br i1 %cmp224, label %for.body, label %for.end13 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv %call3 = 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 %cmp2 = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp132.i = icmp sgt i32 %1, 1 br i1 %cmp132.i, label %for.cond.preheader.us.preheader.i, label %for.end13 for.cond.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %count.136.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %count.2.us.i, %for.body.us.i.backedge ] %flag.134.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.134.us.i.be, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %a, i64 %idxprom.us.i %4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub2.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom3.us.i = and i64 %sub2.us.i, 4294967295 %arrayidx4.us.i = getelementptr inbounds i32, ptr %a, i64 %idxprom3.us.i %5 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5 %cmp5.us.i = icmp slt i32 %4, %5 br i1 %cmp5.us.i, label %if.then.us.i, label %if.end.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %4, ptr %arrayidx4.us.i, align 4, !tbaa !5 store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %count.136.us.i, 1 br label %if.end.us.i if.end.us.i: ; preds = %if.then.us.i, %for.body.us.i %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.134.us.i, %for.body.us.i ] %count.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.136.us.i, %for.body.us.i ] %cmp1.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp1.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %if.end.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %if.end.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.134.us.i.be = phi i32 [ %flag.2.us.i, %if.end.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %if.end.us.i %cmp.us.i = icmp eq i32 %flag.2.us.i, 1 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %bubbleSort.exit bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i br i1 %cmp132.i, label %for.body7, label %for.end13 for.body7: ; preds = %bubbleSort.exit, %for.body7 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body7 ], [ 0, %bubbleSort.exit ] %arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv32 %6 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %7 = load i32, ptr %n, align 4, !tbaa !5 %sub = add nsw i32 %7, -1 %8 = sext i32 %sub to i64 %cmp6 = icmp slt i64 %indvars.iv.next33, %8 br i1 %cmp6, label %for.body7, label %for.end13.loopexit, !llvm.loop !12 for.end13.loopexit: ; preds = %for.body7 %9 = and i64 %indvars.iv.next33, 4294967295 br label %for.end13 for.end13: ; preds = %entry, %for.end, %for.end13.loopexit, %bubbleSort.exit %.us-phi.i39 = phi i32 [ %count.2.us.i, %bubbleSort.exit ], [ %count.2.us.i, %for.end13.loopexit ], [ 0, %for.end ], [ 0, %entry ] %i.1.lcssa = phi i64 [ 0, %bubbleSort.exit ], [ %9, %for.end13.loopexit ], [ 0, %for.end ], [ 0, %entry ] %arrayidx15 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %i.1.lcssa %10 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10) %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i39) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 400, 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #3 { entry: %cmp132 = icmp sgt i32 %n, 1 br i1 %cmp132, label %for.cond.preheader.us.preheader, label %while.end for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %n to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %count.136.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %count.2.us, %for.body.us.backedge ] %flag.134.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.134.us.be, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %a, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub2.us = add i64 %indvars.iv, 4294967294 %idxprom3.us = and i64 %sub2.us, 4294967295 %arrayidx4.us = getelementptr inbounds i32, ptr %a, i64 %idxprom3.us %2 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5 %cmp5.us = icmp slt i32 %1, %2 br i1 %cmp5.us, label %if.then.us, label %if.end.us if.then.us: ; preds = %for.body.us store i32 %1, ptr %arrayidx4.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 %inc.us = add nsw i32 %count.136.us, 1 br label %if.end.us if.end.us: ; preds = %if.then.us, %for.body.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.134.us, %for.body.us ] %count.2.us = phi i32 [ %inc.us, %if.then.us ], [ %count.136.us, %for.body.us ] %cmp1.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp1.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %if.end.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %if.end.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.134.us.be = phi i32 [ %flag.2.us, %if.end.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %if.end.us %cmp.us = icmp eq i32 %flag.2.us, 1 br i1 %cmp.us, label %for.body.us.backedge, label %while.end while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %count.2.us, %for.cond.while.cond.loopexit_crit_edge.us ] ret i32 %.us-phi } ; 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: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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; int A[101]; int x = 0, cnt = 0, i, tmp; scanf("%d", &n); for(i = 0; i < n; i++) scanf("%d", &A[i]); while(x < n) { for(i = n - 1; i > x; i--) { if(A[i - 1] > A[i]) { tmp = A[i - 1]; A[i - 1] = A[i]; A[i] = tmp; cnt++; } } x++; } for(i = 0; i < n; i++) { if(i > 0) printf(" "); printf("%d", A[i]); } printf("\n%d\n", cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282913/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282913/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [101 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %A) #4 %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.end38 while.cond.preheader: ; preds = %for.body %cmp267 = icmp sgt i32 %4, 0 br i1 %cmp267, label %for.cond3.preheader.lr.ph, label %for.end38 for.cond3.preheader.lr.ph: ; preds = %while.cond.preheader %i.161 = add nsw i32 %4, -1 %1 = zext i32 %4 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %i.161 to i64 %wide.trip.count = zext i32 %4 to i64 br label %for.cond3.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [101 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 %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 %while.cond.preheader, !llvm.loop !9 for.cond3.preheader: ; preds = %for.cond3.preheader.lr.ph, %for.end24 %indvars.iv83 = phi i64 [ 0, %for.cond3.preheader.lr.ph ], [ %indvars.iv.next84, %for.end24 ] %cnt.068 = phi i32 [ 0, %for.cond3.preheader.lr.ph ], [ %cnt.1.lcssa, %for.end24 ] %cmp462 = icmp ult i64 %indvars.iv83, %3 br i1 %cmp462, label %for.body5, label %for.end24 for.cond26.preheader: ; preds = %for.end24 br i1 %cmp267, label %if.end32.peel, label %for.end38 if.end32.peel: ; preds = %for.cond26.preheader %.pre = load i32, ptr %A, align 16, !tbaa !5 %call35.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp27.peel = icmp sgt i32 %6, 1 br i1 %cmp27.peel, label %if.end32, label %for.end38 for.body5: ; preds = %for.cond3.preheader, %for.inc23 %indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.inc23 ], [ %1, %for.cond3.preheader ] %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc23 ], [ %2, %for.cond3.preheader ] %cnt.163 = phi i32 [ %cnt.2, %for.inc23 ], [ %cnt.068, %for.cond3.preheader ] %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1 %7 = add nsw i64 %indvars.iv77, -2 %arrayidx8 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %7 %8 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %arrayidx10 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv75 %9 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %8, %9 br i1 %cmp11, label %if.then, label %for.inc23 if.then: ; preds = %for.body5 store i32 %9, ptr %arrayidx8, align 4, !tbaa !5 store i32 %8, ptr %arrayidx10, align 4, !tbaa !5 %inc22 = add nsw i32 %cnt.163, 1 br label %for.inc23 for.inc23: ; preds = %for.body5, %if.then %cnt.2 = phi i32 [ %inc22, %if.then ], [ %cnt.163, %for.body5 ] %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1 %cmp4 = icmp sgt i64 %indvars.iv.next76, %indvars.iv83 br i1 %cmp4, label %for.body5, label %for.end24, !llvm.loop !11 for.end24: ; preds = %for.inc23, %for.cond3.preheader %cnt.1.lcssa = phi i32 [ %cnt.068, %for.cond3.preheader ], [ %cnt.2, %for.inc23 ] %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.cond26.preheader, label %for.cond3.preheader, !llvm.loop !12 if.end32: ; preds = %if.end32.peel, %if.end32 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %if.end32 ], [ 1, %if.end32.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx34 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv86 %10 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp27 = icmp slt i64 %indvars.iv.next87, %12 br i1 %cmp27, label %if.end32, label %for.end38, !llvm.loop !13 for.end38: ; preds = %if.end32, %entry, %while.cond.preheader, %if.end32.peel, %for.cond26.preheader %cnt.0.lcssa94 = phi i32 [ %cnt.1.lcssa, %for.cond26.preheader ], [ %cnt.1.lcssa, %if.end32.peel ], [ 0, %while.cond.preheader ], [ 0, %entry ], [ %cnt.1.lcssa, %if.end32 ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa94) call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> void ire(int*,int*); void sort(int*,int); int c; int main(){ int s,i,su[100]; scanf("%d",&s); for(i=0;i<s;i++){ scanf("%d",&su[i]); } sort(su,s); for (i=0; i < s; i++) { printf("%d",su[i]); if(i!=s-1)printf(" "); } printf("\n"); printf("%d\n",c); return 0; } void sort (int su[], int size) { int i, j; for (i = 0; i < size - 1; i++){ for (j = size - 1; j >= i + 1; j--){ if (su[j] < su[j-1]) { ire(&su[j], &su[j-1]);c++; } } } } void ire (int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282957/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282957/source.c" target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @c = dso_local local_unnamed_addr global i32 0, align 4 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca i32, align 4 %su = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #6 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %su) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %0 = load i32, ptr %s, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end12 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %su, 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 %s, 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 %cmp29.i = icmp sgt i32 %1, 1 br i1 %cmp29.i, label %for.cond2.preheader.preheader.i, label %sort.exit for.cond2.preheader.preheader.i: ; preds = %for.end %sub.i = add nsw i32 %1, -1 %3 = zext i32 %1 to i64 %4 = add nsw i64 %3, -1 %wide.trip.count.i = zext i32 %sub.i to i64 %c.promoted26 = load i32, ptr @c, align 4, !tbaa !5 %arrayidx.i.phi.trans.insert = getelementptr inbounds i32, ptr %su, i64 %4 br label %for.cond2.preheader.i for.cond2.preheader.i: ; preds = %for.inc14.i, %for.cond2.preheader.preheader.i %c.promoted29 = phi i32 [ %c.promoted26, %for.cond2.preheader.preheader.i ], [ %c.promoted27, %for.inc14.i ] %indvars.iv32.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next33.i, %for.inc14.i ] %.pre = load i32, ptr %arrayidx.i.phi.trans.insert, align 4, !tbaa !5 br label %for.body4.i for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i %5 = phi i32 [ %.pre, %for.cond2.preheader.i ], [ %7, %for.inc.i ] %c.promoted28 = phi i32 [ %c.promoted29, %for.cond2.preheader.i ], [ %c.promoted27, %for.inc.i ] %inc.i25 = phi i32 [ %c.promoted29, %for.cond2.preheader.i ], [ %inc.i24, %for.inc.i ] %indvars.iv.i = phi i64 [ %4, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx7.i = getelementptr inbounds i32, ptr %su, i64 %indvars.iv.next.i %6 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5 %cmp8.i = icmp slt i32 %5, %6 br i1 %cmp8.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body4.i %arrayidx.i = getelementptr inbounds i32, ptr %su, i64 %indvars.iv.i store i32 %6, ptr %arrayidx.i, align 4, !tbaa !5 store i32 %5, ptr %arrayidx7.i, align 4, !tbaa !5 %inc.i = add nsw i32 %inc.i25, 1 store i32 %inc.i, ptr @c, align 4, !tbaa !5 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body4.i %7 = phi i32 [ %5, %if.then.i ], [ %6, %for.body4.i ] %c.promoted27 = phi i32 [ %inc.i, %if.then.i ], [ %c.promoted28, %for.body4.i ] %inc.i24 = phi i32 [ %inc.i, %if.then.i ], [ %inc.i25, %for.body4.i ] %cmp3.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv32.i br i1 %cmp3.not.not.i, label %for.body4.i, label %for.inc14.i, !llvm.loop !11 for.inc14.i: ; preds = %for.inc.i %indvars.iv.next33.i = add nuw nsw i64 %indvars.iv32.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next33.i, %wide.trip.count.i br i1 %exitcond.not.i, label %sort.exit, label %for.cond2.preheader.i, !llvm.loop !12 sort.exit: ; preds = %for.inc14.i, %for.end %cmp330 = icmp sgt i32 %1, 0 br i1 %cmp330, label %for.body4, label %for.end12 for.body4: ; preds = %sort.exit, %for.inc10 %indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.inc10 ], [ 0, %sort.exit ] %arrayidx6 = getelementptr inbounds [100 x i32], ptr %su, i64 0, i64 %indvars.iv34 %8 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) %9 = load i32, ptr %s, align 4, !tbaa !5 %sub = add nsw i32 %9, -1 %10 = zext i32 %sub to i64 %cmp8.not = icmp eq i64 %indvars.iv34, %10 br i1 %cmp8.not, label %for.inc10, label %if.then if.then: ; preds = %for.body4 %putchar21 = call i32 @putchar(i32 32) %.pre37 = load i32, ptr %s, align 4, !tbaa !5 br label %for.inc10 for.inc10: ; preds = %for.body4, %if.then %11 = phi i32 [ %9, %for.body4 ], [ %.pre37, %if.then ] %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1 %12 = sext i32 %11 to i64 %cmp3 = icmp slt i64 %indvars.iv.next35, %12 br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !13 for.end12: ; preds = %for.inc10, %entry, %sort.exit %putchar = call i32 @putchar(i32 10) %13 = load i32, ptr @c, align 4, !tbaa !5 %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %su) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @sort(ptr nocapture noundef %su, i32 noundef %size) local_unnamed_addr #3 { entry: %cmp29 = icmp sgt i32 %size, 1 br i1 %cmp29, label %for.cond2.preheader.preheader, label %for.end16 for.cond2.preheader.preheader: ; preds = %entry %sub = add nsw i32 %size, -1 %0 = zext i32 %size to i64 %1 = add nsw i64 %0, -1 %wide.trip.count = zext i32 %sub to i64 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc14 %indvars.iv32 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next33, %for.inc14 ] br label %for.body4 for.body4: ; preds = %for.cond2.preheader, %for.inc %indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ] %arrayidx = getelementptr inbounds i32, ptr %su, i64 %indvars.iv %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx7 = getelementptr inbounds i32, ptr %su, i64 %indvars.iv.next %3 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp8 = icmp slt i32 %2, %3 br i1 %cmp8, label %if.then, label %for.inc if.then: ; preds = %for.body4 store i32 %3, ptr %arrayidx, align 4, !tbaa !5 store i32 %2, ptr %arrayidx7, align 4, !tbaa !5 %4 = load i32, ptr @c, align 4, !tbaa !5 %inc = add nsw i32 %4, 1 store i32 %inc, ptr @c, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body4, %if.then %cmp3.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv32 br i1 %cmp3.not.not, label %for.body4, label %for.inc14, !llvm.loop !11 for.inc14: ; preds = %for.inc %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count br i1 %exitcond.not, label %for.end16, label %for.cond2.preheader, !llvm.loop !12 for.end16: ; preds = %for.inc14, %entry 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(argmem: readwrite) uwtable define dso_local void @ire(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #4 { entry: %0 = load i32, ptr %x, align 4, !tbaa !5 %1 = load i32, ptr %y, align 4, !tbaa !5 store i32 %1, ptr %x, align 4, !tbaa !5 store i32 %0, ptr %y, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress 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 = { nofree nounwind } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <inttypes.h> #include <memory.h> #define N 200005 int a[N]; int64_t yc[2][N]; int n; int64_t walk(size_t i, int odd) { if (!i) return -1; if (yc[odd][i]) { return yc[odd][i]; } else { int j = odd ? (i - a[i]) : (i + a[i]); if (j < 0 || j >= n) return (yc[odd][i] = a[i]); else { int64_t y; yc[odd][i] = -1; y = walk(j, !odd); if (y < 0) return -1; return (yc[odd][i] = a[i] + y); }; }; }; int main(void) { int i; scanf("%d", &n); for (i = 1; i < n; i++) { scanf("%d", &a[i]); }; memset(yc[0], 0, sizeof(yc[0])); memset(yc[1], 0, sizeof(yc[1])); for (i = 1; i < n; i++) { int64_t y = walk(i, 1); printf("%" PRId64 "\n", (y < 0)?(int64_t)-1:(i+y)); }; return 0; };
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2830/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2830/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @yc = dso_local local_unnamed_addr global [2 x [200005 x i64]] zeroinitializer, align 16 @a = dso_local global [200005 x i32] zeroinitializer, align 16 @n = dso_local global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @walk(i64 noundef %i, i32 noundef %odd) local_unnamed_addr #0 { entry: %tobool.not = icmp eq i64 %i, 0 br i1 %tobool.not, label %return, label %if.end if.end: ; preds = %entry %idxprom = sext i32 %odd to i64 %arrayidx1 = getelementptr inbounds [2 x [200005 x i64]], ptr @yc, i64 0, i64 %idxprom, i64 %i %0 = load i64, ptr %arrayidx1, align 8, !tbaa !5 %tobool2.not = icmp eq i64 %0, 0 br i1 %tobool2.not, label %if.else, label %return if.else: ; preds = %if.end %tobool7.not = icmp eq i32 %odd, 0 %arrayidx9 = getelementptr inbounds [200005 x i32], ptr @a, i64 0, i64 %i %1 = load i32, ptr %arrayidx9, align 4, !tbaa !9 %conv1059 = zext i32 %1 to i64 %2 = sub nsw i64 0, %conv1059 %cond.p = select i1 %tobool7.not, i64 %conv1059, i64 %2 %cond = add i64 %cond.p, %i %conv11 = trunc i64 %cond to i32 %cmp = icmp sgt i32 %conv11, -1 %3 = load i32, ptr @n, align 4 %cmp13.not = icmp sgt i32 %3, %conv11 %or.cond = select i1 %cmp, i1 %cmp13.not, i1 false br i1 %or.cond, label %if.else21, label %if.then15 if.then15: ; preds = %if.else %conv17 = sext i32 %1 to i64 br label %return.sink.split if.else21: ; preds = %if.else store i64 -1, ptr %arrayidx1, align 8, !tbaa !5 %conv25 = and i64 %cond, 4294967295 %lnot.ext = zext i1 %tobool7.not to i32 %call = tail call i64 @walk(i64 noundef %conv25, i32 noundef %lnot.ext) %cmp27 = icmp slt i64 %call, 0 br i1 %cmp27, label %return, label %if.end30 if.end30: ; preds = %if.else21 %arrayidx31 = getelementptr inbounds [200005 x i32], ptr @a, i64 0, i64 %i %4 = load i32, ptr %arrayidx31, align 4, !tbaa !9 %conv32 = sext i32 %4 to i64 %add33 = add nsw i64 %call, %conv32 br label %return.sink.split return.sink.split: ; preds = %if.end30, %if.then15 %conv17.sink = phi i64 [ %conv17, %if.then15 ], [ %add33, %if.end30 ] store i64 %conv17.sink, ptr %arrayidx1, align 8, !tbaa !5 br label %return return: ; preds = %return.sink.split, %if.else21, %if.end, %entry %retval.2 = phi i64 [ -1, %entry ], [ %0, %if.end ], [ -1, %if.else21 ], [ %conv17.sink, %return.sink.split ] ret i64 %retval.2 } ; 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 @n) %0 = load i32, ptr @n, align 4, !tbaa !9 %cmp20 = icmp sgt i32 %0, 1 br i1 %cmp20, label %for.body, label %for.end.thread for.end.thread: ; preds = %entry tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3200080) @yc, i8 0, i64 3200080, i1 false) br label %for.end12 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [200005 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 !9 %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 %3 = icmp sgt i32 %1, 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3200080) @yc, i8 0, i64 3200080, i1 false) br i1 %3, label %for.body4, label %for.end12 for.body4: ; preds = %for.end, %for.body4 %indvars.iv25 = phi i64 [ %indvars.iv.next26, %for.body4 ], [ 1, %for.end ] %call5 = tail call i64 @walk(i64 noundef %indvars.iv25, i32 noundef 1) %add = add nsw i64 %call5, %indvars.iv25 %cmp6.inv = icmp sgt i64 %call5, -1 %cond = select i1 %cmp6.inv, i64 %add, i64 -1 %call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond) %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1 %4 = load i32, ptr @n, align 4, !tbaa !9 %5 = sext i32 %4 to i64 %cmp3 = icmp slt i64 %indvars.iv.next26, %5 br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !13 for.end12: ; preds = %for.body4, %for.end.thread, %for.end ret i32 0 } ; 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 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree nounwind "no-trapping-math"="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) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include <stdio.h> void bubbleSort(int[],int); int main(){ int i,N; int A[100]; scanf("%d",&N); for(i=0;i<N;i++)scanf("%d",&A[i]); bubbleSort(A,N); return 0; } void bubbleSort(int A[],int N){ int i,count=0,flag=1,kari; while(flag){ flag = 0; for(i=N-1;i>0;i--){ if(A[i] < A[i-1]){ kari = A[i]; A[i] = A[i-1]; A[i-1] = kari; count++; flag = 1; } } } for(i=0;i<N;i++){ printf("%d",A[i]); if(i != N-1)printf(" "); } printf("\n%d\n",count); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283042/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283042/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp4 = icmp sgt i32 %0, 0 br i1 %cmp4, label %for.body, label %bubbleSort.exit for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %cmp51.i = icmp sgt i32 %1, 1 br i1 %cmp51.i, label %for.cond.preheader.us.preheader.i, label %for.cond15.preheader.i for.cond.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %flag.153.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.153.us.i.be, %for.body.us.i.backedge ] %count.152.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %count.2.us.i, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.us.i %4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom2.us.i = and i64 %sub1.us.i, 4294967295 %arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i %5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %4, %5 br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %4, ptr %arrayidx3.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %count.152.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i %count.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.152.us.i, %for.body.us.i ] %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.153.us.i, %for.body.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.153.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i %tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0 br i1 %tobool.not.us.i, label %for.cond15.preheader.i, label %for.body.us.i.backedge for.cond15.preheader.i: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end %.us-phi.i = phi i32 [ 0, %for.end ], [ %count.2.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i ] %cmp1658.i = icmp sgt i32 %1, 0 br i1 %cmp1658.i, label %for.body17.lr.ph.i, label %bubbleSort.exit for.body17.lr.ph.i: ; preds = %for.cond15.preheader.i %sub20.i = add nsw i32 %1, -1 %6 = zext i32 %sub20.i to i64 %wide.trip.count.i = zext i32 %1 to i64 br label %for.body17.i for.body17.i: ; preds = %for.inc25.i, %for.body17.lr.ph.i %indvars.iv61.i = phi i64 [ 0, %for.body17.lr.ph.i ], [ %indvars.iv.next62.i, %for.inc25.i ] %arrayidx19.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv61.i %7 = load i32, ptr %arrayidx19.i, align 4, !tbaa !5 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7) %cmp21.not.i = icmp eq i64 %indvars.iv61.i, %6 br i1 %cmp21.not.i, label %for.inc25.i, label %if.then22.i if.then22.i: ; preds = %for.body17.i %putchar.i = call i32 @putchar(i32 32) br label %for.inc25.i for.inc25.i: ; preds = %if.then22.i, %for.body17.i %indvars.iv.next62.i = add nuw nsw i64 %indvars.iv61.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next62.i, %wide.trip.count.i br i1 %exitcond.not.i, label %bubbleSort.exit, label %for.body17.i, !llvm.loop !12 bubbleSort.exit: ; preds = %for.inc25.i, %entry, %for.cond15.preheader.i %.us-phi.i14 = phi i32 [ %.us-phi.i, %for.cond15.preheader.i ], [ 0, %entry ], [ %.us-phi.i, %for.inc25.i ] %call28.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i14) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 { entry: %cmp51 = icmp sgt i32 %N, 1 br i1 %cmp51, label %for.cond.preheader.us.preheader, label %for.cond15.preheader for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %N to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %flag.153.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.153.us.be, %for.body.us.backedge ] %count.152.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %count.2.us, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub1.us = add i64 %indvars.iv, 4294967294 %idxprom2.us = and i64 %sub1.us, 4294967295 %arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %1, %2 br i1 %cmp4.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 %inc.us = add nsw i32 %count.152.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body.us %count.2.us = phi i32 [ %inc.us, %if.then.us ], [ %count.152.us, %for.body.us ] %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.153.us, %for.body.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.153.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %for.cond15.preheader, label %for.body.us.backedge for.cond15.preheader: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %count.2.us, %for.cond.while.cond.loopexit_crit_edge.us ] %cmp1658 = icmp sgt i32 %N, 0 br i1 %cmp1658, label %for.body17.lr.ph, label %for.end27 for.body17.lr.ph: ; preds = %for.cond15.preheader %sub20 = add nsw i32 %N, -1 %3 = zext i32 %sub20 to i64 %wide.trip.count = zext i32 %N to i64 br label %for.body17 for.body17: ; preds = %for.body17.lr.ph, %for.inc25 %indvars.iv61 = phi i64 [ 0, %for.body17.lr.ph ], [ %indvars.iv.next62, %for.inc25 ] %arrayidx19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv61 %4 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4) %cmp21.not = icmp eq i64 %indvars.iv61, %3 br i1 %cmp21.not, label %for.inc25, label %if.then22 if.then22: ; preds = %for.body17 %putchar = tail call i32 @putchar(i32 32) br label %for.inc25 for.inc25: ; preds = %for.body17, %if.then22 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count br i1 %exitcond.not, label %for.end27, label %for.body17, !llvm.loop !12 for.end27: ; preds = %for.inc25, %for.cond15.preheader %call28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi) 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: 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} !12 = distinct !{!12, !10}
#include <stdio.h> int bubbleSort(int *,int ); int main(){ int kazu,A[100],count,i; scanf("%d",&kazu); for(i=0;i<kazu;i++){ scanf("%d",&A[i]); } count=bubbleSort(A,kazu); for(i=0;i<kazu;i++){ if(i!=kazu-1){ printf("%d ",A[i]); } else{printf("%d",A[i]); } } printf("\n"); printf("%d\n",count); return 0; } int bubbleSort(int *A,int N){ int flag=1,reset,count=0; while(flag){ flag=0; for(int j=N-1;j>=1;j--){ if(A[j]<A[j-1]){ reset=A[j]; A[j]=A[j-1]; A[j-1]=reset; flag=1; count++; } } } return count; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283086/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283086/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.3 = 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: %kazu = alloca i32, align 4 %A = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kazu) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kazu) %0 = load i32, ptr %kazu, align 4, !tbaa !5 %cmp26 = icmp sgt i32 %0, 0 br i1 %cmp26, label %for.body, label %for.end15 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %kazu, 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 %cmp30.i = icmp sgt i32 %1, 1 br i1 %cmp30.i, label %for.cond.preheader.us.preheader.i, label %bubbleSort.exit for.cond.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %count.132.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %count.2.us.i, %for.body.us.i.backedge ] %flag.131.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.131.us.i.be, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.us.i %4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom2.us.i = and i64 %sub1.us.i, 4294967295 %arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i %5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %4, %5 br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %4, ptr %arrayidx3.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %count.132.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.131.us.i, %for.body.us.i ] %count.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.132.us.i, %for.body.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.131.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i %tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0 br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.body.us.i.backedge bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end %.us-phi.i = phi i32 [ 0, %for.end ], [ %count.2.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i ] %cmp428 = icmp sgt i32 %1, 0 br i1 %cmp428, label %for.body5, label %for.end15 for.body5: ; preds = %bubbleSort.exit, %for.body5 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body5 ], [ 0, %bubbleSort.exit ] %6 = phi i32 [ %9, %for.body5 ], [ %1, %bubbleSort.exit ] %sub = add nsw i32 %6, -1 %7 = zext i32 %sub to i64 %cmp6.not = icmp eq i64 %indvars.iv32, %7 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv32 %8 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %.str..str.1 = select i1 %cmp6.not, ptr @.str, ptr @.str.1 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %8) %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %9 = load i32, ptr %kazu, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp4 = icmp slt i64 %indvars.iv.next33, %10 br i1 %cmp4, label %for.body5, label %for.end15, !llvm.loop !12 for.end15: ; preds = %for.body5, %entry, %bubbleSort.exit %.us-phi.i38 = phi i32 [ %.us-phi.i, %bubbleSort.exit ], [ 0, %entry ], [ %.us-phi.i, %for.body5 ] %putchar = call i32 @putchar(i32 10) %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi.i38) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kazu) #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #3 { entry: %cmp30 = icmp sgt i32 %N, 1 br i1 %cmp30, label %for.cond.preheader.us.preheader, label %while.end for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %N to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %count.132.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %count.2.us, %for.body.us.backedge ] %flag.131.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.131.us.be, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub1.us = add i64 %indvars.iv, 4294967294 %idxprom2.us = and i64 %sub1.us, 4294967295 %arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %1, %2 br i1 %cmp4.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 %inc.us = add nsw i32 %count.132.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.131.us, %for.body.us ] %count.2.us = phi i32 [ %inc.us, %if.then.us ], [ %count.132.us, %for.body.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.131.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %count.2.us, %for.cond.while.cond.loopexit_crit_edge.us ] ret i32 %.us-phi } ; 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 #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> /* int swap(){ }*/ int main (){ int N = 0; int A[100] = {0}; int tmp, flag, j, i, k=0; scanf("%d", &N); for(i=0; i<N; i++){ scanf("%d", &A[i]); } flag = 1; // 逆の隣接要素が存在する while(flag){ flag = 0; for(j=N-1; j>=1; j--){ if(A[j] < A[j-1]){ tmp = A[j]; A[j] = A[j-1]; A[j-1] = tmp; k++; flag = 1; /* for(i=0; i<N-1; i++){ printf("%d ", A[i]); }printf("%d\n%d\n", A[N-1], k); */ } } } for(i=0; i<N-1; i++){ printf("%d ", A[i]); }printf("%d\n%d\n", A[N-1], k); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283129/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283129/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 store i32 0, ptr %N, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %A, i8 0, i64 400, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp52 = icmp sgt i32 %0, 0 br i1 %cmp52, label %for.body, label %for.cond24.preheader.for.end33_crit_edge while.cond.preheader: ; preds = %for.body %cmp355 = icmp sgt i32 %4, 1 br i1 %cmp355, label %for.cond2.preheader.us.preheader, label %for.cond24.preheader.for.end33_crit_edge for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body4.us for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader %indvars.iv70 = phi i64 [ %1, %for.cond2.preheader.us.preheader ], [ %indvars.iv70.be, %for.body4.us.backedge ] %k.158.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %k.2.us, %for.body4.us.backedge ] %flag.156.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %flag.156.us.be, %for.body4.us.backedge ] %indvars.iv.next71 = add nsw i64 %indvars.iv70, -1 %idxprom5.us = and i64 %indvars.iv.next71, 4294967295 %arrayidx6.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom5.us %2 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5 %sub7.us = add i64 %indvars.iv70, 4294967294 %idxprom8.us = and i64 %sub7.us, 4294967295 %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom8.us %3 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp slt i32 %2, %3 br i1 %cmp10.us, label %if.then.us, label %for.inc22.us if.then.us: ; preds = %for.body4.us store i32 %3, ptr %arrayidx6.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx9.us, align 4, !tbaa !5 %inc21.us = add nsw i32 %k.158.us, 1 br label %for.inc22.us for.inc22.us: ; preds = %if.then.us, %for.body4.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.156.us, %for.body4.us ] %k.2.us = phi i32 [ %inc21.us, %if.then.us ], [ %k.158.us, %for.body4.us ] %cmp3.us = icmp sgt i64 %indvars.iv70, 2 br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us for.body4.us.backedge: ; preds = %for.inc22.us, %for.cond2.while.cond.loopexit_crit_edge.us %indvars.iv70.be = phi i64 [ %indvars.iv.next71, %for.inc22.us ], [ %1, %for.cond2.while.cond.loopexit_crit_edge.us ] %flag.156.us.be = phi i32 [ %flag.2.us, %for.inc22.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ] br label %for.body4.us, !llvm.loop !9 for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc22.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %for.cond24.preheader, label %for.body4.us.backedge for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond24.preheader: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us br i1 %cmp355, label %for.body27, label %for.cond24.preheader.for.end33_crit_edge for.cond24.preheader.for.end33_crit_edge: ; preds = %entry, %while.cond.preheader, %for.cond24.preheader %.us-phi82 = phi i32 [ %k.2.us, %for.cond24.preheader ], [ 0, %while.cond.preheader ], [ 0, %entry ] %6 = phi i32 [ %4, %for.cond24.preheader ], [ %4, %while.cond.preheader ], [ %0, %entry ] %sub2563 = add nsw i32 %6, -1 %.pre = sext i32 %sub2563 to i64 br label %for.end33 for.body27: ; preds = %for.cond24.preheader, %for.body27 %indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body27 ], [ 0, %for.cond24.preheader ] %arrayidx29 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv73 %7 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7) %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %8 = load i32, ptr %N, align 4, !tbaa !5 %sub25 = add nsw i32 %8, -1 %9 = sext i32 %sub25 to i64 %cmp26 = icmp slt i64 %indvars.iv.next74, %9 br i1 %cmp26, label %for.body27, label %for.end33, !llvm.loop !12 for.end33: ; preds = %for.body27, %for.cond24.preheader.for.end33_crit_edge %.us-phi81 = phi i32 [ %.us-phi82, %for.cond24.preheader.for.end33_crit_edge ], [ %k.2.us, %for.body27 ] %idxprom35.pre-phi = phi i64 [ %.pre, %for.cond24.preheader.for.end33_crit_edge ], [ %9, %for.body27 ] %arrayidx36 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom35.pre-phi %10 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10, i32 noundef %.us-phi81) call void @llvm.lifetime.end.p0(i64 400, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main() { int n,c; int a[101] = {0}; int d,i,j; int flag; scanf("%d",&n); c = 0; for(i = 0;i<n;i++) { scanf("%d" ,&a[i]); } flag = 1; while(flag) { flag = 0; for(j=n-1;j>=1;j--) { if(a[j] < a[j-1]) { d = a[j]; a[j] = a[j-1]; a[j-1] = d; c++; flag = 1; } } } for(i=0;i<n;i++) { printf("%d",a[i]); if(i != n-1) printf(" "); } printf("\n%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283172/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283172/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [101 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %a, i8 0, i64 404, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.end37 while.cond.preheader: ; preds = %for.body %cmp357 = icmp sgt i32 %4, 1 br i1 %cmp357, label %for.cond2.preheader.us.preheader, label %for.cond24.preheader for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body4.us for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader %indvars.iv69 = phi i64 [ %1, %for.cond2.preheader.us.preheader ], [ %indvars.iv69.be, %for.body4.us.backedge ] %flag.160.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %flag.160.us.be, %for.body4.us.backedge ] %c.158.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %c.2.us, %for.body4.us.backedge ] %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1 %idxprom5.us = and i64 %indvars.iv.next70, 4294967295 %arrayidx6.us = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %idxprom5.us %2 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5 %sub7.us = add i64 %indvars.iv69, 4294967294 %idxprom8.us = and i64 %sub7.us, 4294967295 %arrayidx9.us = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %idxprom8.us %3 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp slt i32 %2, %3 br i1 %cmp10.us, label %if.then.us, label %for.inc22.us if.then.us: ; preds = %for.body4.us store i32 %3, ptr %arrayidx6.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx9.us, align 4, !tbaa !5 %inc21.us = add nsw i32 %c.158.us, 1 br label %for.inc22.us for.inc22.us: ; preds = %if.then.us, %for.body4.us %c.2.us = phi i32 [ %inc21.us, %if.then.us ], [ %c.158.us, %for.body4.us ] %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.160.us, %for.body4.us ] %cmp3.us = icmp sgt i64 %indvars.iv69, 2 br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us for.body4.us.backedge: ; preds = %for.inc22.us, %for.cond2.while.cond.loopexit_crit_edge.us %indvars.iv69.be = phi i64 [ %indvars.iv.next70, %for.inc22.us ], [ %1, %for.cond2.while.cond.loopexit_crit_edge.us ] %flag.160.us.be = phi i32 [ %flag.2.us, %for.inc22.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ] br label %for.body4.us, !llvm.loop !9 for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc22.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %for.cond24.preheader, label %for.body4.us.backedge for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [101 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond24.preheader: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %c.2.us, %for.cond2.while.cond.loopexit_crit_edge.us ] %cmp2565 = icmp sgt i32 %4, 0 br i1 %cmp2565, label %for.body26, label %for.end37 for.body26: ; preds = %for.cond24.preheader, %for.inc35 %indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.inc35 ], [ 0, %for.cond24.preheader ] %arrayidx28 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv72 %6 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %7 = load i32, ptr %n, align 4, !tbaa !5 %sub30 = add nsw i32 %7, -1 %8 = zext i32 %sub30 to i64 %cmp31.not = icmp eq i64 %indvars.iv72, %8 br i1 %cmp31.not, label %for.inc35, label %if.then32 if.then32: ; preds = %for.body26 %putchar = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc35 for.inc35: ; preds = %for.body26, %if.then32 %9 = phi i32 [ %7, %for.body26 ], [ %.pre, %if.then32 ] %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %10 = sext i32 %9 to i64 %cmp25 = icmp slt i64 %indvars.iv.next73, %10 br i1 %cmp25, label %for.body26, label %for.end37, !llvm.loop !12 for.end37: ; preds = %for.inc35, %entry, %for.cond24.preheader %.us-phi79 = phi i32 [ %.us-phi, %for.cond24.preheader ], [ 0, %entry ], [ %.us-phi, %for.inc35 ] %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi79) call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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: 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int main(){ int i,j,n,temp; int a[100]; int count=0; scanf("%d",&n); for(i=0; i<n; i++){ scanf("%d",&a[i]); } for(i=0; i<n-1; i++){ for(j=n-1; j>i; j--){ if(a[j]<a[j-1]){ temp=a[j]; a[j]=a[j-1]; a[j-1]=temp; count+=1; } } } for(i=0; i<n; i++){ if(i!=n-1){ printf("%d ",a[i]); } else{ printf("%d",a[i]); } } printf("\n"); printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283215/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283215/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.3 = 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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp68 = icmp sgt i32 %0, 0 br i1 %cmp68, label %for.body, label %for.end45 for.cond2.preheader: ; preds = %for.body %cmp372 = icmp sgt i32 %3, 1 br i1 %cmp372, label %for.cond6.preheader.preheader, label %for.cond30.preheader for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %3, -1 %1 = zext i32 %3 to i64 %2 = add nsw i64 %1, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx10.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %2 br label %for.cond6.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc27 %indvars.iv83 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next84, %for.inc27 ] %count.074 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc27 ] %.pre = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5 br label %for.body8 for.cond30.preheader: ; preds = %for.inc27, %for.cond2.preheader %count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %count.2, %for.inc27 ] %cmp3176 = icmp sgt i32 %3, 0 br i1 %cmp3176, label %for.body32, label %for.end45 for.body8: ; preds = %for.cond6.preheader, %for.inc25 %5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc25 ] %indvars.iv80 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next81, %for.inc25 ] %count.171 = phi i32 [ %count.074, %for.cond6.preheader ], [ %count.2, %for.inc25 ] %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next81 %6 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp slt i32 %5, %6 br i1 %cmp14, label %if.then, label %for.inc25 if.then: ; preds = %for.body8 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv80 store i32 %6, ptr %arrayidx10, align 4, !tbaa !5 store i32 %5, ptr %arrayidx13, align 4, !tbaa !5 %add = add nsw i32 %count.171, 1 br label %for.inc25 for.inc25: ; preds = %for.body8, %if.then %7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ] %count.2 = phi i32 [ %add, %if.then ], [ %count.171, %for.body8 ] %cmp7 = icmp sgt i64 %indvars.iv.next81, %indvars.iv83 br i1 %cmp7, label %for.body8, label %for.inc27, !llvm.loop !11 for.inc27: ; preds = %for.inc25 %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.cond30.preheader, label %for.cond6.preheader, !llvm.loop !12 for.body32: ; preds = %for.cond30.preheader, %for.body32 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body32 ], [ 0, %for.cond30.preheader ] %8 = phi i32 [ %11, %for.body32 ], [ %3, %for.cond30.preheader ] %sub33 = add nsw i32 %8, -1 %9 = zext i32 %sub33 to i64 %cmp34.not = icmp eq i64 %indvars.iv86, %9 %arrayidx40 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv86 %10 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %.str..str.1 = select i1 %cmp34.not, ptr @.str, ptr @.str.1 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %10) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp31 = icmp slt i64 %indvars.iv.next87, %12 br i1 %cmp31, label %for.body32, label %for.end45, !llvm.loop !13 for.end45: ; preds = %for.body32, %entry, %for.cond30.preheader %count.0.lcssa92 = phi i32 [ %count.0.lcssa, %for.cond30.preheader ], [ 0, %entry ], [ %count.0.lcssa, %for.body32 ] %putchar = call i32 @putchar(i32 10) %call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa92) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int bubbleSort(int [],int); void shutsu(int [],int); int main(){ int N,i; int A[100]; int x; scanf("%d",&N); for(i = 0;i < N;i++){ scanf("%d",&A[i]); } x = bubbleSort(A,N); shutsu(A,N); printf("%d\n",x); return 0; } int bubbleSort(int A[],int N){ int temp; int flag = 1; int i = 0,j; while(flag){ flag = 0; for(j = N-1;j >= 1;j--){ if(A[j] < A[j-1]){ temp = A[j]; A[j] = A[j-1]; A[j-1] = temp; flag = 1; i++; } } } return i; } void shutsu(int A[],int N){ int i; for(i = 0;i < N;i++){ if(i > 0) printf(" "); printf("%d",A[i]); } printf("\n"); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283259/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283259/source.c" target datalayout = "e-m:e-p270: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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %0, 0 br i1 %cmp9, label %for.body, label %shutsu.exit for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %cmp30.i = icmp sgt i32 %1, 1 br i1 %cmp30.i, label %for.cond.preheader.us.preheader.i, label %bubbleSort.exit for.cond.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 br label %for.body.us.i for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %i.132.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %i.2.us.i, %for.body.us.i.backedge ] %flag.131.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.131.us.i.be, %for.body.us.i.backedge ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295 %arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.us.i %4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom2.us.i = and i64 %sub1.us.i, 4294967295 %arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i %5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %4, %5 br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %4, ptr %arrayidx3.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %i.132.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.131.us.i, %for.body.us.i ] %i.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %i.132.us.i, %for.body.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ] %flag.131.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ] br label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i %tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0 br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.body.us.i.backedge bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end %.us-phi.i = phi i32 [ 0, %for.end ], [ %i.2.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i ] %cmp8.i = icmp sgt i32 %1, 0 br i1 %cmp8.i, label %if.end.peel.i, label %shutsu.exit if.end.peel.i: ; preds = %bubbleSort.exit %wide.trip.count.i = zext i32 %1 to i64 %.pre.i = load i32, ptr %A, align 16, !tbaa !5 %call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre.i) %exitcond.peel.not.i = icmp eq i32 %1, 1 br i1 %exitcond.peel.not.i, label %shutsu.exit, label %if.end.i if.end.i: ; preds = %if.end.peel.i, %if.end.i %indvars.iv.i7 = phi i64 [ %indvars.iv.next.i8, %if.end.i ], [ 1, %if.end.peel.i ] %putchar7.i = call i32 @putchar(i32 32) %arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i7 %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %indvars.iv.next.i8 = add nuw nsw i64 %indvars.iv.i7, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i8, %wide.trip.count.i br i1 %exitcond.not.i, label %shutsu.exit, label %if.end.i, !llvm.loop !12 shutsu.exit: ; preds = %if.end.i, %entry, %bubbleSort.exit, %if.end.peel.i %.us-phi.i19 = phi i32 [ %.us-phi.i, %bubbleSort.exit ], [ %.us-phi.i, %if.end.peel.i ], [ 0, %entry ], [ %.us-phi.i, %if.end.i ] %putchar.i = call i32 @putchar(i32 10) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi.i19) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #3 { entry: %cmp30 = icmp sgt i32 %N, 1 br i1 %cmp30, label %for.cond.preheader.us.preheader, label %while.end for.cond.preheader.us.preheader: ; preds = %entry %0 = zext i32 %N to i64 br label %for.body.us for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %i.132.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %i.2.us, %for.body.us.backedge ] %flag.131.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.131.us.be, %for.body.us.backedge ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom.us = and i64 %indvars.iv.next, 4294967295 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %sub1.us = add i64 %indvars.iv, 4294967294 %idxprom2.us = and i64 %sub1.us, 4294967295 %arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %1, %2 br i1 %cmp4.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 %inc.us = add nsw i32 %i.132.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.131.us, %for.body.us ] %i.2.us = phi i32 [ %inc.us, %if.then.us ], [ %i.132.us, %for.body.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ] %flag.131.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ] br label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us %tobool.not.us = icmp eq i32 %flag.2.us, 0 br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %i.2.us, %for.cond.while.cond.loopexit_crit_edge.us ] ret i32 %.us-phi } ; Function Attrs: nofree nounwind uwtable define dso_local void @shutsu(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 { entry: %cmp8 = icmp sgt i32 %N, 0 br i1 %cmp8, label %if.end.peel, label %for.end if.end.peel: ; preds = %entry %wide.trip.count = zext i32 %N to i64 %.pre = load i32, ptr %A, align 4, !tbaa !5 %call2.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 ] %putchar7 = tail call i32 @putchar(i32 32) %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %call2 = 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 !12 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 #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 #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind } 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.peeled.count", i32 1}
#include<stdio.h> int main() { int i, j, a[1000], n, temp, cnt=0; scanf("%d", &n); for(i = 0; i < n; i++) scanf("%d", &a[i]); for(i = 0; i < n; i++){ for(j = n - 1; j != i; j--){ if(a[j] < a[j - 1]){ temp = a[j]; a[j] = a[j-1]; a[j-1] = temp; cnt++; } } } for(i = 0; i < n; i++){ printf("%d", a[i]); if(i < n-1) printf(" "); else printf("\n%d\n", cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283301/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283301/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [1000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #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 %cmp64 = icmp sgt i32 %0, 0 br i1 %cmp64, label %for.body, label %for.end44 for.cond2.preheader: ; preds = %for.body %cmp372 = icmp sgt i32 %5, 0 br i1 %cmp372, label %for.cond5.preheader.lr.ph, label %for.end44 for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader %j.066 = add nsw i32 %5, -1 %1 = zext i32 %5 to i64 %2 = add nsw i64 %1, -1 %3 = add i32 %5, -2 %arrayidx9.prol = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %2 %sub10.prol = add nsw i32 %5, -2 %idxprom11.prol = sext i32 %sub10.prol to i64 %arrayidx12.prol = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom11.prol %indvars.iv.next81.prol = add nsw i64 %1, -2 %4 = trunc i64 %2 to i32 br label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000 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 %5 = load i32, ptr %n, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc27 %cnt.074 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %cnt.1.lcssa, %for.inc27 ] %i.173 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc28, %for.inc27 ] %cmp6.not67 = icmp eq i32 %j.066, %i.173 br i1 %cmp6.not67, label %for.inc27, label %for.body7.preheader for.body7.preheader: ; preds = %for.cond5.preheader %7 = sub i32 %j.066, %i.173 %xtraiter = and i32 %7, 1 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body7.prol.loopexit, label %for.body7.prol for.body7.prol: ; preds = %for.body7.preheader %8 = load i32, ptr %arrayidx9.prol, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx12.prol, align 4, !tbaa !5 %cmp13.prol = icmp slt i32 %8, %9 br i1 %cmp13.prol, label %if.then.prol, label %for.body7.prol.loopexit if.then.prol: ; preds = %for.body7.prol store i32 %9, ptr %arrayidx9.prol, align 4, !tbaa !5 store i32 %8, ptr %arrayidx12.prol, align 4, !tbaa !5 %inc24.prol = add nsw i32 %cnt.074, 1 br label %for.body7.prol.loopexit for.body7.prol.loopexit: ; preds = %for.body7.prol, %if.then.prol, %for.body7.preheader %cnt.2.lcssa.unr = phi i32 [ undef, %for.body7.preheader ], [ %inc24.prol, %if.then.prol ], [ %cnt.074, %for.body7.prol ] %indvars.iv80.unr = phi i64 [ %2, %for.body7.preheader ], [ %indvars.iv.next81.prol, %if.then.prol ], [ %indvars.iv.next81.prol, %for.body7.prol ] %cnt.169.unr = phi i32 [ %cnt.074, %for.body7.preheader ], [ %inc24.prol, %if.then.prol ], [ %cnt.074, %for.body7.prol ] %j.0.in68.unr = phi i32 [ %5, %for.body7.preheader ], [ %4, %if.then.prol ], [ %4, %for.body7.prol ] %10 = icmp eq i32 %3, %i.173 br i1 %10, label %for.inc27, label %for.body7 for.cond30.preheader: ; preds = %for.inc27 br i1 %cmp372, label %for.body32, label %for.end44 for.body7: ; preds = %for.body7.prol.loopexit, %for.inc25.1 %indvars.iv80 = phi i64 [ %indvars.iv.next81.1, %for.inc25.1 ], [ %indvars.iv80.unr, %for.body7.prol.loopexit ] %cnt.169 = phi i32 [ %cnt.2.1, %for.inc25.1 ], [ %cnt.169.unr, %for.body7.prol.loopexit ] %j.0.in68 = phi i32 [ %16, %for.inc25.1 ], [ %j.0.in68.unr, %for.body7.prol.loopexit ] %arrayidx9 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv80 %11 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = add nsw i32 %j.0.in68, -2 %idxprom11 = sext i32 %sub10 to i64 %arrayidx12 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom11 %12 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %cmp13 = icmp slt i32 %11, %12 br i1 %cmp13, label %if.then, label %for.inc25 if.then: ; preds = %for.body7 store i32 %12, ptr %arrayidx9, align 4, !tbaa !5 store i32 %11, ptr %arrayidx12, align 4, !tbaa !5 %inc24 = add nsw i32 %cnt.169, 1 br label %for.inc25 for.inc25: ; preds = %for.body7, %if.then %cnt.2 = phi i32 [ %inc24, %if.then ], [ %cnt.169, %for.body7 ] %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1 %arrayidx9.1 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv.next81 %13 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5 %sub10.1 = shl i64 %indvars.iv80, 32 %sext = add i64 %sub10.1, -8589934592 %idxprom11.1 = ashr exact i64 %sext, 32 %arrayidx12.1 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom11.1 %14 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5 %cmp13.1 = icmp slt i32 %13, %14 br i1 %cmp13.1, label %if.then.1, label %for.inc25.1 if.then.1: ; preds = %for.inc25 store i32 %14, ptr %arrayidx9.1, align 4, !tbaa !5 store i32 %13, ptr %arrayidx12.1, align 4, !tbaa !5 %inc24.1 = add nsw i32 %cnt.2, 1 br label %for.inc25.1 for.inc25.1: ; preds = %if.then.1, %for.inc25 %cnt.2.1 = phi i32 [ %inc24.1, %if.then.1 ], [ %cnt.2, %for.inc25 ] %indvars.iv.next81.1 = add nsw i64 %indvars.iv80, -2 %15 = trunc i64 %indvars.iv.next81.1 to i32 %cmp6.not.1 = icmp eq i32 %i.173, %15 %16 = trunc i64 %indvars.iv.next81 to i32 br i1 %cmp6.not.1, label %for.inc27, label %for.body7, !llvm.loop !11 for.inc27: ; preds = %for.body7.prol.loopexit, %for.inc25.1, %for.cond5.preheader %cnt.1.lcssa = phi i32 [ %cnt.074, %for.cond5.preheader ], [ %cnt.2.lcssa.unr, %for.body7.prol.loopexit ], [ %cnt.2.1, %for.inc25.1 ] %inc28 = add nuw nsw i32 %i.173, 1 %exitcond.not = icmp eq i32 %inc28, %5 br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body32: ; preds = %for.cond30.preheader, %for.inc42 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc42 ], [ 0, %for.cond30.preheader ] %arrayidx34 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv83 %17 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17) %18 = load i32, ptr %n, align 4, !tbaa !5 %sub36 = add nsw i32 %18, -1 %19 = sext i32 %sub36 to i64 %cmp37 = icmp slt i64 %indvars.iv83, %19 br i1 %cmp37, label %if.then38, label %if.else if.then38: ; preds = %for.body32 %putchar = call i32 @putchar(i32 32) br label %for.inc42 if.else: ; preds = %for.body32 %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.1.lcssa) br label %for.inc42 for.inc42: ; preds = %if.then38, %if.else %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %20 = load i32, ptr %n, align 4, !tbaa !5 %21 = sext i32 %20 to i64 %cmp31 = icmp slt i64 %indvars.iv.next84, %21 br i1 %cmp31, label %for.body32, label %for.end44, !llvm.loop !13 for.end44: ; preds = %for.inc42, %entry, %for.cond2.preheader, %for.cond30.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4000, 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: 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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int main(){ int A[100],N,i,j,tmp,flag=1,cnt=0; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%d",&A[i]); } while(flag == 1){ flag = 0; for(j=N-1;j>0;j--){ if(A[j]<A[j-1]){ tmp = A[j]; A[j] = A[j-1]; A[j-1] = tmp; flag = 1; cnt++; } } } for(i=0;i<N;i++){ printf("%d",A[i]); if(i+1 == N){ printf("\n"); break; } printf(" "); } printf("%d\n",cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283345/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283345/source.c" target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca [100 x i32], align 16 %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #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 %cmp56 = icmp sgt i32 %0, 0 br i1 %cmp56, label %for.body, label %for.end38 while.cond.preheader: ; preds = %for.body %cmp459 = icmp sgt i32 %4, 1 br i1 %cmp459, label %for.cond3.preheader.us.preheader, label %for.cond25.preheader for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body5.us for.body5.us: ; preds = %for.body5.us.backedge, %for.cond3.preheader.us.preheader %indvars.iv71 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv71.be, %for.body5.us.backedge ] %cnt.162.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %cnt.2.us, %for.body5.us.backedge ] %flag.161.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %flag.161.us.be, %for.body5.us.backedge ] %indvars.iv.next72 = add nsw i64 %indvars.iv71, -1 %idxprom6.us = and i64 %indvars.iv.next72, 4294967295 %arrayidx7.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom6.us %2 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5 %sub8.us = add i64 %indvars.iv71, 4294967294 %idxprom9.us = and i64 %sub8.us, 4294967295 %arrayidx10.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom9.us %3 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5 %cmp11.us = icmp slt i32 %2, %3 br i1 %cmp11.us, label %if.then.us, label %for.inc23.us if.then.us: ; preds = %for.body5.us store i32 %3, ptr %arrayidx7.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5 %inc22.us = add nsw i32 %cnt.162.us, 1 br label %for.inc23.us for.inc23.us: ; preds = %if.then.us, %for.body5.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.161.us, %for.body5.us ] %cnt.2.us = phi i32 [ %inc22.us, %if.then.us ], [ %cnt.162.us, %for.body5.us ] %cmp4.us = icmp sgt i64 %indvars.iv71, 2 br i1 %cmp4.us, label %for.body5.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us for.body5.us.backedge: ; preds = %for.inc23.us, %for.cond3.while.cond.loopexit_crit_edge.us %indvars.iv71.be = phi i64 [ %indvars.iv.next72, %for.inc23.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ] %flag.161.us.be = phi i32 [ %flag.2.us, %for.inc23.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ] br label %for.body5.us, !llvm.loop !9 for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc23.us %cmp2.us = icmp eq i32 %flag.2.us, 1 br i1 %cmp2.us, label %for.body5.us.backedge, label %for.cond25.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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 %while.cond.preheader, !llvm.loop !11 for.cond25.preheader: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %cnt.2.us, %for.cond3.while.cond.loopexit_crit_edge.us ] %cmp2667 = icmp sgt i32 %4, 0 br i1 %cmp2667, label %for.body27, label %for.end38 for.body27: ; preds = %for.cond25.preheader, %if.end34 %indvars.iv74 = phi i64 [ %indvars.iv.next75, %if.end34 ], [ 0, %for.cond25.preheader ] %arrayidx29 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv74 %6 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %7 = load i32, ptr %N, align 4, !tbaa !5 %8 = zext i32 %7 to i64 %cmp31 = icmp eq i64 %indvars.iv.next75, %8 br i1 %cmp31, label %if.then32, label %if.end34 if.then32: ; preds = %for.body27 %putchar55 = call i32 @putchar(i32 10) br label %for.end38 if.end34: ; preds = %for.body27 %putchar = call i32 @putchar(i32 32) %9 = load i32, ptr %N, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp26 = icmp slt i64 %indvars.iv.next75, %10 br i1 %cmp26, label %for.body27, label %for.end38, !llvm.loop !12 for.end38: ; preds = %if.end34, %entry, %for.cond25.preheader, %if.then32 %.us-phi81 = phi i32 [ %.us-phi, %for.cond25.preheader ], [ %.us-phi, %if.then32 ], [ 0, %entry ], [ %.us-phi, %if.end34 ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi81) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.end.p0(i64 400, 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: 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} !12 = distinct !{!12, !10}
#include<stdio.h> #define N 100 int main(){ int n,A[N],i,j,hoge,sum=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&A[i]); for(i=0;i<n-1;i++){ for(j=n-1;j>i;j--){ if(A[j]<A[j-1]){ sum++; hoge=A[j]; A[j]=A[j-1]; A[j-1]=hoge; } } } for(i=0;i<n;i++){ if(i!=0) printf(" "); printf("%d",A[i]); } printf("\n%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283396/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283396/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp63 = icmp sgt i32 %0, 0 br i1 %cmp63, label %for.body, label %for.end43 for.cond2.preheader: ; preds = %for.body %cmp367 = icmp sgt i32 %3, 1 br i1 %cmp367, label %for.cond6.preheader.preheader, label %for.cond31.preheader for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %3, -1 %1 = zext i32 %3 to i64 %2 = add nsw i64 %1, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx10.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %2 br label %for.cond6.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 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 %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.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28 %indvars.iv78 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next79, %for.inc28 ] %sum.069 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %sum.2, %for.inc28 ] %.pre = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5 br label %for.body8 for.cond31.preheader: ; preds = %for.inc28, %for.cond2.preheader %sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %sum.2, %for.inc28 ] %cmp3271 = icmp sgt i32 %3, 0 br i1 %cmp3271, label %if.end37.peel, label %for.end43 if.end37.peel: ; preds = %for.cond31.preheader %.pre85 = load i32, ptr %A, align 16, !tbaa !5 %call40.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre85) %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp32.peel = icmp sgt i32 %5, 1 br i1 %cmp32.peel, label %if.end37, label %for.end43 for.body8: ; preds = %for.cond6.preheader, %for.inc26 %6 = phi i32 [ %.pre, %for.cond6.preheader ], [ %8, %for.inc26 ] %indvars.iv75 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next76, %for.inc26 ] %sum.166 = phi i32 [ %sum.069, %for.cond6.preheader ], [ %sum.2, %for.inc26 ] %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next76 %7 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp slt i32 %6, %7 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body8 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv75 %inc15 = add nsw i32 %sum.166, 1 store i32 %7, ptr %arrayidx10, align 4, !tbaa !5 store i32 %6, ptr %arrayidx13, align 4, !tbaa !5 br label %for.inc26 for.inc26: ; preds = %for.body8, %if.then %8 = phi i32 [ %6, %if.then ], [ %7, %for.body8 ] %sum.2 = phi i32 [ %inc15, %if.then ], [ %sum.166, %for.body8 ] %cmp7 = icmp sgt i64 %indvars.iv.next76, %indvars.iv78 br i1 %cmp7, label %for.body8, label %for.inc28, !llvm.loop !11 for.inc28: ; preds = %for.inc26 %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond.not, label %for.cond31.preheader, label %for.cond6.preheader, !llvm.loop !12 if.end37: ; preds = %if.end37.peel, %if.end37 %indvars.iv81 = phi i64 [ %indvars.iv.next82, %if.end37 ], [ 1, %if.end37.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx39 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv81 %9 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp32 = icmp slt i64 %indvars.iv.next82, %11 br i1 %cmp32, label %if.end37, label %for.end43, !llvm.loop !13 for.end43: ; preds = %if.end37, %entry, %if.end37.peel, %for.cond31.preheader %sum.0.lcssa89 = phi i32 [ %sum.0.lcssa, %for.cond31.preheader ], [ %sum.0.lcssa, %if.end37.peel ], [ 0, %entry ], [ %sum.0.lcssa, %if.end37 ] %call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa89) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(){ int a[128], b, i, j, count, temp, flag, times; scanf("%d", &b); for(i = 0; i < b; i++){ scanf("%d", &a[i]); } times = b; count = 0; flag = 1; while(flag){ flag = 0; for (j = 0; j < times-1; j++){ if ( a[ j ] > a[j +1] ) { temp = a[j]; a[j] = a[j +1]; a[j + 1] = temp; count++; flag = 1; } } times--; } for( i = 0; i < b; i++){ if(i != 0){ printf(" "); } printf("%d", a[i]); } printf("\n%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283439/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283439/source.c" target datalayout = "e-m:e-p270: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 [5 x i8] c"\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [128 x i32], align 16 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b) %0 = load i32, ptr %b, align 4, !tbaa !5 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body, label %while.cond.preheader while.cond.preheader: ; preds = %for.body, %entry %1 = phi i32 [ %0, %entry ], [ %2, %for.body ] br label %for.cond2.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [128 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 %2 = load i32, ptr %b, 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 %while.cond.preheader, !llvm.loop !9 while.cond.loopexit.unr-lcssa: ; preds = %for.inc21.1, %for.body4.preheader %count.2.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %count.2.1, %for.inc21.1 ] %flag.2.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %flag.2.1, %for.inc21.1 ] %.unr = phi i32 [ %.pre, %for.body4.preheader ], [ %14, %for.inc21.1 ] %indvars.iv70.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next71.1, %for.inc21.1 ] %flag.160.unr = phi i32 [ 0, %for.body4.preheader ], [ %flag.2.1, %for.inc21.1 ] %count.159.unr = phi i32 [ %count.064, %for.body4.preheader ], [ %count.2.1, %for.inc21.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %while.cond.loopexit, label %for.body4.epil for.body4.epil: ; preds = %while.cond.loopexit.unr-lcssa %indvars.iv.next71.epil = add nuw nsw i64 %indvars.iv70.unr, 1 %arrayidx8.epil = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv.next71.epil %4 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %cmp9.epil = icmp sgt i32 %.unr, %4 br i1 %cmp9.epil, label %if.then.epil, label %while.cond.loopexit if.then.epil: ; preds = %for.body4.epil %arrayidx6.epil = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv70.unr store i32 %4, ptr %arrayidx6.epil, align 4, !tbaa !5 store i32 %.unr, ptr %arrayidx8.epil, align 4, !tbaa !5 %inc20.epil = add nsw i32 %count.159.unr, 1 br label %while.cond.loopexit while.cond.loopexit: ; preds = %for.body4.epil, %if.then.epil, %while.cond.loopexit.unr-lcssa %count.2.lcssa = phi i32 [ %count.2.lcssa.ph, %while.cond.loopexit.unr-lcssa ], [ %inc20.epil, %if.then.epil ], [ %count.159.unr, %for.body4.epil ] %flag.2.lcssa = phi i32 [ %flag.2.lcssa.ph, %while.cond.loopexit.unr-lcssa ], [ 1, %if.then.epil ], [ %flag.160.unr, %for.body4.epil ] %tobool.not = icmp eq i32 %flag.2.lcssa, 0 %indvar.next = add i32 %indvar, 1 br i1 %tobool.not, label %for.cond24.preheader, label %for.cond2.preheader, !llvm.loop !11 for.cond2.preheader: ; preds = %while.cond.preheader, %while.cond.loopexit %indvar = phi i32 [ 0, %while.cond.preheader ], [ %indvar.next, %while.cond.loopexit ] %times.065 = phi i32 [ %1, %while.cond.preheader ], [ %sub, %while.cond.loopexit ] %count.064 = phi i32 [ 0, %while.cond.preheader ], [ %count.2.lcssa, %while.cond.loopexit ] %5 = xor i32 %indvar, -1 %6 = add i32 %1, %5 %7 = zext i32 %6 to i64 %sub = add nsw i32 %times.065, -1 %cmp357 = icmp sgt i32 %times.065, 1 br i1 %cmp357, label %for.body4.preheader, label %for.cond24.preheader for.body4.preheader: ; preds = %for.cond2.preheader %.pre = load i32, ptr %a, align 16, !tbaa !5 %xtraiter = and i64 %7, 1 %8 = icmp eq i32 %6, 1 br i1 %8, label %while.cond.loopexit.unr-lcssa, label %for.body4.preheader.new for.body4.preheader.new: ; preds = %for.body4.preheader %unroll_iter = and i64 %7, 4294967294 br label %for.body4 for.cond24.preheader: ; preds = %for.cond2.preheader, %while.cond.loopexit %count.1.lcssa83 = phi i32 [ %count.2.lcssa, %while.cond.loopexit ], [ %count.064, %for.cond2.preheader ] %cmp2566 = icmp sgt i32 %1, 0 br i1 %cmp2566, label %if.end30.peel, label %for.end36 if.end30.peel: ; preds = %for.cond24.preheader %.pre79 = load i32, ptr %a, align 16, !tbaa !5 %call33.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre79) %9 = load i32, ptr %b, align 4, !tbaa !5 %cmp25.peel = icmp sgt i32 %9, 1 br i1 %cmp25.peel, label %if.end30, label %for.end36 for.body4: ; preds = %for.inc21.1, %for.body4.preheader.new %10 = phi i32 [ %.pre, %for.body4.preheader.new ], [ %14, %for.inc21.1 ] %indvars.iv70 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next71.1, %for.inc21.1 ] %flag.160 = phi i32 [ 0, %for.body4.preheader.new ], [ %flag.2.1, %for.inc21.1 ] %count.159 = phi i32 [ %count.064, %for.body4.preheader.new ], [ %count.2.1, %for.inc21.1 ] %niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.inc21.1 ] %indvars.iv.next71 = or i64 %indvars.iv70, 1 %arrayidx8 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv.next71 %11 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %10, %11 br i1 %cmp9, label %if.then, label %for.inc21 if.then: ; preds = %for.body4 %arrayidx6 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv70 store i32 %11, ptr %arrayidx6, align 8, !tbaa !5 store i32 %10, ptr %arrayidx8, align 4, !tbaa !5 %inc20 = add nsw i32 %count.159, 1 br label %for.inc21 for.inc21: ; preds = %for.body4, %if.then %12 = phi i32 [ %10, %if.then ], [ %11, %for.body4 ] %count.2 = phi i32 [ %inc20, %if.then ], [ %count.159, %for.body4 ] %flag.2 = phi i32 [ 1, %if.then ], [ %flag.160, %for.body4 ] %indvars.iv.next71.1 = add nuw nsw i64 %indvars.iv70, 2 %arrayidx8.1 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv.next71.1 %13 = load i32, ptr %arrayidx8.1, align 8, !tbaa !5 %cmp9.1 = icmp sgt i32 %12, %13 br i1 %cmp9.1, label %if.then.1, label %for.inc21.1 if.then.1: ; preds = %for.inc21 %arrayidx6.1 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv.next71 store i32 %13, ptr %arrayidx6.1, align 4, !tbaa !5 store i32 %12, ptr %arrayidx8.1, align 8, !tbaa !5 %inc20.1 = add nsw i32 %count.2, 1 br label %for.inc21.1 for.inc21.1: ; preds = %if.then.1, %for.inc21 %14 = phi i32 [ %12, %if.then.1 ], [ %13, %for.inc21 ] %count.2.1 = phi i32 [ %inc20.1, %if.then.1 ], [ %count.2, %for.inc21 ] %flag.2.1 = phi i32 [ 1, %if.then.1 ], [ %flag.2, %for.inc21 ] %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %while.cond.loopexit.unr-lcssa, label %for.body4, !llvm.loop !12 if.end30: ; preds = %if.end30.peel, %if.end30 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %if.end30 ], [ 1, %if.end30.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx32 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %indvars.iv75 %15 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %16 = load i32, ptr %b, align 4, !tbaa !5 %17 = sext i32 %16 to i64 %cmp25 = icmp slt i64 %indvars.iv.next76, %17 br i1 %cmp25, label %if.end30, label %for.end36, !llvm.loop !13 for.end36: ; preds = %if.end30, %if.end30.peel, %for.cond24.preheader %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.1.lcssa83) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 512, 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: 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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int BubbleSort ( int* Arr, int Max_order ); int main ( void ) { int Max_order = 0; int Arr[100] = {}; int i = 0; int count_for_swap = 0; scanf( "%d", &Max_order ); for ( i = 0; i < Max_order; i++ ) { scanf ( "%d ", &Arr[i] ); } count_for_swap = BubbleSort ( Arr, Max_order ); for ( i = 0; i < Max_order - 1; i++ ) { printf( "%d ", Arr[i] ); } printf( "%d\n", Arr[i] ); printf( "%d\n", count_for_swap ); return 0; } int BubbleSort ( int* Arr, int Max_order ) { int count_for_swap = 0; int tmp = 0; int i = 0; int j = 0; for ( i = 0; i < Max_order; i++ ) { for ( j = Max_order - 1; j > i; j-- ) { if ( Arr[j] < Arr[j-1] ) { tmp = Arr[j]; Arr[j] = Arr[j-1]; Arr[j-1] = tmp; count_for_swap++; } } } return count_for_swap; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283482/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283482/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %Max_order = alloca i32, align 4 %Arr = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Max_order) #5 store i32 0, ptr %Max_order, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %Arr) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %Arr, i8 0, i64 400, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Max_order) %0 = load i32, ptr %Max_order, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end11 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %Arr, 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 %1 = load i32, ptr %Max_order, 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 %cmp43.i = icmp sgt i32 %1, 0 br i1 %cmp43.i, label %for.cond1.preheader.lr.ph.i, label %for.end11 for.cond1.preheader.lr.ph.i: ; preds = %for.end %j.038.i = add nsw i32 %1, -1 %3 = zext i32 %1 to i64 %4 = add nsw i64 %3, -1 %5 = zext i32 %j.038.i to i64 %invariant.gep.i = getelementptr i32, ptr %Arr, i64 -2 br label %for.cond1.preheader.i for.cond1.preheader.i: ; preds = %for.inc18.i, %for.cond1.preheader.lr.ph.i %indvars.iv53.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next54.i, %for.inc18.i ] %count_for_swap.044.i = phi i32 [ 0, %for.cond1.preheader.lr.ph.i ], [ %count_for_swap.1.lcssa.i, %for.inc18.i ] %cmp239.i = icmp ult i64 %indvars.iv53.i, %5 br i1 %cmp239.i, label %for.body3.i, label %for.inc18.i for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i %indvars.iv47.i = phi i64 [ %indvars.iv.next48.i, %for.inc.i ], [ %3, %for.cond1.preheader.i ] %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %4, %for.cond1.preheader.i ] %count_for_swap.140.i = phi i32 [ %count_for_swap.2.i, %for.inc.i ], [ %count_for_swap.044.i, %for.cond1.preheader.i ] %indvars.iv.next48.i = add nsw i64 %indvars.iv47.i, -1 %arrayidx.i = getelementptr inbounds i32, ptr %Arr, i64 %indvars.iv.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv47.i %7 = load i32, ptr %gep.i, align 4, !tbaa !5 %cmp7.i = icmp slt i32 %6, %7 br i1 %cmp7.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body3.i store i32 %7, ptr %arrayidx.i, align 4, !tbaa !5 store i32 %6, ptr %gep.i, align 4, !tbaa !5 %inc.i = add nsw i32 %count_for_swap.140.i, 1 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body3.i %count_for_swap.2.i = phi i32 [ %inc.i, %if.then.i ], [ %count_for_swap.140.i, %for.body3.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv53.i br i1 %cmp2.i, label %for.body3.i, label %for.inc18.i, !llvm.loop !11 for.inc18.i: ; preds = %for.inc.i, %for.cond1.preheader.i %count_for_swap.1.lcssa.i = phi i32 [ %count_for_swap.044.i, %for.cond1.preheader.i ], [ %count_for_swap.2.i, %for.inc.i ] %indvars.iv.next54.i = add nuw nsw i64 %indvars.iv53.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next54.i, %3 br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !12 BubbleSort.exit: ; preds = %for.inc18.i %cmp425 = icmp sgt i32 %1, 1 br i1 %cmp425, label %for.body5, label %for.end11 for.body5: ; preds = %BubbleSort.exit, %for.body5 %indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body5 ], [ 0, %BubbleSort.exit ] %arrayidx7 = getelementptr inbounds [100 x i32], ptr %Arr, i64 0, i64 %indvars.iv30 %8 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1 %9 = load i32, ptr %Max_order, align 4, !tbaa !5 %sub = add nsw i32 %9, -1 %10 = sext i32 %sub to i64 %cmp4 = icmp slt i64 %indvars.iv.next31, %10 br i1 %cmp4, label %for.body5, label %for.end11.loopexit, !llvm.loop !13 for.end11.loopexit: ; preds = %for.body5 %11 = and i64 %indvars.iv.next31, 4294967295 br label %for.end11 for.end11: ; preds = %entry, %for.end, %for.end11.loopexit, %BubbleSort.exit %count_for_swap.0.lcssa.i36 = phi i32 [ %count_for_swap.1.lcssa.i, %BubbleSort.exit ], [ %count_for_swap.1.lcssa.i, %for.end11.loopexit ], [ 0, %for.end ], [ 0, %entry ] %i.1.lcssa = phi i64 [ 0, %BubbleSort.exit ], [ %11, %for.end11.loopexit ], [ 0, %for.end ], [ 0, %entry ] %arrayidx13 = getelementptr inbounds [100 x i32], ptr %Arr, i64 0, i64 %i.1.lcssa %12 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12) %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count_for_swap.0.lcssa.i36) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %Arr) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Max_order) #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @BubbleSort(ptr nocapture noundef %Arr, i32 noundef %Max_order) local_unnamed_addr #4 { entry: %cmp43 = icmp sgt i32 %Max_order, 0 br i1 %cmp43, label %for.cond1.preheader.lr.ph, label %for.end20 for.cond1.preheader.lr.ph: ; preds = %entry %j.038 = add nsw i32 %Max_order, -1 %0 = zext i32 %Max_order to i64 %1 = add nsw i64 %0, -1 %2 = zext i32 %j.038 to i64 %wide.trip.count = zext i32 %Max_order to i64 %invariant.gep = getelementptr i32, ptr %Arr, i64 -2 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc18 %indvars.iv53 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next54, %for.inc18 ] %count_for_swap.044 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %count_for_swap.1.lcssa, %for.inc18 ] %cmp239 = icmp ult i64 %indvars.iv53, %2 br i1 %cmp239, label %for.body3, label %for.inc18 for.body3: ; preds = %for.cond1.preheader, %for.inc %indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.inc ], [ %0, %for.cond1.preheader ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ] %count_for_swap.140 = phi i32 [ %count_for_swap.2, %for.inc ], [ %count_for_swap.044, %for.cond1.preheader ] %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1 %arrayidx = getelementptr inbounds i32, ptr %Arr, i64 %indvars.iv %3 = load i32, ptr %arrayidx, align 4, !tbaa !5 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv47 %4 = load i32, ptr %gep, align 4, !tbaa !5 %cmp7 = icmp slt i32 %3, %4 br i1 %cmp7, label %if.then, label %for.inc if.then: ; preds = %for.body3 store i32 %4, ptr %arrayidx, align 4, !tbaa !5 store i32 %3, ptr %gep, align 4, !tbaa !5 %inc = add nsw i32 %count_for_swap.140, 1 br label %for.inc for.inc: ; preds = %for.body3, %if.then %count_for_swap.2 = phi i32 [ %inc, %if.then ], [ %count_for_swap.140, %for.body3 ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv53 br i1 %cmp2, label %for.body3, label %for.inc18, !llvm.loop !11 for.inc18: ; preds = %for.inc, %for.cond1.preheader %count_for_swap.1.lcssa = phi i32 [ %count_for_swap.044, %for.cond1.preheader ], [ %count_for_swap.2, %for.inc ] %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1 %exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !12 for.end20: ; preds = %for.inc18, %entry %count_for_swap.0.lcssa = phi i32 [ 0, %entry ], [ %count_for_swap.1.lcssa, %for.inc18 ] ret i32 %count_for_swap.0.lcssa } ; 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 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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 t,n,l,a,b,c,d; scanf("%d",&t); for(l=1;l<=t;l++){ scanf("%d%d%d%d%d",&n,&a,&b,&c,&d); if(n*(a+b)<(c-d)) printf("No\n"); else if(n*(a-b)>(c+d)) printf("No\n"); else printf("Yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28354/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28354/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1 @str = 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: %t = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not16 = icmp slt i32 %0, 1 br i1 %cmp.not16, label %for.end, label %for.body for.body: ; preds = %entry, %for.inc %l.017 = phi i32 [ %inc, %for.inc ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %3, %2 %mul = mul nsw i32 %add, %1 %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %d, align 4, !tbaa !5 %sub = sub nsw i32 %4, %5 %cmp2 = icmp slt i32 %mul, %sub br i1 %cmp2, label %for.inc, label %if.else if.else: ; preds = %for.body %sub4 = sub nsw i32 %2, %3 %mul5 = mul nsw i32 %sub4, %1 %add6 = add nsw i32 %5, %4 %cmp7 = icmp sgt i32 %mul5, %add6 %str.4.str = select i1 %cmp7, ptr @str.5, ptr @str br label %for.inc for.inc: ; preds = %if.else, %for.body %str.5.sink = phi ptr [ @str.5, %for.body ], [ %str.4.str, %if.else ] %puts15 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) %inc = add nuw nsw i32 %l.017, 1 %6 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %l.017, %6 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.inc, %entry 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 %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { int D,L,m1,m2; scanf("%d %d",&D,&L); m1=D/L; m2=D%L; if(D%L==0)printf("%d\n",m1); else printf("%d\n",m1+m2); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283583/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283583/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %D = alloca i32, align 4 %L = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %D, ptr noundef nonnull %L) %0 = load i32, ptr %D, align 4, !tbaa !5 %1 = load i32, ptr %L, align 4, !tbaa !5 %div = sdiv i32 %0, %1 %rem = srem i32 %0, %1 %add = add nsw i32 %rem, %div %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #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> typedef struct{int Parent,Rank;}UnionFind; static inline int Root(int x,UnionFind *uf) { if(uf[x].Parent==x)return x; else return uf[x].Parent=Root(uf[x].Parent,uf); } static inline int Unite(int x,int y,UnionFind *uf) { x=Root(x,uf),y=Root(y,uf); if(x==y)return 0; uf[x].Parent=y;uf[y].Rank+=uf[x].Rank;return 1; } static inline int Size(int x,UnionFind *uf){return uf[Root(x,uf)].Rank;} static inline int Belong(int x,int y,UnionFind *uf){return Root(x,uf)==Root(y,uf);} int main(void) { int A,B,C,D,N,M,K,j; j=scanf("%d %d %d",&N,&M,&K); int known[N]; UnionFind uft[N]; for(int i=0;i<N;i++){known[i]=0;uft[i].Parent=i;uft[i].Rank=1;} while(M--) { j=scanf("%d %d",&A,&B); A--,B--;known[A]++,known[B]++;Unite(A,B,uft); } while(K--) { j=scanf("%d %d",&C,&D); C--,D--;if(Belong(C,D,uft))known[C]++,known[D]++; } for(int i=0;i<N;i++){printf("%d ",Size(i,uft)-known[i]-1);} return printf("\n"),0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283626/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283626/source.c" target datalayout = "e-m:e-p270: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.UnionFind = type { i32, i32 } @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %C = alloca i32, align 4 %D = alloca i32, align 4 %N = alloca i32, align 4 %M = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %K) %0 = load i32, ptr %N, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %N, align 4, !tbaa !5 %4 = zext i32 %3 to i64 %vla1 = alloca %struct.UnionFind, i64 %4, align 16 %cmp60 = icmp sgt i32 %3, 0 br i1 %cmp60, label %for.body.preheader, label %while.cond.preheader for.body.preheader: ; preds = %entry %5 = shl nuw nsw i64 %4, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %5, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %3, 4 br i1 %min.iters.check, label %for.body.preheader74, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %4, 4294967292 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2> %6 = or i64 %index, 2 %7 = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %index %8 = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %6 %interleaved.vec = shufflevector <2 x i32> %vec.ind, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec, ptr %7, align 16, !tbaa !5 %interleaved.vec73 = shufflevector <2 x i32> %step.add, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec73, ptr %8, align 16, !tbaa !5 %index.next = add nuw i64 %index, 4 %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4> %9 = icmp eq i64 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %4 br i1 %cmp.n, label %while.cond.preheader, label %for.body.preheader74 for.body.preheader74: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body while.cond.preheader: ; preds = %for.body, %middle.block, %entry %10 = load i32, ptr %M, align 4, !tbaa !5 %dec62 = add nsw i32 %10, -1 store i32 %dec62, ptr %M, align 4, !tbaa !5 %tobool.not63 = icmp eq i32 %10, 0 br i1 %tobool.not63, label %while.cond16.preheader, label %while.body for.body: ; preds = %for.body.preheader74, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader74 ] %arrayidx3 = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %indvars.iv %11 = trunc i64 %indvars.iv to i32 store i32 %11, ptr %arrayidx3, align 8, !tbaa !13 %Rank = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %indvars.iv, i32 1 store i32 1, ptr %Rank, align 4, !tbaa !15 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %4 br i1 %exitcond.not, label %while.cond.preheader, label %for.body, !llvm.loop !16 while.cond16.preheader: ; preds = %Unite.exit, %while.cond.preheader %12 = load i32, ptr %K, align 4, !tbaa !5 %dec1764 = add nsw i32 %12, -1 store i32 %dec1764, ptr %K, align 4, !tbaa !5 %tobool18.not65 = icmp eq i32 %12, 0 br i1 %tobool18.not65, label %for.cond33.preheader, label %while.body19 while.body: ; preds = %while.cond.preheader, %Unite.exit %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A, ptr noundef nonnull %B) %13 = load i32, ptr %A, align 4, !tbaa !5 %dec7 = add nsw i32 %13, -1 store i32 %dec7, ptr %A, align 4, !tbaa !5 %14 = load i32, ptr %B, align 4, !tbaa !5 %dec8 = add nsw i32 %14, -1 store i32 %dec8, ptr %B, align 4, !tbaa !5 %idxprom9 = sext i32 %dec7 to i64 %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %idxprom9 %15 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %inc11 = add nsw i32 %15, 1 store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5 %idxprom12 = sext i32 %dec8 to i64 %arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12 %16 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %inc14 = add nsw i32 %16, 1 store i32 %inc14, ptr %arrayidx13, align 4, !tbaa !5 %call.i = call fastcc i32 @Root(i32 noundef %dec7, ptr noundef nonnull %vla1) %call1.i = call fastcc i32 @Root(i32 noundef %dec8, ptr noundef nonnull %vla1) %cmp.i = icmp eq i32 %call.i, %call1.i br i1 %cmp.i, label %Unite.exit, label %if.end.i if.end.i: ; preds = %while.body %idxprom.i = sext i32 %call.i to i64 %arrayidx.i = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %idxprom.i store i32 %call1.i, ptr %arrayidx.i, align 8, !tbaa !13 %Rank.i = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %idxprom.i, i32 1 %17 = load i32, ptr %Rank.i, align 4, !tbaa !15 %idxprom4.i = sext i32 %call1.i to i64 %Rank6.i = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %idxprom4.i, i32 1 %18 = load i32, ptr %Rank6.i, align 4, !tbaa !15 %add.i = add nsw i32 %18, %17 store i32 %add.i, ptr %Rank6.i, align 4, !tbaa !15 br label %Unite.exit Unite.exit: ; preds = %while.body, %if.end.i %19 = load i32, ptr %M, align 4, !tbaa !5 %dec = add nsw i32 %19, -1 store i32 %dec, ptr %M, align 4, !tbaa !5 %tobool.not = icmp eq i32 %19, 0 br i1 %tobool.not, label %while.cond16.preheader, label %while.body, !llvm.loop !17 for.cond33.preheader: ; preds = %if.end, %while.cond16.preheader %20 = load i32, ptr %N, align 4, !tbaa !5 %cmp3466 = icmp sgt i32 %20, 0 br i1 %cmp3466, label %for.body36, label %for.cond.cleanup35 while.body19: ; preds = %while.cond16.preheader, %if.end %call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %C, ptr noundef nonnull %D) %21 = load i32, ptr %C, align 4, !tbaa !5 %dec21 = add nsw i32 %21, -1 store i32 %dec21, ptr %C, align 4, !tbaa !5 %22 = load i32, ptr %D, align 4, !tbaa !5 %dec22 = add nsw i32 %22, -1 store i32 %dec22, ptr %D, align 4, !tbaa !5 %call.i54 = call fastcc i32 @Root(i32 noundef %dec21, ptr noundef nonnull %vla1) %call1.i55 = call fastcc i32 @Root(i32 noundef %dec22, ptr noundef nonnull %vla1) %cmp.i56.not = icmp eq i32 %call.i54, %call1.i55 br i1 %cmp.i56.not, label %if.then, label %if.end if.then: ; preds = %while.body19 %idxprom25 = sext i32 %dec21 to i64 %arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25 %23 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %inc27 = add nsw i32 %23, 1 store i32 %inc27, ptr %arrayidx26, align 4, !tbaa !5 %idxprom28 = sext i32 %dec22 to i64 %arrayidx29 = getelementptr inbounds i32, ptr %vla, i64 %idxprom28 %24 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %inc30 = add nsw i32 %24, 1 store i32 %inc30, ptr %arrayidx29, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %while.body19 %25 = load i32, ptr %K, align 4, !tbaa !5 %dec17 = add nsw i32 %25, -1 store i32 %dec17, ptr %K, align 4, !tbaa !5 %tobool18.not = icmp eq i32 %25, 0 br i1 %tobool18.not, label %for.cond33.preheader, label %while.body19, !llvm.loop !18 for.cond.cleanup35: ; preds = %for.body36, %for.cond33.preheader %putchar = call i32 @putchar(i32 10) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #7 ret i32 0 for.body36: ; preds = %for.cond33.preheader, %for.body36 %indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body36 ], [ 0, %for.cond33.preheader ] %26 = trunc i64 %indvars.iv69 to i32 %call.i57 = call fastcc i32 @Root(i32 noundef %26, ptr noundef nonnull %vla1) %idxprom.i58 = sext i32 %call.i57 to i64 %Rank.i59 = getelementptr inbounds %struct.UnionFind, ptr %vla1, i64 %idxprom.i58, i32 1 %27 = load i32, ptr %Rank.i59, align 4, !tbaa !15 %arrayidx39 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv69 %28 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %29 = xor i32 %28, -1 %sub40 = add i32 %27, %29 %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub40) %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1 %30 = load i32, ptr %N, align 4, !tbaa !5 %31 = sext i32 %30 to i64 %cmp34 = icmp slt i64 %indvars.iv.next70, %31 br i1 %cmp34, label %for.body36, label %for.cond.cleanup35, !llvm.loop !19 } ; 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: inlinehint nofree nosync nounwind memory(argmem: readwrite) uwtable define internal fastcc i32 @Root(i32 noundef %x, ptr nocapture noundef %uf) unnamed_addr #4 { entry: %idxprom = sext i32 %x to i64 %arrayidx = getelementptr inbounds %struct.UnionFind, ptr %uf, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !13 %cmp = icmp eq i32 %0, %x br i1 %cmp, label %common.ret14, label %if.else common.ret14: ; preds = %entry, %if.else %common.ret14.op = phi i32 [ %call, %if.else ], [ %x, %entry ] ret i32 %common.ret14.op if.else: ; preds = %entry %call = tail call fastcc i32 @Root(i32 noundef %0, ptr noundef nonnull %uf) store i32 %call, ptr %arrayidx, align 4, !tbaa !13 br label %common.ret14 } ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) 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 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 = { inlinehint nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = !{!14, !6, i64 0} !14 = !{!"", !6, i64 0, !6, i64 4} !15 = !{!14, !6, i64 4} !16 = distinct !{!16, !10, !12, !11} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10}
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(void) { int W, a, b; char buf[128], *ch; fgets(buf, sizeof(buf), stdin); ch = strtok(buf, " "); W = atoi(ch); ch = strtok(NULL, " "); a = atoi(ch); ch = strtok(NULL, " "); b = atoi(ch); if(a + W < b) { printf("%d\n", b - a - W); } else if(b + W < a) { printf("%d\n", a - b - W); } else { printf("%d\n", 0); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283677/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283677/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [2 x i8] c" \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: %buf = alloca [128 x i8], align 16 call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %buf) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 128, ptr noundef %0) %call2 = call ptr @strtok(ptr noundef nonnull %buf, ptr noundef nonnull @.str) #4 %call.i = call i64 @strtol(ptr nocapture noundef nonnull %call2, ptr noundef null, i32 noundef 10) #4 %conv.i = trunc i64 %call.i to i32 %call4 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #4 %call.i30 = call i64 @strtol(ptr nocapture noundef nonnull %call4, ptr noundef null, i32 noundef 10) #4 %conv.i31 = trunc i64 %call.i30 to i32 %call6 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #4 %call.i32 = call i64 @strtol(ptr nocapture noundef nonnull %call6, ptr noundef null, i32 noundef 10) #4 %conv.i33 = trunc i64 %call.i32 to i32 %add = add nsw i32 %conv.i31, %conv.i %cmp = icmp slt i32 %add, %conv.i33 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %sub8 = sub i32 %conv.i33, %add br label %if.end18 if.else: ; preds = %entry %add10 = add nsw i32 %conv.i33, %conv.i %cmp11 = icmp slt i32 %add10, %conv.i31 %sub14 = sub i32 %conv.i31, %add10 %spec.select = select i1 %cmp11, i32 %sub14, i32 0 br label %if.end18 if.end18: ; preds = %if.else, %if.then %sub14.sink = phi i32 [ %sub8, %if.then ], [ %spec.select, %if.else ] %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub14.sink) call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %buf) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) 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 nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { 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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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"}
#include <stdio.h> int main (){ int r; scanf("%d",&r); while(r--){ int n,a,b,c,d; scanf("%d%d%d%d%d",&n,&a,&b,&c,&d); if (n*(a-b) > c+d) printf("No\n"); else if (n*(a+b) < c-d) printf("No\n"); else printf("Yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28372/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28372/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1 @str = 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: %r = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load i32, ptr %r, align 4, !tbaa !5 %dec14 = add nsw i32 %0, -1 store i32 %dec14, ptr %r, align 4, !tbaa !5 %tobool.not15 = icmp eq i32 %0, 0 br i1 %tobool.not15, label %while.end, label %while.body while.body: ; preds = %entry, %if.end11 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %2, %3 %mul = mul nsw i32 %sub, %1 %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %d, align 4, !tbaa !5 %add = add nsw i32 %5, %4 %cmp = icmp sgt i32 %mul, %add br i1 %cmp, label %if.end11, label %if.else if.else: ; preds = %while.body %add3 = add nsw i32 %3, %2 %mul4 = mul nsw i32 %add3, %1 %sub5 = sub nsw i32 %4, %5 %cmp6 = icmp slt i32 %mul4, %sub5 %str.4.str = select i1 %cmp6, ptr @str.5, ptr @str br label %if.end11 if.end11: ; preds = %if.else, %while.body %str.4.sink = phi ptr [ @str.5, %while.body ], [ %str.4.str, %if.else ] %puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %6 = load i32, ptr %r, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %r, 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.end11, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main() { int w, a, b, ans; scanf("%d%d%d", &w, &a, &b); if (a == b) { ans = 0; } else if (a < b) { if (a + w >= b) { ans = 0; } else { ans = b - (a + w); } } else { if (b + w >= a) { ans = 0; } else { ans = a - (b + w); } } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283763/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283763/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1 @.str.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: %w = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp eq i32 %0, %1 br i1 %cmp, label %if.end16, label %if.else if.else: ; preds = %entry %cmp1 = icmp slt i32 %0, %1 %2 = load i32, ptr %w, align 4, !tbaa !5 br i1 %cmp1, label %if.then2, label %if.else7 if.then2: ; preds = %if.else %add = add nsw i32 %2, %0 %cmp3.not = icmp slt i32 %add, %1 %sub = sub nsw i32 %1, %add %spec.select = select i1 %cmp3.not, i32 %sub, i32 0 br label %if.end16 if.else7: ; preds = %if.else %add8 = add nsw i32 %2, %1 %cmp9.not = icmp slt i32 %add8, %0 %sub13 = sub nsw i32 %0, %add8 %spec.select19 = select i1 %cmp9.not, i32 %sub13, i32 0 br label %if.end16 if.end16: ; preds = %if.else7, %if.then2, %entry %ans.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.then2 ], [ %spec.select19, %if.else7 ] %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void){ int w,a,b,temp; scanf("%d %d %d",&w,&a,&b); if(a>b){ temp=a; a=b; b=temp; }else if(a==b){ printf("0\n"); return 0; } if(a+w>b){ printf("0\n"); }else{ printf("%d\n",b-(a+w)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283806/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283806/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str.3 = 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: %w = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, %1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 br label %if.end4 if.else: ; preds = %entry %cmp1 = icmp eq i32 %0, %1 br i1 %cmp1, label %if.then2, label %if.end4 if.then2: ; preds = %if.else %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.end4: ; preds = %if.else, %if.then %2 = phi i32 [ %1, %if.else ], [ %0, %if.then ] %3 = phi i32 [ %0, %if.else ], [ %1, %if.then ] %4 = load i32, ptr %w, align 4, !tbaa !5 %add = add nsw i32 %4, %3 %cmp5 = icmp sgt i32 %add, %2 br i1 %cmp5, label %if.then6, label %if.else8 if.then6: ; preds = %if.end4 %puts18 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.else8: ; preds = %if.end4 %sub = sub nsw i32 %2, %add %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub) br label %cleanup cleanup: ; preds = %if.then6, %if.else8, %if.then2 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 %w) #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"}
#include<stdio.h> int main(){ int test_cases; int n; int a,b,c,d; scanf("%d",&test_cases); for(int i=0;i<test_cases;i++){ scanf("%d %d %d %d %d ",&n,&a,&b,&c,&d); int p=n*(a-b); int q=n*(a+b); int r=c-d; int s=c+d; if((p<=r)&&(r<=q))printf("Yes\n"); else if ((p<=s)&&(s<=q))printf("Yes\n"); else if ((r<=p)&&(q<=s))printf("Yes\n"); else printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28385/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28385/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [16 x i8] c"%d %d %d %d %d \00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.6 = 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: %test_cases = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %test_cases) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %test_cases) %0 = load i32, ptr %test_cases, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %if.end22, %entry 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 %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %test_cases) #4 ret i32 0 for.body: ; preds = %entry, %if.end22 %i.038 = phi i32 [ %inc, %if.end22 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %2, %3 %mul = mul nsw i32 %sub, %1 %add = add nsw i32 %3, %2 %mul2 = mul nsw i32 %add, %1 %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %d, align 4, !tbaa !5 %sub3 = sub nsw i32 %4, %5 %add4 = add nsw i32 %5, %4 %cmp5.not = icmp sgt i32 %mul, %sub3 %cmp6.not = icmp sgt i32 %sub3, %mul2 %or.cond = select i1 %cmp5.not, i1 true, i1 %cmp6.not br i1 %or.cond, label %if.else, label %if.end22 if.else: ; preds = %for.body %cmp8.not = icmp sgt i32 %mul, %add4 %cmp10.not = icmp sgt i32 %add4, %mul2 %or.cond35 = select i1 %cmp8.not, i1 true, i1 %cmp10.not br i1 %or.cond35, label %if.else13, label %if.end22 if.else13: ; preds = %if.else %cmp14.not = icmp sgt i32 %sub3, %mul %cmp16.not = icmp sgt i32 %mul2, %add4 %or.cond36 = select i1 %cmp14.not, i1 true, i1 %cmp16.not %str.str.4 = select i1 %or.cond36, ptr @str, ptr @str.6 br label %if.end22 if.end22: ; preds = %if.else13, %if.else, %for.body %str.5.sink = phi ptr [ @str.6, %for.body ], [ @str.6, %if.else ], [ %str.str.4, %if.else13 ] %puts33 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) %inc = add nuw nsw i32 %i.038, 1 %6 = load i32, ptr %test_cases, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %6 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main() { int ncase ; scanf ("%d\n" ,&ncase); int a,b,c,d,n; for (int i=0;i<ncase;i++) { scanf ("%d ",&n); scanf ("%d ",&a); scanf ("%d ",&b); scanf ("%d ",&c); scanf ("%d ",&d); if (n*(a-b) > c+d || n*(a+b) < c-d) printf ("No\n"); else printf("Yes\n"); scanf("\n"); } //scanf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28390/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28390/source.c" target datalayout = "e-m:e-p270: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.4 = private unnamed_addr constant [2 x i8] c"\0A\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: %ncase = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ncase) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ncase) 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 %n) #4 %0 = load i32, ptr %ncase, align 4, !tbaa !5 %cmp16 = icmp sgt i32 %0, 0 br i1 %cmp16, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %if.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 %ncase) #4 ret i32 0 for.body: ; preds = %entry, %if.end %i.017 = phi i32 [ %inc, %if.end ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c) %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %2, %3 %mul = mul nsw i32 %sub, %1 %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %d, align 4, !tbaa !5 %add = add nsw i32 %5, %4 %cmp6 = icmp sgt i32 %mul, %add br i1 %cmp6, label %if.end, label %lor.lhs.false lor.lhs.false: ; preds = %for.body %add7 = add nsw i32 %3, %2 %mul8 = mul nsw i32 %add7, %1 %sub9 = sub nsw i32 %4, %5 %cmp10 = icmp slt i32 %mul8, %sub9 %spec.select = select i1 %cmp10, ptr @str.5, ptr @str br label %if.end if.end: ; preds = %lor.lhs.false, %for.body %str.sink = phi ptr [ @str.5, %for.body ], [ %spec.select, %lor.lhs.false ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4) %inc = add nuw nsw i32 %i.017, 1 %6 = load i32, ptr %ncase, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %6 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress 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> #define INF 10000000 int main(){ int n,i,j,k,l,t,m[101],c,o; int mm[101][101]; scanf("%d",&n); for(i = 1 ; i < n+1; i++){ scanf("%d%d",&m[i-1],&m[i]); } for( i = 1 ; i <= n ; i++ ){ mm[i][i] = 0; } for(l = 2 ; l <n+1 ; l++){ for(i=1;i<n-l+2;i++) { o=i+l-1; mm[i][o] = INF; for(k = i ; k < o ; k++){ t=mm[i][k] + mm[k+1][o] + m[i-1] * m[k] *m[o]; if(t < mm[i][o]) mm[i][o] = t; } } } printf("%d\n",mm[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283943/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283943/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %m = alloca [101 x i32], align 16 %mm = alloca [101 x [101 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %m) #4 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %mm) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not102 = icmp slt i32 %0, 1 br i1 %cmp.not102, label %for.end68, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not104 = icmp slt i32 %6, 1 br i1 %cmp5.not104, label %for.end68, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %2, -4 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %5 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [101 x i32], ptr %m, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 x i32], ptr %m, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.cond4.preheader, !llvm.loop !9 for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv116.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next117.3, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil %indvars.iv116.epil = phi i64 [ %indvars.iv.next117.epil, %for.body6.epil ], [ %indvars.iv116.unr, %for.cond14.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ] %arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv116.epil, i64 %indvars.iv116.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next117.epil = add nuw nsw i64 %indvars.iv116.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11 for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa %cmp16.not111 = icmp slt i32 %6, 2 br i1 %cmp16.not111, label %for.end68, label %for.cond18.preheader.lr.ph for.cond18.preheader.lr.ph: ; preds = %for.cond14.preheader %sub19 = add nuw i32 %6, 2 %8 = add nuw i32 %6, 1 %wide.trip.count141 = zext i32 %8 to i64 br label %for.cond18.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv116 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next117.3, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ] %arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv116, i64 %indvars.iv116 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv.next117, i64 %indvars.iv.next117 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next117.1 = add nuw nsw i64 %indvars.iv116, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv.next117.1, i64 %indvars.iv.next117.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next117.2 = add nuw nsw i64 %indvars.iv116, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv.next117.2, i64 %indvars.iv.next117.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next117.3 = add nuw nsw i64 %indvars.iv116, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13 for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc66 %indvars.iv128 = phi i64 [ 2, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next129, %for.inc66 ] %indvars140 = trunc i64 %indvars.iv128 to i32 %add20 = sub i32 %sub19, %indvars140 %cmp21109 = icmp sgt i32 %add20, 1 br i1 %cmp21109, label %for.body22.lr.ph, label %for.inc66 for.body22.lr.ph: ; preds = %for.cond18.preheader %9 = add nuw i64 %indvars.iv128, 4294967295 br label %for.body22 for.body22: ; preds = %for.body22.lr.ph, %for.inc63 %indvars.iv130 = phi i64 [ %indvars.iv128, %for.body22.lr.ph ], [ %indvars.iv.next131, %for.inc63 ] %indvars.iv119 = phi i64 [ 1, %for.body22.lr.ph ], [ %indvars.iv.next120, %for.inc63 ] %10 = add i64 %9, %indvars.iv119 %sext = shl i64 %10, 32 %idxprom27 = ashr exact i64 %sext, 32 %arrayidx28 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv119, i64 %idxprom27 store i32 10000000, ptr %arrayidx28, align 4 %cmp30106 = icmp slt i64 %indvars.iv119, %idxprom27 br i1 %cmp30106, label %for.body31.lr.ph, label %for.inc63 for.body31.lr.ph: ; preds = %for.body22 %11 = add nsw i64 %indvars.iv119, -1 %arrayidx44 = getelementptr inbounds [101 x i32], ptr %m, i64 0, i64 %11 %12 = load i32, ptr %arrayidx44, align 4, !tbaa !5 %arrayidx48 = getelementptr inbounds [101 x i32], ptr %m, i64 0, i64 %idxprom27 %13 = load i32, ptr %arrayidx48, align 4, !tbaa !5 br label %for.body31 for.body31: ; preds = %for.body31.lr.ph, %for.body31 %indvars.iv121 = phi i64 [ %indvars.iv119, %for.body31.lr.ph ], [ %indvars.iv.next122, %for.body31 ] %storemerge107 = phi i32 [ 10000000, %for.body31.lr.ph ], [ %spec.store.select, %for.body31 ] %arrayidx35 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv119, i64 %indvars.iv121 %14 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1 %arrayidx40 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 %indvars.iv.next122, i64 %idxprom27 %15 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %add41 = add nsw i32 %15, %14 %arrayidx46 = getelementptr inbounds [101 x i32], ptr %m, i64 0, i64 %indvars.iv121 %16 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %mul = mul nsw i32 %16, %12 %mul49 = mul nsw i32 %mul, %13 %add50 = add nsw i32 %add41, %mul49 %spec.store.select = call i32 @llvm.smin.i32(i32 %add50, i32 %storemerge107) store i32 %spec.store.select, ptr %arrayidx28, align 4 %exitcond127.not = icmp eq i64 %indvars.iv.next122, %indvars.iv130 br i1 %exitcond127.not, label %for.inc63, label %for.body31, !llvm.loop !14 for.inc63: ; preds = %for.body31, %for.body22 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond138.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count141 br i1 %exitcond138.not, label %for.inc66, label %for.body22, !llvm.loop !15 for.inc66: ; preds = %for.inc63, %for.cond18.preheader %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count141 br i1 %exitcond142.not, label %for.end68, label %for.cond18.preheader, !llvm.loop !16 for.end68: ; preds = %for.inc66, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa145148 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc66 ] %idxprom70 = sext i32 %.lcssa145148 to i64 %arrayidx71 = getelementptr inbounds [101 x [101 x i32]], ptr %mm, i64 0, i64 1, i64 %idxprom70 %17 = load i32, ptr %arrayidx71, align 4, !tbaa !5 %call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17) call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %mm) #4 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include<stdio.h> #include<stdlib.h> void Matrix_Chain_Order(); int **m; int n; int *P; int main(void){ int i; int temp; scanf("%d",&n); P=(int *)malloc(sizeof(int)*(n+1)); for(i=1;i<=n;i++){ if(i==1) scanf("%d",&P[0]); else scanf("%d",&temp); scanf("%d",&P[i]); } m=(int **)malloc(sizeof(int *)*(n+1)); for(i=0;i<=n;i++) m[i]=(int *)malloc(sizeof(int)*(n+1)); Matrix_Chain_Order(); printf("%d\n",m[1][n]); free(P); for(i=0;i<=n;i++) free(m[i]); free(m); return 0; } void Matrix_Chain_Order(){ int i,j,k,l; int work; for(i=1;i<=n;i++) m[i][i]=0; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j=i+l-1; m[i][j]=m[i][i]+m[i+1][j]+P[i-1]*P[i]*P[j]; for(k=i+1;k<j;k++){ work=m[i][k]+m[k+1][j]+P[i-1]*P[k]*P[j]; if(work<m[i][j]) m[i][j]=work; } } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283994/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283994/source.c" target datalayout = "e-m:e-p270: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 @P = dso_local local_unnamed_addr global ptr null, align 8 @m = dso_local local_unnamed_addr global ptr null, align 8 @.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: %temp = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #6 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %add = add i32 %0, 1 %conv = sext i32 %add to i64 %mul = shl nsw i64 %conv, 2 %call1 = tail call noalias ptr @malloc(i64 noundef %mul) #7 store ptr %call1, ptr @P, align 8, !tbaa !9 %cmp.not49 = icmp slt i32 %0, 1 br i1 %cmp.not49, label %for.end, label %if.end.peel if.end.peel: ; preds = %entry %call5.peel = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call1) %.pre = load ptr, ptr @P, align 8, !tbaa !9 %arrayidx7.peel = getelementptr inbounds i32, ptr %.pre, i64 1 %call8.peel = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7.peel) %1 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not.not.peel = icmp sgt i32 %1, 1 br i1 %cmp.not.not.peel, label %if.end, label %for.end.loopexit if.end: ; preds = %if.end.peel, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 2, %if.end.peel ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp) %.pre64 = load ptr, ptr @P, align 8, !tbaa !9 %arrayidx7 = getelementptr inbounds i32, ptr %.pre64, i64 %indvars.iv %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %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.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %if.end, label %for.end.loopexit, !llvm.loop !11 for.end.loopexit: ; preds = %if.end, %if.end.peel %.lcssa55 = phi i32 [ %1, %if.end.peel ], [ %2, %if.end ] %.pre65 = add i32 %.lcssa55, 1 %.pre66 = sext i32 %.pre65 to i64 br label %for.end for.end: ; preds = %for.end.loopexit, %entry %conv10.pre-phi = phi i64 [ %.pre66, %for.end.loopexit ], [ %conv, %entry ] %add9.pre-phi = phi i32 [ %.pre65, %for.end.loopexit ], [ %add, %entry ] %.lcssa = phi i32 [ %.lcssa55, %for.end.loopexit ], [ %0, %entry ] %mul11 = shl nsw i64 %conv10.pre-phi, 3 %call12 = call noalias ptr @malloc(i64 noundef %mul11) #7 store ptr %call12, ptr @m, align 8, !tbaa !9 %cmp14.not51 = icmp slt i32 %.lcssa, 0 br i1 %cmp14.not51, label %for.end25, label %for.body16.lr.ph for.body16.lr.ph: ; preds = %for.end %mul19 = shl nsw i64 %conv10.pre-phi, 2 %wide.trip.count = zext i32 %add9.pre-phi to i64 br label %for.body16 for.body16: ; preds = %for.body16.lr.ph, %for.body16 %indvars.iv58 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next59, %for.body16 ] %call20 = call noalias ptr @malloc(i64 noundef %mul19) #7 %4 = load ptr, ptr @m, align 8, !tbaa !9 %arrayidx22 = getelementptr inbounds ptr, ptr %4, i64 %indvars.iv58 store ptr %call20, ptr %arrayidx22, align 8, !tbaa !9 %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1 %exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count br i1 %exitcond.not, label %for.end25, label %for.body16, !llvm.loop !14 for.end25: ; preds = %for.body16, %for.end call void @Matrix_Chain_Order() %5 = load ptr, ptr @m, align 8, !tbaa !9 %arrayidx26 = getelementptr inbounds ptr, ptr %5, i64 1 %6 = load ptr, ptr %arrayidx26, align 8, !tbaa !9 %7 = load i32, ptr @n, align 4, !tbaa !5 %idxprom27 = sext i32 %7 to i64 %arrayidx28 = getelementptr inbounds i32, ptr %6, i64 %idxprom27 %8 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %9 = load ptr, ptr @P, align 8, !tbaa !9 call void @free(ptr noundef %9) #6 %10 = load i32, ptr @n, align 4, !tbaa !5 %cmp31.not53 = icmp slt i32 %10, 0 br i1 %cmp31.not53, label %for.end38, label %for.body33 for.body33: ; preds = %for.end25, %for.body33 %indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.body33 ], [ 0, %for.end25 ] %11 = load ptr, ptr @m, align 8, !tbaa !9 %arrayidx35 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv61 %12 = load ptr, ptr %arrayidx35, align 8, !tbaa !9 call void @free(ptr noundef %12) #6 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %13 = load i32, ptr @n, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp31.not.not = icmp slt i64 %indvars.iv61, %14 br i1 %cmp31.not.not, label %for.body33, label %for.end38, !llvm.loop !15 for.end38: ; preds = %for.body33, %for.end25 %15 = load ptr, ptr @m, align 8, !tbaa !9 call void @free(ptr noundef %15) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @Matrix_Chain_Order() local_unnamed_addr #5 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not108 = icmp slt i32 %0, 1 br i1 %cmp.not108, label %for.end75, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %1 = load ptr, ptr @m, align 8, !tbaa !9 br label %for.body for.cond3.preheader: ; preds = %for.body %cmp4.not115 = icmp slt i32 %5, 2 br i1 %cmp4.not115, label %for.end75, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %2 = load ptr, ptr @m, align 8 %3 = load ptr, ptr @P, align 8 %arrayidx12.phi.trans.insert = getelementptr inbounds ptr, ptr %2, i64 1 %invariant.gep = getelementptr i32, ptr %3, i64 -1 br label %for.cond6.preheader for.body: ; preds = %for.body.lr.ph, %for.body %indvars.iv = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv %4 = load ptr, ptr %arrayidx, align 8, !tbaa !9 %arrayidx2 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %5 = load i32, ptr @n, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %6 br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !16 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc73 %7 = phi i32 [ %5, %for.cond6.preheader.lr.ph ], [ %29, %for.inc73 ] %indvars.iv125 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next126, %for.inc73 ] %indvars138 = trunc i64 %indvars.iv125 to i32 %reass.sub = sub i32 %7, %indvars138 %cmp7.not113 = icmp ugt i32 %reass.sub, 2147483646 br i1 %cmp7.not113, label %for.inc73, label %for.body8.lr.ph for.body8.lr.ph: ; preds = %for.cond6.preheader %8 = add nuw i64 %indvars.iv125, 4294967295 %.pre = load ptr, ptr %arrayidx12.phi.trans.insert, align 8, !tbaa !9 %9 = trunc i64 %indvars.iv125 to i32 br label %for.body8 for.cond6.loopexit: ; preds = %for.inc67, %for.body8 %10 = load i32, ptr @n, align 4, !tbaa !5 %reass.sub139 = sub i32 %10, %9 %add = add i32 %reass.sub139, 1 %11 = sext i32 %add to i64 %cmp7.not.not = icmp slt i64 %indvars.iv129, %11 %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 br i1 %cmp7.not.not, label %for.body8, label %for.inc73, !llvm.loop !17 for.body8: ; preds = %for.body8.lr.ph, %for.cond6.loopexit %12 = phi ptr [ %.pre, %for.body8.lr.ph ], [ %15, %for.cond6.loopexit ] %indvars.iv129 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next130, %for.cond6.loopexit ] %indvars.iv127 = phi i64 [ %indvars.iv125, %for.body8.lr.ph ], [ %indvars.iv.next128, %for.cond6.loopexit ] %indvars.iv118 = phi i64 [ 2, %for.body8.lr.ph ], [ %indvars.iv.next119, %for.cond6.loopexit ] %13 = add i64 %8, %indvars.iv129 %arrayidx14 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv129 %14 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1 %indvars134 = trunc i64 %indvars.iv.next130 to i32 %arrayidx17 = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv.next130 %15 = load ptr, ptr %arrayidx17, align 8, !tbaa !9 %16 = trunc i64 %13 to i32 %sext = shl i64 %13, 32 %idxprom18 = ashr exact i64 %sext, 32 %arrayidx19 = getelementptr inbounds i32, ptr %15, i64 %idxprom18 %17 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %add20 = add nsw i32 %17, %14 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv129 %18 = load i32, ptr %gep, align 4, !tbaa !5 %arrayidx25 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv129 %19 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %mul = mul nsw i32 %19, %18 %arrayidx27 = getelementptr inbounds i32, ptr %3, i64 %idxprom18 %20 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %mul28 = mul nsw i32 %mul, %20 %add29 = add nsw i32 %add20, %mul28 %arrayidx33 = getelementptr inbounds i32, ptr %12, i64 %idxprom18 store i32 %add29, ptr %arrayidx33, align 4, !tbaa !5 %cmp36110 = icmp slt i32 %indvars134, %16 br i1 %cmp36110, label %for.body37, label %for.cond6.loopexit for.body37: ; preds = %for.body8, %for.inc67 %21 = phi i32 [ %28, %for.inc67 ], [ %add29, %for.body8 ] %indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.inc67 ], [ %indvars.iv118, %for.body8 ] %arrayidx41 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv120 %22 = load i32, ptr %arrayidx41, align 4, !tbaa !5 %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %arrayidx44 = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv.next121 %23 = load ptr, ptr %arrayidx44, align 8, !tbaa !9 %arrayidx46 = getelementptr inbounds i32, ptr %23, i64 %idxprom18 %24 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %add47 = add nsw i32 %24, %22 %25 = load i32, ptr %gep, align 4, !tbaa !5 %arrayidx52 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv120 %26 = load i32, ptr %arrayidx52, align 4, !tbaa !5 %mul53 = mul nsw i32 %26, %25 %27 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %mul56 = mul nsw i32 %mul53, %27 %add57 = add nsw i32 %add47, %mul56 %cmp62 = icmp slt i32 %add57, %21 br i1 %cmp62, label %if.then, label %for.inc67 if.then: ; preds = %for.body37 store i32 %add57, ptr %arrayidx33, align 4, !tbaa !5 br label %for.inc67 for.inc67: ; preds = %for.body37, %if.then %28 = phi i32 [ %21, %for.body37 ], [ %add57, %if.then ] %exitcond.not = icmp eq i64 %indvars.iv.next121, %indvars.iv127 br i1 %exitcond.not, label %for.cond6.loopexit, label %for.body37, !llvm.loop !18 for.inc73: ; preds = %for.cond6.loopexit, %for.cond6.preheader %29 = phi i32 [ %7, %for.cond6.preheader ], [ %10, %for.cond6.loopexit ] %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1 %30 = sext i32 %29 to i64 %cmp4.not.not = icmp slt i64 %indvars.iv125, %30 br i1 %cmp4.not.not, label %for.cond6.preheader, label %for.end75, !llvm.loop !19 for.end75: ; preds = %for.inc73, %entry, %for.cond3.preheader ret void } 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 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"any pointer", !7, i64 0} !11 = distinct !{!11, !12, !13} !12 = !{!"llvm.loop.mustprogress"} !13 = !{!"llvm.loop.peeled.count", i32 1} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !12} !19 = distinct !{!19, !12}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> typedef struct CELL{ int row; int col; }CELL; int dp[100][100]; int main( ){ int i, j, k, n; scanf("%d", &n); CELL *A = (CELL *)malloc(sizeof(CELL)*(n+1)); for (i=0; i<n; i++) { scanf("%d %d", &(A[i].row), &(A[i].col)); } for (i=0; i < 100; i++) { for (j=0; j < 100; j++) { if (i==j) { dp[i][j] = 0; } else{ dp[i][j] = 100000000; } } } j = 1; for (j=1; j < n; j++) { for (i=0; i + j < n; i++) { for (k = i; k < i+j; k++) { if( dp[i][i+j] > dp[i][k] + dp[k+1][i+j] + A[i].row * A[k].col * A[i+j].col){ dp[i][i+j] = dp[i][k] + dp[k+1][i+j] + A[i].row * A[k].col * A[i+j].col; } } } } printf("%d\n", dp[0][n-1]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284087/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284087/source.c" target datalayout = "e-m:e-p270: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.CELL = type { i32, i32 } @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @dp = dso_local local_unnamed_addr global [100 x [100 x i32]] 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 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, 1 %conv = sext i32 %add to i64 %mul = shl nsw i64 %conv, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #5 %cmp170 = icmp sgt i32 %0, 0 br i1 %cmp170, label %for.body, label %for.cond6.preheader for.cond6.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ] br label %vector.ph for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds %struct.CELL, ptr %call1, i64 %indvars.iv %col = getelementptr inbounds %struct.CELL, ptr %call1, i64 %indvars.iv, i32 1 %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx, ptr noundef nonnull %col) %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.cond6.preheader, !llvm.loop !9 vector.ph: ; preds = %for.inc27, %for.cond6.preheader %indvars.iv184 = phi i64 [ 0, %for.cond6.preheader ], [ %indvars.iv.next185, %for.inc27 ] %broadcast.splatinsert = insertelement <4 x i64> poison, i64 %indvars.iv184, i64 0 %broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %3 = icmp eq <4 x i64> %broadcast.splat, %vec.ind %4 = select <4 x i1> %3, <4 x i32> zeroinitializer, <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000> %5 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv184, i64 %index store <4 x i32> %4, ptr %5, align 16 %index.next = add nuw i64 %index, 4 %vec.ind.next = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4> %6 = icmp eq i64 %index.next, 100 br i1 %6, label %for.inc27, label %vector.body, !llvm.loop !11 for.cond30.preheader: ; preds = %for.inc27 %cmp31177 = icmp sgt i32 %.lcssa, 1 br i1 %cmp31177, label %for.cond34.preheader.preheader, label %for.end114 for.cond34.preheader.preheader: ; preds = %for.cond30.preheader %7 = zext i32 %.lcssa to i64 %wide.trip.count = zext i32 %.lcssa to i64 br label %for.cond34.preheader for.inc27: ; preds = %vector.body %indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1 %exitcond187.not = icmp eq i64 %indvars.iv.next185, 100 br i1 %exitcond187.not, label %for.cond30.preheader, label %vector.ph, !llvm.loop !14 for.cond34.preheader: ; preds = %for.cond34.preheader.preheader, %for.inc112 %indvars.iv196 = phi i64 [ 1, %for.cond34.preheader.preheader ], [ %indvars.iv.next197, %for.inc112 ] %invariant.op = sub nsw i64 %7, %indvars.iv196 br label %for.cond39.preheader for.cond39.preheader: ; preds = %for.cond34.preheader, %for.inc109 %indvars.iv198 = phi i64 [ %indvars.iv196, %for.cond34.preheader ], [ %indvars.iv.next199, %for.inc109 ] %indvars.iv188 = phi i64 [ 0, %for.cond34.preheader ], [ %indvars.iv.next189, %for.inc109 ] %arrayidx48 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv188, i64 %indvars.iv198 %arrayidx61 = getelementptr inbounds %struct.CELL, ptr %call1, i64 %indvars.iv188 %8 = load i32, ptr %arrayidx61, align 4, !tbaa !15 %col70 = getelementptr inbounds %struct.CELL, ptr %call1, i64 %indvars.iv198, i32 1 %9 = load i32, ptr %col70, align 4, !tbaa !17 %arrayidx48.promoted = load i32, ptr %arrayidx48, align 4, !tbaa !5 br label %for.body43 for.body43: ; preds = %for.cond39.preheader, %for.inc106 %indvars.iv190 = phi i64 [ %indvars.iv188, %for.cond39.preheader ], [ %indvars.iv.next191, %for.inc106 ] %10 = phi i32 [ %arrayidx48.promoted, %for.cond39.preheader ], [ %14, %for.inc106 ] %arrayidx52 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv188, i64 %indvars.iv190 %11 = load i32, ptr %arrayidx52, align 4, !tbaa !5 %indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1 %arrayidx58 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next191, i64 %indvars.iv198 %12 = load i32, ptr %arrayidx58, align 4, !tbaa !5 %add59 = add nsw i32 %12, %11 %col65 = getelementptr inbounds %struct.CELL, ptr %call1, i64 %indvars.iv190, i32 1 %13 = load i32, ptr %col65, align 4, !tbaa !17 %mul66 = mul nsw i32 %13, %8 %mul71 = mul nsw i32 %mul66, %9 %add72 = add nsw i32 %add59, %mul71 %cmp73 = icmp sgt i32 %10, %add72 br i1 %cmp73, label %if.then75, label %for.inc106 if.then75: ; preds = %for.body43 store i32 %add72, ptr %arrayidx48, align 4, !tbaa !5 br label %for.inc106 for.inc106: ; preds = %for.body43, %if.then75 %14 = phi i32 [ %10, %for.body43 ], [ %add72, %if.then75 ] %exitcond195.not = icmp eq i64 %indvars.iv.next191, %indvars.iv198 br i1 %exitcond195.not, label %for.inc109, label %for.body43, !llvm.loop !18 for.inc109: ; preds = %for.inc106 %indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1 %indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1 %cmp36 = icmp slt i64 %indvars.iv.next189, %invariant.op br i1 %cmp36, label %for.cond39.preheader, label %for.inc112, !llvm.loop !19 for.inc112: ; preds = %for.inc109 %indvars.iv.next197 = add nuw nsw i64 %indvars.iv196, 1 %exitcond207.not = icmp eq i64 %indvars.iv.next197, %wide.trip.count br i1 %exitcond207.not, label %for.end114, label %for.cond34.preheader, !llvm.loop !20 for.end114: ; preds = %for.inc112, %for.cond30.preheader %sub = add nsw i32 %.lcssa, -1 %idxprom115 = sext i32 %sub to i64 %arrayidx116 = getelementptr inbounds [100 x i32], ptr @dp, i64 0, i64 %idxprom115 %15 = load i32, ptr %arrayidx116, align 4, !tbaa !5 %call117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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 = !{!16, !6, i64 0} !16 = !{!"CELL", !6, i64 0, !6, i64 4} !17 = !{!16, !6, i64 4} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include <stdio.h> int main(){ int t; scanf("%i",&t); while(t--){ int n,a,b,c,d; scanf("%i%i%i%i%i",&n,&a,&b,&c,&d); if( (n*(a-b)<=(c+d) && n*(a-b)>=(c-d)) || (n*(a+b)<=(c+d) && n*(a+b)>=(c-d)) || ((c-d)>(a-b)*n && (c+d)<(a+b)*n ) ) printf("Yes\n"); else printf("No\n"); } return 0-0-0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28413/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28413/source.c" target datalayout = "e-m:e-p270: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"%i\00", align 1 @.str.1 = private unnamed_addr constant [11 x i8] c"%i%i%i%i%i\00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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 %dec30 = add nsw i32 %0, -1 store i32 %dec30, ptr %t, align 4, !tbaa !5 %tobool.not31 = icmp eq i32 %0, 0 br i1 %tobool.not31, label %while.end, label %while.body while.body: ; preds = %entry, %if.end call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %2, %3 %mul = mul nsw i32 %sub, %1 %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %d, align 4, !tbaa !5 %add = add nsw i32 %5, %4 %cmp.not = icmp sgt i32 %mul, %add %sub4 = sub nsw i32 %4, %5 %cmp5.not = icmp slt i32 %mul, %sub4 %or.cond = select i1 %cmp.not, i1 true, i1 %cmp5.not br i1 %or.cond, label %lor.lhs.false, label %if.end lor.lhs.false: ; preds = %while.body %add6 = add nsw i32 %3, %2 %mul7 = mul nsw i32 %add6, %1 %cmp9.not = icmp sgt i32 %mul7, %add %cmp14.not = icmp sge i32 %mul7, %sub4 %or.cond29 = select i1 %cmp9.not, i1 %cmp5.not, i1 %cmp14.not %spec.select = select i1 %or.cond29, ptr @str.4, ptr @str br label %if.end if.end: ; preds = %lor.lhs.false, %while.body %str.sink = phi ptr [ @str.4, %while.body ], [ %spec.select, %lor.lhs.false ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %6 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int p[100],m[100][100]; void MCM(int n){ int i,l,j,k,b; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j = i + l - 1; m[i][j] = 100000; for(k=i;k<j;k++){ b = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]; if(m[i][j]>b) m[i][j]=b; } } } } int main(){ int n,i,j; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d%d",&p[i-1],&p[i]); } for(i=1;i<=n;i++){ m[i][i]=0; } MCM(n); printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284180/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284180/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @m = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @p = dso_local global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @MCM(i32 noundef %n) local_unnamed_addr #0 { entry: %cmp.not71 = icmp slt i32 %n, 2 br i1 %cmp.not71, label %for.end44, label %for.cond1.preheader.lr.ph for.cond1.preheader.lr.ph: ; preds = %entry %sub = add nuw i32 %n, 1 %wide.trip.count = zext i32 %sub to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc42 %indvars.iv78 = phi i64 [ 2, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next79, %for.inc42 ] %indvars90 = trunc i64 %indvars.iv78 to i32 %add = sub i32 %sub, %indvars90 %cmp2.not69 = icmp slt i32 %add, 1 br i1 %cmp2.not69, label %for.inc42, label %for.body3.lr.ph for.body3.lr.ph: ; preds = %for.cond1.preheader %0 = add nuw i64 %indvars.iv78, 4294967295 br label %for.body3 for.body3: ; preds = %for.body3.lr.ph, %for.inc39 %indvars.iv80 = phi i64 [ %indvars.iv78, %for.body3.lr.ph ], [ %indvars.iv.next81, %for.inc39 ] %indvars.iv = phi i64 [ 1, %for.body3.lr.ph ], [ %indvars.iv.next, %for.inc39 ] %1 = add i64 %0, %indvars.iv %sext = shl i64 %1, 32 %idxprom6 = ashr exact i64 %sext, 32 %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %idxprom6 store i32 100000, ptr %arrayidx7, align 4, !tbaa !5 %cmp967 = icmp slt i64 %indvars.iv, %idxprom6 br i1 %cmp967, label %for.body10.lr.ph, label %for.inc39 for.body10.lr.ph: ; preds = %for.body3 %2 = add nsw i64 %indvars.iv, -1 %arrayidx23 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %2 %3 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %arrayidx27 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %idxprom6 %4 = load i32, ptr %arrayidx27, align 4, !tbaa !5 br label %for.body10 for.body10: ; preds = %for.body10.lr.ph, %for.inc %indvars.iv73 = phi i64 [ %indvars.iv, %for.body10.lr.ph ], [ %indvars.iv.next74, %for.inc ] %5 = phi i32 [ 100000, %for.body10.lr.ph ], [ %9, %for.inc ] %arrayidx14 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %indvars.iv73 %6 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %arrayidx19 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next74, i64 %idxprom6 %7 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %add20 = add nsw i32 %7, %6 %arrayidx25 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv73 %8 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %mul = mul nsw i32 %8, %3 %mul28 = mul nsw i32 %mul, %4 %add29 = add nsw i32 %add20, %mul28 %cmp34 = icmp sgt i32 %5, %add29 br i1 %cmp34, label %if.then, label %for.inc if.then: ; preds = %for.body10 store i32 %add29, ptr %arrayidx7, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body10, %if.then %9 = phi i32 [ %5, %for.body10 ], [ %add29, %if.then ] %exitcond.not = icmp eq i64 %indvars.iv.next74, %indvars.iv80 br i1 %exitcond.not, label %for.inc39, label %for.body10, !llvm.loop !9 for.inc39: ; preds = %for.inc, %for.body3 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %exitcond88.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count br i1 %exitcond88.not, label %for.inc42, label %for.body3, !llvm.loop !11 for.inc42: ; preds = %for.inc39, %for.cond1.preheader %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond91.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond91.not, label %for.end44, label %for.cond1.preheader, !llvm.loop !12 for.end44: ; preds = %for.inc42, %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not24 = icmp slt i32 %0, 1 br i1 %cmp.not24, label %MCM.exit, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not26 = icmp slt i32 %6, 1 br i1 %cmp5.not26, label %MCM.exit, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end13.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %2, -4 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %5 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.cond4.preheader, !llvm.loop !13 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv31 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next32.3, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ] %arrayidx10 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv31, i64 %indvars.iv31 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1 %arrayidx10.1 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32, i64 %indvars.iv.next32 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next32.1 = add nuw nsw i64 %indvars.iv31, 2 %arrayidx10.2 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32.1, i64 %indvars.iv.next32.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next32.2 = add nuw nsw i64 %indvars.iv31, 3 %arrayidx10.3 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32.2, i64 %indvars.iv.next32.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next32.3 = add nuw nsw i64 %indvars.iv31, 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.end13.unr-lcssa, label %for.body6, !llvm.loop !14 for.end13.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv31.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next32.3, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end13, label %for.body6.epil for.body6.epil: ; preds = %for.end13.unr-lcssa, %for.body6.epil %indvars.iv31.epil = phi i64 [ %indvars.iv.next32.epil, %for.body6.epil ], [ %indvars.iv31.unr, %for.end13.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.end13.unr-lcssa ] %arrayidx10.epil = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv31.epil, i64 %indvars.iv31.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next32.epil = add nuw nsw i64 %indvars.iv31.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.end13, label %for.body6.epil, !llvm.loop !15 for.end13: ; preds = %for.body6.epil, %for.end13.unr-lcssa %cmp.not71.i = icmp slt i32 %6, 2 br i1 %cmp.not71.i, label %MCM.exit, label %for.cond1.preheader.lr.ph.i for.cond1.preheader.lr.ph.i: ; preds = %for.end13 %sub.i = add nuw nsw i32 %6, 1 %wide.trip.count.i = zext i32 %sub.i to i64 br label %for.cond1.preheader.i for.cond1.preheader.i: ; preds = %for.inc42.i, %for.cond1.preheader.lr.ph.i %indvars.iv78.i = phi i64 [ 2, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next79.i, %for.inc42.i ] %indvars90.i = trunc i64 %indvars.iv78.i to i32 %add.i = sub i32 %sub.i, %indvars90.i %cmp2.not69.i = icmp slt i32 %add.i, 1 br i1 %cmp2.not69.i, label %for.inc42.i, label %for.body3.lr.ph.i for.body3.lr.ph.i: ; preds = %for.cond1.preheader.i %8 = add nuw nsw i64 %indvars.iv78.i, 4294967295 br label %for.body3.i for.body3.i: ; preds = %for.inc39.i, %for.body3.lr.ph.i %indvars.iv80.i = phi i64 [ %indvars.iv78.i, %for.body3.lr.ph.i ], [ %indvars.iv.next81.i, %for.inc39.i ] %indvars.iv.i = phi i64 [ 1, %for.body3.lr.ph.i ], [ %indvars.iv.next.i, %for.inc39.i ] %9 = add nuw i64 %8, %indvars.iv.i %sext.i = shl i64 %9, 32 %idxprom6.i = ashr exact i64 %sext.i, 32 %arrayidx7.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %idxprom6.i store i32 100000, ptr %arrayidx7.i, align 4, !tbaa !5 %cmp967.i = icmp slt i64 %indvars.iv.i, %idxprom6.i br i1 %cmp967.i, label %for.body10.lr.ph.i, label %for.inc39.i for.body10.lr.ph.i: ; preds = %for.body3.i %10 = add nsw i64 %indvars.iv.i, -1 %arrayidx23.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5 %arrayidx27.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %idxprom6.i %12 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %mul.i = mul i32 %12, %11 br label %for.body10.i for.body10.i: ; preds = %for.inc.i, %for.body10.lr.ph.i %indvars.iv73.i = phi i64 [ %indvars.iv.i, %for.body10.lr.ph.i ], [ %indvars.iv.next74.i, %for.inc.i ] %13 = phi i32 [ 100000, %for.body10.lr.ph.i ], [ %17, %for.inc.i ] %arrayidx14.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %indvars.iv73.i %14 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5 %indvars.iv.next74.i = add nuw nsw i64 %indvars.iv73.i, 1 %arrayidx19.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next74.i, i64 %idxprom6.i %15 = load i32, ptr %arrayidx19.i, align 4, !tbaa !5 %add20.i = add nsw i32 %15, %14 %arrayidx25.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv73.i %16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5 %mul28.i = mul i32 %mul.i, %16 %add29.i = add nsw i32 %add20.i, %mul28.i %cmp34.i = icmp sgt i32 %13, %add29.i br i1 %cmp34.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body10.i store i32 %add29.i, ptr %arrayidx7.i, align 4, !tbaa !5 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body10.i %17 = phi i32 [ %13, %for.body10.i ], [ %add29.i, %if.then.i ] %exitcond.not.i = icmp eq i64 %indvars.iv.next74.i, %indvars.iv80.i br i1 %exitcond.not.i, label %for.inc39.i, label %for.body10.i, !llvm.loop !9 for.inc39.i: ; preds = %for.inc.i, %for.body3.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %indvars.iv.next81.i = add nuw nsw i64 %indvars.iv80.i, 1 %exitcond88.not.i = icmp eq i64 %indvars.iv.next81.i, %wide.trip.count.i br i1 %exitcond88.not.i, label %for.inc42.i, label %for.body3.i, !llvm.loop !11 for.inc42.i: ; preds = %for.inc39.i, %for.cond1.preheader.i %indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1 %exitcond91.not.i = icmp eq i64 %indvars.iv.next79.i, %wide.trip.count.i br i1 %exitcond91.not.i, label %MCM.exit, label %for.cond1.preheader.i, !llvm.loop !12 MCM.exit: ; preds = %for.inc42.i, %entry, %for.cond4.preheader, %for.end13 %.lcssa3639 = phi i32 [ %6, %for.end13 ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc42.i ] %idxprom14 = sext i32 %.lcssa3639 to i64 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom14 %18 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !16} !16 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> #include<math.h> static const int N = 100; int main() { int i,j,l,k,n,p[N + 1],m[N + 1][N + 1]; scanf("%d\n", &n); for(i=1;i<=n;i++) { scanf("%d%d\n", &p[i-1],&p[i]); } for(i = 1;i<=n;i++)m[i][i]=0; for(l = 2;l<=n;l++) { for(i=1;i<=n - l + 1; i++) { j=i+l-1; m[i][j] = (1<<21); for(k=i;k<=j-1;k++) { m[i][j] = fmin(m[i][j],m[i][k] + m[k+1][j]+p[i-1]*p[k]*p[j]); } } } printf("%d\n", m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284223/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284223/source.c" target datalayout = "e-m:e-p270: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 [6 x i8] c"%d%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %0 = tail call ptr @llvm.stacksave.p0() %vla102 = alloca [101 x i32], align 16 %vla1103 = alloca [10201 x i32], align 16 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not104 = icmp slt i32 %1, 1 br i1 %cmp.not104, label %for.end69, label %for.body.preheader for.body.preheader: ; preds = %entry %invariant.gep152 = getelementptr i32, ptr %vla102, i64 -1 br label %for.body for.cond5.preheader: ; preds = %for.body %cmp6.not106 = icmp slt i32 %6, 1 br i1 %cmp6.not106, label %for.end69, label %for.body7.preheader for.body7.preheader: ; preds = %for.cond5.preheader %2 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %2 to i64 %3 = add nsw i64 %wide.trip.count, -1 %4 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %3, 3 %5 = icmp ult i64 %4, 3 br i1 %5, label %for.cond15.preheader.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %3, -4 br label %for.body7 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %gep153 = getelementptr i32, ptr %invariant.gep152, i64 %indvars.iv %arrayidx3 = getelementptr inbounds i32, ptr %vla102, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %gep153, ptr noundef nonnull %arrayidx3) %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.cond5.preheader, !llvm.loop !9 for.cond15.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %indvars.iv118.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next119.3, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil for.body7.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body7.epil %indvars.iv118.epil = phi i64 [ %indvars.iv.next119.epil, %for.body7.epil ], [ %indvars.iv118.unr, %for.cond15.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond15.preheader.unr-lcssa ] %8 = mul nuw nsw i64 %indvars.iv118.epil, 101 %arrayidx9.epil = getelementptr inbounds i32, ptr %vla1103, i64 %8 %arrayidx11.epil = getelementptr inbounds i32, ptr %arrayidx9.epil, i64 %indvars.iv118.epil store i32 0, ptr %arrayidx11.epil, align 4, !tbaa !5 %indvars.iv.next119.epil = add nuw nsw i64 %indvars.iv118.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.cond15.preheader, label %for.body7.epil, !llvm.loop !11 for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.unr-lcssa %cmp16.not113 = icmp slt i32 %6, 2 br i1 %cmp16.not113, label %for.end69, label %for.cond18.preheader.lr.ph for.cond18.preheader.lr.ph: ; preds = %for.cond15.preheader %sub19 = add nuw i32 %6, 1 %wide.trip.count144 = zext i32 %sub19 to i64 %invariant.gep154 = getelementptr i32, ptr %vla102, i64 -1 br label %for.cond18.preheader for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv118 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next119.3, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ] %9 = mul nuw nsw i64 %indvars.iv118, 101 %arrayidx9 = getelementptr inbounds i32, ptr %vla1103, i64 %9 %arrayidx11 = getelementptr inbounds i32, ptr %arrayidx9, i64 %indvars.iv118 store i32 0, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %10 = mul nuw nsw i64 %indvars.iv.next119, 101 %arrayidx9.1 = getelementptr inbounds i32, ptr %vla1103, i64 %10 %arrayidx11.1 = getelementptr inbounds i32, ptr %arrayidx9.1, i64 %indvars.iv.next119 store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5 %indvars.iv.next119.1 = add nuw nsw i64 %indvars.iv118, 2 %11 = mul nuw nsw i64 %indvars.iv.next119.1, 101 %arrayidx9.2 = getelementptr inbounds i32, ptr %vla1103, i64 %11 %arrayidx11.2 = getelementptr inbounds i32, ptr %arrayidx9.2, i64 %indvars.iv.next119.1 store i32 0, ptr %arrayidx11.2, align 4, !tbaa !5 %indvars.iv.next119.2 = add nuw nsw i64 %indvars.iv118, 3 %12 = mul nuw nsw i64 %indvars.iv.next119.2, 101 %arrayidx9.3 = getelementptr inbounds i32, ptr %vla1103, i64 %12 %arrayidx11.3 = getelementptr inbounds i32, ptr %arrayidx9.3, i64 %indvars.iv.next119.2 store i32 0, ptr %arrayidx11.3, align 4, !tbaa !5 %indvars.iv.next119.3 = add nuw nsw i64 %indvars.iv118, 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.cond15.preheader.unr-lcssa, label %for.body7, !llvm.loop !13 for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc67 %indvars.iv130 = phi i64 [ 2, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next131, %for.inc67 ] %indvars143 = trunc i64 %indvars.iv130 to i32 %add = sub i32 %sub19, %indvars143 %cmp20.not111 = icmp slt i32 %add, 1 br i1 %cmp20.not111, label %for.inc67, label %for.body31.lr.ph for.body31.lr.ph: ; preds = %for.cond18.preheader, %for.inc64 %indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.inc64 ], [ %indvars.iv130, %for.cond18.preheader ] %indvars.iv121 = phi i64 [ %indvars.iv.next122, %for.inc64 ], [ 1, %for.cond18.preheader ] %13 = add nuw nsw i64 %indvars.iv121, %indvars.iv130 %14 = add nsw i64 %13, -1 %15 = mul nuw nsw i64 %indvars.iv121, 101 %arrayidx25 = getelementptr inbounds i32, ptr %vla1103, i64 %15 %arrayidx27 = getelementptr inbounds i32, ptr %arrayidx25, i64 %14 %invariant.gep = getelementptr i32, ptr %vla1103, i64 %14 store i32 2097152, ptr %arrayidx27, align 4, !tbaa !5 %gep155 = getelementptr i32, ptr %invariant.gep154, i64 %indvars.iv121 %16 = load i32, ptr %gep155, align 4, !tbaa !5 %arrayidx52 = getelementptr inbounds i32, ptr %vla102, i64 %14 %17 = load i32, ptr %arrayidx52, align 4, !tbaa !5 br label %for.body31 for.body31: ; preds = %for.body31.lr.ph, %for.body31 %indvars.iv123 = phi i64 [ %indvars.iv121, %for.body31.lr.ph ], [ %indvars.iv.next124, %for.body31 ] %storemerge109 = phi i32 [ 2097152, %for.body31.lr.ph ], [ %conv56, %for.body31 ] %conv = sitofp i32 %storemerge109 to double %arrayidx39 = getelementptr inbounds i32, ptr %arrayidx25, i64 %indvars.iv123 %18 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1 %19 = mul nuw nsw i64 %indvars.iv.next124, 101 %gep = getelementptr i32, ptr %invariant.gep, i64 %19 %20 = load i32, ptr %gep, align 4, !tbaa !5 %add45 = add nsw i32 %20, %18 %arrayidx50 = getelementptr inbounds i32, ptr %vla102, i64 %indvars.iv123 %21 = load i32, ptr %arrayidx50, align 4, !tbaa !5 %mul = mul nsw i32 %21, %16 %mul53 = mul nsw i32 %mul, %17 %add54 = add nsw i32 %add45, %mul53 %conv55 = sitofp i32 %add54 to double %22 = call double @llvm.minnum.f64(double %conv, double %conv55) %conv56 = fptosi double %22 to i32 store i32 %conv56, ptr %arrayidx27, align 4, !tbaa !5 %exitcond129.not = icmp eq i64 %indvars.iv.next124, %indvars.iv132 br i1 %exitcond129.not, label %for.inc64, label %for.body31, !llvm.loop !14 for.inc64: ; preds = %for.body31 %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1 %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count144 br i1 %exitcond142.not, label %for.inc67, label %for.body31.lr.ph, !llvm.loop !15 for.inc67: ; preds = %for.inc64, %for.cond18.preheader %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond145.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count144 br i1 %exitcond145.not, label %for.end69, label %for.cond18.preheader, !llvm.loop !16 for.end69: ; preds = %for.inc67, %entry, %for.cond5.preheader, %for.cond15.preheader %.lcssa148151 = phi i32 [ %6, %for.cond15.preheader ], [ %6, %for.cond5.preheader ], [ %1, %entry ], [ %6, %for.inc67 ] %arrayidx70 = getelementptr inbounds i32, ptr %vla1103, i64 101 %idxprom71 = sext i32 %.lcssa148151 to i64 %arrayidx72 = getelementptr inbounds i32, ptr %arrayidx70, i64 %idxprom71 %23 = load i32, ptr %arrayidx72, align 4, !tbaa !5 %call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23) call void @llvm.stackrestore.p0(ptr %0) 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 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.minnum.f64(double, double) #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 declare void @llvm.stackrestore.p0(ptr) #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 = { 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 = { 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"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include <stdio.h> #define IN 100000000 int min(int r,int s){ if(r<s) return r; return s; } int main(){ int i,j,a,b,n,r[101],M[101][101]; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d %d",&r[i-1],&r[i]); for(i=1;i<=n;i++) M[i][i]=0; for(i=2;i<=n;i++){ for(j=1;j<=n-i+1;j++){ b = i + j - 1; M[j][b] = IN; for (a=j;a<=b-1;a++){ M[j][b]=min(M[j][b],M[j][a] + M[a+1][b] + r[j-1]*r[a]*r[b]); } } } printf("%d\n",M[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284267/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284267/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %r, i32 noundef %s) local_unnamed_addr #0 { entry: %r.s = tail call i32 @llvm.smin.i32(i32 %r, i32 %s) ret i32 %r.s } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %r = alloca [101 x i32], align 16 %M = alloca [101 x [101 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %r) #5 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %M) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not100 = icmp slt i32 %0, 1 br i1 %cmp.not100, label %for.end67, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not102 = icmp slt i32 %6, 1 br i1 %cmp5.not102, label %for.end67, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %2, -4 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %5 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [101 x i32], ptr %r, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 x i32], ptr %r, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.cond4.preheader, !llvm.loop !9 for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv114.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next115.3, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil %indvars.iv114.epil = phi i64 [ %indvars.iv.next115.epil, %for.body6.epil ], [ %indvars.iv114.unr, %for.cond14.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ] %arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv114.epil, i64 %indvars.iv114.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next115.epil = add nuw nsw i64 %indvars.iv114.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11 for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa %cmp15.not109 = icmp slt i32 %6, 2 br i1 %cmp15.not109, label %for.end67, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub18 = add nuw i32 %6, 1 %wide.trip.count140 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv114 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next115.3, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ] %arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv114, i64 %indvars.iv114 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv.next115 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv.next115.1, i64 %indvars.iv.next115.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next115.2 = add nuw nsw i64 %indvars.iv114, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv.next115.2, i64 %indvars.iv.next115.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next115.3 = add nuw nsw i64 %indvars.iv114, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13 for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc65 %indvars.iv126 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next127, %for.inc65 ] %indvars139 = trunc i64 %indvars.iv126 to i32 %add = sub i32 %sub18, %indvars139 %cmp19.not107 = icmp slt i32 %add, 1 br i1 %cmp19.not107, label %for.inc65, label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc62 %indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc62 ], [ %indvars.iv126, %for.cond17.preheader ] %indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.inc62 ], [ 1, %for.cond17.preheader ] %8 = add nuw nsw i64 %indvars.iv117, %indvars.iv126 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv117, i64 %9 store i32 100000000, ptr %arrayidx26, align 4, !tbaa !5 %10 = add nsw i64 %indvars.iv117, -1 %arrayidx47 = getelementptr inbounds [101 x i32], ptr %r, i64 0, i64 %10 %11 = load i32, ptr %arrayidx47, align 4, !tbaa !5 %arrayidx51 = getelementptr inbounds [101 x i32], ptr %r, i64 0, i64 %9 %12 = load i32, ptr %arrayidx51, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ] %storemerge105 = phi i32 [ 100000000, %for.body30.lr.ph ], [ %r.s.i, %for.body30 ] %arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv117, i64 %indvars.iv119 %13 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 %indvars.iv.next120, i64 %9 %14 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %add44 = add nsw i32 %14, %13 %arrayidx49 = getelementptr inbounds [101 x i32], ptr %r, i64 0, i64 %indvars.iv119 %15 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul52 = mul nsw i32 %mul, %12 %add53 = add nsw i32 %add44, %mul52 %r.s.i = call i32 @llvm.smin.i32(i32 %storemerge105, i32 %add53) store i32 %r.s.i, ptr %arrayidx26, align 4, !tbaa !5 %exitcond125.not = icmp eq i64 %indvars.iv.next120, %indvars.iv128 br i1 %exitcond125.not, label %for.inc62, label %for.body30, !llvm.loop !14 for.inc62: ; preds = %for.body30 %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %exitcond138.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count140 br i1 %exitcond138.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15 for.inc65: ; preds = %for.inc62, %for.cond17.preheader %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1 %exitcond141.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count140 br i1 %exitcond141.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16 for.end67: ; preds = %for.inc65, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa144147 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc65 ] %idxprom69 = sext i32 %.lcssa144147 to i64 %arrayidx70 = getelementptr inbounds [101 x [101 x i32]], ptr %M, i64 0, i64 1, i64 %idxprom69 %16 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16) call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %M) #5 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include <stdio.h> int main() { int t, k=0; scanf("%d", &t); int res[t]; for(int i=0; i<t; i++){ res[i]=0; } while(k<t){ int n,a,b,c,d; scanf("%d%d%d%d%d", &n, &a, &b, &c, &d); if( (n*(a+b) < c-d) || (n*(a-b) > c+d) ) res[k]=0; else res[k]=1; k++; } for(int i=0; i<t; i++){ if(res[i]==0) printf("No\n"); else printf("Yes\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28431/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28431/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1 @str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %t, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %3, 0 br i1 %cmp37, label %while.body.preheader, label %for.cond.cleanup16 while.body.preheader: ; preds = %entry %4 = zext i32 %3 to i64 %5 = shl nuw nsw i64 %4, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %5, i1 false), !tbaa !5 br label %while.body for.cond14.preheader: ; preds = %if.end %6 = icmp sgt i32 %12, 0 br i1 %6, label %for.body17, label %for.cond.cleanup16 while.body: ; preds = %while.body.preheader, %if.end %indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %if.end ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #6 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %7 = load i32, ptr %n, align 4, !tbaa !5 %8 = load i32, ptr %a, align 4, !tbaa !5 %9 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %9, %8 %mul = mul nsw i32 %add, %7 %10 = load i32, ptr %c, align 4, !tbaa !5 %11 = load i32, ptr %d, align 4, !tbaa !5 %sub = sub nsw i32 %10, %11 %cmp3 = icmp slt i32 %mul, %sub br i1 %cmp3, label %if.end, label %lor.lhs.false lor.lhs.false: ; preds = %while.body %sub4 = sub nsw i32 %8, %9 %mul5 = mul nsw i32 %sub4, %7 %add6 = add nsw i32 %11, %10 %cmp7 = icmp sle i32 %mul5, %add6 %spec.select = zext i1 %cmp7 to i32 br label %if.end if.end: ; preds = %lor.lhs.false, %while.body %.sink = phi i32 [ 0, %while.body ], [ %spec.select, %lor.lhs.false ] %arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %.sink, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 %12 = load i32, ptr %t, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %13 br i1 %cmp1, label %while.body, label %for.cond14.preheader, !llvm.loop !9 for.cond.cleanup16: ; preds = %for.body17, %entry, %for.cond14.preheader call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6 ret i32 0 for.body17: ; preds = %for.cond14.preheader, %for.body17 %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body17 ], [ 0, %for.cond14.preheader ] %arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv45 %14 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %cmp20 = icmp eq i32 %14, 0 %str.4.str = select i1 %cmp20, ptr @str.4, ptr @str %puts36 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str) %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %15 = load i32, ptr %t, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp15 = icmp slt i64 %indvars.iv.next46, %16 br i1 %cmp15, label %for.body17, label %for.cond.cleanup16, !llvm.loop !11 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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: 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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { 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}
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MIN (1) #define MAX (100) #define INFTY (0x7FFFFFFF) typedef enum { ERROR =-1, SUCCESS= 0 } ResultType; static ResultType checkRangeOfNum(int, int, int); static int getMinimumOfScalarMultiplication(int); int R[MAX + 1]; // row and column table R[x], as follows; // R[0]=row of 1st Matrix "M1" (x=0) // R[1]=column of 1st Matrix "M1" (x=1) // R[2]=column of 2nd Matrix "M2" (x=2) // R[3]=column of 3rd Matrix "M3" (x=3) // ... int C[MAX][MAX + 1]; // cost table C[i][i+j], which means // minimum of scalar multiplication (Mi * Mi+1 * ... Mi+j) // (where i>=1, j>=1) int main(void) { int x, y; int N; ResultType eResult; /* input line 1 */ scanf("%d",&N); eResult = checkRangeOfNum(N, MIN, MAX); if(eResult < SUCCESS) { printf("Err: %d is out of range.", N); return eResult; } /* input line 2 */ for(x=0; x<=1; x++) { scanf("%d",&R[x]); eResult = checkRangeOfNum(R[x], MIN, MAX); if(eResult < SUCCESS) { printf("Err: %d is out of range.", R[x]); return eResult; } } /* input line from 3 to (N + 1) */ for(y=2; y<N*2; y++) { x = (y+1)/2; scanf("%d",&R[x]); eResult = checkRangeOfNum(R[x], MIN, MAX); if(eResult < SUCCESS) { printf("Err: %d is out of range.", R[x]); return eResult; } } /* print minimum of scalar multiplication */ printf("%d\n", getMinimumOfScalarMultiplication(N)); return SUCCESS; } static ResultType checkRangeOfNum(int n, int nMin, int nMax) { if((n < nMin) || (nMax < n)) { return ERROR; } return SUCCESS; } static int getMinimumOfScalarMultiplication(int n) { int i, j, k; int cost; for(i = 1; i <= n; i++) { for(j = 1; j <= n; j++) { C[i][j] = INFTY; } } for(i = 1; i <= n; i++) { C[i][i] = 0; } for(j = 1; j <= n - 1; j++) { for (i = 1; i <= n - j; i++) { for (k = i + 1; k <= i + j; k++) { // C[i][i+j] = min( C[i][i+j], // C[i][k-1] + C[k][i+j] + R[i-1]*R[k-1]*R[i+j] ); cost = C[i][k-1] + C[k][i+j] + R[i-1]*R[k-1]*R[i+j]; if (cost < C[i][i+j]) { C[i][i+j] = cost; } } } } return C[1][n]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284360/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284360/source.c" target datalayout = "e-m:e-p270: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 [25 x i8] c"Err: %d is out of range.\00", align 1 @R = dso_local global [101 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @C = dso_local local_unnamed_addr global [100 x [101 x i32]] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %1 = add i32 %0, -101 %or.cond.i = icmp ult i32 %1, -100 br i1 %or.cond.i, label %if.then, label %for.body.preheader for.body.preheader: ; preds = %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @R) %2 = load i32, ptr @R, align 16, !tbaa !5 %3 = add i32 %2, -101 %or.cond.i52 = icmp ult i32 %3, -100 br i1 %or.cond.i52, label %if.then9, label %for.cond if.then: ; preds = %entry %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0) br label %cleanup for.cond: ; preds = %for.body.preheader %call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([101 x i32], ptr @R, i64 0, i64 1)) %4 = load i32, ptr getelementptr inbounds ([101 x i32], ptr @R, i64 0, i64 1), align 4, !tbaa !5 %5 = add i32 %4, -101 %or.cond.i52.1 = icmp ult i32 %5, -100 br i1 %or.cond.i52.1, label %if.then9, label %for.cond14 if.then9: ; preds = %for.cond, %for.body.preheader %.lcssa62 = phi i32 [ %2, %for.body.preheader ], [ %4, %for.cond ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa62) br label %cleanup for.cond14: ; preds = %for.cond, %for.body16 %y.0 = phi i32 [ %add, %for.body16 ], [ 2, %for.cond ] %6 = load i32, ptr %N, align 4, !tbaa !5 %mul = shl nsw i32 %6, 1 %cmp15 = icmp slt i32 %y.0, %mul br i1 %cmp15, label %for.body16, label %for.end31 for.body16: ; preds = %for.cond14 %add = add nuw nsw i32 %y.0, 1 %div51 = lshr i32 %add, 1 %idxprom17 = zext i32 %div51 to i64 %arrayidx18 = getelementptr inbounds [101 x i32], ptr @R, i64 0, i64 %idxprom17 %call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx18) %7 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %8 = add i32 %7, -101 %or.cond.i54 = icmp ult i32 %8, -100 br i1 %or.cond.i54, label %if.then24, label %for.cond14, !llvm.loop !9 if.then24: ; preds = %for.body16 %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7) br label %cleanup for.end31: ; preds = %for.cond14 %cmp.not114.i = icmp slt i32 %6, 1 br i1 %cmp.not114.i, label %for.cond19.preheader.for.end71_crit_edge.i, label %for.cond1.preheader.preheader.i for.cond1.preheader.preheader.i: ; preds = %for.end31 %9 = add i32 %6, 1 %wide.trip.count127.i = zext i32 %9 to i64 %10 = add nsw i64 %wide.trip.count127.i, -1 %min.iters.check = icmp ult i32 %6, 8 %n.vec = and i64 %10, -8 %ind.end = or i64 %n.vec, 1 %cmp.n = icmp eq i64 %10, %n.vec br label %for.cond1.preheader.i for.cond1.preheader.i: ; preds = %for.cond1.for.inc6_crit_edge.i, %for.cond1.preheader.preheader.i %indvars.iv124.i = phi i64 [ 1, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next125.i, %for.cond1.for.inc6_crit_edge.i ] br i1 %min.iters.check, label %for.body3.i.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.i, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.i ] %offset.idx = or i64 %index, 1 %11 = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv124.i, i64 %offset.idx store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %11, align 4, !tbaa !5 %12 = getelementptr inbounds i32, ptr %11, i64 4 store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %12, align 4, !tbaa !5 %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 !11 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.i, label %for.body3.i.preheader for.body3.i.preheader: ; preds = %for.cond1.preheader.i, %middle.block %indvars.iv.i.ph = phi i64 [ 1, %for.cond1.preheader.i ], [ %ind.end, %middle.block ] br label %for.body3.i for.body3.i: ; preds = %for.body3.i.preheader, %for.body3.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body3.i ], [ %indvars.iv.i.ph, %for.body3.i.preheader ] %arrayidx5.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv124.i, i64 %indvars.iv.i store i32 2147483647, ptr %arrayidx5.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count127.i br i1 %exitcond.not.i, label %for.cond1.for.inc6_crit_edge.i, label %for.body3.i, !llvm.loop !14 for.cond1.for.inc6_crit_edge.i: ; preds = %for.body3.i, %middle.block %indvars.iv.next125.i = add nuw nsw i64 %indvars.iv124.i, 1 %exitcond128.not.i = icmp eq i64 %indvars.iv.next125.i, %wide.trip.count127.i br i1 %exitcond128.not.i, label %for.body11.i.preheader, label %for.cond1.preheader.i, !llvm.loop !15 for.body11.i.preheader: ; preds = %for.cond1.for.inc6_crit_edge.i %14 = add nsw i64 %wide.trip.count127.i, -2 %xtraiter = and i64 %10, 3 %15 = icmp ult i64 %14, 3 br i1 %15, label %for.cond19.preheader.i.unr-lcssa, label %for.body11.i.preheader.new for.body11.i.preheader.new: ; preds = %for.body11.i.preheader %unroll_iter = and i64 %10, -4 br label %for.body11.i for.cond19.preheader.i.unr-lcssa: ; preds = %for.body11.i, %for.body11.i.preheader %indvars.iv129.i.unr = phi i64 [ 1, %for.body11.i.preheader ], [ %indvars.iv.next130.i.3, %for.body11.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond19.preheader.i, label %for.body11.i.epil for.body11.i.epil: ; preds = %for.cond19.preheader.i.unr-lcssa, %for.body11.i.epil %indvars.iv129.i.epil = phi i64 [ %indvars.iv.next130.i.epil, %for.body11.i.epil ], [ %indvars.iv129.i.unr, %for.cond19.preheader.i.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body11.i.epil ], [ 0, %for.cond19.preheader.i.unr-lcssa ] %arrayidx15.i.epil = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv129.i.epil, i64 %indvars.iv129.i.epil store i32 0, ptr %arrayidx15.i.epil, align 4, !tbaa !5 %indvars.iv.next130.i.epil = add nuw nsw i64 %indvars.iv129.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond19.preheader.i, label %for.body11.i.epil, !llvm.loop !16 for.cond19.preheader.i: ; preds = %for.body11.i.epil, %for.cond19.preheader.i.unr-lcssa %cmp20.not.not121.i = icmp sgt i32 %6, 1 br i1 %cmp20.not.not121.i, label %for.cond22.preheader.preheader.i, label %for.cond19.preheader.for.end71_crit_edge.i for.cond19.preheader.for.end71_crit_edge.i: ; preds = %for.cond19.preheader.i, %for.end31 %.pre.i = sext i32 %6 to i64 br label %getMinimumOfScalarMultiplication.exit for.cond22.preheader.preheader.i: ; preds = %for.cond19.preheader.i %16 = zext i32 %6 to i64 br label %for.cond22.preheader.i for.body11.i: ; preds = %for.body11.i, %for.body11.i.preheader.new %indvars.iv129.i = phi i64 [ 1, %for.body11.i.preheader.new ], [ %indvars.iv.next130.i.3, %for.body11.i ] %niter = phi i64 [ 0, %for.body11.i.preheader.new ], [ %niter.next.3, %for.body11.i ] %arrayidx15.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv129.i, i64 %indvars.iv129.i store i32 0, ptr %arrayidx15.i, align 4, !tbaa !5 %indvars.iv.next130.i = add nuw nsw i64 %indvars.iv129.i, 1 %arrayidx15.i.1 = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv.next130.i, i64 %indvars.iv.next130.i store i32 0, ptr %arrayidx15.i.1, align 4, !tbaa !5 %indvars.iv.next130.i.1 = add nuw nsw i64 %indvars.iv129.i, 2 %arrayidx15.i.2 = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv.next130.i.1, i64 %indvars.iv.next130.i.1 store i32 0, ptr %arrayidx15.i.2, align 4, !tbaa !5 %indvars.iv.next130.i.2 = add nuw nsw i64 %indvars.iv129.i, 3 %arrayidx15.i.3 = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv.next130.i.2, i64 %indvars.iv.next130.i.2 store i32 0, ptr %arrayidx15.i.3, align 4, !tbaa !5 %indvars.iv.next130.i.3 = add nuw nsw i64 %indvars.iv129.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond19.preheader.i.unr-lcssa, label %for.body11.i, !llvm.loop !18 for.cond22.preheader.i: ; preds = %for.inc69.i, %for.cond22.preheader.preheader.i %indvars.iv154.i = phi i64 [ 1, %for.cond22.preheader.preheader.i ], [ %indvars.iv.next155.i, %for.inc69.i ] %indvars.iv150.i = phi i32 [ %6, %for.cond22.preheader.preheader.i ], [ %indvars.iv.next151.i, %for.inc69.i ] %indvars.iv140.i = phi i32 [ 3, %for.cond22.preheader.preheader.i ], [ %indvars.iv.next141.i, %for.inc69.i ] %cmp24.not119.not.i = icmp ult i64 %indvars.iv154.i, %16 br i1 %cmp24.not119.not.i, label %for.body25.preheader.i, label %for.inc69.i for.body25.preheader.i: ; preds = %for.cond22.preheader.i %wide.trip.count152.i = zext i32 %indvars.iv150.i to i64 br label %for.body25.i for.cond22.loopexit.i: ; preds = %for.inc63.i %indvars.iv.next146.i = add nuw nsw i64 %indvars.iv145.i, 1 %indvars.iv.next135.i = add nuw i32 %indvars.iv134.i, 1 %indvars.iv.next143.i = add nuw i32 %indvars.iv142.i, 1 %exitcond153.not.i = icmp eq i64 %indvars.iv.next146.i, %wide.trip.count152.i br i1 %exitcond153.not.i, label %for.inc69.i, label %for.body25.i, !llvm.loop !19 for.body25.i: ; preds = %for.cond22.loopexit.i, %for.body25.preheader.i %indvars.iv145.i = phi i64 [ 1, %for.body25.preheader.i ], [ %indvars.iv.next146.i, %for.cond22.loopexit.i ] %indvars.iv142.i = phi i32 [ %indvars.iv140.i, %for.body25.preheader.i ], [ %indvars.iv.next143.i, %for.cond22.loopexit.i ] %indvars.iv134.i = phi i32 [ 2, %for.body25.preheader.i ], [ %indvars.iv.next135.i, %for.cond22.loopexit.i ] %17 = sext i32 %indvars.iv134.i to i64 %18 = add nuw nsw i64 %indvars.iv145.i, %indvars.iv154.i %19 = add nsw i64 %indvars.iv145.i, -1 %arrayidx43.i = getelementptr inbounds [101 x i32], ptr @R, i64 0, i64 %19 %20 = load i32, ptr %arrayidx43.i, align 4, !tbaa !5 %arrayidx49.i = getelementptr inbounds [101 x i32], ptr @R, i64 0, i64 %18 %21 = load i32, ptr %arrayidx49.i, align 4, !tbaa !5 %arrayidx56.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv145.i, i64 %18 %arrayidx56.promoted.i = load i32, ptr %arrayidx56.i, align 4, !tbaa !5 %mul.i = mul i32 %21, %20 br label %for.body29.i for.body29.i: ; preds = %for.inc63.i, %for.body25.i %indvars.iv136.i = phi i64 [ %17, %for.body25.i ], [ %indvars.iv.next137.i, %for.inc63.i ] %22 = phi i32 [ %arrayidx56.promoted.i, %for.body25.i ], [ %27, %for.inc63.i ] %23 = add nsw i64 %indvars.iv136.i, -1 %arrayidx34.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %indvars.iv145.i, i64 %23 %24 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5 %idxprom35.i = and i64 %indvars.iv136.i, 4294967295 %arrayidx39.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 %idxprom35.i, i64 %18 %25 = load i32, ptr %arrayidx39.i, align 4, !tbaa !5 %add40.i = add nsw i32 %25, %24 %arrayidx46.i = getelementptr inbounds [101 x i32], ptr @R, i64 0, i64 %23 %26 = load i32, ptr %arrayidx46.i, align 4, !tbaa !5 %mul50.i = mul i32 %mul.i, %26 %add51.i = add nsw i32 %add40.i, %mul50.i %cmp57.i = icmp slt i32 %add51.i, %22 br i1 %cmp57.i, label %if.then.i, label %for.inc63.i if.then.i: ; preds = %for.body29.i store i32 %add51.i, ptr %arrayidx56.i, align 4, !tbaa !5 br label %for.inc63.i for.inc63.i: ; preds = %if.then.i, %for.body29.i %27 = phi i32 [ %22, %for.body29.i ], [ %add51.i, %if.then.i ] %indvars.iv.next137.i = add nsw i64 %indvars.iv136.i, 1 %lftr.wideiv = trunc i64 %indvars.iv.next137.i to i32 %exitcond = icmp eq i32 %indvars.iv142.i, %lftr.wideiv br i1 %exitcond, label %for.cond22.loopexit.i, label %for.body29.i, !llvm.loop !20 for.inc69.i: ; preds = %for.cond22.loopexit.i, %for.cond22.preheader.i %indvars.iv.next155.i = add nuw nsw i64 %indvars.iv154.i, 1 %indvars.iv.next141.i = add nuw i32 %indvars.iv140.i, 1 %indvars.iv.next151.i = add i32 %indvars.iv150.i, -1 %exitcond159.not.i = icmp eq i64 %indvars.iv.next155.i, %16 br i1 %exitcond159.not.i, label %getMinimumOfScalarMultiplication.exit, label %for.cond22.preheader.i, !llvm.loop !21 getMinimumOfScalarMultiplication.exit: ; preds = %for.inc69.i, %for.cond19.preheader.for.end71_crit_edge.i %idxprom72.pre-phi.i = phi i64 [ %.pre.i, %for.cond19.preheader.for.end71_crit_edge.i ], [ %16, %for.inc69.i ] %arrayidx73.i = getelementptr inbounds [100 x [101 x i32]], ptr @C, i64 0, i64 1, i64 %idxprom72.pre-phi.i %28 = load i32, ptr %arrayidx73.i, align 4, !tbaa !5 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28) br label %cleanup cleanup: ; preds = %getMinimumOfScalarMultiplication.exit, %if.then24, %if.then9, %if.then %retval.0 = phi i32 [ -1, %if.then ], [ -1, %if.then9 ], [ -1, %if.then24 ], [ 0, %getMinimumOfScalarMultiplication.exit ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !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, !13, !12} !15 = distinct !{!15, !10} !16 = distinct !{!16, !17} !17 = !{!"llvm.loop.unroll.disable"} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10} !21 = distinct !{!21, !10}
#include<stdio.h> #define INF 100000000 int m[101][101]; int p[101]; int n; void matrixChainOrder(void){ int i,j,k,q,l; for(i=1;i<=n;i++) m[i][i] = 0; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j = i+l-1; //printf("a%d %d\n",i,j); m[i][j] = INF; for(k=i;k<=j-1;k++){ q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]; m[i][j] = m[i][j] > q ? q : m[i][j]; } } } } int main(){ int i,j; for(i=0;i<101;i++) for(j=0;j<101;j++) m[i][j] = INF; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d%d",&p[i-1],&p[i]); } matrixChainOrder(); printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284403/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284403/source.c" target datalayout = "e-m:e-p270: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 @m = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16 @p = dso_local global [101 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 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @matrixChainOrder() local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not87 = icmp slt i32 %0, 1 br i1 %cmp.not87, label %for.end59, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ] %arrayidx2.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not94 = icmp slt i32 %0, 2 br i1 %cmp4.not94, label %for.end59, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %0, 1 %wide.trip.count120 = zext i32 %sub to i64 br label %for.cond6.preheader for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx2.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1 store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx2.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2 store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc57 %indvars.iv106 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next107, %for.inc57 ] %indvars119 = trunc i64 %indvars.iv106 to i32 %add = sub i32 %sub, %indvars119 %cmp7.not92 = icmp slt i32 %add, 1 br i1 %cmp7.not92, label %for.inc57, label %for.body18.lr.ph for.body18.lr.ph: ; preds = %for.cond6.preheader, %for.inc54 %indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc54 ], [ %indvars.iv106, %for.cond6.preheader ] %indvars.iv97 = phi i64 [ %indvars.iv.next98, %for.inc54 ], [ 1, %for.cond6.preheader ] %5 = add nuw nsw i64 %indvars.iv97, %indvars.iv106 %6 = add nsw i64 %5, -1 %arrayidx14 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv97, i64 %6 store i32 100000000, ptr %arrayidx14, align 4, !tbaa !5 %7 = add nsw i64 %indvars.iv97, -1 %arrayidx31 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %7 %8 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx35 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %6 %9 = load i32, ptr %arrayidx35, align 4, !tbaa !5 br label %for.body18 for.body18: ; preds = %for.body18.lr.ph, %for.body18 %indvars.iv99 = phi i64 [ %indvars.iv97, %for.body18.lr.ph ], [ %indvars.iv.next100, %for.body18 ] %storemerge90 = phi i32 [ 100000000, %for.body18.lr.ph ], [ %add37., %for.body18 ] %arrayidx22 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv97, i64 %indvars.iv99 %10 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1 %arrayidx27 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next100, i64 %6 %11 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %add28 = add nsw i32 %11, %10 %arrayidx33 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv99 %12 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %mul = mul nsw i32 %12, %8 %mul36 = mul nsw i32 %mul, %9 %add37 = add nsw i32 %add28, %mul36 %add37. = tail call i32 @llvm.smin.i32(i32 %storemerge90, i32 %add37) store i32 %add37., ptr %arrayidx14, align 4, !tbaa !5 %exitcond105.not = icmp eq i64 %indvars.iv.next100, %indvars.iv108 br i1 %exitcond105.not, label %for.inc54, label %for.body18, !llvm.loop !13 for.inc54: ; preds = %for.body18 %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1 %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1 %exitcond118.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count120 br i1 %exitcond118.not, label %for.inc57, label %for.body18.lr.ph, !llvm.loop !14 for.inc57: ; preds = %for.inc54, %for.cond6.preheader %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %exitcond121.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count120 br i1 %exitcond121.not, label %for.end59, label %for.cond6.preheader, !llvm.loop !15 for.end59: ; preds = %for.inc57, %entry, %for.cond3.preheader ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: br label %vector.ph vector.ph: ; preds = %vector.ph, %entry %indvars.iv37 = phi i64 [ 0, %entry ], [ %indvars.iv.next38, %vector.ph ] %0 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 0 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %0, align 4, !tbaa !5 %1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %1, align 4, !tbaa !5 %2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 8 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 4, !tbaa !5 %3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 12 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %3, align 4, !tbaa !5 %4 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 16 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %4, align 4, !tbaa !5 %5 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 20 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 24 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %6, align 4, !tbaa !5 %7 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 28 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %7, align 4, !tbaa !5 %8 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 32 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %8, align 4, !tbaa !5 %9 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 36 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %9, align 4, !tbaa !5 %10 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 40 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %10, align 4, !tbaa !5 %11 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 44 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %11, align 4, !tbaa !5 %12 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 48 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %12, align 4, !tbaa !5 %13 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 52 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %13, align 4, !tbaa !5 %14 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 56 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %14, align 4, !tbaa !5 %15 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 60 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %15, align 4, !tbaa !5 %16 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 64 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %16, align 4, !tbaa !5 %17 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 68 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %17, align 4, !tbaa !5 %18 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 72 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %18, align 4, !tbaa !5 %19 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 76 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %19, align 4, !tbaa !5 %20 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 80 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %20, align 4, !tbaa !5 %21 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 84 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %21, align 4, !tbaa !5 %22 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 88 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %22, align 4, !tbaa !5 %23 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 92 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %23, align 4, !tbaa !5 %24 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 96 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %24, align 4, !tbaa !5 %arrayidx5 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv37, i64 100 store i32 100000000, ptr %arrayidx5, align 4, !tbaa !5 %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1 %exitcond40.not = icmp eq i64 %indvars.iv.next38, 101 br i1 %exitcond40.not, label %for.end8, label %vector.ph, !llvm.loop !16 for.end8: ; preds = %vector.ph %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %25 = load i32, ptr @n, align 4, !tbaa !5 %cmp10.not33 = icmp slt i32 %25, 1 br i1 %cmp10.not33, label %matrixChainOrder.exit, label %for.body11 for.body11: ; preds = %for.end8, %for.body11 %indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body11 ], [ 1, %for.end8 ] %26 = add nsw i64 %indvars.iv41, -1 %arrayidx13 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %26 %arrayidx15 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv41 %call16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx13, ptr noundef nonnull %arrayidx15) %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1 %27 = load i32, ptr @n, align 4, !tbaa !5 %28 = sext i32 %27 to i64 %cmp10.not.not = icmp slt i64 %indvars.iv41, %28 br i1 %cmp10.not.not, label %for.body11, label %for.end19, !llvm.loop !17 for.end19: ; preds = %for.body11 %cmp.not87.i = icmp slt i32 %27, 1 br i1 %cmp.not87.i, label %matrixChainOrder.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end19 %29 = add nuw nsw i32 %27, 1 %wide.trip.count.i = zext i32 %29 to i64 %30 = add nsw i64 %wide.trip.count.i, -1 %31 = add nsw i64 %wide.trip.count.i, -2 %xtraiter = and i64 %30, 3 %32 = icmp ult i64 %31, 3 br i1 %32, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %30, -4 br label %for.body.i for.cond3.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader.i, label %for.body.i.epil for.body.i.epil: ; preds = %for.cond3.preheader.i.unr-lcssa, %for.body.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond3.preheader.i.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond3.preheader.i.unr-lcssa ] %arrayidx2.i.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !18 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not94.i = icmp slt i32 %27, 2 br i1 %cmp4.not94.i, label %matrixChainOrder.exit, label %for.cond6.preheader.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %arrayidx2.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i store i32 0, ptr %arrayidx2.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx2.i.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx2.i.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1 store i32 0, ptr %arrayidx2.i.2, align 4, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %arrayidx2.i.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2 store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !11 for.cond6.preheader.i: ; preds = %for.cond3.preheader.i, %for.inc57.i %indvars.iv106.i = phi i64 [ %indvars.iv.next107.i, %for.inc57.i ], [ 2, %for.cond3.preheader.i ] %indvars119.i = trunc i64 %indvars.iv106.i to i32 %add.i = sub i32 %29, %indvars119.i %cmp7.not92.i = icmp slt i32 %add.i, 1 br i1 %cmp7.not92.i, label %for.inc57.i, label %for.body18.lr.ph.i.preheader for.body18.lr.ph.i.preheader: ; preds = %for.cond6.preheader.i %33 = add nsw i64 %indvars.iv106.i, -1 br label %for.body18.lr.ph.i for.body18.lr.ph.i: ; preds = %for.body18.lr.ph.i.preheader, %for.inc54.i %indvars.iv108.i = phi i64 [ %indvars.iv.next109.i, %for.inc54.i ], [ %indvars.iv106.i, %for.body18.lr.ph.i.preheader ] %indvars.iv97.i = phi i64 [ %indvars.iv.next98.i, %for.inc54.i ], [ 1, %for.body18.lr.ph.i.preheader ] %34 = add nuw nsw i64 %33, %indvars.iv97.i %arrayidx14.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv97.i, i64 %34 store i32 100000000, ptr %arrayidx14.i, align 4, !tbaa !5 %35 = add nsw i64 %indvars.iv97.i, -1 %arrayidx31.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %35 %36 = load i32, ptr %arrayidx31.i, align 4, !tbaa !5 %arrayidx35.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %34 %37 = load i32, ptr %arrayidx35.i, align 4, !tbaa !5 %mul.i = mul i32 %37, %36 br label %for.body18.i for.body18.i: ; preds = %for.body18.i, %for.body18.lr.ph.i %indvars.iv99.i = phi i64 [ %indvars.iv97.i, %for.body18.lr.ph.i ], [ %indvars.iv.next100.i, %for.body18.i ] %storemerge90.i = phi i32 [ 100000000, %for.body18.lr.ph.i ], [ %add37..i, %for.body18.i ] %arrayidx22.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv97.i, i64 %indvars.iv99.i %38 = load i32, ptr %arrayidx22.i, align 4, !tbaa !5 %indvars.iv.next100.i = add nuw nsw i64 %indvars.iv99.i, 1 %arrayidx27.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next100.i, i64 %34 %39 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %add28.i = add nsw i32 %39, %38 %arrayidx33.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv99.i %40 = load i32, ptr %arrayidx33.i, align 4, !tbaa !5 %mul36.i = mul i32 %mul.i, %40 %add37.i = add nsw i32 %add28.i, %mul36.i %add37..i = tail call i32 @llvm.smin.i32(i32 %storemerge90.i, i32 %add37.i) store i32 %add37..i, ptr %arrayidx14.i, align 4, !tbaa !5 %exitcond105.not.i = icmp eq i64 %indvars.iv.next100.i, %indvars.iv108.i br i1 %exitcond105.not.i, label %for.inc54.i, label %for.body18.i, !llvm.loop !13 for.inc54.i: ; preds = %for.body18.i %indvars.iv.next98.i = add nuw nsw i64 %indvars.iv97.i, 1 %indvars.iv.next109.i = add nuw nsw i64 %indvars.iv108.i, 1 %exitcond118.not.i = icmp eq i64 %indvars.iv.next109.i, %wide.trip.count.i br i1 %exitcond118.not.i, label %for.inc57.i, label %for.body18.lr.ph.i, !llvm.loop !14 for.inc57.i: ; preds = %for.inc54.i, %for.cond6.preheader.i %indvars.iv.next107.i = add nuw nsw i64 %indvars.iv106.i, 1 %exitcond121.not.i = icmp eq i64 %indvars.iv.next107.i, %wide.trip.count.i br i1 %exitcond121.not.i, label %matrixChainOrder.exit, label %for.cond6.preheader.i, !llvm.loop !15 matrixChainOrder.exit: ; preds = %for.inc57.i, %for.end8, %for.end19, %for.cond3.preheader.i %.lcssa47 = phi i32 [ %27, %for.end19 ], [ %27, %for.cond3.preheader.i ], [ %25, %for.end8 ], [ %27, %for.inc57.i ] %idxprom20 = sext i32 %.lcssa47 to i64 %arrayidx21 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom20 %41 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %call22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %41) ret i32 0 } ; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree nounwind "no-trapping-math"="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 = distinct !{!9, !10} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !10}
#include <stdio.h> #define INF (1<<21) int N = 100; int min(int a, int b){ return a < b ? a : b; } int main(){ int n, i, j, k, l; int p[N+1], m[N+1][N+1]; scanf("%d", &n); for( i = 1; i <= n; i++ ){ scanf("%d", &p[i-1]); scanf("%d", &p[i]); } for( i = 1; i <= n; i++ ){ m[i][i] = 0; } for( l = 2; l <= n; l++ ){ for( i = 0; i <= n - l + 1; i++ ){ j = i + l - 1; m[i][j] = INF; for( k = i; k <= j - 1; k++ ){ m[i][j] = min( m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j] ); } } } printf("%d\n", m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284454/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284454/source.c" target datalayout = "e-m:e-p270: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 local_unnamed_addr global i32 100, align 4 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %0 = load i32, ptr @N, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = tail call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr @N, align 4, !tbaa !5 %add1 = add nsw i32 %3, 1 %4 = zext i32 %add1 to i64 %5 = mul nuw i64 %4, %4 %vla3 = alloca i32, i64 %5, align 16 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not105 = icmp slt i32 %6, 1 br i1 %cmp.not105, label %for.end72, label %for.body.preheader for.body.preheader: ; preds = %entry %invariant.gep161 = getelementptr i32, ptr %vla, i64 -1 br label %for.body for.cond8.preheader: ; preds = %for.body %cmp9.not107 = icmp slt i32 %11, 1 br i1 %cmp9.not107, label %for.end72, label %for.body10.preheader for.body10.preheader: ; preds = %for.cond8.preheader %7 = add nuw i32 %11, 1 %wide.trip.count = zext i32 %7 to i64 %8 = add nsw i64 %wide.trip.count, -1 %9 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %8, 3 %10 = icmp ult i64 %9, 3 br i1 %10, label %for.cond18.preheader.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %8, -4 br label %for.body10 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %gep162 = getelementptr i32, ptr %invariant.gep161, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gep162) %arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %12 br i1 %cmp.not.not, label %for.body, label %for.cond8.preheader, !llvm.loop !9 for.cond18.preheader.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %indvars.iv119.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next120.3, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond18.preheader, label %for.body10.epil for.body10.epil: ; preds = %for.cond18.preheader.unr-lcssa, %for.body10.epil %indvars.iv119.epil = phi i64 [ %indvars.iv.next120.epil, %for.body10.epil ], [ %indvars.iv119.unr, %for.cond18.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.cond18.preheader.unr-lcssa ] %13 = mul nuw nsw i64 %indvars.iv119.epil, %4 %arrayidx12.epil = getelementptr inbounds i32, ptr %vla3, i64 %13 %arrayidx14.epil = getelementptr inbounds i32, ptr %arrayidx12.epil, i64 %indvars.iv119.epil store i32 0, ptr %arrayidx14.epil, align 4, !tbaa !5 %indvars.iv.next120.epil = add nuw nsw i64 %indvars.iv119.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.cond18.preheader, label %for.body10.epil, !llvm.loop !11 for.cond18.preheader: ; preds = %for.body10.epil, %for.cond18.preheader.unr-lcssa %cmp19.not114 = icmp slt i32 %11, 2 br i1 %cmp19.not114, label %for.end72, label %for.cond21.preheader.lr.ph for.cond21.preheader.lr.ph: ; preds = %for.cond18.preheader %sub22 = add nuw i32 %11, 1 %wide.trip.count153 = zext i32 %sub22 to i64 %invariant.gep163 = getelementptr i32, ptr %vla, i64 -1 br label %for.cond21.preheader for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv119 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next120.3, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.3, %for.body10 ] %14 = mul nuw nsw i64 %indvars.iv119, %4 %arrayidx12 = getelementptr inbounds i32, ptr %vla3, i64 %14 %arrayidx14 = getelementptr inbounds i32, ptr %arrayidx12, i64 %indvars.iv119 store i32 0, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %15 = mul nuw nsw i64 %indvars.iv.next120, %4 %arrayidx12.1 = getelementptr inbounds i32, ptr %vla3, i64 %15 %arrayidx14.1 = getelementptr inbounds i32, ptr %arrayidx12.1, i64 %indvars.iv.next120 store i32 0, ptr %arrayidx14.1, align 4, !tbaa !5 %indvars.iv.next120.1 = add nuw nsw i64 %indvars.iv119, 2 %16 = mul nuw nsw i64 %indvars.iv.next120.1, %4 %arrayidx12.2 = getelementptr inbounds i32, ptr %vla3, i64 %16 %arrayidx14.2 = getelementptr inbounds i32, ptr %arrayidx12.2, i64 %indvars.iv.next120.1 store i32 0, ptr %arrayidx14.2, align 4, !tbaa !5 %indvars.iv.next120.2 = add nuw nsw i64 %indvars.iv119, 3 %17 = mul nuw nsw i64 %indvars.iv.next120.2, %4 %arrayidx12.3 = getelementptr inbounds i32, ptr %vla3, i64 %17 %arrayidx14.3 = getelementptr inbounds i32, ptr %arrayidx12.3, i64 %indvars.iv.next120.2 store i32 0, ptr %arrayidx14.3, align 4, !tbaa !5 %indvars.iv.next120.3 = add nuw nsw i64 %indvars.iv119, 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.cond18.preheader.unr-lcssa, label %for.body10, !llvm.loop !13 for.cond21.preheader: ; preds = %for.cond21.preheader.lr.ph, %for.inc70 %indvar = phi i64 [ 0, %for.cond21.preheader.lr.ph ], [ %indvar.next, %for.inc70 ] %indvars.iv148 = phi i64 [ 2, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next149, %for.inc70 ] %indvars.iv144 = phi i32 [ %11, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next145, %for.inc70 ] %indvars.iv133 = phi i64 [ 1, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next134, %for.inc70 ] %indvars152 = trunc i64 %indvars.iv148 to i32 %add23 = sub i32 %sub22, %indvars152 %cmp24.not112 = icmp slt i32 %add23, 0 br i1 %cmp24.not112, label %for.inc70, label %for.body25.preheader for.body25.preheader: ; preds = %for.cond21.preheader %wide.trip.count146 = zext i32 %indvars.iv144 to i64 %xtraiter165 = and i64 %indvars.iv133, 1 %18 = icmp eq i64 %indvar, 0 %unroll_iter168 = and i64 %indvars.iv133, -2 %lcmp.mod167.not = icmp eq i64 %xtraiter165, 0 br label %for.body35.lr.ph for.body35.lr.ph: ; preds = %for.inc67, %for.body25.preheader %indvars.iv122 = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next123, %for.inc67 ] %19 = add nuw nsw i64 %indvars.iv122, %indvars.iv148 %20 = add nsw i64 %19, -1 %21 = mul nuw nsw i64 %indvars.iv122, %4 %arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %21 %arrayidx31 = getelementptr inbounds i32, ptr %arrayidx29, i64 %20 %invariant.gep = getelementptr i32, ptr %vla3, i64 %20 store i32 2097152, ptr %arrayidx31, align 4, !tbaa !5 %gep164 = getelementptr i32, ptr %invariant.gep163, i64 %indvars.iv122 %22 = load i32, ptr %gep164, align 4, !tbaa !5 %arrayidx56 = getelementptr inbounds i32, ptr %vla, i64 %20 %23 = load i32, ptr %arrayidx56, align 4, !tbaa !5 br i1 %18, label %for.inc67.unr-lcssa, label %for.body35 for.body35: ; preds = %for.body35.lr.ph, %for.body35 %indvars.iv124 = phi i64 [ %indvars.iv.next125.1, %for.body35 ], [ %indvars.iv122, %for.body35.lr.ph ] %storemerge110 = phi i32 [ %cond.i.1, %for.body35 ], [ 2097152, %for.body35.lr.ph ] %niter169 = phi i64 [ %niter169.next.1, %for.body35 ], [ 0, %for.body35.lr.ph ] %arrayidx43 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv124 %24 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %25 = mul nuw nsw i64 %indvars.iv.next125, %4 %gep = getelementptr i32, ptr %invariant.gep, i64 %25 %26 = load i32, ptr %gep, align 4, !tbaa !5 %add49 = add nsw i32 %26, %24 %arrayidx54 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv124 %27 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %mul = mul nsw i32 %27, %22 %mul57 = mul nsw i32 %mul, %23 %add58 = add nsw i32 %add49, %mul57 %cond.i = call i32 @llvm.smin.i32(i32 %storemerge110, i32 %add58) store i32 %cond.i, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx43.1 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv.next125 %28 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5 %indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124, 2 %29 = mul nuw nsw i64 %indvars.iv.next125.1, %4 %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %29 %30 = load i32, ptr %gep.1, align 4, !tbaa !5 %add49.1 = add nsw i32 %30, %28 %arrayidx54.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next125 %31 = load i32, ptr %arrayidx54.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %31, %22 %mul57.1 = mul nsw i32 %mul.1, %23 %add58.1 = add nsw i32 %add49.1, %mul57.1 %cond.i.1 = call i32 @llvm.smin.i32(i32 %cond.i, i32 %add58.1) store i32 %cond.i.1, ptr %arrayidx31, align 4, !tbaa !5 %niter169.next.1 = add i64 %niter169, 2 %niter169.ncmp.1 = icmp eq i64 %niter169.next.1, %unroll_iter168 br i1 %niter169.ncmp.1, label %for.inc67.unr-lcssa, label %for.body35, !llvm.loop !14 for.inc67.unr-lcssa: ; preds = %for.body35, %for.body35.lr.ph %indvars.iv124.unr = phi i64 [ %indvars.iv122, %for.body35.lr.ph ], [ %indvars.iv.next125.1, %for.body35 ] %storemerge110.unr = phi i32 [ 2097152, %for.body35.lr.ph ], [ %cond.i.1, %for.body35 ] br i1 %lcmp.mod167.not, label %for.inc67, label %for.body35.epil for.body35.epil: ; preds = %for.inc67.unr-lcssa %arrayidx43.epil = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv124.unr %32 = load i32, ptr %arrayidx43.epil, align 4, !tbaa !5 %indvars.iv.next125.epil = add nuw nsw i64 %indvars.iv124.unr, 1 %33 = mul nuw nsw i64 %indvars.iv.next125.epil, %4 %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %33 %34 = load i32, ptr %gep.epil, align 4, !tbaa !5 %add49.epil = add nsw i32 %34, %32 %arrayidx54.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv124.unr %35 = load i32, ptr %arrayidx54.epil, align 4, !tbaa !5 %mul.epil = mul nsw i32 %35, %22 %mul57.epil = mul nsw i32 %mul.epil, %23 %add58.epil = add nsw i32 %add49.epil, %mul57.epil %cond.i.epil = call i32 @llvm.smin.i32(i32 %storemerge110.unr, i32 %add58.epil) store i32 %cond.i.epil, ptr %arrayidx31, align 4, !tbaa !5 br label %for.inc67 for.inc67: ; preds = %for.inc67.unr-lcssa, %for.body35.epil %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1 %exitcond147.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count146 br i1 %exitcond147.not, label %for.inc70, label %for.body35.lr.ph, !llvm.loop !15 for.inc70: ; preds = %for.inc67, %for.cond21.preheader %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1 %indvars.iv.next134 = add i64 %indvars.iv133, 1 %indvars.iv.next145 = add i32 %indvars.iv144, -1 %exitcond154.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count153 %indvar.next = add i64 %indvar, 1 br i1 %exitcond154.not, label %for.end72, label %for.cond21.preheader, !llvm.loop !16 for.end72: ; preds = %for.inc70, %entry, %for.cond8.preheader, %for.cond18.preheader %.lcssa157160 = phi i32 [ %11, %for.cond18.preheader ], [ %11, %for.cond8.preheader ], [ %6, %entry ], [ %11, %for.inc70 ] %arrayidx73 = getelementptr inbounds i32, ptr %vla3, i64 %4 %idxprom74 = sext i32 %.lcssa157160 to i64 %arrayidx75 = getelementptr inbounds i32, ptr %arrayidx73, i64 %idxprom74 %36 = load i32, ptr %arrayidx75, align 4, !tbaa !5 %call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %36) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #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: 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) #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #5 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include<stdio.h> #define N 100 int P[N],M[N][N],q,n; int MCO(int P[]){ int i,j,k,l,t; t=n-1; for(i=0;i<=n;i++) M[i][i]=0; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j=i+l-1; M[i][j]=10000000; for(k=i;k<=j-1;k++){ q = M[i][k]+M[k+1][j]+P[i-1]*P[k]*P[j]; if(M[i][j]>q) M[i][j]=q; } } } return M[1][n]; } int main (){ int i,t; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d%d",&P[i],&t); P[n]=t; printf("%d\n",MCO(P)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284498/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284498/source.c" target datalayout = "e-m:e-p270: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 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @q = dso_local local_unnamed_addr global i32 0, align 4 @.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 @P = dso_local global [100 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @MCO(ptr nocapture noundef readonly %P) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not85 = icmp slt i32 %0, 0 br i1 %cmp.not85, label %for.end56, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %xtraiter = and i64 %wide.trip.count, 3 %2 = icmp ult i32 %0, 3 br i1 %2, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ] %arrayidx2.epil = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not91 = icmp slt i32 %0, 2 br i1 %cmp4.not91, label %for.end56, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub7 = add nuw i32 %0, 1 %wide.trip.count117 = zext i32 %sub7 to i64 %invariant.gep = getelementptr i32, ptr %P, i64 -1 br label %for.cond6.preheader for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx2 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 16, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx2.2 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1 store i32 0, ptr %arrayidx2.2, align 8, !tbaa !5 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx2.3 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2 store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc54 %indvars.iv103 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next104, %for.inc54 ] %indvars116 = trunc i64 %indvars.iv103 to i32 %add = sub i32 %sub7, %indvars116 %cmp8.not89 = icmp slt i32 %add, 1 br i1 %cmp8.not89, label %for.inc54, label %for.body19.lr.ph for.body19.lr.ph: ; preds = %for.cond6.preheader, %for.inc51 %indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.inc51 ], [ %indvars.iv103, %for.cond6.preheader ] %indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.inc51 ], [ 1, %for.cond6.preheader ] %3 = add nuw nsw i64 %indvars.iv94, %indvars.iv103 %4 = add nsw i64 %3, -1 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv94, i64 %4 store i32 10000000, ptr %arrayidx15, align 4, !tbaa !5 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv94 %arrayidx36 = getelementptr inbounds i32, ptr %P, i64 %4 br label %for.body19 for.body19: ; preds = %for.body19.lr.ph, %for.inc48 %5 = phi i32 [ 10000000, %for.body19.lr.ph ], [ %11, %for.inc48 ] %indvars.iv96 = phi i64 [ %indvars.iv94, %for.body19.lr.ph ], [ %indvars.iv.next97, %for.inc48 ] %arrayidx23 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv94, i64 %indvars.iv96 %6 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1 %arrayidx28 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next97, i64 %4 %7 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %add29 = add nsw i32 %7, %6 %8 = load i32, ptr %gep, align 4, !tbaa !5 %arrayidx34 = getelementptr inbounds i32, ptr %P, i64 %indvars.iv96 %9 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 %10 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %mul37 = mul nsw i32 %mul, %10 %add38 = add nsw i32 %add29, %mul37 store i32 %add38, ptr @q, align 4, !tbaa !5 %cmp43 = icmp sgt i32 %5, %add38 br i1 %cmp43, label %if.then, label %for.inc48 if.then: ; preds = %for.body19 store i32 %add38, ptr %arrayidx15, align 4, !tbaa !5 br label %for.inc48 for.inc48: ; preds = %for.body19, %if.then %11 = phi i32 [ %5, %for.body19 ], [ %add38, %if.then ] %exitcond102.not = icmp eq i64 %indvars.iv.next97, %indvars.iv105 br i1 %exitcond102.not, label %for.inc51, label %for.body19, !llvm.loop !13 for.inc51: ; preds = %for.inc48 %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1 %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1 %exitcond115.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count117 br i1 %exitcond115.not, label %for.inc54, label %for.body19.lr.ph, !llvm.loop !14 for.inc54: ; preds = %for.inc51, %for.cond6.preheader %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1 %exitcond118.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count117 br i1 %exitcond118.not, label %for.end56, label %for.cond6.preheader, !llvm.loop !15 for.end56: ; preds = %for.inc54, %entry, %for.cond3.preheader %idxprom57 = sext i32 %0 to i64 %arrayidx58 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 1, i64 %idxprom57 %12 = load i32, ptr %arrayidx58, align 4, !tbaa !5 ret i32 %12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %t = alloca i32, align 4 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 %cmp8 = icmp sgt i32 %0, 0 br i1 %cmp8, label %for.body, label %entry.for.end_crit_edge entry.for.end_crit_edge: ; preds = %entry %.pre12 = sext i32 %0 to i64 br label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr @P, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %t) %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.loopexit, !llvm.loop !16 for.end.loopexit: ; preds = %for.body %.pre = load i32, ptr %t, align 4, !tbaa !5 br label %for.end for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit %idxprom2.pre-phi = phi i64 [ %.pre12, %entry.for.end_crit_edge ], [ %2, %for.end.loopexit ] %3 = phi i32 [ undef, %entry.for.end_crit_edge ], [ %.pre, %for.end.loopexit ] %.lcssa = phi i32 [ %0, %entry.for.end_crit_edge ], [ %1, %for.end.loopexit ] %arrayidx3 = getelementptr inbounds [100 x i32], ptr @P, i64 0, i64 %idxprom2.pre-phi store i32 %3, ptr %arrayidx3, align 4, !tbaa !5 %cmp.not85.i = icmp slt i32 %.lcssa, 0 br i1 %cmp.not85.i, label %MCO.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end %4 = add nuw i32 %.lcssa, 1 %wide.trip.count.i = zext i32 %4 to i64 %xtraiter = and i64 %wide.trip.count.i, 3 %5 = icmp ult i32 %.lcssa, 3 br i1 %5, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %wide.trip.count.i, 4294967292 br label %for.body.i for.cond3.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader.i, label %for.body.i.epil for.body.i.epil: ; preds = %for.cond3.preheader.i.unr-lcssa, %for.body.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond3.preheader.i.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond3.preheader.i.unr-lcssa ] %arrayidx2.i.epil = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !17 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not91.i = icmp slt i32 %.lcssa, 2 br i1 %cmp4.not91.i, label %MCO.exit, label %for.cond6.preheader.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %arrayidx2.i = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i store i32 0, ptr %arrayidx2.i, align 16, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %arrayidx2.i.1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2 %arrayidx2.i.2 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1 store i32 0, ptr %arrayidx2.i.2, align 8, !tbaa !5 %indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3 %arrayidx2.i.3 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2 store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !11 for.cond6.preheader.i: ; preds = %for.cond3.preheader.i, %for.inc54.i %indvars.iv103.i = phi i64 [ %indvars.iv.next104.i, %for.inc54.i ], [ 2, %for.cond3.preheader.i ] %indvars116.i = trunc i64 %indvars.iv103.i to i32 %add.i = sub i32 %4, %indvars116.i %cmp8.not89.i = icmp slt i32 %add.i, 1 br i1 %cmp8.not89.i, label %for.inc54.i, label %for.body19.lr.ph.i.preheader for.body19.lr.ph.i.preheader: ; preds = %for.cond6.preheader.i %6 = add nsw i64 %indvars.iv103.i, -1 br label %for.body19.lr.ph.i for.body19.lr.ph.i: ; preds = %for.body19.lr.ph.i.preheader, %for.inc51.i %indvars.iv105.i = phi i64 [ %indvars.iv.next106.i, %for.inc51.i ], [ %indvars.iv103.i, %for.body19.lr.ph.i.preheader ] %indvars.iv94.i = phi i64 [ %indvars.iv.next95.i, %for.inc51.i ], [ 1, %for.body19.lr.ph.i.preheader ] %7 = add nuw nsw i64 %6, %indvars.iv94.i %arrayidx15.i = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv94.i, i64 %7 store i32 10000000, ptr %arrayidx15.i, align 4, !tbaa !5 %gep.i = getelementptr i32, ptr getelementptr ([100 x i32], ptr @P, i64 -1, i64 99), i64 %indvars.iv94.i %arrayidx36.i = getelementptr inbounds i32, ptr @P, i64 %7 %8 = load i32, ptr %gep.i, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx36.i, align 4, !tbaa !5 br label %for.body19.i for.body19.i: ; preds = %for.inc48.i, %for.body19.lr.ph.i %10 = phi i32 [ 10000000, %for.body19.lr.ph.i ], [ %14, %for.inc48.i ] %indvars.iv96.i = phi i64 [ %indvars.iv94.i, %for.body19.lr.ph.i ], [ %indvars.iv.next97.i, %for.inc48.i ] %arrayidx23.i = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv94.i, i64 %indvars.iv96.i %11 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5 %indvars.iv.next97.i = add nuw nsw i64 %indvars.iv96.i, 1 %arrayidx28.i = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv.next97.i, i64 %7 %12 = load i32, ptr %arrayidx28.i, align 4, !tbaa !5 %add29.i = add nsw i32 %12, %11 %arrayidx34.i = getelementptr inbounds i32, ptr @P, i64 %indvars.iv96.i %13 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5 %mul.i = mul nsw i32 %13, %8 %mul37.i = mul nsw i32 %mul.i, %9 %add38.i = add nsw i32 %add29.i, %mul37.i %cmp43.i = icmp sgt i32 %10, %add38.i br i1 %cmp43.i, label %if.then.i, label %for.inc48.i if.then.i: ; preds = %for.body19.i store i32 %add38.i, ptr %arrayidx15.i, align 4, !tbaa !5 br label %for.inc48.i for.inc48.i: ; preds = %if.then.i, %for.body19.i %14 = phi i32 [ %10, %for.body19.i ], [ %add38.i, %if.then.i ] %exitcond102.not.i = icmp eq i64 %indvars.iv.next97.i, %indvars.iv105.i br i1 %exitcond102.not.i, label %for.inc51.i, label %for.body19.i, !llvm.loop !13 for.inc51.i: ; preds = %for.inc48.i %indvars.iv.next95.i = add nuw nsw i64 %indvars.iv94.i, 1 %indvars.iv.next106.i = add nuw nsw i64 %indvars.iv105.i, 1 %exitcond115.not.i = icmp eq i64 %indvars.iv.next106.i, %wide.trip.count.i br i1 %exitcond115.not.i, label %for.inc54.i.loopexit, label %for.body19.lr.ph.i, !llvm.loop !14 for.inc54.i.loopexit: ; preds = %for.inc51.i store i32 %add38.i, ptr @q, align 4, !tbaa !5 br label %for.inc54.i for.inc54.i: ; preds = %for.inc54.i.loopexit, %for.cond6.preheader.i %indvars.iv.next104.i = add nuw nsw i64 %indvars.iv103.i, 1 %exitcond118.not.i = icmp eq i64 %indvars.iv.next104.i, %wide.trip.count.i br i1 %exitcond118.not.i, label %MCO.exit, label %for.cond6.preheader.i, !llvm.loop !15 MCO.exit: ; preds = %for.inc54.i, %for.end, %for.cond3.preheader.i %arrayidx58.i = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 1, i64 %idxprom2.pre-phi %15 = load i32, ptr %arrayidx58.i, align 4, !tbaa !5 %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: 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 #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.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !10}
#include <stdio.h> #define MAX 100 int min(int ,int); int main(){ int n,i,l,k,j,kazu,tpp[MAX+1],mov[MAX+1][MAX+1]; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d%d",&tpp[i-1],&tpp[i]); } for(i=1;i<=n;i++){ mov[i][i]=0; } for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j=i+l-1; mov[i][j]=100000; for(k=i;k<=j-1;k++){ mov[i][j]=min(mov[i][j],mov[i][k]+mov[k+1][j]+tpp[i-1]*tpp[k]*tpp[j]); } } } printf("%d\n",mov[1][n]); return 0; } int min(int a,int b){ if(a<=b){ return a; } else { return b; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284540/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284540/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%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 %tpp = alloca [101 x i32], align 16 %mov = alloca [101 x [101 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %tpp) #5 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %mov) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not100 = icmp slt i32 %0, 1 br i1 %cmp.not100, label %for.end67, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not102 = icmp slt i32 %6, 1 br i1 %cmp5.not102, label %for.end67, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %2, -4 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %5 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [101 x i32], ptr %tpp, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 x i32], ptr %tpp, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.cond4.preheader, !llvm.loop !9 for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv114.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next115.3, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil %indvars.iv114.epil = phi i64 [ %indvars.iv.next115.epil, %for.body6.epil ], [ %indvars.iv114.unr, %for.cond14.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ] %arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv114.epil, i64 %indvars.iv114.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next115.epil = add nuw nsw i64 %indvars.iv114.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11 for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa %cmp15.not109 = icmp slt i32 %6, 2 br i1 %cmp15.not109, label %for.end67, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub18 = add nuw i32 %6, 1 %wide.trip.count140 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv114 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next115.3, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ] %arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv114, i64 %indvars.iv114 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv.next115 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv.next115.1, i64 %indvars.iv.next115.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next115.2 = add nuw nsw i64 %indvars.iv114, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv.next115.2, i64 %indvars.iv.next115.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next115.3 = add nuw nsw i64 %indvars.iv114, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13 for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc65 %indvars.iv126 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next127, %for.inc65 ] %indvars139 = trunc i64 %indvars.iv126 to i32 %add = sub i32 %sub18, %indvars139 %cmp19.not107 = icmp slt i32 %add, 1 br i1 %cmp19.not107, label %for.inc65, label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc62 %indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc62 ], [ %indvars.iv126, %for.cond17.preheader ] %indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.inc62 ], [ 1, %for.cond17.preheader ] %8 = add nuw nsw i64 %indvars.iv117, %indvars.iv126 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv117, i64 %9 store i32 100000, ptr %arrayidx26, align 4, !tbaa !5 %10 = add nsw i64 %indvars.iv117, -1 %arrayidx47 = getelementptr inbounds [101 x i32], ptr %tpp, i64 0, i64 %10 %11 = load i32, ptr %arrayidx47, align 4, !tbaa !5 %arrayidx51 = getelementptr inbounds [101 x i32], ptr %tpp, i64 0, i64 %9 %12 = load i32, ptr %arrayidx51, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ] %storemerge105 = phi i32 [ 100000, %for.body30.lr.ph ], [ %b.a.i, %for.body30 ] %arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv117, i64 %indvars.iv119 %13 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 %indvars.iv.next120, i64 %9 %14 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %add44 = add nsw i32 %14, %13 %arrayidx49 = getelementptr inbounds [101 x i32], ptr %tpp, i64 0, i64 %indvars.iv119 %15 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul52 = mul nsw i32 %mul, %12 %add53 = add nsw i32 %add44, %mul52 %b.a.i = call i32 @llvm.smin.i32(i32 %storemerge105, i32 %add53) store i32 %b.a.i, ptr %arrayidx26, align 4, !tbaa !5 %exitcond125.not = icmp eq i64 %indvars.iv.next120, %indvars.iv128 br i1 %exitcond125.not, label %for.inc62, label %for.body30, !llvm.loop !14 for.inc62: ; preds = %for.body30 %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %exitcond138.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count140 br i1 %exitcond138.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15 for.inc65: ; preds = %for.inc62, %for.cond17.preheader %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1 %exitcond141.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count140 br i1 %exitcond141.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16 for.end67: ; preds = %for.inc65, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa144147 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc65 ] %idxprom69 = sext i32 %.lcssa144147 to i64 %arrayidx70 = getelementptr inbounds [101 x [101 x i32]], ptr %mov, i64 0, i64 1, i64 %idxprom69 %16 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16) call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %mov) #5 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %tpp) #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 nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %b.a } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree 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, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include<stdio.h> #define N 100 int min(int a, int b); int main(){ int i, j, k, l, n, p[N+1], c[N][N]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) c[i][i] = 0; for ( i = 1; i <= n; i++ ) scanf("%d %d", &p[i-1], &p[i]); for ( l = 2; l <= n; l++ ){ for ( i = 0; i <= n-l+1; i++ ){ j = i+l-1; c[i][j] = (1<<21); for ( k = i; k <= j-1; k++ ){ c[i][j] = min(c[i][j], c[i][k] + c[k+1][j] + p[i-1]*p[k]*p[j]); } } } printf("%d\n", c[1][n]); return 0; } int min(int a, int b) { if (a < b) return a; else return b; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284584/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284584/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %p = alloca [101 x i32], align 16 %c = alloca [100 x [100 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %c) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not100 = icmp slt i32 %0, 1 br i1 %cmp.not100, label %for.end67, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ] %arrayidx2.epil = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa br i1 %cmp.not100, label %for.end67, label %for.body5 for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx2 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx2.2 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1 store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx2.3 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2 store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.cond14.preheader: ; preds = %for.body5 %cmp15.not109 = icmp slt i32 %6, 2 br i1 %cmp15.not109, label %for.end67, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub18 = add nuw i32 %6, 1 %wide.trip.count148 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body5: ; preds = %for.cond3.preheader, %for.body5 %indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.body5 ], [ 1, %for.cond3.preheader ] %5 = add nsw i64 %indvars.iv113, -1 %arrayidx7 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5 %arrayidx9 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv113 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx9) %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %6 = load i32, ptr %n, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp4.not.not = icmp slt i64 %indvars.iv113, %7 br i1 %cmp4.not.not, label %for.body5, label %for.cond14.preheader, !llvm.loop !13 for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc65 %indvars.iv143 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next144, %for.inc65 ] %indvars.iv139 = phi i32 [ %6, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next140, %for.inc65 ] %indvars.iv128 = phi i64 [ 1, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next129, %for.inc65 ] %indvars147 = trunc i64 %indvars.iv143 to i32 %add = sub i32 %sub18, %indvars147 %cmp19.not107 = icmp slt i32 %add, 0 br i1 %cmp19.not107, label %for.inc65, label %for.body20.preheader for.body20.preheader: ; preds = %for.cond17.preheader %wide.trip.count141 = zext i32 %indvars.iv139 to i64 br label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.inc62, %for.body20.preheader %indvars.iv130 = phi i64 [ %indvars.iv128, %for.body20.preheader ], [ %indvars.iv.next131, %for.inc62 ] %indvars.iv117 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next118, %for.inc62 ] %8 = add nuw nsw i64 %indvars.iv117, %indvars.iv143 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv117, i64 %9 store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5 %10 = add nsw i64 %indvars.iv117, -1 %arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx47, align 4, !tbaa !5 %arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9 %12 = load i32, ptr %arrayidx51, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ] %storemerge105 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %a.b.i, %for.body30 ] %arrayidx38 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv117, i64 %indvars.iv119 %13 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %arrayidx43 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 %indvars.iv.next120, i64 %9 %14 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %add44 = add nsw i32 %14, %13 %arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv119 %15 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul52 = mul nsw i32 %mul, %12 %add53 = add nsw i32 %add44, %mul52 %a.b.i = call i32 @llvm.smin.i32(i32 %storemerge105, i32 %add53) store i32 %a.b.i, ptr %arrayidx26, align 4, !tbaa !5 %exitcond127.not = icmp eq i64 %indvars.iv.next120, %indvars.iv130 br i1 %exitcond127.not, label %for.inc62, label %for.body30, !llvm.loop !14 for.inc62: ; preds = %for.body30 %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count141 br i1 %exitcond142.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15 for.inc65: ; preds = %for.inc62, %for.cond17.preheader %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1 %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %indvars.iv.next140 = add i32 %indvars.iv139, -1 %exitcond149.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count148 br i1 %exitcond149.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16 for.end67: ; preds = %for.inc65, %entry, %for.cond3.preheader, %for.cond14.preheader %.lcssa152 = phi i32 [ %6, %for.cond14.preheader ], [ %0, %for.cond3.preheader ], [ %0, %entry ], [ %6, %for.inc65 ] %idxprom69 = sext i32 %.lcssa152 to i64 %arrayidx70 = getelementptr inbounds [100 x [100 x i32]], ptr %c, i64 0, i64 1, i64 %idxprom69 %16 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree 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.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12}
#include<stdio.h> #define MAX 100 #define INF 100000000 int min(int, int); int main(){ int n,i,j,k,l; int a[MAX][MAX],b[MAX]; scanf("%d",&n); for(i = 1;i <= n;i++){ scanf("%d%d",&b[i-1],&b[i]); a[i][i] = 0; } for(l = 2;l <= n;l++){ for(i = 1;i <= n-l+1;i++){ j = i+l-1; a[i][j] = INF; for(k = i;k <= j-1;k++){ a[i][j] = min(a[i][j],a[i][k]+a[k+1][j]+b[i-1]*b[k]*b[j]); } } } printf("%d\n",a[1][n]); return 0; } int min(int a,int b){ if(a < b){ return a; } else { return b; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284627/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284627/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%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 %a = alloca [100 x [100 x i32]], align 16 %b = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 400, 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 %cmp.not92 = icmp slt i32 %0, 1 br i1 %cmp.not92, label %for.end61, label %for.body for.cond8.preheader: ; preds = %for.body %cmp9.not99 = icmp slt i32 %2, 2 br i1 %cmp9.not99, label %for.end61, label %for.cond11.preheader.lr.ph for.cond11.preheader.lr.ph: ; preds = %for.cond8.preheader %sub12 = add nuw i32 %2, 1 %wide.trip.count = zext i32 %sub12 to i64 br label %for.cond11.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %1 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx7, align 4, !tbaa !5 %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.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %for.body, label %for.cond8.preheader, !llvm.loop !9 for.cond11.preheader: ; preds = %for.cond11.preheader.lr.ph, %for.inc59 %indvars.iv111 = phi i64 [ 2, %for.cond11.preheader.lr.ph ], [ %indvars.iv.next112, %for.inc59 ] %indvars124 = trunc i64 %indvars.iv111 to i32 %add = sub i32 %sub12, %indvars124 %cmp13.not97 = icmp slt i32 %add, 1 br i1 %cmp13.not97, label %for.inc59, label %for.body24.lr.ph for.body24.lr.ph: ; preds = %for.cond11.preheader, %for.inc56 %indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.inc56 ], [ %indvars.iv111, %for.cond11.preheader ] %indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc56 ], [ 1, %for.cond11.preheader ] %4 = add nuw nsw i64 %indvars.iv104, %indvars.iv111 %5 = add nsw i64 %4, -1 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv104, i64 %5 store i32 100000000, ptr %arrayidx20, align 4, !tbaa !5 %6 = add nsw i64 %indvars.iv104, -1 %arrayidx41 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %6 %7 = load i32, ptr %arrayidx41, align 4, !tbaa !5 %arrayidx45 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %5 %8 = load i32, ptr %arrayidx45, align 4, !tbaa !5 br label %for.body24 for.body24: ; preds = %for.body24.lr.ph, %for.body24 %indvars.iv106 = phi i64 [ %indvars.iv104, %for.body24.lr.ph ], [ %indvars.iv.next107, %for.body24 ] %storemerge95 = phi i32 [ 100000000, %for.body24.lr.ph ], [ %a.b.i, %for.body24 ] %arrayidx32 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv104, i64 %indvars.iv106 %9 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %arrayidx37 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv.next107, i64 %5 %10 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %add38 = add nsw i32 %10, %9 %arrayidx43 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv106 %11 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %mul = mul nsw i32 %11, %7 %mul46 = mul nsw i32 %mul, %8 %add47 = add nsw i32 %add38, %mul46 %a.b.i = call i32 @llvm.smin.i32(i32 %storemerge95, i32 %add47) store i32 %a.b.i, ptr %arrayidx20, align 4, !tbaa !5 %exitcond.not = icmp eq i64 %indvars.iv.next107, %indvars.iv113 br i1 %exitcond.not, label %for.inc56, label %for.body24, !llvm.loop !11 for.inc56: ; preds = %for.body24 %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1 %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %exitcond123.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count br i1 %exitcond123.not, label %for.inc59, label %for.body24.lr.ph, !llvm.loop !12 for.inc59: ; preds = %for.inc56, %for.cond11.preheader %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1 %exitcond125.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count br i1 %exitcond125.not, label %for.end61, label %for.cond11.preheader, !llvm.loop !13 for.end61: ; preds = %for.inc59, %entry, %for.cond8.preheader %.lcssa128 = phi i32 [ %2, %for.cond8.preheader ], [ %0, %entry ], [ %2, %for.inc59 ] %idxprom63 = sext i32 %.lcssa128 to i64 %arrayidx64 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 1, i64 %idxprom63 %12 = load i32, ptr %arrayidx64, align 4, !tbaa !5 %call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int p[100],m[100][100]; void MCM(int n){ int i,l,j,k,b; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j = i + l - 1; m[i][j] = 100000; for(k=i;k<j;k++){ b = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]; if(m[i][j]>b) m[i][j]=b; } } } } int main(){ int n,i,j; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d%d",&p[i-1],&p[i]); } for(i=1;i<=n;i++){ m[i][i]=0; } MCM(n); printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284670/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284670/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @m = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @p = dso_local global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @MCM(i32 noundef %n) local_unnamed_addr #0 { entry: %cmp.not71 = icmp slt i32 %n, 2 br i1 %cmp.not71, label %for.end44, label %for.cond1.preheader.lr.ph for.cond1.preheader.lr.ph: ; preds = %entry %sub = add nuw i32 %n, 1 %wide.trip.count = zext i32 %sub to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc42 %indvars.iv78 = phi i64 [ 2, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next79, %for.inc42 ] %indvars90 = trunc i64 %indvars.iv78 to i32 %add = sub i32 %sub, %indvars90 %cmp2.not69 = icmp slt i32 %add, 1 br i1 %cmp2.not69, label %for.inc42, label %for.body3.lr.ph for.body3.lr.ph: ; preds = %for.cond1.preheader %0 = add nuw i64 %indvars.iv78, 4294967295 br label %for.body3 for.body3: ; preds = %for.body3.lr.ph, %for.inc39 %indvars.iv80 = phi i64 [ %indvars.iv78, %for.body3.lr.ph ], [ %indvars.iv.next81, %for.inc39 ] %indvars.iv = phi i64 [ 1, %for.body3.lr.ph ], [ %indvars.iv.next, %for.inc39 ] %1 = add i64 %0, %indvars.iv %sext = shl i64 %1, 32 %idxprom6 = ashr exact i64 %sext, 32 %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %idxprom6 store i32 100000, ptr %arrayidx7, align 4, !tbaa !5 %cmp967 = icmp slt i64 %indvars.iv, %idxprom6 br i1 %cmp967, label %for.body10.lr.ph, label %for.inc39 for.body10.lr.ph: ; preds = %for.body3 %2 = add nsw i64 %indvars.iv, -1 %arrayidx23 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %2 %3 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %arrayidx27 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %idxprom6 %4 = load i32, ptr %arrayidx27, align 4, !tbaa !5 br label %for.body10 for.body10: ; preds = %for.body10.lr.ph, %for.inc %indvars.iv73 = phi i64 [ %indvars.iv, %for.body10.lr.ph ], [ %indvars.iv.next74, %for.inc ] %5 = phi i32 [ 100000, %for.body10.lr.ph ], [ %9, %for.inc ] %arrayidx14 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %indvars.iv73 %6 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %arrayidx19 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next74, i64 %idxprom6 %7 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %add20 = add nsw i32 %7, %6 %arrayidx25 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv73 %8 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %mul = mul nsw i32 %8, %3 %mul28 = mul nsw i32 %mul, %4 %add29 = add nsw i32 %add20, %mul28 %cmp34 = icmp sgt i32 %5, %add29 br i1 %cmp34, label %if.then, label %for.inc if.then: ; preds = %for.body10 store i32 %add29, ptr %arrayidx7, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body10, %if.then %9 = phi i32 [ %5, %for.body10 ], [ %add29, %if.then ] %exitcond.not = icmp eq i64 %indvars.iv.next74, %indvars.iv80 br i1 %exitcond.not, label %for.inc39, label %for.body10, !llvm.loop !9 for.inc39: ; preds = %for.inc, %for.body3 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %exitcond88.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count br i1 %exitcond88.not, label %for.inc42, label %for.body3, !llvm.loop !11 for.inc42: ; preds = %for.inc39, %for.cond1.preheader %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond91.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond91.not, label %for.end44, label %for.cond1.preheader, !llvm.loop !12 for.end44: ; preds = %for.inc42, %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not24 = icmp slt i32 %0, 1 br i1 %cmp.not24, label %MCM.exit, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not26 = icmp slt i32 %6, 1 br i1 %cmp5.not26, label %MCM.exit, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %6, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end13.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %2, -4 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %5 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.cond4.preheader, !llvm.loop !13 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv31 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next32.3, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ] %arrayidx10 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv31, i64 %indvars.iv31 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1 %arrayidx10.1 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32, i64 %indvars.iv.next32 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next32.1 = add nuw nsw i64 %indvars.iv31, 2 %arrayidx10.2 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32.1, i64 %indvars.iv.next32.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next32.2 = add nuw nsw i64 %indvars.iv31, 3 %arrayidx10.3 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next32.2, i64 %indvars.iv.next32.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next32.3 = add nuw nsw i64 %indvars.iv31, 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.end13.unr-lcssa, label %for.body6, !llvm.loop !14 for.end13.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv31.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next32.3, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end13, label %for.body6.epil for.body6.epil: ; preds = %for.end13.unr-lcssa, %for.body6.epil %indvars.iv31.epil = phi i64 [ %indvars.iv.next32.epil, %for.body6.epil ], [ %indvars.iv31.unr, %for.end13.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.end13.unr-lcssa ] %arrayidx10.epil = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv31.epil, i64 %indvars.iv31.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next32.epil = add nuw nsw i64 %indvars.iv31.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.end13, label %for.body6.epil, !llvm.loop !15 for.end13: ; preds = %for.body6.epil, %for.end13.unr-lcssa %cmp.not71.i = icmp slt i32 %6, 2 br i1 %cmp.not71.i, label %MCM.exit, label %for.cond1.preheader.lr.ph.i for.cond1.preheader.lr.ph.i: ; preds = %for.end13 %sub.i = add nuw nsw i32 %6, 1 %wide.trip.count.i = zext i32 %sub.i to i64 br label %for.cond1.preheader.i for.cond1.preheader.i: ; preds = %for.inc42.i, %for.cond1.preheader.lr.ph.i %indvars.iv78.i = phi i64 [ 2, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next79.i, %for.inc42.i ] %indvars90.i = trunc i64 %indvars.iv78.i to i32 %add.i = sub i32 %sub.i, %indvars90.i %cmp2.not69.i = icmp slt i32 %add.i, 1 br i1 %cmp2.not69.i, label %for.inc42.i, label %for.body3.lr.ph.i for.body3.lr.ph.i: ; preds = %for.cond1.preheader.i %8 = add nuw nsw i64 %indvars.iv78.i, 4294967295 br label %for.body3.i for.body3.i: ; preds = %for.inc39.i, %for.body3.lr.ph.i %indvars.iv80.i = phi i64 [ %indvars.iv78.i, %for.body3.lr.ph.i ], [ %indvars.iv.next81.i, %for.inc39.i ] %indvars.iv.i = phi i64 [ 1, %for.body3.lr.ph.i ], [ %indvars.iv.next.i, %for.inc39.i ] %9 = add nuw i64 %8, %indvars.iv.i %sext.i = shl i64 %9, 32 %idxprom6.i = ashr exact i64 %sext.i, 32 %arrayidx7.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %idxprom6.i store i32 100000, ptr %arrayidx7.i, align 4, !tbaa !5 %cmp967.i = icmp slt i64 %indvars.iv.i, %idxprom6.i br i1 %cmp967.i, label %for.body10.lr.ph.i, label %for.inc39.i for.body10.lr.ph.i: ; preds = %for.body3.i %10 = add nsw i64 %indvars.iv.i, -1 %arrayidx23.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5 %arrayidx27.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %idxprom6.i %12 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %mul.i = mul i32 %12, %11 br label %for.body10.i for.body10.i: ; preds = %for.inc.i, %for.body10.lr.ph.i %indvars.iv73.i = phi i64 [ %indvars.iv.i, %for.body10.lr.ph.i ], [ %indvars.iv.next74.i, %for.inc.i ] %13 = phi i32 [ 100000, %for.body10.lr.ph.i ], [ %17, %for.inc.i ] %arrayidx14.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %indvars.iv73.i %14 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5 %indvars.iv.next74.i = add nuw nsw i64 %indvars.iv73.i, 1 %arrayidx19.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next74.i, i64 %idxprom6.i %15 = load i32, ptr %arrayidx19.i, align 4, !tbaa !5 %add20.i = add nsw i32 %15, %14 %arrayidx25.i = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv73.i %16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5 %mul28.i = mul i32 %mul.i, %16 %add29.i = add nsw i32 %add20.i, %mul28.i %cmp34.i = icmp sgt i32 %13, %add29.i br i1 %cmp34.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body10.i store i32 %add29.i, ptr %arrayidx7.i, align 4, !tbaa !5 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body10.i %17 = phi i32 [ %13, %for.body10.i ], [ %add29.i, %if.then.i ] %exitcond.not.i = icmp eq i64 %indvars.iv.next74.i, %indvars.iv80.i br i1 %exitcond.not.i, label %for.inc39.i, label %for.body10.i, !llvm.loop !9 for.inc39.i: ; preds = %for.inc.i, %for.body3.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %indvars.iv.next81.i = add nuw nsw i64 %indvars.iv80.i, 1 %exitcond88.not.i = icmp eq i64 %indvars.iv.next81.i, %wide.trip.count.i br i1 %exitcond88.not.i, label %for.inc42.i, label %for.body3.i, !llvm.loop !11 for.inc42.i: ; preds = %for.inc39.i, %for.cond1.preheader.i %indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1 %exitcond91.not.i = icmp eq i64 %indvars.iv.next79.i, %wide.trip.count.i br i1 %exitcond91.not.i, label %MCM.exit, label %for.cond1.preheader.i, !llvm.loop !12 MCM.exit: ; preds = %for.inc42.i, %entry, %for.cond4.preheader, %for.end13 %.lcssa3639 = phi i32 [ %6, %for.end13 ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc42.i ] %idxprom14 = sext i32 %.lcssa3639 to i64 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom14 %18 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !16} !16 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> #define MAX 101 #define INFTY 2000000001 int n,p[MAX],m[MAX][MAX]; void MatricxChainMultiplication(){ int i,j,l,k; for(i=1;i<=n;i++)m[i][i]=0; for(l=2;l<=n;l++){ for(i=1;i<=n-l+1;i++){ j=i+l-1; m[i][j]=INFTY; for(k=i;k<j;k++){ int a=m[i][j],b=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]; m[i][j]=(a>b)?b:a; } } } } int main(){ int i; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%d %d",&p[i-1],&p[i]); MatricxChainMultiplication(); printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284713/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284713/source.c" target datalayout = "e-m:e-p270: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 @m = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16 @p = dso_local global [101 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @MatricxChainMultiplication() local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not81 = icmp slt i32 %0, 1 br i1 %cmp.not81, label %for.end54, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ] %arrayidx2.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not88 = icmp slt i32 %0, 2 br i1 %cmp4.not88, label %for.end54, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %0, 1 %wide.trip.count113 = zext i32 %sub to i64 br label %for.cond6.preheader for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx2.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1 store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx2.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2 store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc52 %indvars.iv100 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next101, %for.inc52 ] %indvars112 = trunc i64 %indvars.iv100 to i32 %add = sub i32 %sub, %indvars112 %cmp7.not86 = icmp slt i32 %add, 1 br i1 %cmp7.not86, label %for.inc52, label %for.body8.lr.ph for.body8.lr.ph: ; preds = %for.cond6.preheader %5 = add nuw i64 %indvars.iv100, 4294967295 br label %for.body8 for.body8: ; preds = %for.body8.lr.ph, %for.inc49 %indvars.iv102 = phi i64 [ %indvars.iv100, %for.body8.lr.ph ], [ %indvars.iv.next103, %for.inc49 ] %indvars.iv91 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next92, %for.inc49 ] %6 = add i64 %5, %indvars.iv91 %sext = shl i64 %6, 32 %idxprom13 = ashr exact i64 %sext, 32 %arrayidx14 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv91, i64 %idxprom13 store i32 2000000001, ptr %arrayidx14, align 4, !tbaa !5 %cmp1683 = icmp slt i64 %indvars.iv91, %idxprom13 br i1 %cmp1683, label %for.body17.lr.ph, label %for.inc49 for.body17.lr.ph: ; preds = %for.body8 %7 = add nsw i64 %indvars.iv91, -1 %arrayidx34 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %7 %8 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %arrayidx38 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13 %9 = load i32, ptr %arrayidx38, align 4, !tbaa !5 br label %for.body17 for.body17: ; preds = %for.body17.lr.ph, %for.body17 %indvars.iv93 = phi i64 [ %indvars.iv91, %for.body17.lr.ph ], [ %indvars.iv.next94, %for.body17 ] %storemerge84 = phi i32 [ 2000000001, %for.body17.lr.ph ], [ %cond, %for.body17 ] %arrayidx25 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv91, i64 %indvars.iv93 %10 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1 %arrayidx30 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next94, i64 %idxprom13 %11 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %add31 = add nsw i32 %11, %10 %arrayidx36 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv93 %12 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %mul = mul nsw i32 %12, %8 %mul39 = mul nsw i32 %mul, %9 %add40 = add nsw i32 %add31, %mul39 %cond = tail call i32 @llvm.smin.i32(i32 %storemerge84, i32 %add40) store i32 %cond, ptr %arrayidx14, align 4, !tbaa !5 %exitcond99.not = icmp eq i64 %indvars.iv.next94, %indvars.iv102 br i1 %exitcond99.not, label %for.inc49, label %for.body17, !llvm.loop !13 for.inc49: ; preds = %for.body17, %for.body8 %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1 %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1 %exitcond110.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count113 br i1 %exitcond110.not, label %for.inc52, label %for.body8, !llvm.loop !14 for.inc52: ; preds = %for.inc49, %for.cond6.preheader %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1 %exitcond114.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count113 br i1 %exitcond114.not, label %for.end54, label %for.cond6.preheader, !llvm.loop !15 for.end54: ; preds = %for.inc52, %entry, %for.cond3.preheader ret void } ; 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 @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not10 = icmp slt i32 %0, 1 br i1 %cmp.not10, label %MatricxChainMultiplication.exit, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %1 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv %call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !16 for.end: ; preds = %for.body %cmp.not81.i = icmp slt i32 %2, 1 br i1 %cmp.not81.i, label %MatricxChainMultiplication.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end %4 = add nuw nsw i32 %2, 1 %wide.trip.count.i = zext i32 %4 to i64 %5 = add nsw i64 %wide.trip.count.i, -1 %6 = add nsw i64 %wide.trip.count.i, -2 %xtraiter = and i64 %5, 3 %7 = icmp ult i64 %6, 3 br i1 %7, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %5, -4 br label %for.body.i for.cond3.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader.i, label %for.body.i.epil for.body.i.epil: ; preds = %for.cond3.preheader.i.unr-lcssa, %for.body.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond3.preheader.i.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond3.preheader.i.unr-lcssa ] %arrayidx2.i.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !17 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not88.i = icmp slt i32 %2, 2 br i1 %cmp4.not88.i, label %MatricxChainMultiplication.exit, label %for.cond6.preheader.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %arrayidx2.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i store i32 0, ptr %arrayidx2.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx2.i.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx2.i.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1 store i32 0, ptr %arrayidx2.i.2, align 4, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %arrayidx2.i.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2 store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !11 for.cond6.preheader.i: ; preds = %for.cond3.preheader.i, %for.inc52.i %indvars.iv100.i = phi i64 [ %indvars.iv.next101.i, %for.inc52.i ], [ 2, %for.cond3.preheader.i ] %indvars112.i = trunc i64 %indvars.iv100.i to i32 %add.i = sub i32 %4, %indvars112.i %cmp7.not86.i = icmp slt i32 %add.i, 1 br i1 %cmp7.not86.i, label %for.inc52.i, label %for.body8.lr.ph.i for.body8.lr.ph.i: ; preds = %for.cond6.preheader.i %8 = add nuw nsw i64 %indvars.iv100.i, 4294967295 br label %for.body8.i for.body8.i: ; preds = %for.inc49.i, %for.body8.lr.ph.i %indvars.iv102.i = phi i64 [ %indvars.iv100.i, %for.body8.lr.ph.i ], [ %indvars.iv.next103.i, %for.inc49.i ] %indvars.iv91.i = phi i64 [ 1, %for.body8.lr.ph.i ], [ %indvars.iv.next92.i, %for.inc49.i ] %9 = add nuw i64 %8, %indvars.iv91.i %sext.i = shl i64 %9, 32 %idxprom13.i = ashr exact i64 %sext.i, 32 %arrayidx14.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv91.i, i64 %idxprom13.i store i32 2000000001, ptr %arrayidx14.i, align 4, !tbaa !5 %cmp1683.i = icmp slt i64 %indvars.iv91.i, %idxprom13.i br i1 %cmp1683.i, label %for.body17.lr.ph.i, label %for.inc49.i for.body17.lr.ph.i: ; preds = %for.body8.i %10 = add nsw i64 %indvars.iv91.i, -1 %arrayidx34.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5 %arrayidx38.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13.i %12 = load i32, ptr %arrayidx38.i, align 4, !tbaa !5 %mul.i = mul i32 %12, %11 br label %for.body17.i for.body17.i: ; preds = %for.body17.i, %for.body17.lr.ph.i %indvars.iv93.i = phi i64 [ %indvars.iv91.i, %for.body17.lr.ph.i ], [ %indvars.iv.next94.i, %for.body17.i ] %storemerge84.i = phi i32 [ 2000000001, %for.body17.lr.ph.i ], [ %cond.i, %for.body17.i ] %arrayidx25.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv91.i, i64 %indvars.iv93.i %13 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5 %indvars.iv.next94.i = add nuw nsw i64 %indvars.iv93.i, 1 %arrayidx30.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next94.i, i64 %idxprom13.i %14 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5 %add31.i = add nsw i32 %14, %13 %arrayidx36.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv93.i %15 = load i32, ptr %arrayidx36.i, align 4, !tbaa !5 %mul39.i = mul i32 %mul.i, %15 %add40.i = add nsw i32 %add31.i, %mul39.i %cond.i = tail call i32 @llvm.smin.i32(i32 %storemerge84.i, i32 %add40.i) store i32 %cond.i, ptr %arrayidx14.i, align 4, !tbaa !5 %exitcond99.not.i = icmp eq i64 %indvars.iv.next94.i, %indvars.iv102.i br i1 %exitcond99.not.i, label %for.inc49.i, label %for.body17.i, !llvm.loop !13 for.inc49.i: ; preds = %for.body17.i, %for.body8.i %indvars.iv.next92.i = add nuw nsw i64 %indvars.iv91.i, 1 %indvars.iv.next103.i = add nuw nsw i64 %indvars.iv102.i, 1 %exitcond110.not.i = icmp eq i64 %indvars.iv.next103.i, %wide.trip.count.i br i1 %exitcond110.not.i, label %for.inc52.i, label %for.body8.i, !llvm.loop !14 for.inc52.i: ; preds = %for.inc49.i, %for.cond6.preheader.i %indvars.iv.next101.i = add nuw nsw i64 %indvars.iv100.i, 1 %exitcond114.not.i = icmp eq i64 %indvars.iv.next101.i, %wide.trip.count.i br i1 %exitcond114.not.i, label %MatricxChainMultiplication.exit, label %for.cond6.preheader.i, !llvm.loop !15 MatricxChainMultiplication.exit: ; preds = %for.inc52.i, %entry, %for.end, %for.cond3.preheader.i %.lcssa17 = phi i32 [ %2, %for.end ], [ %2, %for.cond3.preheader.i ], [ %0, %entry ], [ %2, %for.inc52.i ] %idxprom4 = sext i32 %.lcssa17 to i64 %arrayidx5 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom4 %16 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16) ret i32 0 } ; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree nounwind "no-trapping-math"="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 = distinct !{!9, !10} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !10}
#include <stdio.h> #define N 100 int m[101][101], p[101], n; void matrixChain() { int i, j, k, l; for (i = 1; i <= n; i++){ m[i][i] = 0; } for (l = 2; l <= n; l++){ for (i = 1; i <= n - l + 1; i++){ j = i + l - 1; m[i][j] = 100000000; for (k = i; k < j; k++){ if (m[i][j] > m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j]) m[i][j] = m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j]; } } } } int main() { int i; scanf("%d", &n); for (i = 1; i <= n; i++){ scanf("%d %d", &p[i-1], &p[i]); } matrixChain(); printf("%d\n", m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284757/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284757/source.c" target datalayout = "e-m:e-p270: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 @m = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16 @p = dso_local global [101 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @matrixChain() local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not106 = icmp slt i32 %0, 1 br i1 %cmp.not106, label %for.end74, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ] %arrayidx2.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not112 = icmp slt i32 %0, 2 br i1 %cmp4.not112, label %for.end74, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %0, 1 %wide.trip.count137 = zext i32 %sub to i64 br label %for.cond6.preheader for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %indvars.iv store i32 0, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx2.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1 store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx2.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2 store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc72 %indvars.iv124 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next125, %for.inc72 ] %indvars136 = trunc i64 %indvars.iv124 to i32 %add = sub i32 %sub, %indvars136 %cmp7.not110 = icmp slt i32 %add, 1 br i1 %cmp7.not110, label %for.inc72, label %for.body8.lr.ph for.body8.lr.ph: ; preds = %for.cond6.preheader %5 = add nuw i64 %indvars.iv124, 4294967295 br label %for.body8 for.body8: ; preds = %for.body8.lr.ph, %for.inc69 %indvars.iv126 = phi i64 [ %indvars.iv124, %for.body8.lr.ph ], [ %indvars.iv.next127, %for.inc69 ] %indvars.iv115 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next116, %for.inc69 ] %6 = add i64 %5, %indvars.iv115 %sext = shl i64 %6, 32 %idxprom13 = ashr exact i64 %sext, 32 %arrayidx14 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv115, i64 %idxprom13 store i32 100000000, ptr %arrayidx14, align 4, !tbaa !5 %cmp16108 = icmp slt i64 %indvars.iv115, %idxprom13 br i1 %cmp16108, label %for.body17.lr.ph, label %for.inc69 for.body17.lr.ph: ; preds = %for.body8 %7 = add nsw i64 %indvars.iv115, -1 %arrayidx34 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %7 %8 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %arrayidx38 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13 %9 = load i32, ptr %arrayidx38, align 4, !tbaa !5 br label %for.body17 for.body17: ; preds = %for.body17.lr.ph, %for.inc66 %indvars.iv117 = phi i64 [ %indvars.iv115, %for.body17.lr.ph ], [ %indvars.iv.next118, %for.inc66 ] %10 = phi i32 [ 100000000, %for.body17.lr.ph ], [ %14, %for.inc66 ] %arrayidx25 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv115, i64 %indvars.iv117 %11 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %arrayidx30 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next118, i64 %idxprom13 %12 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %add31 = add nsw i32 %12, %11 %arrayidx36 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv117 %13 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %mul = mul nsw i32 %13, %8 %mul39 = mul nsw i32 %mul, %9 %add40 = add nsw i32 %add31, %mul39 %cmp41 = icmp sgt i32 %10, %add40 br i1 %cmp41, label %if.then, label %for.inc66 if.then: ; preds = %for.body17 store i32 %add40, ptr %arrayidx14, align 4, !tbaa !5 br label %for.inc66 for.inc66: ; preds = %for.body17, %if.then %14 = phi i32 [ %10, %for.body17 ], [ %add40, %if.then ] %exitcond123.not = icmp eq i64 %indvars.iv.next118, %indvars.iv126 br i1 %exitcond123.not, label %for.inc69, label %for.body17, !llvm.loop !13 for.inc69: ; preds = %for.inc66, %for.body8 %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1 %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1 %exitcond134.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count137 br i1 %exitcond134.not, label %for.inc72, label %for.body8, !llvm.loop !14 for.inc72: ; preds = %for.inc69, %for.cond6.preheader %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %exitcond138.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count137 br i1 %exitcond138.not, label %for.end74, label %for.cond6.preheader, !llvm.loop !15 for.end74: ; preds = %for.inc72, %entry, %for.cond3.preheader ret void } ; 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 @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not10 = icmp slt i32 %0, 1 br i1 %cmp.not10, label %matrixChain.exit, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %1 = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv %call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !16 for.end: ; preds = %for.body %cmp.not106.i = icmp slt i32 %2, 1 br i1 %cmp.not106.i, label %matrixChain.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end %4 = add nuw nsw i32 %2, 1 %wide.trip.count.i = zext i32 %4 to i64 %5 = add nsw i64 %wide.trip.count.i, -1 %6 = add nsw i64 %wide.trip.count.i, -2 %xtraiter = and i64 %5, 3 %7 = icmp ult i64 %6, 3 br i1 %7, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %5, -4 br label %for.body.i for.cond3.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond3.preheader.i, label %for.body.i.epil for.body.i.epil: ; preds = %for.cond3.preheader.i.unr-lcssa, %for.body.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond3.preheader.i.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond3.preheader.i.unr-lcssa ] %arrayidx2.i.epil = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !17 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not112.i = icmp slt i32 %2, 2 br i1 %cmp4.not112.i, label %matrixChain.exit, label %for.cond6.preheader.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %arrayidx2.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i store i32 0, ptr %arrayidx2.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx2.i.1 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx2.i.2 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1 store i32 0, ptr %arrayidx2.i.2, align 4, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %arrayidx2.i.3 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2 store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !11 for.cond6.preheader.i: ; preds = %for.cond3.preheader.i, %for.inc72.i %indvars.iv124.i = phi i64 [ %indvars.iv.next125.i, %for.inc72.i ], [ 2, %for.cond3.preheader.i ] %indvars136.i = trunc i64 %indvars.iv124.i to i32 %add.i = sub i32 %4, %indvars136.i %cmp7.not110.i = icmp slt i32 %add.i, 1 br i1 %cmp7.not110.i, label %for.inc72.i, label %for.body8.lr.ph.i for.body8.lr.ph.i: ; preds = %for.cond6.preheader.i %8 = add nuw nsw i64 %indvars.iv124.i, 4294967295 br label %for.body8.i for.body8.i: ; preds = %for.inc69.i, %for.body8.lr.ph.i %indvars.iv126.i = phi i64 [ %indvars.iv124.i, %for.body8.lr.ph.i ], [ %indvars.iv.next127.i, %for.inc69.i ] %indvars.iv115.i = phi i64 [ 1, %for.body8.lr.ph.i ], [ %indvars.iv.next116.i, %for.inc69.i ] %9 = add nuw i64 %8, %indvars.iv115.i %sext.i = shl i64 %9, 32 %idxprom13.i = ashr exact i64 %sext.i, 32 %arrayidx14.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv115.i, i64 %idxprom13.i store i32 100000000, ptr %arrayidx14.i, align 4, !tbaa !5 %cmp16108.i = icmp slt i64 %indvars.iv115.i, %idxprom13.i br i1 %cmp16108.i, label %for.body17.lr.ph.i, label %for.inc69.i for.body17.lr.ph.i: ; preds = %for.body8.i %10 = add nsw i64 %indvars.iv115.i, -1 %arrayidx34.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5 %arrayidx38.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13.i %12 = load i32, ptr %arrayidx38.i, align 4, !tbaa !5 %mul.i = mul i32 %12, %11 br label %for.body17.i for.body17.i: ; preds = %for.inc66.i, %for.body17.lr.ph.i %indvars.iv117.i = phi i64 [ %indvars.iv115.i, %for.body17.lr.ph.i ], [ %indvars.iv.next118.i, %for.inc66.i ] %13 = phi i32 [ 100000000, %for.body17.lr.ph.i ], [ %17, %for.inc66.i ] %arrayidx25.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv115.i, i64 %indvars.iv117.i %14 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5 %indvars.iv.next118.i = add nuw nsw i64 %indvars.iv117.i, 1 %arrayidx30.i = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 %indvars.iv.next118.i, i64 %idxprom13.i %15 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5 %add31.i = add nsw i32 %15, %14 %arrayidx36.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv117.i %16 = load i32, ptr %arrayidx36.i, align 4, !tbaa !5 %mul39.i = mul i32 %mul.i, %16 %add40.i = add nsw i32 %add31.i, %mul39.i %cmp41.i = icmp sgt i32 %13, %add40.i br i1 %cmp41.i, label %if.then.i, label %for.inc66.i if.then.i: ; preds = %for.body17.i store i32 %add40.i, ptr %arrayidx14.i, align 4, !tbaa !5 br label %for.inc66.i for.inc66.i: ; preds = %if.then.i, %for.body17.i %17 = phi i32 [ %13, %for.body17.i ], [ %add40.i, %if.then.i ] %exitcond123.not.i = icmp eq i64 %indvars.iv.next118.i, %indvars.iv126.i br i1 %exitcond123.not.i, label %for.inc69.i, label %for.body17.i, !llvm.loop !13 for.inc69.i: ; preds = %for.inc66.i, %for.body8.i %indvars.iv.next116.i = add nuw nsw i64 %indvars.iv115.i, 1 %indvars.iv.next127.i = add nuw nsw i64 %indvars.iv126.i, 1 %exitcond134.not.i = icmp eq i64 %indvars.iv.next127.i, %wide.trip.count.i br i1 %exitcond134.not.i, label %for.inc72.i, label %for.body8.i, !llvm.loop !14 for.inc72.i: ; preds = %for.inc69.i, %for.cond6.preheader.i %indvars.iv.next125.i = add nuw nsw i64 %indvars.iv124.i, 1 %exitcond138.not.i = icmp eq i64 %indvars.iv.next125.i, %wide.trip.count.i br i1 %exitcond138.not.i, label %matrixChain.exit, label %for.cond6.preheader.i, !llvm.loop !15 matrixChain.exit: ; preds = %for.inc72.i, %entry, %for.end, %for.cond3.preheader.i %.lcssa17 = phi i32 [ %2, %for.end ], [ %2, %for.cond3.preheader.i ], [ %0, %entry ], [ %2, %for.inc72.i ] %idxprom4 = sext i32 %.lcssa17 to i64 %arrayidx5 = getelementptr inbounds [101 x [101 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom4 %18 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18) ret i32 0 } ; 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 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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" } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !10}
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,a,b,c,d; scanf("%d %d %d %d %d",&n,&a,&b,&c,&d); int V=a-b,o=a+b,C=c-d,D=c+d,f=0; int x=V*n; int y=o*n; if(x>=C&&x<=D) printf("Yes\n"); else if(y>=C&&y<=D) printf("Yes\n"); else if(x<=C&&y>=D) printf("Yes\n"); else printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28480/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28480/source.c" target datalayout = "e-m:e-p270: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 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.6 = 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: %t = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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 %dec35 = add nsw i32 %0, -1 store i32 %dec35, ptr %t, align 4, !tbaa !5 %tobool.not36 = icmp eq i32 %0, 0 br i1 %tobool.not36, label %while.end, label %while.body while.body: ; preds = %entry, %if.end21 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %1, %2 %add = add nsw i32 %2, %1 %3 = load i32, ptr %c, align 4, !tbaa !5 %4 = load i32, ptr %d, align 4, !tbaa !5 %sub2 = sub nsw i32 %3, %4 %add3 = add nsw i32 %4, %3 %5 = load i32, ptr %n, align 4, !tbaa !5 %mul = mul nsw i32 %5, %sub %mul4 = mul nsw i32 %5, %add %cmp.not = icmp slt i32 %mul, %sub2 %cmp5.not = icmp sgt i32 %mul, %add3 %or.cond = select i1 %cmp.not, i1 true, i1 %cmp5.not br i1 %or.cond, label %if.else, label %if.end21 if.else: ; preds = %while.body %cmp7.not = icmp slt i32 %mul4, %sub2 %cmp9.not = icmp sgt i32 %mul4, %add3 %or.cond33 = select i1 %cmp7.not, i1 true, i1 %cmp9.not br i1 %or.cond33, label %if.else12, label %if.end21 if.else12: ; preds = %if.else %cmp13.not = icmp sgt i32 %mul, %sub2 %cmp15.not = icmp slt i32 %mul4, %add3 %or.cond34 = select i1 %cmp13.not, i1 true, i1 %cmp15.not %str.str.4 = select i1 %or.cond34, ptr @str, ptr @str.6 br label %if.end21 if.end21: ; preds = %if.else12, %if.else, %while.body %str.5.sink = phi ptr [ @str.6, %while.body ], [ @str.6, %if.else ], [ %str.str.4, %if.else12 ] %puts31 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %6 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end21, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<math.h> int main(){ int n,t,i,j,d[10010][5]; double l,r[2][2]={-60,-1,-60,-1}; scanf("%d",&n); for(i=0;i<n;i++){ for(j=0;j<5;j++)scanf("%d",&d[i][j]); } for(i=1;i<n;i++){ if(d[i-1][1]==d[i][1]||d[i-1][2]-d[i][2])continue; l=hypot(d[i-1][3]-d[i][3],d[i-1][4]-d[i][4]); t=d[i][2]; if(r[t][1]<l||fabs(r[t][1]-l)<1e-9&&r[t][0]>d[i][0]-d[i-1][0]){ r[t][0]=d[i][0]-d[i-1][0]; r[t][1]=l; } } printf("%f %f\n%f %f\n",r[0][1],r[0][0]/60.0,r[1][1],r[1][0]/60.0); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284850/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284850/source.c" target datalayout = "e-m:e-p270: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.r = private unnamed_addr constant [2 x [2 x double]] [[2 x double] [double -6.000000e+01, double -1.000000e+00], [2 x double] [double -6.000000e+01, double -1.000000e+00]], align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [13 x i8] c"%f %f\0A%f %f\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca [10010 x [5 x i32]], align 16 %r = alloca [2 x [2 x double]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 200200, ptr nonnull %d) #6 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %r) #6 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %r, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.r, i64 32, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp131 = icmp sgt i32 %0, 0 br i1 %cmp131, label %for.cond1.preheader, label %for.end94 for.cond1.preheader: ; preds = %entry, %for.cond1.preheader %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ] %arrayidx5 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 0 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5) %arrayidx5.1 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 1 %call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1) %arrayidx5.2 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 2 %call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2) %arrayidx5.3 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 3 %call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3) %arrayidx5.4 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 4 %call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.4) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !9 for.cond10.preheader: ; preds = %for.cond1.preheader %3 = icmp sgt i32 %1, 1 br i1 %3, label %for.body12, label %for.end94 for.body12: ; preds = %for.cond10.preheader, %for.inc92 %indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.inc92 ], [ 1, %for.cond10.preheader ] %4 = add nsw i64 %indvars.iv137, -1 %arrayidx14 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %4 %arrayidx15 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %4, i64 1 %5 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %arrayidx17 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv137 %arrayidx18 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv137, i64 1 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %cmp19 = icmp eq i32 %5, %6 br i1 %cmp19, label %for.inc92, label %lor.lhs.false lor.lhs.false: ; preds = %for.body12 %arrayidx23 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %4, i64 2 %7 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %arrayidx26 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv137, i64 2 %8 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %tobool.not = icmp eq i32 %7, %8 br i1 %tobool.not, label %if.end, label %for.inc92 if.end: ; preds = %lor.lhs.false %arrayidx31 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %4, i64 3 %9 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx34 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv137, i64 3 %10 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %sub35 = sub nsw i32 %9, %10 %conv = sitofp i32 %sub35 to double %arrayidx39 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %4, i64 4 %11 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %arrayidx42 = getelementptr inbounds [10010 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv137, i64 4 %12 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %sub43 = sub nsw i32 %11, %12 %conv44 = sitofp i32 %sub43 to double %call45 = call double @hypot(double noundef %conv, double noundef %conv44) #6 %13 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %idxprom49 = sext i32 %13 to i64 %arrayidx50 = getelementptr inbounds [2 x [2 x double]], ptr %r, i64 0, i64 %idxprom49 %arrayidx51 = getelementptr inbounds [2 x [2 x double]], ptr %r, i64 0, i64 %idxprom49, i64 1 %14 = load double, ptr %arrayidx51, align 8, !tbaa !11 %cmp52 = fcmp olt double %14, %call45 br i1 %cmp52, label %if.end.if.then75_crit_edge, label %lor.lhs.false54 if.end.if.then75_crit_edge: ; preds = %if.end %.pre = load i32, ptr %arrayidx17, align 4, !tbaa !5 %.pre141 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %.pre146 = sub nsw i32 %.pre, %.pre141 %.pre147 = sitofp i32 %.pre146 to double br label %if.then75 lor.lhs.false54: ; preds = %if.end %sub58 = fsub double %14, %call45 %15 = call double @llvm.fabs.f64(double %sub58) %cmp59 = fcmp olt double %15, 1.000000e-09 br i1 %cmp59, label %land.lhs.true, label %for.inc92 land.lhs.true: ; preds = %lor.lhs.false54 %16 = load double, ptr %arrayidx50, align 16, !tbaa !11 %17 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %18 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %sub71 = sub nsw i32 %17, %18 %conv72 = sitofp i32 %sub71 to double %cmp73 = fcmp ogt double %16, %conv72 br i1 %cmp73, label %if.then75, label %for.inc92 if.then75: ; preds = %if.end.if.then75_crit_edge, %land.lhs.true %conv84.pre-phi = phi double [ %.pre147, %if.end.if.then75_crit_edge ], [ %conv72, %land.lhs.true ] store double %conv84.pre-phi, ptr %arrayidx50, align 16, !tbaa !11 store double %call45, ptr %arrayidx51, align 8, !tbaa !11 br label %for.inc92 for.inc92: ; preds = %lor.lhs.false54, %land.lhs.true, %if.then75, %for.body12, %lor.lhs.false %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1 %19 = load i32, ptr %n, align 4, !tbaa !5 %20 = sext i32 %19 to i64 %cmp11 = icmp slt i64 %indvars.iv.next138, %20 br i1 %cmp11, label %for.body12, label %for.end94.loopexit, !llvm.loop !13 for.end94.loopexit: ; preds = %for.inc92 %arrayidx96.phi.trans.insert = getelementptr inbounds [2 x double], ptr %r, i64 0, i64 1 %.pre142 = load double, ptr %arrayidx96.phi.trans.insert, align 8, !tbaa !11 %.pre143 = load double, ptr %r, align 16, !tbaa !11 %arrayidx100.phi.trans.insert = getelementptr inbounds [2 x [2 x double]], ptr %r, i64 0, i64 1, i64 1 %.pre144 = load double, ptr %arrayidx100.phi.trans.insert, align 8, !tbaa !11 %arrayidx99.phi.trans.insert = getelementptr inbounds [2 x [2 x double]], ptr %r, i64 0, i64 1 %.pre145 = load double, ptr %arrayidx99.phi.trans.insert, align 16, !tbaa !11 br label %for.end94 for.end94: ; preds = %entry, %for.end94.loopexit, %for.cond10.preheader %21 = phi double [ %.pre145, %for.end94.loopexit ], [ -6.000000e+01, %for.cond10.preheader ], [ -6.000000e+01, %entry ] %22 = phi double [ %.pre144, %for.end94.loopexit ], [ -1.000000e+00, %for.cond10.preheader ], [ -1.000000e+00, %entry ] %23 = phi double [ %.pre143, %for.end94.loopexit ], [ -6.000000e+01, %for.cond10.preheader ], [ -6.000000e+01, %entry ] %24 = phi double [ %.pre142, %for.end94.loopexit ], [ -1.000000e+00, %for.cond10.preheader ], [ -1.000000e+00, %entry ] %div = fdiv double %23, 6.000000e+01 %div103 = fdiv double %21, 6.000000e+01 %call104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %24, double noundef %div, double noundef %22, double noundef %div103) call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %r) #6 call void @llvm.lifetime.end.p0(i64 200200, ptr nonnull %d) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nounwind declare double @hypot(double noundef, double noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #5 ; 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!12, !12, i64 0} !12 = !{!"double", !7, i64 0} !13 = distinct !{!13, !10}
#include <stdio.h> int main(void) { int a, b, c, tmp; scanf("%d %d %d", &a, &b, &c); if (a > b){ tmp = a; a = b; b = tmp; } if (b > c){ tmp = b; b = c; c = tmp; } if (a > b){ tmp = a; a = b; b = tmp; } printf("%d %d %d\n", a, b, c); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284937/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284937/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i32 [ %1, %if.then ], [ %0, %entry ] %3 = phi i32 [ %0, %if.then ], [ %1, %entry ] %4 = load i32, ptr %c, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %3, %4 br i1 %cmp1, label %if.then2, label %if.end3 if.then2: ; preds = %if.end store i32 %4, ptr %b, align 4, !tbaa !5 store i32 %3, ptr %c, align 4, !tbaa !5 br label %if.end3 if.end3: ; preds = %if.then2, %if.end %5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ] %6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ] %cmp4 = icmp sgt i32 %2, %6 br i1 %cmp4, label %if.then5, label %if.end6 if.then5: ; preds = %if.end3 store i32 %6, ptr %a, align 4, !tbaa !5 store i32 %2, ptr %b, align 4, !tbaa !5 br label %if.end6 if.end6: ; preds = %if.then5, %if.end3 %7 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ] %8 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main (void) { int a,b,c,d; scanf("%d %d %d",&a,&b,&c); if(a>b){ d=a; a=b; b=d; } if(b>c){ d=b; b=c; c=d; } if(a>b){ d=a; a=b; b=d; } printf("%d %d %d\n",a,b,c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284988/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284988/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %b, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i32 [ %1, %if.then ], [ %0, %entry ] %3 = phi i32 [ %0, %if.then ], [ %1, %entry ] %4 = load i32, ptr %c, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %3, %4 br i1 %cmp1, label %if.then2, label %if.end3 if.then2: ; preds = %if.end store i32 %4, ptr %b, align 4, !tbaa !5 store i32 %3, ptr %c, align 4, !tbaa !5 br label %if.end3 if.end3: ; preds = %if.then2, %if.end %5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ] %6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ] %cmp4 = icmp sgt i32 %2, %6 br i1 %cmp4, label %if.then5, label %if.end6 if.then5: ; preds = %if.end3 store i32 %6, ptr %a, align 4, !tbaa !5 store i32 %2, ptr %b, align 4, !tbaa !5 br label %if.end6 if.end6: ; preds = %if.then5, %if.end3 %7 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ] %8 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> long e[200005]={0},last[200005]={0},totm=0,now[50005]={0}; long fa[50005]={0}; void dfs(long x,long father) { long i; fa[x]=father; for(i=now[x];i;i=last[i]) if(e[i]!=father) dfs(e[i],x); } int main() { long n,r1,r2; long i,x; scanf("%ld%ld%ld",&n,&r1,&r2); for(i=1;i<=n;i++) if(i!=r1) { scanf("%ld",&x); e[++totm]=i; last[totm]=now[x];now[x]=totm; e[++totm]=x; last[totm]=now[i];now[i]=totm; } dfs(r2,0); for(i=1;i<=n;i++) if(i!=r2) printf("%ld ",fa[i]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28503/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28503/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @e = dso_local local_unnamed_addr global [200005 x i64] zeroinitializer, align 16 @last = dso_local local_unnamed_addr global [200005 x i64] zeroinitializer, align 16 @totm = dso_local local_unnamed_addr global i64 0, align 8 @now = dso_local local_unnamed_addr global [50005 x i64] zeroinitializer, align 16 @fa = dso_local local_unnamed_addr global [50005 x i64] zeroinitializer, align 16 @.str = private unnamed_addr constant [10 x i8] c"%ld%ld%ld\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%ld \00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @dfs(i64 noundef %x, i64 noundef %father) local_unnamed_addr #0 { entry: %arrayidx = getelementptr inbounds [50005 x i64], ptr @fa, i64 0, i64 %x store i64 %father, ptr %arrayidx, align 8, !tbaa !5 %arrayidx1 = getelementptr inbounds [50005 x i64], ptr @now, i64 0, i64 %x %i.011 = load i64, ptr %arrayidx1, align 8, !tbaa !5 %tobool.not12 = icmp eq i64 %i.011, 0 br i1 %tobool.not12, label %for.end, label %for.body for.body: ; preds = %entry, %for.inc %i.013 = phi i64 [ %i.0, %for.inc ], [ %i.011, %entry ] %arrayidx2 = getelementptr inbounds [200005 x i64], ptr @e, i64 0, i64 %i.013 %0 = load i64, ptr %arrayidx2, align 8, !tbaa !5 %cmp.not = icmp eq i64 %0, %father br i1 %cmp.not, label %for.inc, label %if.then if.then: ; preds = %for.body tail call void @dfs(i64 noundef %0, i64 noundef %x) br label %for.inc for.inc: ; preds = %for.body, %if.then %arrayidx4 = getelementptr inbounds [200005 x i64], ptr @last, i64 0, i64 %i.013 %i.0 = load i64, ptr %arrayidx4, align 8, !tbaa !5 %tobool.not = icmp eq i64 %i.0, 0 br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %for.inc, %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: 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 i64, align 8 %r1 = alloca i64, align 8 %r2 = alloca i64, align 8 %x = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r2) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %r1, ptr noundef nonnull %r2) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp.not32 = icmp slt i64 %0, 1 br i1 %cmp.not32, label %for.end, label %for.body for.body: ; preds = %entry, %for.inc %1 = phi i64 [ %7, %for.inc ], [ %0, %entry ] %i.033 = phi i64 [ %inc11, %for.inc ], [ 1, %entry ] %2 = load i64, ptr %r1, align 8, !tbaa !5 %cmp1.not = icmp eq i64 %i.033, %2 br i1 %cmp1.not, label %for.inc, label %if.then if.then: ; preds = %for.body %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %3 = load i64, ptr @totm, align 8, !tbaa !5 %inc = add nsw i64 %3, 1 %arrayidx = getelementptr inbounds [200005 x i64], ptr @e, i64 0, i64 %inc store i64 %i.033, ptr %arrayidx, align 8, !tbaa !5 %4 = load i64, ptr %x, align 8, !tbaa !5 %arrayidx3 = getelementptr inbounds [50005 x i64], ptr @now, i64 0, i64 %4 %5 = load i64, ptr %arrayidx3, align 8, !tbaa !5 %arrayidx4 = getelementptr inbounds [200005 x i64], ptr @last, i64 0, i64 %inc store i64 %5, ptr %arrayidx4, align 8, !tbaa !5 store i64 %inc, ptr %arrayidx3, align 8, !tbaa !5 %inc6 = add nsw i64 %3, 2 store i64 %inc6, ptr @totm, align 8, !tbaa !5 %arrayidx7 = getelementptr inbounds [200005 x i64], ptr @e, i64 0, i64 %inc6 store i64 %4, ptr %arrayidx7, align 8, !tbaa !5 %arrayidx8 = getelementptr inbounds [50005 x i64], ptr @now, i64 0, i64 %i.033 %6 = load i64, ptr %arrayidx8, align 8, !tbaa !5 %arrayidx9 = getelementptr inbounds [200005 x i64], ptr @last, i64 0, i64 %inc6 store i64 %6, ptr %arrayidx9, align 8, !tbaa !5 store i64 %inc6, ptr %arrayidx8, align 8, !tbaa !5 %.pre = load i64, ptr %n, align 8, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body, %if.then %7 = phi i64 [ %1, %for.body ], [ %.pre, %if.then ] %inc11 = add nuw nsw i64 %i.033, 1 %cmp.not.not = icmp slt i64 %i.033, %7 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.inc, %entry %8 = load i64, ptr %r2, align 8, !tbaa !5 call void @dfs(i64 noundef %8, i64 noundef 0) %9 = load i64, ptr %n, align 8, !tbaa !5 %cmp13.not34 = icmp slt i64 %9, 1 br i1 %cmp13.not34, label %for.end22, label %for.body14 for.body14: ; preds = %for.end, %for.inc20 %10 = phi i64 [ %13, %for.inc20 ], [ %9, %for.end ] %i.135 = phi i64 [ %inc21, %for.inc20 ], [ 1, %for.end ] %11 = load i64, ptr %r2, align 8, !tbaa !5 %cmp15.not = icmp eq i64 %i.135, %11 br i1 %cmp15.not, label %for.inc20, label %if.then16 if.then16: ; preds = %for.body14 %arrayidx17 = getelementptr inbounds [50005 x i64], ptr @fa, i64 0, i64 %i.135 %12 = load i64, ptr %arrayidx17, align 8, !tbaa !5 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %12) %.pre36 = load i64, ptr %n, align 8, !tbaa !5 br label %for.inc20 for.inc20: ; preds = %for.body14, %if.then16 %13 = phi i64 [ %10, %for.body14 ], [ %.pre36, %if.then16 ] %inc21 = add nuw nsw i64 %i.135, 1 %cmp13.not.not = icmp slt i64 %i.135, %13 br i1 %cmp13.not.not, label %for.body14, label %for.end22, !llvm.loop !12 for.end22: ; preds = %for.inc20, %for.end call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r2) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r1) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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}
#include <stdio.h> int main(void) { const int INPUTN=3; int a[INPUTN], i, j, tmp; for(i=0; i<INPUTN; i++) scanf("%d", &a[i]); for(i=0; i<INPUTN-1; i++) for(j=i; j<INPUTN; j++) { if(a[i]>a[j]) { tmp =a[i]; a[i] =a[j]; a[j] =tmp; } } printf("%d", a[0]); for(i=1; i<INPUTN; i++) printf(" %d", a[i]); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285073/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285073/source.c" target datalayout = "e-m:e-p270: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 { for.inc20: %vla54 = alloca [3 x i32], align 16 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vla54) %arrayidx.1 = getelementptr inbounds i32, ptr %vla54, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds i32, ptr %vla54, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %0 = load i32, ptr %vla54, align 16, !tbaa !5 %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11.165 = icmp sgt i32 %0, %1 br i1 %cmp11.165, label %if.then.167, label %for.inc20.168 if.then.167: ; preds = %for.inc20 store i32 %1, ptr %vla54, align 16, !tbaa !5 store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc20.168 for.inc20.168: ; preds = %if.then.167, %for.inc20 %2 = phi i32 [ %0, %if.then.167 ], [ %1, %for.inc20 ] %3 = phi i32 [ %1, %if.then.167 ], [ %0, %for.inc20 ] %4 = load i32, ptr %arrayidx.2, align 8, !tbaa !5 %cmp11.2 = icmp sgt i32 %3, %4 br i1 %cmp11.2, label %if.then.2, label %for.inc20.1 if.then.2: ; preds = %for.inc20.168 store i32 %4, ptr %vla54, align 16, !tbaa !5 store i32 %3, ptr %arrayidx.2, align 8, !tbaa !5 br label %for.inc20.1 for.inc20.1: ; preds = %for.inc20.168, %if.then.2 %5 = phi i32 [ %4, %if.then.2 ], [ %3, %for.inc20.168 ] %6 = phi i32 [ %3, %if.then.2 ], [ %4, %for.inc20.168 ] %cmp11.1.1 = icmp sgt i32 %2, %6 br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc20.1.1 if.then.1.1: ; preds = %for.inc20.1 store i32 %6, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %2, ptr %arrayidx.2, align 8, !tbaa !5 br label %for.inc20.1.1 for.inc20.1.1: ; preds = %if.then.1.1, %for.inc20.1 %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5) %7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7) %8 = load i32, ptr %arrayidx.2, align 8, !tbaa !5 %call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %putchar = call i32 @putchar(i32 10) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}