Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include<stdio.h> int main() { int t, i, j; long int x, y; scanf("%d", &t); while(t--) { scanf("%ld %ld", &x, &y); printf("%ld %ld\n", x, 2*x); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28264/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28264/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"%ld %ld\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"%ld %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %x = alloca i64, align 8 %y = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %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 %x, ptr noundef nonnull %y) %1 = load i64, ptr %x, align 8, !tbaa !9 %mul = shl nsw i64 %1, 1 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %1, i64 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 !11 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int FuncBubbleSortInt(int a[], int len); void FuncShowArray(int array[], int head, int num); int main(void) { int n, num[128]; int count; int i; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &num[i]); count = FuncBubbleSortInt(num, n); FuncShowArray(num, 0, n); printf("%d\n", count); return 0; } int FuncBubbleSortInt(int a[], int len) { int count = 0; int temp; int i, j; for (i = 0; i < len; i++) { for (j = (len - 1); j > i; j--) { if (a[j] < a[j - 1]) { temp = a[j]; a[j] = a[j-1]; a[j-1] = temp; count++; } } } return (count); } void FuncShowArray(int array[], int head, int num) { int i; for (i = head; i < num; i++){ if (i > head) putchar(' '); printf("%d", array[i]); } putchar('\n'); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282683/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282683/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %num = alloca [128 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %num) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp14 = icmp sgt i32 %0, 0 br i1 %cmp14, label %for.body, label %FuncShowArray.exit for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [128 x i32], ptr %num, 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 %cmp43.i = icmp sgt i32 %1, 0 br i1 %cmp43.i, label %for.cond1.preheader.lr.ph.i, label %FuncShowArray.exit 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 %num, 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.044.i = phi i32 [ 0, %for.cond1.preheader.lr.ph.i ], [ %count.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.140.i = phi i32 [ %count.2.i, %for.inc.i ], [ %count.044.i, %for.cond1.preheader.i ] %indvars.iv.next48.i = add nsw i64 %indvars.iv47.i, -1 %arrayidx.i = getelementptr inbounds i32, ptr %num, 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.140.i, 1 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body3.i %count.2.i = phi i32 [ %inc.i, %if.then.i ], [ %count.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.1.lcssa.i = phi i32 [ %count.044.i, %for.cond1.preheader.i ], [ %count.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 %if.end.peel.i, label %for.cond1.preheader.i, !llvm.loop !12 if.end.peel.i: ; preds = %for.inc18.i %.pre.i = load i32, ptr %num, 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 %FuncShowArray.exit, label %if.end.i if.end.i: ; preds = %if.end.peel.i, %if.end.i %indvars.iv.i7 = phi i64 [ %indvars.iv.next.i9, %if.end.i ], [ 1, %if.end.peel.i ] %8 = load ptr, ptr @stdout, align 8, !tbaa !13 %call.i.i = call i32 @putc(i32 noundef 32, ptr noundef %8) %arrayidx.i8 = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i7 %9 = load i32, ptr %arrayidx.i8, align 4, !tbaa !5 %call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %indvars.iv.next.i9 = add nuw nsw i64 %indvars.iv.i7, 1 %lftr.wideiv = trunc i64 %indvars.iv.next.i9 to i32 %exitcond = icmp eq i32 %1, %lftr.wideiv br i1 %exitcond, label %FuncShowArray.exit, label %if.end.i, !llvm.loop !15 FuncShowArray.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i %count.0.lcssa.i13 = phi i32 [ %count.1.lcssa.i, %if.end.peel.i ], [ 0, %for.end ], [ 0, %entry ], [ %count.1.lcssa.i, %if.end.i ] %10 = load ptr, ptr @stdout, align 8, !tbaa !13 %call.i8.i = call i32 @putc(i32 noundef 10, ptr noundef %10) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa.i13) call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %num) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @FuncBubbleSortInt(ptr nocapture noundef %a, i32 noundef %len) local_unnamed_addr #3 { entry: %cmp43 = icmp sgt i32 %len, 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 %len, -1 %0 = zext i32 %len to i64 %1 = add nsw i64 %0, -1 %2 = zext i32 %j.038 to i64 %wide.trip.count = zext i32 %len to i64 %invariant.gep = getelementptr i32, ptr %a, 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.044 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %count.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.140 = phi i32 [ %count.2, %for.inc ], [ %count.044, %for.cond1.preheader ] %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1 %arrayidx = getelementptr inbounds i32, ptr %a, 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.140, 1 br label %for.inc for.inc: ; preds = %for.body3, %if.then %count.2 = phi i32 [ %inc, %if.then ], [ %count.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.1.lcssa = phi i32 [ %count.044, %for.cond1.preheader ], [ %count.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.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa, %for.inc18 ] ret i32 %count.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @FuncShowArray(ptr nocapture noundef readonly %array, i32 noundef %head, i32 noundef %num) local_unnamed_addr #0 { entry: %cmp9 = icmp slt i32 %head, %num br i1 %cmp9, label %if.end.peel, label %for.end if.end.peel: ; preds = %entry %0 = sext i32 %head to i64 %arrayidx.peel.phi.trans.insert = getelementptr inbounds i32, ptr %array, i64 %0 %.pre = load i32, ptr %arrayidx.peel.phi.trans.insert, align 4, !tbaa !5 %call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %indvars.iv.next.peel = add nsw i64 %0, 1 %lftr.wideiv.peel = trunc i64 %indvars.iv.next.peel to i32 %exitcond.peel.not = icmp eq i32 %lftr.wideiv.peel, %num br i1 %exitcond.peel.not, label %for.end, label %for.body for.body: ; preds = %if.end.peel, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ %indvars.iv.next.peel, %if.end.peel ] %cmp1 = icmp sgt i64 %indvars.iv, %0 br i1 %cmp1, label %if.then, label %if.end if.then: ; preds = %for.body %1 = load ptr, ptr @stdout, align 8, !tbaa !13 %call.i = tail call i32 @putc(i32 noundef 32, ptr noundef %1) br label %if.end if.end: ; preds = %if.then, %for.body %arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2) %indvars.iv.next = add nsw i64 %indvars.iv, 1 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 %exitcond.not = icmp eq i32 %lftr.wideiv, %num br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !15 for.end: ; preds = %if.end, %if.end.peel, %entry %3 = load ptr, ptr @stdout, align 8, !tbaa !13 %call.i8 = tail call i32 @putc(i32 noundef 10, ptr noundef %3) 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 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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} !13 = !{!14, !14, i64 0} !14 = !{!"any pointer", !7, i64 0} !15 = distinct !{!15, !10, !16} !16 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> #define N 100 void trace(int A[], int n){ int i; for (i=0;i < n;i++){ if (i > 0) printf(" "); printf("%d", A[i]); } printf("\n"); } void swap(int *a,int *b){ int temp; temp = *a; *a = *b; *b = temp; } int main(){ int A[N]; int n=0; int i,j; int count=0; scanf("%d",&n); if(n > 100 || n < 0){ return 0; } 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]){ swap(&A[j],&A[j-1]); count++; } } } trace(A,n); printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282733/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282733/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str.1 = private unnamed_addr constant [3 x i8] c"%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 @trace(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.1, 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.1, 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 !9 for.end: ; preds = %if.end, %if.end.peel, %entry %putchar = tail call i32 @putchar(i32 10) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #3 { 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: 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) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 store i32 0, ptr %n, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4 %or.cond = icmp ugt i32 %0, 100 br i1 %or.cond, label %cleanup, label %for.cond.preheader for.cond.preheader: ; preds = %entry %cmp245.not = icmp eq i32 %0, 0 br i1 %cmp245.not, label %trace.exit, label %for.body for.cond4.preheader: ; preds = %for.body %cmp553 = icmp sgt i32 %.pr, 0 br i1 %cmp553, label %for.cond7.preheader.lr.ph, label %trace.exit for.cond7.preheader.lr.ph: ; preds = %for.cond4.preheader %j.047 = add nsw i32 %.pr, -1 %1 = zext i32 %.pr to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.047 to i64 %wide.trip.count = zext i32 %.pr to i64 br label %for.cond7.preheader for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %.pr = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %.pr to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp2, label %for.body, label %for.cond4.preheader, !llvm.loop !12 for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.inc26 %indvars.iv66 = phi i64 [ 0, %for.cond7.preheader.lr.ph ], [ %indvars.iv.next67, %for.inc26 ] %count.055 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %count.1.lcssa, %for.inc26 ] %cmp848 = icmp ult i64 %indvars.iv66, %3 br i1 %cmp848, label %for.body9, label %for.inc26 for.body9: ; preds = %for.cond7.preheader, %for.inc24 %indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc24 ], [ %1, %for.cond7.preheader ] %indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc24 ], [ %2, %for.cond7.preheader ] %count.150 = phi i32 [ %count.2, %for.inc24 ], [ %count.055, %for.cond7.preheader ] %indvars.iv.next61 = add nsw i64 %indvars.iv60, -1 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv58 %5 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %6 = add nsw i64 %indvars.iv60, -2 %arrayidx14 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %6 %7 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %cmp15 = icmp slt i32 %5, %7 br i1 %cmp15, label %if.then16, label %for.inc24 if.then16: ; preds = %for.body9 store i32 %7, ptr %arrayidx11, align 4, !tbaa !5 store i32 %5, ptr %arrayidx14, align 4, !tbaa !5 %inc22 = add nsw i32 %count.150, 1 br label %for.inc24 for.inc24: ; preds = %for.body9, %if.then16 %count.2 = phi i32 [ %inc22, %if.then16 ], [ %count.150, %for.body9 ] %indvars.iv.next59 = add nsw i64 %indvars.iv58, -1 %cmp8 = icmp sgt i64 %indvars.iv.next59, %indvars.iv66 br i1 %cmp8, label %for.body9, label %for.inc26, !llvm.loop !13 for.inc26: ; preds = %for.inc24, %for.cond7.preheader %count.1.lcssa = phi i32 [ %count.055, %for.cond7.preheader ], [ %count.2, %for.inc24 ] %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count br i1 %exitcond.not, label %for.end28, label %for.cond7.preheader, !llvm.loop !14 for.end28: ; preds = %for.inc26 br i1 %cmp553, label %if.end.peel.i, label %trace.exit if.end.peel.i: ; preds = %for.end28 %wide.trip.count.i = zext i32 %.pr 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.1, i32 noundef %.pre.i) %exitcond.peel.not.i = icmp eq i32 %.pr, 1 br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i if.end.i: ; preds = %if.end.peel.i, %if.end.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %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.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %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 %trace.exit, label %if.end.i, !llvm.loop !9 trace.exit: ; preds = %if.end.i, %for.cond.preheader, %for.cond4.preheader, %for.end28, %if.end.peel.i %count.0.lcssa76 = phi i32 [ %count.1.lcssa, %for.end28 ], [ %count.1.lcssa, %if.end.peel.i ], [ 0, %for.cond4.preheader ], [ 0, %for.cond.preheader ], [ %count.1.lcssa, %if.end.i ] %putchar.i = call i32 @putchar(i32 10) %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa76) br label %cleanup cleanup: ; preds = %entry, %trace.exit 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 #2 ; 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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include <stdio.h> #include <stdlib.h> int main() { int i, j, k; int count; int n; scanf("%d", &n); int A[10000]; 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]) { //swap k =A[j]; A[j] =A[j + 1]; A[j + 1] = k; count++; } } } //bubble for (i = 0; i <n; i++) { if (i == n- 1)printf("%d\n", A[i]); else printf("%d ", A[i]); } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282791/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282791/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %A = alloca [10000 x i32], align 16 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) call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #4 %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not69 = icmp ne i32 %0, 0 call void @llvm.assume(i1 %cmp.not69) br label %for.body for.cond2.preheader: ; preds = %for.body %cmp375 = icmp sgt i32 %1, 1 br i1 %cmp375, label %for.cond5.preheader.preheader, label %for.cond32.preheader for.cond5.preheader.preheader: ; preds = %for.cond2.preheader %sub = add i32 %1, -1 %wide.trip.count = zext i32 %sub 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 [10000 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 i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = zext i32 %1 to i64 %cmp.not = icmp eq i64 %indvars.iv.next, %2 br i1 %cmp.not, label %for.cond2.preheader, label %for.body, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc29 %indvars.iv86 = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %indvars.iv.next87, %for.inc29 ] %count.077 = phi i32 [ undef, %for.cond5.preheader.preheader ], [ %count.1.lcssa, %for.inc29 ] %3 = trunc i64 %indvars.iv86 to i32 %4 = sub i32 %sub, %3 %5 = zext i32 %4 to i64 %indvars88 = trunc i64 %indvars.iv86 to i32 %.neg = add i32 %indvars88, 1 %cmp8.not71 = icmp eq i32 %1, %.neg br i1 %cmp8.not71, label %for.inc29, label %for.body9.preheader for.body9.preheader: ; preds = %for.cond5.preheader %.pre = load i32, ptr %A, align 16, !tbaa !5 %xtraiter = and i64 %5, 1 %6 = icmp eq i32 %4, 1 br i1 %6, label %for.inc29.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %5, 4294967294 br label %for.body9 for.cond32.preheader: ; preds = %for.inc29, %for.cond2.preheader %count.0.lcssa = phi i32 [ undef, %for.cond2.preheader ], [ %count.1.lcssa, %for.inc29 ] %cmp3379 = icmp sgt i32 %1, 0 br i1 %cmp3379, label %for.body34, label %for.end47 for.body9: ; preds = %for.inc26.1, %for.body9.preheader.new %7 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %11, %for.inc26.1 ] %indvars.iv83 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next84.1, %for.inc26.1 ] %count.173 = phi i32 [ %count.077, %for.body9.preheader.new ], [ %count.2.1, %for.inc26.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc26.1 ] %indvars.iv.next84 = or i64 %indvars.iv83, 1 %arrayidx13 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv.next84 %8 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp sgt i32 %7, %8 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body9 %arrayidx11 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv83 store i32 %8, ptr %arrayidx11, align 8, !tbaa !5 store i32 %7, ptr %arrayidx13, align 4, !tbaa !5 %inc25 = add nsw i32 %count.173, 1 br label %for.inc26 for.inc26: ; preds = %for.body9, %if.then %9 = phi i32 [ %7, %if.then ], [ %8, %for.body9 ] %count.2 = phi i32 [ %inc25, %if.then ], [ %count.173, %for.body9 ] %indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 2 %arrayidx13.1 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv.next84.1 %10 = load i32, ptr %arrayidx13.1, align 8, !tbaa !5 %cmp14.1 = icmp sgt i32 %9, %10 br i1 %cmp14.1, label %if.then.1, label %for.inc26.1 if.then.1: ; preds = %for.inc26 %arrayidx11.1 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv.next84 store i32 %10, ptr %arrayidx11.1, align 4, !tbaa !5 store i32 %9, ptr %arrayidx13.1, align 8, !tbaa !5 %inc25.1 = add nsw i32 %count.2, 1 br label %for.inc26.1 for.inc26.1: ; preds = %if.then.1, %for.inc26 %11 = phi i32 [ %9, %if.then.1 ], [ %10, %for.inc26 ] %count.2.1 = phi i32 [ %inc25.1, %if.then.1 ], [ %count.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 %count.2.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %count.2.1, %for.inc26.1 ] %.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %11, %for.inc26.1 ] %indvars.iv83.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next84.1, %for.inc26.1 ] %count.173.unr = phi i32 [ %count.077, %for.body9.preheader ], [ %count.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.next84.epil = add nuw nsw i64 %indvars.iv83.unr, 1 %arrayidx13.epil = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv.next84.epil %12 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5 %cmp14.epil = icmp sgt i32 %.unr, %12 br i1 %cmp14.epil, label %if.then.epil, label %for.inc29 if.then.epil: ; preds = %for.body9.epil %arrayidx11.epil = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv83.unr store i32 %12, ptr %arrayidx11.epil, align 4, !tbaa !5 store i32 %.unr, ptr %arrayidx13.epil, align 4, !tbaa !5 %inc25.epil = add nsw i32 %count.173.unr, 1 br label %for.inc29 for.inc29: ; preds = %for.inc29.loopexit.unr-lcssa, %if.then.epil, %for.body9.epil, %for.cond5.preheader %count.1.lcssa = phi i32 [ %count.077, %for.cond5.preheader ], [ %count.2.lcssa.ph, %for.inc29.loopexit.unr-lcssa ], [ %inc25.epil, %if.then.epil ], [ %count.173.unr, %for.body9.epil ] %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %exitcond.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count br i1 %exitcond.not, label %for.cond32.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body34: ; preds = %for.cond32.preheader, %for.body34 %indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.body34 ], [ 0, %for.cond32.preheader ] %13 = phi i32 [ %16, %for.body34 ], [ %1, %for.cond32.preheader ] %sub35 = add nsw i32 %13, -1 %14 = zext i32 %sub35 to i64 %cmp36 = icmp eq i64 %indvars.iv89, %14 %arrayidx39 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv89 %15 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %.str.1..str.2 = select i1 %cmp36, ptr @.str.1, ptr @.str.2 %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %15) %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1 %16 = load i32, ptr %n, align 4, !tbaa !5 %17 = sext i32 %16 to i64 %cmp33 = icmp slt i64 %indvars.iv.next90, %17 br i1 %cmp33, label %for.body34, label %for.end47, !llvm.loop !13 for.end47: ; preds = %for.body34, %for.cond32.preheader %call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int i,j,n,a[101],t,p=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]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; p++; } } } for(i=0;i<n;i++){ printf("%d",a[i]); if(i==n-1){printf("\n");} else{printf(" ");} } printf("%d\n",p); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282834/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282834/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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 %cmp67 = icmp sgt i32 %0, 0 br i1 %cmp67, label %for.body, label %for.end46 for.cond2.preheader: ; preds = %for.body %sub = add i32 %1, -1 %cmp373 = icmp sgt i32 %1, 1 br i1 %cmp373, label %for.cond5.preheader, label %for.cond32.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 %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.iv84 = phi i32 [ %indvars.iv.next85, %for.inc29 ], [ %sub, %for.cond2.preheader ] %p.075 = phi i32 [ %p.1.lcssa, %for.inc29 ], [ 0, %for.cond2.preheader ] %i.174 = phi i32 [ %inc30, %for.inc29 ], [ 0, %for.cond2.preheader ] %3 = zext i32 %indvars.iv84 to i64 %4 = xor i32 %i.174, -1 %sub7 = add i32 %1, %4 %cmp869 = icmp sgt i32 %sub7, 0 br i1 %cmp869, 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.iv84, 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, %for.cond2.preheader %p.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %p.1.lcssa, %for.inc29 ] %cmp3377 = icmp sgt i32 %1, 0 br i1 %cmp3377, label %for.body34, label %for.end46 for.body9: ; preds = %for.inc26.1, %for.body9.preheader.new %6 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %10, %for.inc26.1 ] %indvars.iv81 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next82.1, %for.inc26.1 ] %p.171 = phi i32 [ %p.075, %for.body9.preheader.new ], [ %p.2.1, %for.inc26.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc26.1 ] %indvars.iv.next82 = or i64 %indvars.iv81, 1 %arrayidx13 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next82 %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 [101 x i32], ptr %a, i64 0, i64 %indvars.iv81 store i32 %7, ptr %arrayidx11, align 8, !tbaa !5 store i32 %6, ptr %arrayidx13, align 4, !tbaa !5 %inc25 = add nsw i32 %p.171, 1 br label %for.inc26 for.inc26: ; preds = %for.body9, %if.then %8 = phi i32 [ %6, %if.then ], [ %7, %for.body9 ] %p.2 = phi i32 [ %inc25, %if.then ], [ %p.171, %for.body9 ] %indvars.iv.next82.1 = add nuw nsw i64 %indvars.iv81, 2 %arrayidx13.1 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next82.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 [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next82 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 %p.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 ] %p.2.1 = phi i32 [ %inc25.1, %if.then.1 ], [ %p.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 %p.2.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %p.2.1, %for.inc26.1 ] %.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %10, %for.inc26.1 ] %indvars.iv81.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next82.1, %for.inc26.1 ] %p.171.unr = phi i32 [ %p.075, %for.body9.preheader ], [ %p.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.next82.epil = add nuw nsw i64 %indvars.iv81.unr, 1 %arrayidx13.epil = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next82.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 [101 x i32], ptr %a, i64 0, i64 %indvars.iv81.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 %p.171.unr, 1 br label %for.inc29 for.inc29: ; preds = %for.inc29.loopexit.unr-lcssa, %if.then.epil, %for.body9.epil, %for.cond5.preheader %p.1.lcssa = phi i32 [ %p.075, %for.cond5.preheader ], [ %p.2.lcssa.ph, %for.inc29.loopexit.unr-lcssa ], [ %inc25.epil, %if.then.epil ], [ %p.171.unr, %for.body9.epil ] %inc30 = add nuw nsw i32 %i.174, 1 %indvars.iv.next85 = add i32 %indvars.iv84, -1 %exitcond86.not = icmp eq i32 %inc30, %sub br i1 %exitcond86.not, label %for.cond32.preheader, label %for.cond5.preheader, !llvm.loop !12 for.body34: ; preds = %for.cond32.preheader, %for.body34 %indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body34 ], [ 0, %for.cond32.preheader ] %arrayidx36 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv87 %12 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12) %13 = load i32, ptr %n, align 4, !tbaa !5 %sub38 = add nsw i32 %13, -1 %14 = zext i32 %sub38 to i64 %cmp39 = icmp eq i64 %indvars.iv87, %14 %. = select i1 %cmp39, i32 10, i32 32 %putchar66 = call i32 @putchar(i32 %.) %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1 %15 = load i32, ptr %n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp33 = icmp slt i64 %indvars.iv.next88, %16 br i1 %cmp33, label %for.body34, label %for.end46, !llvm.loop !13 for.end46: ; preds = %for.body34, %entry, %for.cond32.preheader %p.0.lcssa94 = phi i32 [ %p.0.lcssa, %for.cond32.preheader ], [ 0, %entry ], [ %p.0.lcssa, %for.body34 ] %call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %p.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}
#include<stdio.h> #define MAX 100 int swap(int *x,int *y) { int z=*x; if(*x==*y)return 0;//同じだったら0 *x=*y; *y=z; return 1;//違ったら1 } //Aに代入された数をnまで並べ替えて、入れ直す //   /交換回数 int bubbleSort(int *A, int n) { int flag=1; int i,j; int count=0;//交換回数 for (i=0;flag;i++){ flag = 0;//一回も交換しない、 つまり既に並んんでいたら0 for (j = n-1;j>=1;j--){ if (A[j] < A[j-1]) { swap(&A[j],&A[j-1]); count++; flag=1; } } } return count; } int main(){ int i; int A[MAX]; // need int n; int count; scanf("%d",&n);//Input for(i=0;i<n;i++){ scanf("%d",&A[i]); } count=bubbleSort(A,n); for(i=0;i<n;i++){//OUTPUT if(i)printf(" "); printf("%d",A[i]); } printf("\n%d\n",count); return 0; } /*5 1 2 3 4 5を昇順に並べ替える 出力はそれと、交換回数*/
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282878/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282878/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 { entry: %0 = load i32, ptr %x, align 4, !tbaa !5 %1 = load i32, ptr %y, align 4, !tbaa !5 %cmp = icmp eq i32 %0, %1 br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry store i32 %1, ptr %x, align 4, !tbaa !5 store i32 %0, ptr %y, align 4, !tbaa !5 br label %cleanup cleanup: ; preds = %entry, %if.end %retval.0 = phi i32 [ 1, %if.end ], [ 0, %entry ] 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 { entry: %cmp25 = icmp sgt i32 %n, 1 br i1 %cmp25, label %for.cond1.preheader.us.preheader, label %for.end14 for.cond1.preheader.us.preheader: ; preds = %entry %0 = zext i32 %n to i64 br label %for.body2.us for.body2.us: ; preds = %for.body2.us.backedge, %for.cond1.preheader.us.preheader %indvars.iv = phi i64 [ %0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.be, %for.body2.us.backedge ] %count.128.us = phi i32 [ 0, %for.cond1.preheader.us.preheader ], [ %count.2.us, %for.body2.us.backedge ] %flag.126.us = phi i32 [ 0, %for.cond1.preheader.us.preheader ], [ %flag.126.us.be, %for.body2.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 %sub3.us = add i64 %indvars.iv, 4294967294 %idxprom4.us = and i64 %sub3.us, 4294967295 %arrayidx5.us = getelementptr inbounds i32, ptr %A, i64 %idxprom4.us %2 = load i32, ptr %arrayidx5.us, align 4, !tbaa !5 %cmp6.us = icmp slt i32 %1, %2 br i1 %cmp6.us, label %swap.exit.us, label %for.inc.us swap.exit.us: ; preds = %for.body2.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx5.us, align 4, !tbaa !5 %inc.us = add nsw i32 %count.128.us, 1 br label %for.inc.us for.inc.us: ; preds = %swap.exit.us, %for.body2.us %flag.2.us = phi i32 [ 1, %swap.exit.us ], [ %flag.126.us, %for.body2.us ] %count.2.us = phi i32 [ %inc.us, %swap.exit.us ], [ %count.128.us, %for.body2.us ] %cmp.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp.us, label %for.body2.us.backedge, label %for.cond1.for.cond.loopexit_crit_edge.us for.body2.us.backedge: ; preds = %for.inc.us, %for.cond1.for.cond.loopexit_crit_edge.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond1.for.cond.loopexit_crit_edge.us ] %flag.126.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond1.for.cond.loopexit_crit_edge.us ] br label %for.body2.us, !llvm.loop !9 for.cond1.for.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.end14, label %for.body2.us.backedge for.end14: ; preds = %for.cond1.for.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %count.2.us, %for.cond1.for.cond.loopexit_crit_edge.us ] ret i32 %.us-phi } ; 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) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %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 !11 for.end: ; preds = %for.body %cmp25.i = icmp sgt i32 %1, 1 br i1 %cmp25.i, label %for.cond1.preheader.us.preheader.i, label %bubbleSort.exit for.cond1.preheader.us.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 br label %for.body2.us.i for.body2.us.i: ; preds = %for.body2.us.i.backedge, %for.cond1.preheader.us.preheader.i %indvars.iv.i = phi i64 [ %3, %for.cond1.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body2.us.i.backedge ] %count.128.us.i = phi i32 [ 0, %for.cond1.preheader.us.preheader.i ], [ %count.2.us.i, %for.body2.us.i.backedge ] %flag.126.us.i = phi i32 [ 0, %for.cond1.preheader.us.preheader.i ], [ %flag.126.us.i.be, %for.body2.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 %sub3.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom4.us.i = and i64 %sub3.us.i, 4294967295 %arrayidx5.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom4.us.i %5 = load i32, ptr %arrayidx5.us.i, align 4, !tbaa !5 %cmp6.us.i = icmp slt i32 %4, %5 br i1 %cmp6.us.i, label %swap.exit.us.i, label %for.inc.us.i swap.exit.us.i: ; preds = %for.body2.us.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %4, ptr %arrayidx5.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %count.128.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %swap.exit.us.i, %for.body2.us.i %flag.2.us.i = phi i32 [ 1, %swap.exit.us.i ], [ %flag.126.us.i, %for.body2.us.i ] %count.2.us.i = phi i32 [ %inc.us.i, %swap.exit.us.i ], [ %count.128.us.i, %for.body2.us.i ] %cmp.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp.us.i, label %for.body2.us.i.backedge, label %for.cond1.for.cond.loopexit_crit_edge.us.i for.body2.us.i.backedge: ; preds = %for.inc.us.i, %for.cond1.for.cond.loopexit_crit_edge.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond1.for.cond.loopexit_crit_edge.us.i ] %flag.126.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond1.for.cond.loopexit_crit_edge.us.i ] br label %for.body2.us.i, !llvm.loop !9 for.cond1.for.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.body2.us.i.backedge bubbleSort.exit: ; preds = %for.cond1.for.cond.loopexit_crit_edge.us.i, %for.end %.us-phi.i = phi i32 [ 0, %for.end ], [ %count.2.us.i, %for.cond1.for.cond.loopexit_crit_edge.us.i ] %cmp422 = icmp sgt i32 %1, 0 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) %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %6, 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 %7 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7) %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1 %8 = load i32, ptr %n, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp4 = icmp slt i64 %indvars.iv.next27, %9 br i1 %cmp4, label %if.end, label %for.end12, !llvm.loop !12 for.end12: ; preds = %if.end, %entry, %if.end.peel, %bubbleSort.exit %.us-phi.i33 = phi i32 [ %.us-phi.i, %bubbleSort.exit ], [ %.us-phi.i, %if.end.peel ], [ 0, %entry ], [ %.us-phi.i, %if.end ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i33) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #6 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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> #define N 100 int main() { int a,i,j,tmp; int cnt = 0; int A[N]; scanf("%d",&a); for(i = 0 ; i < a ; i++){ scanf("%d",&A[i]); } for(i = 0 ; i < a - 1 ; i++){ for(j = a - 1 ; j >=i+1 ; j--){ if(A[j] < A[j-1]){ tmp = A[j]; A[j] = A[j - 1]; A[j - 1] = tmp; cnt++; } } } for(i = 0 ; i < a ; i++){ printf("%d",A[i]); if(i < a - 1)printf(" "); } printf("\n%d\n",cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282920/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282920/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32, align 4 %A = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #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 %a) %0 = load i32, ptr %a, 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 %cmp368 = icmp sgt i32 %3, 1 br i1 %cmp368, 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 %a, 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.iv79 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next80, %for.inc28 ] %cnt.070 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %cnt.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 %cnt.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %cnt.2, %for.inc28 ] %cmp3272 = icmp sgt i32 %3, 0 br i1 %cmp3272, label %for.body33, label %for.end44 for.body8: ; preds = %for.cond6.preheader, %for.inc26 %5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc26 ] %indvars.iv76 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next77, %for.inc26 ] %cnt.167 = phi i32 [ %cnt.070, %for.cond6.preheader ], [ %cnt.2, %for.inc26 ] %indvars.iv.next77 = add nsw i64 %indvars.iv76, -1 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next77 %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.iv76 store i32 %6, ptr %arrayidx10, align 4, !tbaa !5 store i32 %5, ptr %arrayidx13, align 4, !tbaa !5 %inc25 = add nsw i32 %cnt.167, 1 br label %for.inc26 for.inc26: ; preds = %for.body8, %if.then %7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ] %cnt.2 = phi i32 [ %inc25, %if.then ], [ %cnt.167, %for.body8 ] %cmp7.not.not = icmp sgt i64 %indvars.iv.next77, %indvars.iv79 br i1 %cmp7.not.not, label %for.body8, label %for.inc28, !llvm.loop !11 for.inc28: ; preds = %for.inc26 %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1 %exitcond.not = icmp eq i64 %indvars.iv.next80, %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.inc42 %indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.inc42 ], [ 0, %for.cond31.preheader ] %arrayidx35 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv82 %8 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) %9 = load i32, ptr %a, align 4, !tbaa !5 %sub37 = add nsw i32 %9, -1 %10 = sext i32 %sub37 to i64 %cmp38 = icmp slt i64 %indvars.iv82, %10 br i1 %cmp38, label %if.then39, label %for.inc42 if.then39: ; preds = %for.body33 %putchar = call i32 @putchar(i32 32) %.pre85 = load i32, ptr %a, align 4, !tbaa !5 br label %for.inc42 for.inc42: ; preds = %for.body33, %if.then39 %11 = phi i32 [ %9, %for.body33 ], [ %.pre85, %if.then39 ] %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1 %12 = sext i32 %11 to i64 %cmp32 = icmp slt i64 %indvars.iv.next83, %12 br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !13 for.end44: ; preds = %for.inc42, %entry, %for.cond31.preheader %cnt.0.lcssa89 = phi i32 [ %cnt.0.lcssa, %for.cond31.preheader ], [ 0, %entry ], [ %cnt.0.lcssa, %for.inc42 ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa89) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 Ntw,Btw,Ctw=0,i,j; scanf("%d",&Ntw); int Atw[Ntw]; for(i=0;i<Ntw;i++){ scanf("%d",&Atw[i]); } i=0; while(i<Ntw){ for(j=Ntw-1;j>i;j--){ if(Atw[j]<Atw[j-1]){ Btw=Atw[j]; Atw[j]=Atw[j-1]; Atw[j-1]=Btw; Ctw++; } } i++; } for(i=0;i<Ntw;i++){ if(i>0)printf(" "); printf("%d",Atw[i]); } printf("\n%d\n",Ctw); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282964/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282964/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %Ntw = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Ntw) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Ntw) %0 = load i32, ptr %Ntw, 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 %Ntw, align 4, !tbaa !5 %cmp59 = icmp sgt i32 %3, 0 br i1 %cmp59, label %for.body, label %for.end38 while.cond.preheader: ; preds = %for.body %cmp267 = icmp sgt i32 %7, 0 br i1 %cmp267, label %for.cond3.preheader.lr.ph, label %for.end38 for.cond3.preheader.lr.ph: ; preds = %while.cond.preheader %j.061 = add nsw i32 %7, -1 %4 = zext i32 %7 to i64 %5 = add nsw i64 %4, -1 %6 = zext i32 %j.061 to i64 %wide.trip.count = zext i32 %7 to i64 %invariant.gep = getelementptr i32, ptr %vla, i64 -2 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 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 %Ntw, 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 !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 ] %Ctw.069 = phi i32 [ 0, %for.cond3.preheader.lr.ph ], [ %Ctw.1.lcssa, %for.end24 ] %cmp462 = icmp ult i64 %indvars.iv83, %6 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 %vla, align 16, !tbaa !5 %call35.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %9 = load i32, ptr %Ntw, align 4, !tbaa !5 %cmp27.peel = icmp sgt i32 %9, 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 ], [ %4, %for.cond3.preheader ] %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc23 ], [ %5, %for.cond3.preheader ] %Ctw.164 = phi i32 [ %Ctw.2, %for.inc23 ], [ %Ctw.069, %for.cond3.preheader ] %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1 %arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv75 %10 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv77 %11 = load i32, ptr %gep, align 4, !tbaa !5 %cmp11 = icmp slt i32 %10, %11 br i1 %cmp11, label %if.then, label %for.inc23 if.then: ; preds = %for.body5 store i32 %11, ptr %arrayidx7, align 4, !tbaa !5 store i32 %10, ptr %gep, align 4, !tbaa !5 %inc22 = add nsw i32 %Ctw.164, 1 br label %for.inc23 for.inc23: ; preds = %for.body5, %if.then %Ctw.2 = phi i32 [ %inc22, %if.then ], [ %Ctw.164, %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 %Ctw.1.lcssa = phi i32 [ %Ctw.069, %for.cond3.preheader ], [ %Ctw.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 i32, ptr %vla, i64 %indvars.iv86 %12 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %13 = load i32, ptr %Ntw, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp27 = icmp slt i64 %indvars.iv.next87, %14 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 %Ctw.0.lcssa94 = phi i32 [ %Ctw.1.lcssa, %for.cond26.preheader ], [ %Ctw.1.lcssa, %if.end32.peel ], [ 0, %while.cond.preheader ], [ 0, %entry ], [ %Ctw.1.lcssa, %if.end32 ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %Ctw.0.lcssa94) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Ntw) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> #define N 100 void swap(int *,int *); int main(){ int flag,i,j,n,count=0; int A[N]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&A[i]); } flag = 1; i=0; while(flag){ flag = 0; for (j=n-1;j>=i+1;j--){ if( A[j] < A[j-1]){ swap(&A[j], &A[j-1]); count++; flag = 1; } } i++; } 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 *a,int *b){ int temp; temp = *a; *a=*b; *b=temp; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283006/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283006/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %entry.while.cond.preheader_crit_edge entry.while.cond.preheader_crit_edge: ; preds = %entry %.pre78 = sext i32 %0 to i64 br label %while.cond.preheader while.cond.preheader.loopexit: ; preds = %for.body %1 = icmp sgt i32 %2, 0 br label %while.cond.preheader while.cond.preheader: ; preds = %entry.while.cond.preheader_crit_edge, %while.cond.preheader.loopexit %.pre-phi = phi i64 [ %.pre78, %entry.while.cond.preheader_crit_edge ], [ %3, %while.cond.preheader.loopexit ] %cmp2164 = phi i1 [ false, %entry.while.cond.preheader_crit_edge ], [ %1, %while.cond.preheader.loopexit ] 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 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %while.cond.preheader.loopexit, !llvm.loop !9 while.cond.loopexit: ; preds = %for.inc17 %tobool.not = icmp eq i32 %flag.2, 0 br i1 %tobool.not, label %for.cond20.preheader, label %for.cond2.preheader, !llvm.loop !11 for.cond2.preheader: ; preds = %while.cond.preheader, %while.cond.loopexit %indvars.iv72 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next73, %while.cond.loopexit ] %count.063 = phi i32 [ 0, %while.cond.preheader ], [ %count.2, %while.cond.loopexit ] %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %cmp3.not.not54 = icmp sgt i64 %.pre-phi, %indvars.iv.next73 br i1 %cmp3.not.not54, label %for.body4, label %for.cond20.preheader for.cond20.preheader: ; preds = %for.cond2.preheader, %while.cond.loopexit %count.1.lcssa82 = phi i32 [ %count.2, %while.cond.loopexit ], [ %count.063, %for.cond2.preheader ] br i1 %cmp2164, label %for.body22, label %for.end33 for.body4: ; preds = %for.cond2.preheader, %for.inc17 %indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.inc17 ], [ %.pre-phi, %for.cond2.preheader ] %count.157 = phi i32 [ %count.2, %for.inc17 ], [ %count.063, %for.cond2.preheader ] %flag.155 = phi i32 [ %flag.2, %for.inc17 ], [ 0, %for.cond2.preheader ] %indvars.iv.next69 = add nsw i64 %indvars.iv68, -1 %arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next69 %4 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %5 = add nsw i64 %indvars.iv68, -2 %arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %5 %6 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp slt i32 %4, %6 br i1 %cmp10, label %if.then, label %for.inc17 if.then: ; preds = %for.body4 store i32 %6, ptr %arrayidx6, align 4, !tbaa !5 store i32 %4, ptr %arrayidx9, align 4, !tbaa !5 %inc16 = add nsw i32 %count.157, 1 br label %for.inc17 for.inc17: ; preds = %for.body4, %if.then %flag.2 = phi i32 [ 1, %if.then ], [ %flag.155, %for.body4 ] %count.2 = phi i32 [ %inc16, %if.then ], [ %count.157, %for.body4 ] %cmp3.not.not = icmp sgt i64 %indvars.iv.next69, %indvars.iv.next73 br i1 %cmp3.not.not, label %for.body4, label %while.cond.loopexit, !llvm.loop !12 for.body22: ; preds = %for.cond20.preheader, %for.inc31 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc31 ], [ 0, %for.cond20.preheader ] %arrayidx24 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv75 %7 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7) %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.iv75, %9 br i1 %cmp27, label %if.then28, label %for.inc31 if.then28: ; preds = %for.body22 %putchar50 = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc31 for.inc31: ; preds = %for.body22, %if.then28 %10 = phi i32 [ %8, %for.body22 ], [ %.pre, %if.then28 ] %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %11 = sext i32 %10 to i64 %cmp21 = icmp slt i64 %indvars.iv.next76, %11 br i1 %cmp21, label %for.body22, label %for.end33, !llvm.loop !13 for.end33: ; preds = %for.inc31, %for.cond20.preheader %putchar = call i32 @putchar(i32 10) %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.1.lcssa82) 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 %a, ptr nocapture noundef %b) local_unnamed_addr #3 { 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: 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} !13 = distinct !{!13, !10}
#include<stdio.h> #include<limits.h> int p[100005]; int pos[100005]; int count[100005]; int r[100005]; int main(){ int t; scanf("%d", &t); int n; while(t--){ scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%d", &p[i]); pos[p[i]] = i; } /*for(int i = 1; i <= n; i++){ printf("%d ", p[i]); } printf("\n"); fflush(stdout);*/ for(int i = 1; i <= n; i++){ count[i] = 1; r[i] = i; } r[n + 1] = -1; count[n + 1] = 0; int max = 1; int second_max = 1; int flag = 1; for(int i = 1; i <= n; i++){ int v = pos[i]; if(max == count[v]){ int u; for(int j = v + 1; j <= n + 1; j++){ if(count[j] > 0 || r[j] == -1){ u = r[j]; break; } } if(u == -1){ r[v] = -1; if(count[v] == max){ int m = INT_MIN; count[v] = 0; for(int p = 1; p <= n; p++){ if(count[p] > m){ m = count[p]; } } max = m; //printf("HERE = %d\n", max); } else{ count[v] = 0; } //continue; } else{ count[u] = count[r[v]] + 1; count[r[v]] = 0; r[v] = u; if(count[u] > max){ max = count[u]; } } } else{ flag = 0; break; } } if(flag == 1){ printf("Yes\n"); } else{ printf("No\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28305/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28305/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @p = dso_local global [100005 x i32] zeroinitializer, align 16 @pos = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16 @count = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16 @r = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16 @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: %t = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %0 = load i32, ptr %t, align 4, !tbaa !5 %dec177 = add nsw i32 %0, -1 store i32 %dec177, ptr %t, align 4, !tbaa !5 %tobool.not178 = icmp eq i32 %0, 0 br i1 %tobool.not178, label %while.end, label %while.body while.body: ; preds = %entry, %if.end114 %u.0179 = phi i32 [ %u.4159, %if.end114 ], [ undef, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not164 = icmp slt i32 %1, 1 br i1 %cmp.not164, label %for.cond.cleanup10.thread, label %for.body for.cond8.preheader: ; preds = %for.body %cmp9.not166 = icmp slt i32 %11, 1 br i1 %cmp9.not166, label %for.cond.cleanup10.thread, label %for.body11.preheader for.cond.cleanup10.thread: ; preds = %for.cond8.preheader, %while.body %.lcssa203 = phi i32 [ %11, %for.cond8.preheader ], [ %1, %while.body ] %.pre199 = add nsw i32 %.lcssa203, 1 %idxprom19209 = sext i32 %.pre199 to i64 %arrayidx20210 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %idxprom19209 store i32 -1, ptr %arrayidx20210, align 4, !tbaa !5 %arrayidx23211 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %idxprom19209 store i32 0, ptr %arrayidx23211, align 4, !tbaa !5 br label %if.end114 for.body11.preheader: ; preds = %for.cond8.preheader %2 = add nuw i32 %11, 1 %wide.trip.count = zext i32 %2 to i64 %3 = add nsw i64 %wide.trip.count, -1 %min.iters.check225 = icmp ult i32 %11, 8 br i1 %min.iters.check225, label %for.body11.preheader237, label %vector.ph226 vector.ph226: ; preds = %for.body11.preheader %n.vec228 = and i64 %3, -8 %ind.end229 = or i64 %n.vec228, 1 br label %vector.body232 vector.body232: ; preds = %vector.body232, %vector.ph226 %index233 = phi i64 [ 0, %vector.ph226 ], [ %index.next236, %vector.body232 ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph226 ], [ %vec.ind.next, %vector.body232 ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %offset.idx235 = or i64 %index233, 1 %4 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %offset.idx235 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 4, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %offset.idx235 store <4 x i32> %vec.ind, ptr %6, align 4, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 4 store <4 x i32> %step.add, ptr %7, align 4, !tbaa !5 %index.next236 = add nuw i64 %index233, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %8 = icmp eq i64 %index.next236, %n.vec228 br i1 %8, label %middle.block223, label %vector.body232, !llvm.loop !9 middle.block223: ; preds = %vector.body232 %cmp.n231 = icmp eq i64 %3, %n.vec228 br i1 %cmp.n231, label %for.cond.cleanup10, label %for.body11.preheader237 for.body11.preheader237: ; preds = %for.body11.preheader, %middle.block223 %indvars.iv183.ph = phi i64 [ 1, %for.body11.preheader ], [ %ind.end229, %middle.block223 ] br label %for.body11 for.body: ; preds = %while.body, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %while.body ] %arrayidx = getelementptr inbounds [100005 x i32], ptr @p, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %9 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom5 = sext i32 %9 to i64 %arrayidx6 = getelementptr inbounds [100005 x i32], ptr @pos, i64 0, i64 %idxprom5 %10 = trunc i64 %indvars.iv to i32 store i32 %10, ptr %arrayidx6, align 4, !tbaa !5 %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 !13 for.cond.cleanup10: ; preds = %for.body11, %middle.block223 %idxprom19 = sext i32 %2 to i64 %arrayidx20 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %idxprom19 store i32 -1, ptr %arrayidx20, align 4, !tbaa !5 %arrayidx23 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %idxprom19 store i32 0, ptr %arrayidx23, align 4, !tbaa !5 br i1 %cmp9.not166, label %if.end114, label %for.body28.preheader for.body28.preheader: ; preds = %for.cond.cleanup10 %13 = zext i32 %11 to i64 %wide.trip.count197 = zext i32 %2 to i64 %14 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %11, 8 %n.vec = and i64 %14, -8 %ind.end = or i64 %n.vec, 1 %cmp.n = icmp eq i64 %14, %n.vec br label %for.body28 for.body11: ; preds = %for.body11.preheader237, %for.body11 %indvars.iv183 = phi i64 [ %indvars.iv.next184, %for.body11 ], [ %indvars.iv183.ph, %for.body11.preheader237 ] %arrayidx13 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %indvars.iv183 store i32 1, ptr %arrayidx13, align 4, !tbaa !5 %arrayidx15 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %indvars.iv183 %15 = trunc i64 %indvars.iv183 to i32 store i32 %15, ptr %arrayidx15, align 4, !tbaa !5 %indvars.iv.next184 = add nuw nsw i64 %indvars.iv183, 1 %exitcond.not = icmp eq i64 %indvars.iv.next184, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !14 for.body28: ; preds = %for.body28.preheader, %cleanup104 %indvars.iv194 = phi i64 [ 1, %for.body28.preheader ], [ %indvars.iv.next195, %cleanup104 ] %u.1175 = phi i32 [ %u.0179, %for.body28.preheader ], [ %u.2214, %cleanup104 ] %max.0173 = phi i32 [ 1, %for.body28.preheader ], [ %max.2, %cleanup104 ] %arrayidx30 = getelementptr inbounds [100005 x i32], ptr @pos, i64 0, i64 %indvars.iv194 %16 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %idxprom31 = sext i32 %16 to i64 %arrayidx32 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %idxprom31 %17 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %cmp33 = icmp eq i32 %max.0173, %17 br i1 %cmp33, label %for.cond35, label %if.end114 for.cond35: ; preds = %for.body28, %lor.lhs.false %indvars.iv186 = phi i64 [ %indvars.iv.next187, %lor.lhs.false ], [ %idxprom31, %for.body28 ] %indvars.iv.next187 = add i64 %indvars.iv186, 1 %cmp37.not = icmp sgt i64 %indvars.iv186, %13 br i1 %cmp37.not, label %cleanup, label %for.body39 for.body39: ; preds = %for.cond35 %arrayidx41 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %indvars.iv.next187 %18 = load i32, ptr %arrayidx41, align 4, !tbaa !5 %cmp42 = icmp sgt i32 %18, 0 %arrayidx48.phi.trans.insert = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %indvars.iv.next187 %.pre = load i32, ptr %arrayidx48.phi.trans.insert, align 4, !tbaa !5 br i1 %cmp42, label %cleanup, label %lor.lhs.false lor.lhs.false: ; preds = %for.body39 %cmp45 = icmp eq i32 %.pre, -1 br i1 %cmp45, label %if.then53, label %for.cond35, !llvm.loop !15 cleanup: ; preds = %for.cond35, %for.body39 %u.2 = phi i32 [ %.pre, %for.body39 ], [ %u.1175, %for.cond35 ] %cmp52 = icmp eq i32 %u.2, -1 br i1 %cmp52, label %if.then53, label %if.else80 if.then53: ; preds = %lor.lhs.false, %cleanup %arrayidx55 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %idxprom31 store i32 -1, ptr %arrayidx55, align 4, !tbaa !5 store i32 0, ptr %arrayidx32, align 4, !tbaa !5 br i1 %min.iters.check, label %for.body65.preheader, label %vector.body vector.body: ; preds = %if.then53, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %if.then53 ] %vec.phi = phi <4 x i32> [ %21, %vector.body ], [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %if.then53 ] %vec.phi221 = phi <4 x i32> [ %22, %vector.body ], [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %if.then53 ] %offset.idx = or i64 %index, 1 %19 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %19, align 4, !tbaa !5 %20 = getelementptr inbounds i32, ptr %19, i64 4 %wide.load222 = load <4 x i32>, ptr %20, align 4, !tbaa !5 %21 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi) %22 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load222, <4 x i32> %vec.phi221) %index.next = add nuw i64 %index, 8 %23 = icmp eq i64 %index.next, %n.vec br i1 %23, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %21, <4 x i32> %22) %24 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) br i1 %cmp.n, label %cleanup104, label %for.body65.preheader for.body65.preheader: ; preds = %if.then53, %middle.block %indvars.iv189.ph = phi i64 [ 1, %if.then53 ], [ %ind.end, %middle.block ] %m.0169.ph = phi i32 [ -2147483648, %if.then53 ], [ %24, %middle.block ] br label %for.body65 for.body65: ; preds = %for.body65.preheader, %for.body65 %indvars.iv189 = phi i64 [ %indvars.iv.next190, %for.body65 ], [ %indvars.iv189.ph, %for.body65.preheader ] %m.0169 = phi i32 [ %spec.select, %for.body65 ], [ %m.0169.ph, %for.body65.preheader ] %arrayidx67 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %indvars.iv189 %25 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %25, i32 %m.0169) %indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1 %exitcond193.not = icmp eq i64 %indvars.iv.next190, %wide.trip.count197 br i1 %exitcond193.not, label %cleanup104, label %for.body65, !llvm.loop !17 if.else80: ; preds = %cleanup %arrayidx82 = getelementptr inbounds [100005 x i32], ptr @r, i64 0, i64 %idxprom31 %26 = load i32, ptr %arrayidx82, align 4, !tbaa !5 %idxprom83 = sext i32 %26 to i64 %arrayidx84 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %idxprom83 %27 = load i32, ptr %arrayidx84, align 4, !tbaa !5 %add85 = add nsw i32 %27, 1 %idxprom86 = sext i32 %u.2 to i64 %arrayidx87 = getelementptr inbounds [100005 x i32], ptr @count, i64 0, i64 %idxprom86 store i32 %add85, ptr %arrayidx87, align 4, !tbaa !5 store i32 0, ptr %arrayidx84, align 4, !tbaa !5 store i32 %u.2, ptr %arrayidx82, align 4, !tbaa !5 %28 = load i32, ptr %arrayidx87, align 4, !tbaa !5 %spec.select152 = call i32 @llvm.smax.i32(i32 %28, i32 %max.0173) br label %cleanup104 cleanup104: ; preds = %for.body65, %middle.block, %if.else80 %u.2214 = phi i32 [ %u.2, %if.else80 ], [ -1, %middle.block ], [ -1, %for.body65 ] %max.2 = phi i32 [ %spec.select152, %if.else80 ], [ %24, %middle.block ], [ %spec.select, %for.body65 ] %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1 %exitcond198.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count197 br i1 %exitcond198.not, label %if.end114, label %for.body28, !llvm.loop !18 if.end114: ; preds = %for.body28, %cleanup104, %for.cond.cleanup10, %for.cond.cleanup10.thread %str.sink = phi ptr [ @str.3, %for.cond.cleanup10.thread ], [ @str.3, %for.cond.cleanup10 ], [ @str.3, %cleanup104 ], [ @str, %for.body28 ] %u.4159 = phi i32 [ %u.0179, %for.cond.cleanup10.thread ], [ %u.0179, %for.cond.cleanup10 ], [ %u.2214, %cleanup104 ], [ %u.1175, %for.body28 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %29 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %29, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %29, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !19 while.end: ; preds = %if.end114, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10}
#include<stdio.h> int bubblesort(int A[], int N) { int flag, j, temp, cnt, i; cnt=0; i=0; flag=1; while(flag ==1) { 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; cnt++; } flag=1; } i++; } return cnt; } int main(void) { int N, cnt, i; scanf("%d", &N); int A[N]; for(i=0; i<N; i++) { scanf("%d", &A[i]); } cnt = bubblesort(A, N); for(i=0; i<N; i++) { if(i>0) { printf(" "); } printf("%d", A[i]); } printf("\n"); printf("%d\n", cnt); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283093/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283093/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @bubblesort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 { entry: %0 = sext i32 %N to i64 %smax = tail call i32 @llvm.smax.i32(i32 %N, i32 1) %wide.trip.count = zext i32 %smax to i64 %invariant.gep = getelementptr i32, ptr %A, i64 -2 br label %for.cond.preheader while.cond.loopexit: ; preds = %if.end, %for.cond.preheader %cnt.1.lcssa = phi i32 [ %cnt.039, %for.cond.preheader ], [ %cnt.2, %if.end ] %exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count br i1 %exitcond.not, label %while.end, label %for.cond.preheader, !llvm.loop !5 for.cond.preheader: ; preds = %entry, %while.cond.loopexit %indvars.iv43 = phi i64 [ 0, %entry ], [ %indvars.iv.next44, %while.cond.loopexit ] %cnt.039 = phi i32 [ 0, %entry ], [ %cnt.1.lcssa, %while.cond.loopexit ] %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %cmp1.not.not33 = icmp slt i64 %indvars.iv.next44, %0 br i1 %cmp1.not.not33, label %for.body, label %while.cond.loopexit for.body: ; preds = %for.cond.preheader, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ %0, %for.cond.preheader ] %cnt.135 = phi i32 [ %cnt.2, %if.end ], [ %cnt.039, %for.cond.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 !7 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv %2 = load i32, ptr %gep, align 4, !tbaa !7 %cmp5 = icmp slt i32 %1, %2 br i1 %cmp5, label %if.then, label %if.end if.then: ; preds = %for.body store i32 %2, ptr %arrayidx, align 4, !tbaa !7 store i32 %1, ptr %gep, align 4, !tbaa !7 %inc = add nsw i32 %cnt.135, 1 br label %if.end if.end: ; preds = %if.then, %for.body %cnt.2 = phi i32 [ %inc, %if.then ], [ %cnt.135, %for.body ] %cmp1.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next44 br i1 %cmp1.not.not, label %for.body, label %while.cond.loopexit, !llvm.loop !11 while.end: ; preds = %while.cond.loopexit ret i32 %cnt.1.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !7 %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 !7 %cmp23 = icmp sgt i32 %3, 0 br i1 %cmp23, label %for.body, label %entry.for.end_crit_edge entry.for.end_crit_edge: ; preds = %entry %.pre33 = sext i32 %3 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 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 !7 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12 for.end: ; preds = %for.body, %entry.for.end_crit_edge %.pre-phi = phi i64 [ %.pre33, %entry.for.end_crit_edge ], [ %5, %for.body ] %6 = phi i32 [ %3, %entry.for.end_crit_edge ], [ %4, %for.body ] %smax.i = call i32 @llvm.smax.i32(i32 %6, i32 1) %wide.trip.count.i = zext i32 %smax.i to i64 %invariant.gep.i = getelementptr i32, ptr %vla, i64 -2 br label %for.cond.preheader.i while.cond.loopexit.i: ; preds = %if.end.i, %for.cond.preheader.i %cnt.1.lcssa.i = phi i32 [ %cnt.039.i, %for.cond.preheader.i ], [ %cnt.2.i, %if.end.i ] %exitcond.not.i = icmp eq i64 %indvars.iv.next44.i, %wide.trip.count.i br i1 %exitcond.not.i, label %for.cond3.preheader, label %for.cond.preheader.i, !llvm.loop !5 for.cond3.preheader: ; preds = %while.cond.loopexit.i %cmp425 = icmp sgt i32 %6, 0 br i1 %cmp425, label %if.end.peel, label %for.end13 if.end.peel: ; preds = %for.cond3.preheader %.pre = load i32, ptr %vla, align 16, !tbaa !7 %call10.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %7 = load i32, ptr %N, align 4, !tbaa !7 %cmp4.peel = icmp sgt i32 %7, 1 br i1 %cmp4.peel, label %if.end, label %for.end13 for.cond.preheader.i: ; preds = %while.cond.loopexit.i, %for.end %indvars.iv43.i = phi i64 [ 0, %for.end ], [ %indvars.iv.next44.i, %while.cond.loopexit.i ] %cnt.039.i = phi i32 [ 0, %for.end ], [ %cnt.1.lcssa.i, %while.cond.loopexit.i ] %indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1 %cmp1.not.not33.i = icmp slt i64 %indvars.iv.next44.i, %.pre-phi br i1 %cmp1.not.not33.i, label %for.body.i, label %while.cond.loopexit.i for.body.i: ; preds = %for.cond.preheader.i, %if.end.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ %.pre-phi, %for.cond.preheader.i ] %cnt.135.i = phi i32 [ %cnt.2.i, %if.end.i ], [ %cnt.039.i, %for.cond.preheader.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !7 %gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i %9 = load i32, ptr %gep.i, align 4, !tbaa !7 %cmp5.i = icmp slt i32 %8, %9 br i1 %cmp5.i, label %if.then.i, label %if.end.i if.then.i: ; preds = %for.body.i store i32 %9, ptr %arrayidx.i, align 4, !tbaa !7 store i32 %8, ptr %gep.i, align 4, !tbaa !7 %inc.i = add nsw i32 %cnt.135.i, 1 br label %if.end.i if.end.i: ; preds = %if.then.i, %for.body.i %cnt.2.i = phi i32 [ %inc.i, %if.then.i ], [ %cnt.135.i, %for.body.i ] %cmp1.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next44.i br i1 %cmp1.not.not.i, label %for.body.i, label %while.cond.loopexit.i, !llvm.loop !11 if.end: ; preds = %if.end.peel, %if.end %indvars.iv29 = phi i64 [ %indvars.iv.next30, %if.end ], [ 1, %if.end.peel ] %putchar22 = call i32 @putchar(i32 32) %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv29 %10 = load i32, ptr %arrayidx9, align 4, !tbaa !7 %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1 %11 = load i32, ptr %N, align 4, !tbaa !7 %12 = sext i32 %11 to i64 %cmp4 = icmp slt i64 %indvars.iv.next30, %12 br i1 %cmp4, label %if.end, label %for.end13, !llvm.loop !13 for.end13: ; preds = %if.end, %if.end.peel, %for.cond3.preheader %putchar = call i32 @putchar(i32 10) %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cnt.1.lcssa.i) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 declare void @llvm.stackrestore.p0(ptr) #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 i32 @llvm.smax.i32(i32, i32) #6 attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 nocallback nofree nosync nounwind willreturn } 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"int", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"} !11 = distinct !{!11, !6} !12 = distinct !{!12, !6} !13 = distinct !{!13, !6, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(void){ int N[100]; int x,flag,t,c=0; scanf("%d",&x); for(int i=0;i<x;i++){ scanf("%d",&N[i]); } flag=1; while(flag==1){ flag=0; for(int j=x-1;j>0;j--){ if(N[j] < N[j-1]){ t=N[j]; N[j]=N[j-1]; N[j-1]=t; c++; flag=1; } } } printf("%d",N[0]); for(int i=1;i<x;i++){ printf(" %d",N[i]); } printf("\n"); printf("%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283136/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283136/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100 x i32], align 16 %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %while.end while.cond.preheader: ; preds = %for.body %cmp457 = icmp sgt i32 %4, 1 br i1 %cmp457, label %for.cond3.preheader.us.preheader, label %while.end for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 br label %for.body6.us for.body6.us: ; preds = %for.body6.us.backedge, %for.cond3.preheader.us.preheader %indvars.iv69 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv69.be, %for.body6.us.backedge ] %c.159.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %c.2.us, %for.body6.us.backedge ] %flag.158.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %flag.158.us.be, %for.body6.us.backedge ] %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1 %idxprom7.us = and i64 %indvars.iv.next70, 4294967295 %arrayidx8.us = getelementptr inbounds [100 x i32], ptr %N, i64 0, i64 %idxprom7.us %2 = load i32, ptr %arrayidx8.us, align 4, !tbaa !5 %sub9.us = add i64 %indvars.iv69, 4294967294 %idxprom10.us = and i64 %sub9.us, 4294967295 %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %N, 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.inc24.us if.then.us: ; preds = %for.body6.us store i32 %3, ptr %arrayidx8.us, align 4, !tbaa !5 store i32 %2, ptr %arrayidx11.us, align 4, !tbaa !5 %inc23.us = add nsw i32 %c.159.us, 1 br label %for.inc24.us for.inc24.us: ; preds = %if.then.us, %for.body6.us %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.158.us, %for.body6.us ] %c.2.us = phi i32 [ %inc23.us, %if.then.us ], [ %c.159.us, %for.body6.us ] %cmp4.us = icmp sgt i64 %indvars.iv69, 2 br i1 %cmp4.us, label %for.body6.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us for.body6.us.backedge: ; preds = %for.inc24.us, %for.cond3.while.cond.loopexit_crit_edge.us %indvars.iv69.be = phi i64 [ %indvars.iv.next70, %for.inc24.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ] %flag.158.us.be = phi i32 [ %flag.2.us, %for.inc24.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ] br label %for.body6.us, !llvm.loop !9 for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc24.us %cmp2.us = icmp eq i32 %flag.2.us, 1 br i1 %cmp2.us, label %for.body6.us.backedge, label %while.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 %N, 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 %x, 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 while.end: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us, %entry, %while.cond.preheader %.us-phi = phi i32 [ 0, %while.cond.preheader ], [ 0, %entry ], [ %c.2.us, %for.cond3.while.cond.loopexit_crit_edge.us ] %6 = load i32, ptr %N, align 16, !tbaa !5 %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %7 = load i32, ptr %x, align 4, !tbaa !5 %cmp3065 = icmp sgt i32 %7, 1 br i1 %cmp3065, label %for.body32, label %for.cond.cleanup31 for.cond.cleanup31: ; preds = %for.body32, %while.end %putchar = call i32 @putchar(i32 10) %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %N) #4 ret i32 0 for.body32: ; preds = %while.end, %for.body32 %indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body32 ], [ 1, %while.end ] %arrayidx34 = getelementptr inbounds [100 x i32], ptr %N, i64 0, i64 %indvars.iv72 %8 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %9 = load i32, ptr %x, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp30 = icmp slt i64 %indvars.iv.next73, %10 br i1 %cmp30, label %for.body32, label %for.cond.cleanup31, !llvm.loop !12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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() { int t; scanf("%d",&t); while(t--){ int n,k; scanf("%d %d",&n,&k); int a[n+5]; int i,t=1; int sum=1,max=0; for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=2;i<=k-1;i++){ if(a[i]>a[i-1]&&a[i]>a[i+1]) sum++; } max=sum; for(i=2;i<=n-k+1;i++){ if(a[i]>a[i-1]&&a[i]>a[i+1])sum--; if(a[i+k-2]>a[i+k-3]&&a[i+k-2]>a[i+k-1])sum++; if(sum>max){max=sum;t=i;} } printf("%d %d\n",max,t); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28318/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28318/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %t = alloca i32, align 4 %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec119 = add nsw i32 %0, -1 store i32 %dec119, ptr %t, align 4, !tbaa !5 %tobool.not120 = icmp eq i32 %0, 0 br i1 %tobool.not120, label %while.end, label %while.body while.body: ; preds = %entry, %for.end71 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k) %1 = load i32, ptr %n, align 4, !tbaa !5 %add = add nsw i32 %1, 5 %2 = zext i32 %add to i64 %3 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %2, align 16 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not105 = icmp slt i32 %4, 1 br i1 %cmp.not105, label %for.cond4.preheader, label %for.body for.cond4.preheader: ; preds = %for.body, %while.body %.lcssa = phi i32 [ %4, %while.body ], [ %9, %for.body ] %5 = load i32, ptr %k, align 4, !tbaa !5 %cmp5.not.not107 = icmp sgt i32 %5, 2 br i1 %cmp5.not.not107, label %for.body6.preheader, label %for.cond23.preheader for.body6.preheader: ; preds = %for.cond4.preheader %wide.trip.count = zext i32 %5 to i64 %arrayidx11.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 1 %.pre = load i32, ptr %arrayidx11.phi.trans.insert, align 4, !tbaa !5 %xtraiter = and i64 %wide.trip.count, 1 %6 = icmp eq i32 %5, 3 br i1 %6, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %7 = and i64 %wide.trip.count, 4294967294 %8 = add nsw i64 %7, -4 br label %for.body6 for.body: ; preds = %while.body, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %while.body ] %arrayidx = getelementptr inbounds i32, ptr %vla, 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 %9 = load i32, ptr %n, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %10 br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9 for.cond23.preheader.loopexit.unr-lcssa: ; preds = %for.inc20.1, %for.body6.preheader %sum.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %sum.1.1, %for.inc20.1 ] %.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %21, %for.inc20.1 ] %indvars.iv123.unr = phi i64 [ 2, %for.body6.preheader ], [ %22, %for.inc20.1 ] %sum.0109.unr = phi i32 [ 1, %for.body6.preheader ], [ %sum.1.1, %for.inc20.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond23.preheader, label %for.body6.epil for.body6.epil: ; preds = %for.cond23.preheader.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv123.unr %11 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %cmp12.epil = icmp sgt i32 %11, %.unr br i1 %cmp12.epil, label %land.lhs.true.epil, label %for.cond23.preheader land.lhs.true.epil: ; preds = %for.body6.epil %12 = getelementptr i32, ptr %vla, i64 %indvars.iv123.unr %arrayidx17.epil = getelementptr i32, ptr %12, i64 1 %13 = load i32, ptr %arrayidx17.epil, align 4, !tbaa !5 %cmp18.epil = icmp sgt i32 %11, %13 %inc19.epil = zext i1 %cmp18.epil to i32 %spec.select.epil = add nsw i32 %sum.0109.unr, %inc19.epil br label %for.cond23.preheader for.cond23.preheader: ; preds = %for.cond23.preheader.loopexit.unr-lcssa, %land.lhs.true.epil, %for.body6.epil, %for.cond4.preheader %sum.0.lcssa = phi i32 [ 1, %for.cond4.preheader ], [ %sum.1.lcssa.ph, %for.cond23.preheader.loopexit.unr-lcssa ], [ %spec.select.epil, %land.lhs.true.epil ], [ %sum.0109.unr, %for.body6.epil ] %sub24 = add i32 %.lcssa, 1 %add25 = sub i32 %sub24, %5 %cmp26.not112 = icmp slt i32 %add25, 2 br i1 %cmp26.not112, label %for.end71, label %for.body27.preheader for.body27.preheader: ; preds = %for.cond23.preheader %14 = sext i32 %5 to i64 %15 = add i32 %.lcssa, 2 %16 = sub i32 %15, %5 %wide.trip.count137 = zext i32 %16 to i64 %arrayidx32.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 1 %.pre139 = load i32, ptr %arrayidx32.phi.trans.insert, align 4, !tbaa !5 %invariant.gep = getelementptr i32, ptr %vla, i64 -2 %invariant.gep142 = getelementptr i32, ptr %vla, i64 -3 %invariant.gep144 = getelementptr i32, ptr %vla, i64 -1 br label %for.body27 for.body6: ; preds = %for.inc20.1, %for.body6.preheader.new %17 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %21, %for.inc20.1 ] %indvars.iv123 = phi i64 [ 2, %for.body6.preheader.new ], [ %22, %for.inc20.1 ] %sum.0109 = phi i32 [ 1, %for.body6.preheader.new ], [ %sum.1.1, %for.inc20.1 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.inc20.1 ] %arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv123 %18 = load i32, ptr %arrayidx8, align 8, !tbaa !5 %cmp12 = icmp sgt i32 %18, %17 %19 = or i64 %indvars.iv123, 1 br i1 %cmp12, label %land.lhs.true, label %for.inc20 land.lhs.true: ; preds = %for.body6 %arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %19 %20 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %18, %20 %inc19 = zext i1 %cmp18 to i32 %spec.select = add nsw i32 %sum.0109, %inc19 br label %for.inc20 for.inc20: ; preds = %for.body6, %land.lhs.true %sum.1 = phi i32 [ %spec.select, %land.lhs.true ], [ %sum.0109, %for.body6 ] %arrayidx8.1 = getelementptr inbounds i32, ptr %vla, i64 %19 %21 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %cmp12.1 = icmp sgt i32 %21, %18 %22 = add nuw nsw i64 %indvars.iv123, 2 br i1 %cmp12.1, label %land.lhs.true.1, label %for.inc20.1 land.lhs.true.1: ; preds = %for.inc20 %arrayidx17.1 = getelementptr inbounds i32, ptr %vla, i64 %22 %23 = load i32, ptr %arrayidx17.1, align 8, !tbaa !5 %cmp18.1 = icmp sgt i32 %21, %23 %inc19.1 = zext i1 %cmp18.1 to i32 %spec.select.1 = add nsw i32 %sum.1, %inc19.1 br label %for.inc20.1 for.inc20.1: ; preds = %land.lhs.true.1, %for.inc20 %sum.1.1 = phi i32 [ %spec.select.1, %land.lhs.true.1 ], [ %sum.1, %for.inc20 ] %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter, %8 br i1 %niter.ncmp.1, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11 for.body27: ; preds = %for.body27.preheader, %if.end65 %24 = phi i32 [ %.pre139, %for.body27.preheader ], [ %25, %if.end65 ] %indvars.iv128 = phi i64 [ 2, %for.body27.preheader ], [ %indvars.iv.next129, %if.end65 ] %max.0116 = phi i32 [ %sum.0.lcssa, %for.body27.preheader ], [ %spec.select103, %if.end65 ] %sum.2115 = phi i32 [ %sum.0.lcssa, %for.body27.preheader ], [ %sum.4, %if.end65 ] %t2.0114 = phi i32 [ 1, %for.body27.preheader ], [ %spec.select102, %if.end65 ] %arrayidx29 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv128 %25 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %cmp33 = icmp sgt i32 %25, %24 br i1 %cmp33, label %land.lhs.true34, label %if.end43 land.lhs.true34: ; preds = %for.body27 %26 = add nuw i64 %indvars.iv128, 1 %idxprom38 = and i64 %26, 4294967295 %arrayidx39 = getelementptr inbounds i32, ptr %vla, i64 %idxprom38 %27 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %cmp40 = icmp sgt i32 %25, %27 %dec42 = sext i1 %cmp40 to i32 %spec.select100 = add nsw i32 %sum.2115, %dec42 br label %if.end43 if.end43: ; preds = %land.lhs.true34, %for.body27 %sum.3 = phi i32 [ %sum.2115, %for.body27 ], [ %spec.select100, %land.lhs.true34 ] %28 = add nsw i64 %indvars.iv128, %14 %gep = getelementptr i32, ptr %invariant.gep, i64 %28 %29 = load i32, ptr %gep, align 4, !tbaa !5 %gep143 = getelementptr i32, ptr %invariant.gep142, i64 %28 %30 = load i32, ptr %gep143, align 4, !tbaa !5 %cmp52 = icmp sgt i32 %29, %30 br i1 %cmp52, label %land.lhs.true53, label %if.end65 land.lhs.true53: ; preds = %if.end43 %gep145 = getelementptr i32, ptr %invariant.gep144, i64 %28 %31 = load i32, ptr %gep145, align 4, !tbaa !5 %cmp62 = icmp sgt i32 %29, %31 %inc64 = zext i1 %cmp62 to i32 %spec.select101 = add nsw i32 %sum.3, %inc64 br label %if.end65 if.end65: ; preds = %land.lhs.true53, %if.end43 %sum.4 = phi i32 [ %sum.3, %if.end43 ], [ %spec.select101, %land.lhs.true53 ] %cmp66 = icmp sgt i32 %sum.4, %max.0116 %32 = trunc i64 %indvars.iv128 to i32 %spec.select102 = select i1 %cmp66, i32 %32, i32 %t2.0114 %spec.select103 = call i32 @llvm.smax.i32(i32 %sum.4, i32 %max.0116) %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %exitcond138.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count137 br i1 %exitcond138.not, label %for.end71, label %for.body27, !llvm.loop !12 for.end71: ; preds = %if.end65, %for.cond23.preheader %t2.0.lcssa = phi i32 [ 1, %for.cond23.preheader ], [ %spec.select102, %if.end65 ] %max.0.lcssa = phi i32 [ %sum.0.lcssa, %for.cond23.preheader ], [ %spec.select103, %if.end65 ] %call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa, i32 noundef %t2.0.lcssa) call void @llvm.stackrestore.p0(ptr %3) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 %33 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %33, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %33, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13 while.end: ; preds = %for.end71, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int bubbleSort(int A[],int N); int main(){ int i,A[100],N,count; scanf("%d",&N); for(i = 0 ; i < N ; i++)scanf("%d",&A[i]); count = bubbleSort(A,N); for(i = 0 ; i < N ; i++){ if(i > 0)printf(" "); printf("%d",A[i]); } printf("\n"); printf("%d\n",count); return 0; } int bubbleSort(int A[], int N){ int count = 0,flag,j,s; flag = 1 ; while (flag) { flag = 0; for (j = 1 ; j < N ; j++) { if (A[j] < A[j-1]) { s = A[j]; A[j] = A[j-1]; A[j-1] = s; flag = 1; count++; } } } return count; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283222/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283222/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, 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 %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 %wide.trip.count.i = zext i32 %1 to i64 %invariant.gep.i = getelementptr i32, ptr %A, i64 -1 %3 = add nsw i64 %wide.trip.count.i, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 %unroll_iter = and i64 %3, -2 %invariant.gep = getelementptr i32, ptr %A, i64 1 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond.preheader.us.i for.cond.preheader.us.i: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.cond.preheader.us.preheader.i %count.034.us.i = phi i32 [ %count.2.us.i.lcssa, %for.cond.while.cond.loopexit_crit_edge.us.i ], [ 0, %for.cond.preheader.us.preheader.i ] %.pre.i = load i32, ptr %A, align 16, !tbaa !5 br i1 %4, label %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa, label %for.body.us.i for.body.us.i: ; preds = %for.cond.preheader.us.i, %for.inc.us.i.1 %5 = phi i32 [ %9, %for.inc.us.i.1 ], [ %.pre.i, %for.cond.preheader.us.i ] %indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.inc.us.i.1 ], [ 1, %for.cond.preheader.us.i ] %count.132.us.i = phi i32 [ %count.2.us.i.1, %for.inc.us.i.1 ], [ %count.034.us.i, %for.cond.preheader.us.i ] %flag.130.us.i = phi i32 [ %flag.2.us.i.1, %for.inc.us.i.1 ], [ 0, %for.cond.preheader.us.i ] %niter = phi i64 [ %niter.next.1, %for.inc.us.i.1 ], [ 0, %for.cond.preheader.us.i ] %arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i %6 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %cmp3.us.i = icmp slt i32 %6, %5 br i1 %cmp3.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body.us.i %gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %6, ptr %gep.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 %7 = phi i32 [ %5, %if.then.us.i ], [ %6, %for.body.us.i ] %flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.130.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 ] %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i %8 = load i32, ptr %gep, align 4, !tbaa !5 %cmp3.us.i.1 = icmp slt i32 %8, %7 br i1 %cmp3.us.i.1, label %if.then.us.i.1, label %for.inc.us.i.1 if.then.us.i.1: ; preds = %for.inc.us.i %gep.i.1 = getelementptr i32, ptr %A, i64 %indvars.iv.i store i32 %7, ptr %gep, align 4, !tbaa !5 store i32 %8, ptr %gep.i.1, align 4, !tbaa !5 %inc.us.i.1 = add nsw i32 %count.2.us.i, 1 br label %for.inc.us.i.1 for.inc.us.i.1: ; preds = %if.then.us.i.1, %for.inc.us.i %9 = phi i32 [ %7, %if.then.us.i.1 ], [ %8, %for.inc.us.i ] %flag.2.us.i.1 = phi i32 [ 1, %if.then.us.i.1 ], [ %flag.2.us.i, %for.inc.us.i ] %count.2.us.i.1 = phi i32 [ %inc.us.i.1, %if.then.us.i.1 ], [ %count.2.us.i, %for.inc.us.i ] %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa, label %for.body.us.i, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa: ; preds = %for.inc.us.i.1, %for.cond.preheader.us.i %flag.2.us.i.lcssa.ph = phi i32 [ undef, %for.cond.preheader.us.i ], [ %flag.2.us.i.1, %for.inc.us.i.1 ] %count.2.us.i.lcssa.ph = phi i32 [ undef, %for.cond.preheader.us.i ], [ %count.2.us.i.1, %for.inc.us.i.1 ] %.unr = phi i32 [ %.pre.i, %for.cond.preheader.us.i ], [ %9, %for.inc.us.i.1 ] %indvars.iv.i.unr = phi i64 [ 1, %for.cond.preheader.us.i ], [ %indvars.iv.next.i.1, %for.inc.us.i.1 ] %count.132.us.i.unr = phi i32 [ %count.034.us.i, %for.cond.preheader.us.i ], [ %count.2.us.i.1, %for.inc.us.i.1 ] %flag.130.us.i.unr = phi i32 [ 0, %for.cond.preheader.us.i ], [ %flag.2.us.i.1, %for.inc.us.i.1 ] br i1 %lcmp.mod.not, label %for.cond.while.cond.loopexit_crit_edge.us.i, label %for.body.us.i.epil for.body.us.i.epil: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa %arrayidx.us.i.epil = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.unr %10 = load i32, ptr %arrayidx.us.i.epil, align 4, !tbaa !5 %cmp3.us.i.epil = icmp slt i32 %10, %.unr br i1 %cmp3.us.i.epil, label %if.then.us.i.epil, label %for.cond.while.cond.loopexit_crit_edge.us.i if.then.us.i.epil: ; preds = %for.body.us.i.epil %gep.i.epil = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.unr store i32 %.unr, ptr %arrayidx.us.i.epil, align 4, !tbaa !5 store i32 %10, ptr %gep.i.epil, align 4, !tbaa !5 %inc.us.i.epil = add nsw i32 %count.132.us.i.unr, 1 br label %for.cond.while.cond.loopexit_crit_edge.us.i for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.body.us.i.epil, %if.then.us.i.epil, %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa %flag.2.us.i.lcssa = phi i32 [ %flag.2.us.i.lcssa.ph, %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa ], [ 1, %if.then.us.i.epil ], [ %flag.130.us.i.unr, %for.body.us.i.epil ] %count.2.us.i.lcssa = phi i32 [ %count.2.us.i.lcssa.ph, %for.cond.while.cond.loopexit_crit_edge.us.i.unr-lcssa ], [ %inc.us.i.epil, %if.then.us.i.epil ], [ %count.132.us.i.unr, %for.body.us.i.epil ] %tobool.not.us.i = icmp eq i32 %flag.2.us.i.lcssa, 0 br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.cond.preheader.us.i, !llvm.loop !12 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.lcssa, %for.cond.while.cond.loopexit_crit_edge.us.i ] %cmp425 = icmp sgt i32 %1, 0 br i1 %cmp425, label %if.end.peel, label %for.end13 if.end.peel: ; preds = %bubbleSort.exit %.pre = load i32, ptr %A, align 16, !tbaa !5 %call10.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %11 = load i32, ptr %N, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %11, 1 br i1 %cmp4.peel, label %if.end, label %for.end13 if.end: ; preds = %if.end.peel, %if.end %indvars.iv29 = phi i64 [ %indvars.iv.next30, %if.end ], [ 1, %if.end.peel ] %putchar22 = call i32 @putchar(i32 32) %arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv29 %12 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12) %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1 %13 = load i32, ptr %N, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp4 = icmp slt i64 %indvars.iv.next30, %14 br i1 %cmp4, label %if.end, label %for.end13, !llvm.loop !13 for.end13: ; preds = %if.end, %entry, %if.end.peel, %bubbleSort.exit %.us-phi.i36 = phi i32 [ %.us-phi.i, %bubbleSort.exit ], [ %.us-phi.i, %if.end.peel ], [ 0, %entry ], [ %.us-phi.i, %if.end ] %putchar = call i32 @putchar(i32 10) %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi.i36) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(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: %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 %wide.trip.count = zext i32 %N to i64 %invariant.gep = getelementptr i32, ptr %A, i64 -1 %0 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %0, 1 %1 = icmp eq i32 %N, 2 %unroll_iter = and i64 %0, -2 %invariant.gep39 = getelementptr i32, ptr %A, i64 1 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond.preheader.us for.cond.preheader.us: ; preds = %for.cond.preheader.us.preheader, %for.cond.while.cond.loopexit_crit_edge.us %count.034.us = phi i32 [ %count.2.us.lcssa, %for.cond.while.cond.loopexit_crit_edge.us ], [ 0, %for.cond.preheader.us.preheader ] %.pre = load i32, ptr %A, align 4, !tbaa !5 br i1 %1, label %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa, label %for.body.us for.body.us: ; preds = %for.cond.preheader.us, %for.inc.us.1 %2 = phi i32 [ %6, %for.inc.us.1 ], [ %.pre, %for.cond.preheader.us ] %indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us.1 ], [ 1, %for.cond.preheader.us ] %count.132.us = phi i32 [ %count.2.us.1, %for.inc.us.1 ], [ %count.034.us, %for.cond.preheader.us ] %flag.130.us = phi i32 [ %flag.2.us.1, %for.inc.us.1 ], [ 0, %for.cond.preheader.us ] %niter = phi i64 [ %niter.next.1, %for.inc.us.1 ], [ 0, %for.cond.preheader.us ] %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv %3 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %cmp3.us = icmp slt i32 %3, %2 br i1 %cmp3.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body.us %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %3, ptr %gep, 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 %4 = phi i32 [ %2, %if.then.us ], [ %3, %for.body.us ] %flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.130.us, %for.body.us ] %count.2.us = phi i32 [ %inc.us, %if.then.us ], [ %count.132.us, %for.body.us ] %gep40 = getelementptr i32, ptr %invariant.gep39, i64 %indvars.iv %5 = load i32, ptr %gep40, align 4, !tbaa !5 %cmp3.us.1 = icmp slt i32 %5, %4 br i1 %cmp3.us.1, label %if.then.us.1, label %for.inc.us.1 if.then.us.1: ; preds = %for.inc.us %gep.1 = getelementptr i32, ptr %A, i64 %indvars.iv store i32 %4, ptr %gep40, align 4, !tbaa !5 store i32 %5, ptr %gep.1, align 4, !tbaa !5 %inc.us.1 = add nsw i32 %count.2.us, 1 br label %for.inc.us.1 for.inc.us.1: ; preds = %if.then.us.1, %for.inc.us %6 = phi i32 [ %4, %if.then.us.1 ], [ %5, %for.inc.us ] %flag.2.us.1 = phi i32 [ 1, %if.then.us.1 ], [ %flag.2.us, %for.inc.us ] %count.2.us.1 = phi i32 [ %inc.us.1, %if.then.us.1 ], [ %count.2.us, %for.inc.us ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa, label %for.body.us, !llvm.loop !11 for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa: ; preds = %for.inc.us.1, %for.cond.preheader.us %flag.2.us.lcssa.ph = phi i32 [ undef, %for.cond.preheader.us ], [ %flag.2.us.1, %for.inc.us.1 ] %count.2.us.lcssa.ph = phi i32 [ undef, %for.cond.preheader.us ], [ %count.2.us.1, %for.inc.us.1 ] %.unr = phi i32 [ %.pre, %for.cond.preheader.us ], [ %6, %for.inc.us.1 ] %indvars.iv.unr = phi i64 [ 1, %for.cond.preheader.us ], [ %indvars.iv.next.1, %for.inc.us.1 ] %count.132.us.unr = phi i32 [ %count.034.us, %for.cond.preheader.us ], [ %count.2.us.1, %for.inc.us.1 ] %flag.130.us.unr = phi i32 [ 0, %for.cond.preheader.us ], [ %flag.2.us.1, %for.inc.us.1 ] br i1 %lcmp.mod.not, label %for.cond.while.cond.loopexit_crit_edge.us, label %for.body.us.epil for.body.us.epil: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa %arrayidx.us.epil = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.unr %7 = load i32, ptr %arrayidx.us.epil, align 4, !tbaa !5 %cmp3.us.epil = icmp slt i32 %7, %.unr br i1 %cmp3.us.epil, label %if.then.us.epil, label %for.cond.while.cond.loopexit_crit_edge.us if.then.us.epil: ; preds = %for.body.us.epil %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.unr store i32 %.unr, ptr %arrayidx.us.epil, align 4, !tbaa !5 store i32 %7, ptr %gep.epil, align 4, !tbaa !5 %inc.us.epil = add nsw i32 %count.132.us.unr, 1 br label %for.cond.while.cond.loopexit_crit_edge.us for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.body.us.epil, %if.then.us.epil, %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa %flag.2.us.lcssa = phi i32 [ %flag.2.us.lcssa.ph, %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa ], [ 1, %if.then.us.epil ], [ %flag.130.us.unr, %for.body.us.epil ] %count.2.us.lcssa = phi i32 [ %count.2.us.lcssa.ph, %for.cond.while.cond.loopexit_crit_edge.us.unr-lcssa ], [ %inc.us.epil, %if.then.us.epil ], [ %count.132.us.unr, %for.body.us.epil ] %tobool.not.us = icmp eq i32 %flag.2.us.lcssa, 0 br i1 %tobool.not.us, label %while.end, label %for.cond.preheader.us, !llvm.loop !12 while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry %.us-phi = phi i32 [ 0, %entry ], [ %count.2.us.lcssa, %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} !13 = distinct !{!13, !10, !14} !14 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> #include<stdlib.h> int BubbleSort(int *,int); int main(){ int swcut=0; int n,*a,i; scanf("%d",&n); a=(int *)malloc(n*sizeof(int)); for(i=0;i<n;i++){ scanf("%d",&a[i]); } swcut=BubbleSort(a,n); for(i=0;i<n;i++){ printf("%d",a[i]); if(i!=n-1) printf(" "); } printf("\n%d\n",swcut); return 0; } int BubbleSort(int *a,int n){ int i,j,stock,count=0; for(i=0;i<n;i++){ for(j=n-1;j>0;j--){ if(a[j]<a[j-1]){ stock=a[j]; a[j]=a[j-1]; a[j-1]=stock; count++; } } } return count; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283266/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283266/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp27 = icmp sgt i32 %0, 0 br i1 %cmp27, label %for.body, label %for.end17 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 %1 = sext i32 %.pr to i64 %cmp = icmp slt i64 %indvars.iv.next, %1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %or.cond.i = icmp slt i32 %.pr, 2 br i1 %or.cond.i, label %BubbleSort.exit, label %for.cond1.preheader.us.preheader.i for.cond1.preheader.us.preheader.i: ; preds = %for.end %2 = zext i32 %.pr to i64 br label %for.cond1.preheader.us.i for.cond1.preheader.us.i: ; preds = %for.cond1.for.inc18_crit_edge.us.i, %for.cond1.preheader.us.preheader.i %count.044.us.i = phi i32 [ %count.2.us.i, %for.cond1.for.inc18_crit_edge.us.i ], [ 0, %for.cond1.preheader.us.preheader.i ] %i.043.us.i = phi i32 [ %inc19.us.i, %for.cond1.for.inc18_crit_edge.us.i ], [ 0, %for.cond1.preheader.us.preheader.i ] br label %for.body3.us.i for.body3.us.i: ; preds = %for.inc.us.i, %for.cond1.preheader.us.i %indvars.iv.i = phi i64 [ %2, %for.cond1.preheader.us.i ], [ %indvars.iv.next.i, %for.inc.us.i ] %count.140.us.i = phi i32 [ %count.044.us.i, %for.cond1.preheader.us.i ], [ %count.2.us.i, %for.inc.us.i ] %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 %call1, i64 %idxprom.us.i %3 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %sub4.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294 %idxprom5.us.i = and i64 %sub4.us.i, 4294967295 %arrayidx6.us.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom5.us.i %4 = load i32, ptr %arrayidx6.us.i, align 4, !tbaa !5 %cmp7.us.i = icmp slt i32 %3, %4 br i1 %cmp7.us.i, label %if.then.us.i, label %for.inc.us.i if.then.us.i: ; preds = %for.body3.us.i store i32 %4, ptr %arrayidx.us.i, align 4, !tbaa !5 store i32 %3, ptr %arrayidx6.us.i, align 4, !tbaa !5 %inc.us.i = add nsw i32 %count.140.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.then.us.i, %for.body3.us.i %count.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.140.us.i, %for.body3.us.i ] %cmp2.us.i = icmp sgt i64 %indvars.iv.i, 2 br i1 %cmp2.us.i, label %for.body3.us.i, label %for.cond1.for.inc18_crit_edge.us.i, !llvm.loop !11 for.cond1.for.inc18_crit_edge.us.i: ; preds = %for.inc.us.i %inc19.us.i = add nuw nsw i32 %i.043.us.i, 1 %exitcond.not.i = icmp eq i32 %inc19.us.i, %.pr br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond1.preheader.us.i, !llvm.loop !12 BubbleSort.exit: ; preds = %for.cond1.for.inc18_crit_edge.us.i, %for.end %count.0.lcssa.i = phi i32 [ 0, %for.end ], [ %count.2.us.i, %for.cond1.for.inc18_crit_edge.us.i ] %cmp629 = icmp sgt i32 %.pr, 0 br i1 %cmp629, label %for.body8, label %for.end17 for.body8: ; preds = %BubbleSort.exit, %for.inc15 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.inc15 ], [ 0, %BubbleSort.exit ] %arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv32 %5 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5) %6 = load i32, ptr %n, align 4, !tbaa !5 %sub = add nsw i32 %6, -1 %7 = zext i32 %sub to i64 %cmp12.not = icmp eq i64 %indvars.iv32, %7 br i1 %cmp12.not, label %for.inc15, label %if.then if.then: ; preds = %for.body8 %putchar = call i32 @putchar(i32 32) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc15 for.inc15: ; preds = %for.body8, %if.then %8 = phi i32 [ %6, %for.body8 ], [ %.pre, %if.then ] %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %9 = sext i32 %8 to i64 %cmp6 = icmp slt i64 %indvars.iv.next33, %9 br i1 %cmp6, label %for.body8, label %for.end17, !llvm.loop !13 for.end17: ; preds = %for.inc15, %entry, %BubbleSort.exit %count.0.lcssa.i38 = phi i32 [ %count.0.lcssa.i, %BubbleSort.exit ], [ 0, %entry ], [ %count.0.lcssa.i, %for.inc15 ] %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa.i38) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @BubbleSort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #4 { entry: %or.cond = icmp slt i32 %n, 2 br i1 %or.cond, label %for.end20, label %for.cond1.preheader.us.preheader for.cond1.preheader.us.preheader: ; preds = %entry %0 = zext i32 %n to i64 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc18_crit_edge.us %count.044.us = phi i32 [ %count.2.us, %for.cond1.for.inc18_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ] %i.043.us = phi i32 [ %inc19.us, %for.cond1.for.inc18_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ] br label %for.body3.us for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us %indvars.iv = phi i64 [ %0, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ] %count.140.us = phi i32 [ %count.044.us, %for.cond1.preheader.us ], [ %count.2.us, %for.inc.us ] %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 %sub4.us = add i64 %indvars.iv, 4294967294 %idxprom5.us = and i64 %sub4.us, 4294967295 %arrayidx6.us = getelementptr inbounds i32, ptr %a, i64 %idxprom5.us %2 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5 %cmp7.us = icmp slt i32 %1, %2 br i1 %cmp7.us, label %if.then.us, label %for.inc.us if.then.us: ; preds = %for.body3.us store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5 store i32 %1, ptr %arrayidx6.us, align 4, !tbaa !5 %inc.us = add nsw i32 %count.140.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.then.us, %for.body3.us %count.2.us = phi i32 [ %inc.us, %if.then.us ], [ %count.140.us, %for.body3.us ] %cmp2.us = icmp sgt i64 %indvars.iv, 2 br i1 %cmp2.us, label %for.body3.us, label %for.cond1.for.inc18_crit_edge.us, !llvm.loop !11 for.cond1.for.inc18_crit_edge.us: ; preds = %for.inc.us %inc19.us = add nuw nsw i32 %i.043.us, 1 %exitcond.not = icmp eq i32 %inc19.us, %n br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader.us, !llvm.loop !12 for.end20: ; preds = %for.cond1.for.inc18_crit_edge.us, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %count.2.us, %for.cond1.for.inc18_crit_edge.us ] ret i32 %count.0.lcssa } ; 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 #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int A[101], n, i, j, t, sw = 0; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); for ( i = 1; i <= n; i++ ){ for ( j = n; j >= i+1; j-- ){ if ( A[j] < A[j-1] ){ t = A[j]; A[j] = A[j-1]; A[j-1] = t; sw++; } } } for ( i = 1; i <= n; i++ ){ if (i>1) printf(" "); printf("%d", A[i]); } printf("\n"); printf("%d\n", sw); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283309/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283309/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [101 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 404, 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 %cmp.not64 = icmp slt i32 %0, 1 br i1 %cmp.not64, label %for.end41, label %for.body for.cond2.preheader: ; preds = %for.body %cmp3.not70 = icmp slt i32 %3, 1 br i1 %cmp3.not70, label %for.end41, label %for.cond5.preheader.preheader for.cond5.preheader.preheader: ; preds = %for.cond2.preheader %1 = zext i32 %3 to i64 %2 = add nuw i32 %3, 1 %wide.trip.count = zext i32 %2 to i64 %arrayidx9.phi.trans.insert = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %1 br label %for.cond5.preheader 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 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %4 br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc26 %indvars.iv81 = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next82, %for.inc26 ] %sw.072 = phi i32 [ 0, %for.cond5.preheader.preheader ], [ %sw.1.lcssa, %for.inc26 ] %cmp6.not.not66 = icmp ult i64 %indvars.iv81, %1 br i1 %cmp6.not.not66, label %for.body7.preheader, label %for.inc26 for.body7.preheader: ; preds = %for.cond5.preheader %.pre = load i32, ptr %arrayidx9.phi.trans.insert, align 4, !tbaa !5 br label %for.body7 for.cond29.preheader: ; preds = %for.inc26 br i1 %cmp3.not70, label %for.end41, label %if.end35.peel if.end35.peel: ; preds = %for.cond29.preheader %arrayidx37.peel.phi.trans.insert = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 1 %.pre88 = load i32, ptr %arrayidx37.peel.phi.trans.insert, align 4, !tbaa !5 %call38.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre88) %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp30.not.not.peel = icmp sgt i32 %5, 1 br i1 %cmp30.not.not.peel, label %if.end35, label %for.end41 for.body7: ; preds = %for.body7.preheader, %for.inc24 %6 = phi i32 [ %.pre, %for.body7.preheader ], [ %8, %for.inc24 ] %indvars.iv78 = phi i64 [ %1, %for.body7.preheader ], [ %indvars.iv.next79, %for.inc24 ] %sw.168 = phi i32 [ %sw.072, %for.body7.preheader ], [ %sw.2, %for.inc24 ] %indvars.iv.next79 = add nsw i64 %indvars.iv78, -1 %arrayidx11 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv.next79 %7 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp slt i32 %6, %7 br i1 %cmp12, label %if.then, label %for.inc24 if.then: ; preds = %for.body7 %arrayidx9 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv78 store i32 %7, ptr %arrayidx9, align 4, !tbaa !5 store i32 %6, ptr %arrayidx11, align 4, !tbaa !5 %inc23 = add nsw i32 %sw.168, 1 br label %for.inc24 for.inc24: ; preds = %for.body7, %if.then %8 = phi i32 [ %6, %if.then ], [ %7, %for.body7 ] %sw.2 = phi i32 [ %inc23, %if.then ], [ %sw.168, %for.body7 ] %cmp6.not.not = icmp sgt i64 %indvars.iv.next79, %indvars.iv81 br i1 %cmp6.not.not, label %for.body7, label %for.inc26, !llvm.loop !11 for.inc26: ; preds = %for.inc24, %for.cond5.preheader %sw.1.lcssa = phi i32 [ %sw.072, %for.cond5.preheader ], [ %sw.2, %for.inc24 ] %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count br i1 %exitcond.not, label %for.cond29.preheader, label %for.cond5.preheader, !llvm.loop !12 if.end35: ; preds = %if.end35.peel, %if.end35 %indvars.iv84 = phi i64 [ %indvars.iv.next85, %if.end35 ], [ 2, %if.end35.peel ] %putchar63 = call i32 @putchar(i32 32) %arrayidx37 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv84 %9 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp30.not.not = icmp slt i64 %indvars.iv84, %11 br i1 %cmp30.not.not, label %if.end35, label %for.end41, !llvm.loop !13 for.end41: ; preds = %if.end35, %entry, %for.cond2.preheader, %if.end35.peel, %for.cond29.preheader %sw.0.lcssa93 = phi i32 [ %sw.1.lcssa, %for.cond29.preheader ], [ %sw.1.lcssa, %if.end35.peel ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sw.1.lcssa, %if.end35 ] %putchar = call i32 @putchar(i32 10) %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sw.0.lcssa93) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 404, 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> void bubbleSort(int A[],int N){ int j,i,v,k,flag,cnt=0; flag = 1; for(i=0; i< N-1 ; i++){ for(j=N-1 ; j > i;j--){ if(A[j] < A[j-1]){ v=A[j - 1]; A[j-1]=A[j]; A[j]=v; cnt++; } } } for(k=0;k<N;k++){ printf("%d",A[k]); if(k<N-1)printf(" "); else printf("\n"); } printf("%d\n",cnt); } int main(){ int N, i; int A[100]; scanf("%d", &N); for ( i = 0; i < N; i++ ) scanf("%d", &A[i]); bubbleSort(A,N); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283352/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283352/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 { entry: %sub = add i32 %N, -1 %cmp63 = icmp sgt i32 %N, 1 br i1 %cmp63, label %for.cond2.preheader.preheader, label %for.cond22.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 %arrayidx.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 %1 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc19 %indvars.iv70 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next71, %for.inc19 ] %cnt.065 = phi i32 [ 0, %for.cond2.preheader.preheader ], [ %cnt.2, %for.inc19 ] %.pre = load i32, ptr %arrayidx.phi.trans.insert, align 4, !tbaa !5 br label %for.body4 for.cond22.preheader: ; preds = %for.inc19, %entry %cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.2, %for.inc19 ] %cmp2367 = icmp sgt i32 %N, 0 br i1 %cmp2367, label %for.body24.preheader, label %for.end35 for.body24.preheader: ; preds = %for.cond22.preheader %2 = zext i32 %sub to i64 %wide.trip.count76 = zext i32 %N to i64 br label %for.body24 for.body4: ; 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 ] %cnt.162 = phi i32 [ %cnt.065, %for.cond2.preheader ], [ %cnt.2, %for.inc ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx7 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next %4 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp8 = icmp slt i32 %3, %4 br i1 %cmp8, label %if.then, label %for.inc if.then: ; preds = %for.body4 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv store i32 %3, ptr %arrayidx7, align 4, !tbaa !5 store i32 %4, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %cnt.162, 1 br label %for.inc for.inc: ; preds = %for.body4, %if.then %5 = phi i32 [ %3, %if.then ], [ %4, %for.body4 ] %cnt.2 = phi i32 [ %inc, %if.then ], [ %cnt.162, %for.body4 ] %cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv70 br i1 %cmp3, label %for.body4, label %for.inc19, !llvm.loop !9 for.inc19: ; preds = %for.inc %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1 %exitcond.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count br i1 %exitcond.not, label %for.cond22.preheader, label %for.cond2.preheader, !llvm.loop !11 for.body24: ; preds = %for.body24.preheader, %for.body24 %indvars.iv73 = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next74, %for.body24 ] %arrayidx26 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv73 %6 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6) %cmp28 = icmp ult i64 %indvars.iv73, %2 %. = select i1 %cmp28, i32 32, i32 10 %putchar60 = tail call i32 @putchar(i32 %.) %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %exitcond77.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count76 br i1 %exitcond77.not, label %for.end35, label %for.body24, !llvm.loop !12 for.end35: ; preds = %for.body24, %for.cond22.preheader %call36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cnt.0.lcssa) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %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 !13 for.end: ; preds = %for.body %sub.i = add i32 %1, -1 %cmp63.i = icmp sgt i32 %1, 1 br i1 %cmp63.i, label %for.cond2.preheader.preheader.i, label %for.cond22.preheader.i for.cond2.preheader.preheader.i: ; preds = %for.end %3 = zext i32 %1 to i64 %4 = add nsw i64 %3, -1 %wide.trip.count.i = zext i32 %sub.i to i64 %arrayidx.phi.trans.insert.i = getelementptr inbounds i32, ptr %A, i64 %4 br label %for.cond2.preheader.i for.cond2.preheader.i: ; preds = %for.inc19.i, %for.cond2.preheader.preheader.i %indvars.iv70.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next71.i, %for.inc19.i ] %cnt.065.i = phi i32 [ 0, %for.cond2.preheader.preheader.i ], [ %cnt.2.i, %for.inc19.i ] %.pre.i = load i32, ptr %arrayidx.phi.trans.insert.i, align 4, !tbaa !5 br label %for.body4.i for.cond22.preheader.i: ; preds = %for.inc19.i, %for.end %cnt.0.lcssa.i = phi i32 [ 0, %for.end ], [ %cnt.2.i, %for.inc19.i ] %cmp2367.i = icmp sgt i32 %1, 0 br i1 %cmp2367.i, label %for.body24.preheader.i, label %bubbleSort.exit for.body24.preheader.i: ; preds = %for.cond22.preheader.i %5 = zext i32 %sub.i to i64 %wide.trip.count76.i = zext i32 %1 to i64 br label %for.body24.i for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i %6 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %8, %for.inc.i ] %indvars.iv.i = phi i64 [ %4, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %cnt.162.i = phi i32 [ %cnt.065.i, %for.cond2.preheader.i ], [ %cnt.2.i, %for.inc.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx7.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i %7 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5 %cmp8.i = icmp slt i32 %6, %7 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 %A, i64 %indvars.iv.i store i32 %6, ptr %arrayidx7.i, align 4, !tbaa !5 store i32 %7, ptr %arrayidx.i, align 4, !tbaa !5 %inc.i = add nsw i32 %cnt.162.i, 1 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body4.i %8 = phi i32 [ %6, %if.then.i ], [ %7, %for.body4.i ] %cnt.2.i = phi i32 [ %inc.i, %if.then.i ], [ %cnt.162.i, %for.body4.i ] %cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv70.i br i1 %cmp3.i, label %for.body4.i, label %for.inc19.i, !llvm.loop !9 for.inc19.i: ; preds = %for.inc.i %indvars.iv.next71.i = add nuw nsw i64 %indvars.iv70.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next71.i, %wide.trip.count.i br i1 %exitcond.not.i, label %for.cond22.preheader.i, label %for.cond2.preheader.i, !llvm.loop !11 for.body24.i: ; preds = %for.body24.i, %for.body24.preheader.i %indvars.iv73.i = phi i64 [ 0, %for.body24.preheader.i ], [ %indvars.iv.next74.i, %for.body24.i ] %arrayidx26.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv73.i %9 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %cmp28.i = icmp ult i64 %indvars.iv73.i, %5 %..i = select i1 %cmp28.i, i32 32, i32 10 %putchar60.i = call i32 @putchar(i32 %..i) %indvars.iv.next74.i = add nuw nsw i64 %indvars.iv73.i, 1 %exitcond77.not.i = icmp eq i64 %indvars.iv.next74.i, %wide.trip.count76.i br i1 %exitcond77.not.i, label %bubbleSort.exit, label %for.body24.i, !llvm.loop !12 bubbleSort.exit: ; preds = %for.body24.i, %entry, %for.cond22.preheader.i %cnt.0.lcssa.i17 = phi i32 [ %cnt.0.lcssa.i, %for.cond22.preheader.i ], [ 0, %entry ], [ %cnt.0.lcssa.i, %for.body24.i ] %call36.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cnt.0.lcssa.i17) 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: nofree nounwind declare noundef i32 @__isoc99_scanf(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} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int N,i,j,temp,cout=0; scanf("%d",&N); int A[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]){ temp=A[j-1]; A[j-1]=A[j]; A[j]=temp; cout++; } } } printf("%d",A[0]); for(i=1;i<N;i++){ printf(" %d",A[i]); } printf("\n"); printf("%d\n",cout); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283402/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283402/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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 %cmp61 = icmp sgt i32 %3, 0 br i1 %cmp61, label %for.body, label %for.end30 for.cond2.preheader: ; preds = %for.body %cmp365 = icmp sgt i32 %6, 1 br i1 %cmp365, label %for.cond6.preheader.preheader, label %for.end30 for.cond6.preheader.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %6, -1 %4 = zext i32 %6 to i64 %5 = add nsw i64 %4, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx10.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 %5 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 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 %6 = load i32, ptr %N, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28 %indvars.iv76 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next77, %for.inc28 ] %cout.066 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %cout.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 %8 = phi i32 [ %.pre, %for.cond6.preheader ], [ %10, %for.inc26 ] %indvars.iv73 = phi i64 [ %5, %for.cond6.preheader ], [ %indvars.iv.next74, %for.inc26 ] %cout.164 = phi i32 [ %cout.066, %for.cond6.preheader ], [ %cout.2, %for.inc26 ] %indvars.iv.next74 = add nsw i64 %indvars.iv73, -1 %arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next74 %9 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %cmp14 = icmp slt i32 %8, %9 br i1 %cmp14, label %if.then, label %for.inc26 if.then: ; preds = %for.body8 %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv73 store i32 %8, ptr %arrayidx13, align 4, !tbaa !5 store i32 %9, ptr %arrayidx10, align 4, !tbaa !5 %inc25 = add nsw i32 %cout.164, 1 br label %for.inc26 for.inc26: ; preds = %for.body8, %if.then %10 = phi i32 [ %8, %if.then ], [ %9, %for.body8 ] %cout.2 = phi i32 [ %inc25, %if.then ], [ %cout.164, %for.body8 ] %cmp7.not.not = icmp sgt i64 %indvars.iv.next74, %indvars.iv76 br i1 %cmp7.not.not, label %for.body8, label %for.inc28, !llvm.loop !11 for.inc28: ; preds = %for.inc26 %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %exitcond.not = icmp eq i64 %indvars.iv.next77, %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 %cout.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %cout.2, %for.inc28 ] %11 = load i32, ptr %vla, align 16, !tbaa !5 %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11) %12 = load i32, ptr %N, align 4, !tbaa !5 %cmp3469 = icmp sgt i32 %12, 1 br i1 %cmp3469, label %for.body35, label %for.end41 for.body35: ; preds = %for.end30, %for.body35 %indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body35 ], [ 1, %for.end30 ] %arrayidx37 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv79 %13 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13) %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1 %14 = load i32, ptr %N, align 4, !tbaa !5 %15 = sext i32 %14 to i64 %cmp34 = icmp slt i64 %indvars.iv.next80, %15 br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13 for.end41: ; preds = %for.body35, %for.end30 %putchar = call i32 @putchar(i32 10) %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cout.0.lcssa) 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 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} !13 = distinct !{!13, !10}
/*ALDS1_2_A:Bubble Sort*/ #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define N 100 int bubbleSort(int *A, int n); void swap(int *A, int x, int y); int main(void){ int n, i = 0, A[N] = {0}, sw; scanf("%d", &n); while(i < n) scanf("%d", &A[i++]); sw = bubbleSort(A, n); for( i = 0; i < n; i++){ if(i > 0) printf(" "); printf("%d", A[i]); } printf("\n%d\n", sw); return 0; } int bubbleSort(int *A, int n){ int sw = 0, i, j; for(i = 0; i < n-1; i++){ for(j = n-1; j > i; j--){ if(A[j] < A[j - 1]){ swap(A, j, j-1); sw++; } } } return sw; } void swap(int *A, int x, int y){ int temp; temp = A[x]; A[x] = A[y]; A[y] = temp; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283446/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283446/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #7 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #7 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 %cmp16 = icmp sgt i32 %0, 0 br i1 %cmp16, label %while.body, label %for.end while.body: ; preds = %entry, %while.body %indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %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 %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body %cmp26.i = icmp sgt i32 %1, 1 br i1 %cmp26.i, label %for.cond2.preheader.preheader.i, label %bubbleSort.exit for.cond2.preheader.preheader.i: ; preds = %while.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 %arrayidx.phi.trans.insert.i = getelementptr inbounds i32, ptr %A, i64 %4 br label %for.cond2.preheader.i for.cond2.preheader.i: ; preds = %for.inc10.i, %for.cond2.preheader.preheader.i %indvars.iv30.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next31.i, %for.inc10.i ] %sw.027.i = phi i32 [ 0, %for.cond2.preheader.preheader.i ], [ %sw.2.i, %for.inc10.i ] %.pre.i = load i32, ptr %arrayidx.phi.trans.insert.i, align 4, !tbaa !5 br label %for.body4.i for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i %5 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %7, %for.inc.i ] %indvars.iv.i = phi i64 [ %4, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %sw.124.i = phi i32 [ %sw.027.i, %for.cond2.preheader.i ], [ %sw.2.i, %for.inc.i ] %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %arrayidx7.i = getelementptr inbounds i32, ptr %A, 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 %A, 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 %sw.124.i, 1 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 ] %sw.2.i = phi i32 [ %inc.i, %if.then.i ], [ %sw.124.i, %for.body4.i ] %cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv30.i br i1 %cmp3.i, label %for.body4.i, label %for.inc10.i, !llvm.loop !11 for.inc10.i: ; preds = %for.inc.i %indvars.iv.next31.i = add nuw nsw i64 %indvars.iv30.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next31.i, %wide.trip.count.i br i1 %exitcond.not.i, label %bubbleSort.exit, label %for.cond2.preheader.i, !llvm.loop !12 bubbleSort.exit: ; preds = %for.inc10.i, %while.end %sw.0.lcssa.i = phi i32 [ 0, %while.end ], [ %sw.2.i, %for.inc10.i ] %cmp318 = icmp sgt i32 %1, 0 br i1 %cmp318, label %if.end.peel, label %for.end if.end.peel: ; preds = %bubbleSort.exit %.pre = load i32, ptr %A, align 16, !tbaa !5 %call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp3.peel = icmp sgt i32 %8, 1 br i1 %cmp3.peel, label %if.end, label %for.end if.end: ; preds = %if.end.peel, %if.end %indvars.iv22 = phi i64 [ %indvars.iv.next23, %if.end ], [ 1, %if.end.peel ] %putchar = call i32 @putchar(i32 32) %arrayidx7 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv22 %9 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp3 = icmp slt i64 %indvars.iv.next23, %11 br i1 %cmp3, label %if.end, label %for.end, !llvm.loop !13 for.end: ; preds = %if.end, %entry, %if.end.peel, %bubbleSort.exit %sw.0.lcssa.i29 = phi i32 [ %sw.0.lcssa.i, %bubbleSort.exit ], [ %sw.0.lcssa.i, %if.end.peel ], [ 0, %entry ], [ %sw.0.lcssa.i, %if.end ] %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sw.0.lcssa.i29) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 %A, i32 noundef %n) local_unnamed_addr #4 { entry: %cmp26 = icmp sgt i32 %n, 1 br i1 %cmp26, label %for.cond2.preheader.preheader, label %for.end12 for.cond2.preheader.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 %0 = zext i32 %n to i64 %1 = add nsw i64 %0, -1 %wide.trip.count = zext i32 %sub to i64 %arrayidx.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 %1 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc10 %indvars.iv30 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next31, %for.inc10 ] %sw.027 = phi i32 [ 0, %for.cond2.preheader.preheader ], [ %sw.2, %for.inc10 ] %.pre = load i32, ptr %arrayidx.phi.trans.insert, align 4, !tbaa !5 br label %for.body4 for.body4: ; preds = %for.cond2.preheader, %for.inc %2 = phi i32 [ %.pre, %for.cond2.preheader ], [ %4, %for.inc ] %indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ] %sw.124 = phi i32 [ %sw.027, %for.cond2.preheader ], [ %sw.2, %for.inc ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx7 = getelementptr inbounds i32, ptr %A, 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 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv store i32 %3, ptr %arrayidx, align 4, !tbaa !5 store i32 %2, ptr %arrayidx7, align 4, !tbaa !5 %inc = add nsw i32 %sw.124, 1 br label %for.inc for.inc: ; preds = %for.body4, %if.then %4 = phi i32 [ %2, %if.then ], [ %3, %for.body4 ] %sw.2 = phi i32 [ %inc, %if.then ], [ %sw.124, %for.body4 ] %cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv30 br i1 %cmp3, label %for.body4, label %for.inc10, !llvm.loop !11 for.inc10: ; preds = %for.inc %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1 %exitcond.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count br i1 %exitcond.not, label %for.end12, label %for.cond2.preheader, !llvm.loop !12 for.end12: ; preds = %for.inc10, %entry %sw.0.lcssa = phi i32 [ 0, %entry ], [ %sw.2, %for.inc10 ] ret i32 %sw.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 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %A, i32 noundef %x, i32 noundef %y) local_unnamed_addr #5 { entry: %idxprom = sext i32 %x to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom1 = sext i32 %y to i64 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %idxprom1 %1 = load i32, ptr %arrayidx2, align 4, !tbaa !5 store i32 %1, ptr %arrayidx, align 4, !tbaa !5 store i32 %0, ptr %arrayidx2, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { 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 = { 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 #6 = { nofree nounwind } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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> #define int long long int main() { int t; scanf("%lld",&t); for(int ii=1;ii<=t;ii++) { int n,a,b,c,d; scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d); if((c-d) <=n*(a+b) && (c+d)>=n*(a-b)) {printf("Yes\n");continue;} printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28349/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28349/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.1 = private unnamed_addr constant [25 x i8] c"%lld %lld %lld %lld %lld\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 i64 @main() local_unnamed_addr #0 { entry: %t = alloca i64, align 8 %n = alloca i64, align 8 %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 %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 %cmp.not17 = icmp slt i64 %0, 1 br i1 %cmp.not17, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %cleanup, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4 ret i64 0 for.body: ; preds = %entry, %cleanup %ii.018 = phi i64 [ %inc, %cleanup ], [ 1, %entry ] call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %c, align 8, !tbaa !5 %2 = load i64, ptr %d, align 8, !tbaa !5 %sub = sub nsw i64 %1, %2 %3 = load i64, ptr %n, align 8, !tbaa !5 %4 = load i64, ptr %a, align 8, !tbaa !5 %5 = load i64, ptr %b, align 8, !tbaa !5 %add = add nsw i64 %5, %4 %mul = mul nsw i64 %add, %3 %cmp2.not = icmp sgt i64 %sub, %mul br i1 %cmp2.not, label %if.end, label %land.lhs.true land.lhs.true: ; preds = %for.body %add3 = add nsw i64 %2, %1 %sub4 = sub nsw i64 %4, %5 %mul5 = mul nsw i64 %sub4, %3 %cmp6.not = icmp slt i64 %add3, %mul5 br i1 %cmp6.not, label %if.end, label %cleanup if.end: ; preds = %land.lhs.true, %for.body br label %cleanup cleanup: ; preds = %land.lhs.true, %if.end %str.sink = phi ptr [ @str, %if.end ], [ @str.4, %land.lhs.true ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) 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 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 %inc = add nuw nsw i64 %ii.018, 1 %6 = load i64, ptr %t, align 8, !tbaa !5 %cmp.not.not = icmp slt i64 %ii.018, %6 br i1 %cmp.not.not, 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 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main() { int d; int l; scanf("%d %d", &d, &l); printf("%d\n", d / l + d % l); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283547/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283547/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call1 = 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> int main(void) { int D,L,g; scanf("%d %d",&D,&L); g=D/L+D%L; printf("%d\n",g); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283590/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283590/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call1 = 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> #include <stdlib.h> #define rep(i,l,n) for(int i=l;i<n;i++) struct relation{ int num; struct relation *next; }; struct person{ int group; // 所属するグループの親番号, 親であればそのグループのサイズ*(-1) struct relation *friends; struct relation *block; }; int insert(struct person*,int,int,int); int unit(struct person*,int,int); int find(struct person*,int); int same(struct person*,int,int); int main(){ int N,M,K; scanf("%d %d %d",&N,&M,&K); struct person *data = (struct person*)malloc(sizeof(struct person)*N); rep(i,0,N){ (data+i)->group = -1; (data+i)->friends = (struct relation*)malloc(sizeof(struct relation)); ((data+i)->friends)->num = i; ((data+i)->friends)->next = NULL; (data+i)->block = (struct relation*)malloc(sizeof(struct relation)); ((data+i)->block)->num = i; ((data+i)->block)->next = NULL; } rep(i,0,M){ int a,b; scanf("%d %d",&a,&b); a--; b--; insert(data,a,b,0); if(same(data,a,b)==0) unit(data,a,b); } rep(i,0,K){ int a,b; scanf("%d %d",&a,&b); a--; b--; insert(data,a,b,1); } rep(i,0,N){ int a = find(data,i); int count = -(data+a)->group; struct relation *data1 = (data+i)->friends; while( data1 != NULL ){ if( same(data,i,data1->num) ) count--; data1 = data1->next; } data1 = (data+i)->block; while( data1 != NULL ){ if( same(data,i,data1->num) ) count--; data1 = data1->next; } printf("%d ",count+1); } return 0; } /* int insert(struct person *data0,int a,int b,int c){ struct relation *data1; if( c==0 ) data1 = (data0+a)->friends; else data1 = (data0+a)->block; while( data1->next != NULL ) data1 = data1->next; data1->next = (struct relation*)malloc(sizeof(struct relation)); (data1->next)->num = b; (data1->next)->next = NULL; data1 = (data0+b)->friends; while( data1->next != NULL ) data1 = data1->next; data1->next = (struct relation*)malloc(sizeof(struct relation)); (data1->next)->num = a; (data1->next)->next = NULL; return 0; }*/ int insert(struct person *data0,int a,int b,int c){ struct relation *data1; if( c==0 ){ data1 = (data0+a)->friends; (data0+a)->friends = (struct relation*)malloc(sizeof(struct relation)); ((data0+a)->friends)->num = b; ((data0+a)->friends)->next = data1; data1 = (data0+b)->friends; (data0+b)->friends = (struct relation*)malloc(sizeof(struct relation)); ((data0+b)->friends)->num = a; ((data0+b)->friends)->next = data1; }else{ data1 = (data0+a)->block; (data0+a)->block = (struct relation*)malloc(sizeof(struct relation)); ((data0+a)->block)->num = b; ((data0+a)->block)->next = data1; data1 = (data0+b)->block; (data0+b)->block = (struct relation*)malloc(sizeof(struct relation)); ((data0+b)->block)->num = a; ((data0+b)->block)->next = data1; } return 0; } int unit(struct person *data,int a,int b){ int *data1 = &(data+a)->group; int *data2 = &(data+b)->group; if( *data1 >= 0 ){ // data+a が子 int c = find(data,a); return unit(data,c,b); } if( *data2 >= 0 ){ // data+b が子 int c = find(data,b); return unit(data,a,c); } // 両方親 if( *data1 < *data2 ){ // aの方がサイズが大きい *data1 += *data2; *data2 = a; return 0; } *data2 += *data1; *data1 = b; return 0; } int find(struct person *data,int a){ // data+aの親番号を返却 if( (data+a)->group < 0 ) return a; (data+a)->group = find(data,(data+a)->group); return (data+a)->group; } int same(struct person *data,int a,int b){ if( find(data,a)==find(data,b) ) return 1; return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283633/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283633/source.c" target datalayout = "e-m:e-p270: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.person = type { i32, ptr, ptr } %struct.relation = type { i32, ptr } @.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: %N = alloca i32, align 4 %M = alloca i32, align 4 %K = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %a45 = alloca i32, align 4 %b46 = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %K) %0 = load i32, ptr %N, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = mul nsw i64 %conv, 24 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp169 = icmp sgt i32 %0, 0 br i1 %cmp169, label %for.body.preheader, label %for.cond24.preheader for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %0 to i64 br label %for.body for.cond24.preheader: ; preds = %for.body, %entry %1 = load i32, ptr %M, align 4, !tbaa !5 %cmp25186 = icmp sgt i32 %1, 0 br i1 %cmp25186, label %for.body28, label %for.cond40.preheader for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %add.ptr = getelementptr inbounds %struct.person, ptr %call1, i64 %indvars.iv store i32 -1, ptr %add.ptr, align 8, !tbaa !9 %call3 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 %friends = getelementptr inbounds %struct.person, ptr %call1, i64 %indvars.iv, i32 1 store ptr %call3, ptr %friends, align 8, !tbaa !12 %2 = trunc i64 %indvars.iv to i32 store i32 %2, ptr %call3, align 8, !tbaa !13 %next = getelementptr inbounds %struct.relation, ptr %call3, i64 0, i32 1 store ptr null, ptr %next, align 8, !tbaa !15 %call12 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 %block = getelementptr inbounds %struct.person, ptr %call1, i64 %indvars.iv, i32 2 store ptr %call12, ptr %block, align 8, !tbaa !16 store i32 %2, ptr %call12, align 8, !tbaa !13 %next22 = getelementptr inbounds %struct.relation, ptr %call12, i64 0, i32 1 store ptr null, ptr %next22, align 8, !tbaa !15 %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.cond24.preheader, label %for.body, !llvm.loop !17 for.cond40.preheader: ; preds = %if.end, %for.cond24.preheader %3 = load i32, ptr %K, align 4, !tbaa !5 %cmp41188 = icmp sgt i32 %3, 0 br i1 %cmp41188, label %for.body44, label %for.cond55.preheader for.body28: ; preds = %for.cond24.preheader, %if.end %i23.0187 = phi i32 [ %inc37, %if.end ], [ 0, %for.cond24.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6 %call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %4 = load i32, ptr %a, align 4, !tbaa !5 %dec = add nsw i32 %4, -1 %5 = load i32, ptr %b, align 4, !tbaa !5 %dec30 = add nsw i32 %5, -1 %idx.ext.i = sext i32 %dec to i64 %idx.ext10.i = sext i32 %dec30 to i64 %friends.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext.i, i32 1 %6 = load ptr, ptr %friends.i, align 8, !tbaa !12 %call.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call.i, ptr %friends.i, align 8, !tbaa !12 store i32 %dec30, ptr %call.i, align 8, !tbaa !13 %next.i = getelementptr inbounds %struct.relation, ptr %call.i, i64 0, i32 1 store ptr %6, ptr %next.i, align 8, !tbaa !15 %friends12.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext10.i, i32 1 %7 = load ptr, ptr %friends12.i, align 8, !tbaa !12 %call13.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call13.i, ptr %friends12.i, align 8, !tbaa !12 store i32 %dec, ptr %call13.i, align 8, !tbaa !13 %next53.i = getelementptr inbounds %struct.relation, ptr %call13.i, i64 0, i32 1 store ptr %7, ptr %next53.i, align 8, !tbaa !15 %call.i137 = call i32 @find(ptr noundef %call1, i32 noundef %dec) %call1.i = call i32 @find(ptr noundef %call1, i32 noundef %dec30) %cmp.i.not = icmp eq i32 %call.i137, %call1.i br i1 %cmp.i.not, label %if.end, label %tailrecurse.outer.i tailrecurse.outer.i: ; preds = %for.body28, %if.then.i %a.tr.ph.i = phi i32 [ %call.i140, %if.then.i ], [ %dec, %for.body28 ] %b.tr.ph.i = phi i32 [ %b.tr.lcssa.i, %if.then.i ], [ %dec30, %for.body28 ] %idx.ext.i138 = sext i32 %a.tr.ph.i to i64 %add.ptr.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext.i138 %8 = load i32, ptr %add.ptr.i, align 4, !tbaa !5 %cmp47.i = icmp sgt i32 %8, -1 br i1 %cmp47.i, label %if.then.i, label %if.end.preheader.i if.end.preheader.i: ; preds = %tailrecurse.outer.i %idx.ext1.pn.peel.i = sext i32 %b.tr.ph.i to i64 %add.ptr251.peel.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext1.pn.peel.i %9 = load i32, ptr %add.ptr251.peel.i, align 4, !tbaa !5 %cmp5.peel.i = icmp sgt i32 %9, -1 br i1 %cmp5.peel.i, label %if.then6.peel.i, label %if.end10.i if.then6.peel.i: ; preds = %if.end.preheader.i %call8.peel.i = call i32 @find(ptr noundef nonnull %call1, i32 noundef %b.tr.ph.i) %10 = load i32, ptr %add.ptr.i, align 4, !tbaa !5 %cmp.peel.i = icmp sgt i32 %10, -1 br i1 %cmp.peel.i, label %if.then.i, label %if.end.i.preheader if.end.i.preheader: ; preds = %if.then6.peel.i %idx.ext1.pn.i171 = sext i32 %call8.peel.i to i64 %add.ptr251.i172 = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext1.pn.i171 %11 = load i32, ptr %add.ptr251.i172, align 4, !tbaa !5 %cmp5.i173 = icmp sgt i32 %11, -1 br i1 %cmp5.i173, label %if.then6.i, label %if.end10.i if.then.i: ; preds = %if.then6.i, %if.then6.peel.i, %tailrecurse.outer.i %b.tr.lcssa.i = phi i32 [ %b.tr.ph.i, %tailrecurse.outer.i ], [ %call8.peel.i, %if.then6.peel.i ], [ %call8.i, %if.then6.i ] %call.i140 = call i32 @find(ptr noundef nonnull %call1, i32 noundef %a.tr.ph.i) br label %tailrecurse.outer.i if.end.i: ; preds = %if.then6.i %idx.ext1.pn.i = sext i32 %call8.i to i64 %add.ptr251.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext1.pn.i %12 = load i32, ptr %add.ptr251.i, align 4, !tbaa !5 %cmp5.i = icmp sgt i32 %12, -1 br i1 %cmp5.i, label %if.then6.i, label %if.end10.i, !llvm.loop !19 if.then6.i: ; preds = %if.end.i.preheader, %if.end.i %b.tr48.i174 = phi i32 [ %call8.i, %if.end.i ], [ %call8.peel.i, %if.end.i.preheader ] %call8.i = call i32 @find(ptr noundef nonnull %call1, i32 noundef %b.tr48.i174) %13 = load i32, ptr %add.ptr.i, align 4, !tbaa !5 %cmp.i139 = icmp sgt i32 %13, -1 br i1 %cmp.i139, label %if.then.i, label %if.end.i, !llvm.loop !19 if.end10.i: ; preds = %if.end.preheader.i, %if.end.i.preheader, %if.end.i %.lcssa59.i = phi i32 [ %13, %if.end.i ], [ %10, %if.end.i.preheader ], [ %8, %if.end.preheader.i ] %b.tr48.lcssa.i = phi i32 [ %call8.i, %if.end.i ], [ %call8.peel.i, %if.end.i.preheader ], [ %b.tr.ph.i, %if.end.preheader.i ] %add.ptr251.lcssa.i = phi ptr [ %add.ptr251.i, %if.end.i ], [ %add.ptr251.i172, %if.end.i.preheader ], [ %add.ptr251.peel.i, %if.end.preheader.i ] %.lcssa.i = phi i32 [ %12, %if.end.i ], [ %11, %if.end.i.preheader ], [ %9, %if.end.preheader.i ] %cmp11.i = icmp ult i32 %.lcssa59.i, %.lcssa.i %add.i = add nsw i32 %.lcssa.i, %.lcssa59.i br i1 %cmp11.i, label %if.then12.i, label %if.end13.i if.then12.i: ; preds = %if.end10.i store i32 %add.i, ptr %add.ptr.i, align 4, !tbaa !5 store i32 %a.tr.ph.i, ptr %add.ptr251.lcssa.i, align 4, !tbaa !5 br label %if.end if.end13.i: ; preds = %if.end10.i store i32 %add.i, ptr %add.ptr251.lcssa.i, align 4, !tbaa !5 store i32 %b.tr48.lcssa.i, ptr %add.ptr.i, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.end13.i, %if.then12.i, %for.body28 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6 %inc37 = add nuw nsw i32 %i23.0187, 1 %14 = load i32, ptr %M, align 4, !tbaa !5 %cmp25 = icmp slt i32 %inc37, %14 br i1 %cmp25, label %for.body28, label %for.cond40.preheader, !llvm.loop !21 for.cond55.preheader: ; preds = %for.body44, %for.cond40.preheader %15 = load i32, ptr %N, align 4, !tbaa !5 %cmp56200 = icmp sgt i32 %15, 0 br i1 %cmp56200, label %for.body59, label %for.cond.cleanup58 for.body44: ; preds = %for.cond40.preheader, %for.body44 %i39.0189 = phi i32 [ %inc52, %for.body44 ], [ 0, %for.cond40.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a45) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b46) #6 %call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a45, ptr noundef nonnull %b46) %16 = load i32, ptr %a45, align 4, !tbaa !5 %dec48 = add nsw i32 %16, -1 %17 = load i32, ptr %b46, align 4, !tbaa !5 %dec49 = add nsw i32 %17, -1 %idx.ext.i141 = sext i32 %dec48 to i64 %idx.ext10.i142 = sext i32 %dec49 to i64 %block.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext.i141, i32 2 %18 = load ptr, ptr %block.i, align 8, !tbaa !16 %call27.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call27.i, ptr %block.i, align 8, !tbaa !16 store i32 %dec49, ptr %call27.i, align 8, !tbaa !13 %next38.i = getelementptr inbounds %struct.relation, ptr %call27.i, i64 0, i32 1 store ptr %18, ptr %next38.i, align 8, !tbaa !15 %block41.i = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext10.i142, i32 2 %19 = load ptr, ptr %block41.i, align 8, !tbaa !16 %call42.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call42.i, ptr %block41.i, align 8, !tbaa !16 store i32 %dec48, ptr %call42.i, align 8, !tbaa !13 %next53.i144 = getelementptr inbounds %struct.relation, ptr %call42.i, i64 0, i32 1 store ptr %19, ptr %next53.i144, align 8, !tbaa !15 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b46) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a45) #6 %inc52 = add nuw nsw i32 %i39.0189, 1 %20 = load i32, ptr %K, align 4, !tbaa !5 %cmp41 = icmp slt i32 %inc52, %20 br i1 %cmp41, label %for.body44, label %for.cond55.preheader, !llvm.loop !22 for.cond.cleanup58: ; preds = %while.end90, %for.cond55.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6 ret i32 0 for.body59: ; preds = %for.cond55.preheader, %while.end90 %indvars.iv211 = phi i64 [ %indvars.iv.next212, %while.end90 ], [ 0, %for.cond55.preheader ] %21 = trunc i64 %indvars.iv211 to i32 %call61 = call i32 @find(ptr noundef %call1, i32 noundef %21) %idx.ext62 = sext i32 %call61 to i64 %add.ptr63 = getelementptr inbounds %struct.person, ptr %call1, i64 %idx.ext62 %22 = load i32, ptr %add.ptr63, align 8, !tbaa !9 %sub = sub nsw i32 0, %22 %friends67 = getelementptr inbounds %struct.person, ptr %call1, i64 %indvars.iv211, i32 1 %data1.0190 = load ptr, ptr %friends67, align 8, !tbaa !23 %cmp68.not191 = icmp eq ptr %data1.0190, null br i1 %cmp68.not191, label %while.end, label %while.body while.body: ; preds = %for.body59, %while.body %data1.0193 = phi ptr [ %data1.0, %while.body ], [ %data1.0190, %for.body59 ] %count.0192 = phi i32 [ %spec.select, %while.body ], [ %sub, %for.body59 ] %23 = load i32, ptr %data1.0193, align 8, !tbaa !13 %call.i145 = call i32 @find(ptr noundef %call1, i32 noundef %21) %call1.i146 = call i32 @find(ptr noundef %call1, i32 noundef %23) %cmp.i147.not = icmp eq i32 %call.i145, %call1.i146 %dec73 = sext i1 %cmp.i147.not to i32 %spec.select = add nsw i32 %count.0192, %dec73 %next75 = getelementptr inbounds %struct.relation, ptr %data1.0193, i64 0, i32 1 %data1.0 = load ptr, ptr %next75, align 8, !tbaa !23 %cmp68.not = icmp eq ptr %data1.0, null br i1 %cmp68.not, label %while.end, label %while.body, !llvm.loop !24 while.end: ; preds = %while.body, %for.body59 %count.0.lcssa = phi i32 [ %sub, %for.body59 ], [ %spec.select, %while.body ] %block78 = getelementptr inbounds %struct.person, ptr %call1, i64 %indvars.iv211, i32 2 %data1.1195 = load ptr, ptr %block78, align 8, !tbaa !23 %cmp80.not196 = icmp eq ptr %data1.1195, null br i1 %cmp80.not196, label %while.end90, label %while.body82 while.body82: ; preds = %while.end, %while.body82 %data1.1198 = phi ptr [ %data1.1, %while.body82 ], [ %data1.1195, %while.end ] %count.2197 = phi i32 [ %spec.select136, %while.body82 ], [ %count.0.lcssa, %while.end ] %24 = load i32, ptr %data1.1198, align 8, !tbaa !13 %call.i149 = call i32 @find(ptr noundef %call1, i32 noundef %21) %call1.i150 = call i32 @find(ptr noundef %call1, i32 noundef %24) %cmp.i151.not = icmp eq i32 %call.i149, %call1.i150 %dec87 = sext i1 %cmp.i151.not to i32 %spec.select136 = add nsw i32 %count.2197, %dec87 %next89 = getelementptr inbounds %struct.relation, ptr %data1.1198, i64 0, i32 1 %data1.1 = load ptr, ptr %next89, align 8, !tbaa !23 %cmp80.not = icmp eq ptr %data1.1, null br i1 %cmp80.not, label %while.end90, label %while.body82, !llvm.loop !25 while.end90: ; preds = %while.body82, %while.end %count.2.lcssa = phi i32 [ %count.0.lcssa, %while.end ], [ %spec.select136, %while.body82 ] %add = add nsw i32 %count.2.lcssa, 1 %call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add) %indvars.iv.next212 = add nuw nsw i64 %indvars.iv211, 1 %25 = load i32, ptr %N, align 4, !tbaa !5 %26 = sext i32 %25 to i64 %cmp56 = icmp slt i64 %indvars.iv.next212, %26 br i1 %cmp56, label %for.body59, label %for.cond.cleanup58, !llvm.loop !26 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: readwrite) uwtable define dso_local i32 @insert(ptr nocapture noundef %data0, i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #4 { entry: %cmp = icmp eq i32 %c, 0 %idx.ext = sext i32 %a to i64 %idx.ext10 = sext i32 %b to i64 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %friends = getelementptr inbounds %struct.person, ptr %data0, i64 %idx.ext, i32 1 %0 = load ptr, ptr %friends, align 8, !tbaa !12 %call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call, ptr %friends, align 8, !tbaa !12 store i32 %b, ptr %call, align 8, !tbaa !13 %next = getelementptr inbounds %struct.relation, ptr %call, i64 0, i32 1 store ptr %0, ptr %next, align 8, !tbaa !15 %friends12 = getelementptr inbounds %struct.person, ptr %data0, i64 %idx.ext10, i32 1 %1 = load ptr, ptr %friends12, align 8, !tbaa !12 %call13 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call13, ptr %friends12, align 8, !tbaa !12 br label %if.end if.else: ; preds = %entry %block = getelementptr inbounds %struct.person, ptr %data0, i64 %idx.ext, i32 2 %2 = load ptr, ptr %block, align 8, !tbaa !16 %call27 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call27, ptr %block, align 8, !tbaa !16 store i32 %b, ptr %call27, align 8, !tbaa !13 %next38 = getelementptr inbounds %struct.relation, ptr %call27, i64 0, i32 1 store ptr %2, ptr %next38, align 8, !tbaa !15 %block41 = getelementptr inbounds %struct.person, ptr %data0, i64 %idx.ext10, i32 2 %3 = load ptr, ptr %block41, align 8, !tbaa !16 %call42 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7 store ptr %call42, ptr %block41, align 8, !tbaa !16 br label %if.end if.end: ; preds = %if.else, %if.then %call42.sink90 = phi ptr [ %call42, %if.else ], [ %call13, %if.then ] %.sink = phi ptr [ %3, %if.else ], [ %1, %if.then ] store i32 %a, ptr %call42.sink90, align 8, !tbaa !13 %next53 = getelementptr inbounds %struct.relation, ptr %call42.sink90, i64 0, i32 1 store ptr %.sink, ptr %next53, align 8, !tbaa !15 ret i32 0 } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @same(ptr nocapture noundef %data, i32 noundef %a, i32 noundef %b) local_unnamed_addr #5 { entry: %call = tail call i32 @find(ptr noundef %data, i32 noundef %a) %call1 = tail call i32 @find(ptr noundef %data, i32 noundef %b) %cmp = icmp eq i32 %call, %call1 %. = zext i1 %cmp to i32 ret i32 %. } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @unit(ptr nocapture noundef %data, i32 noundef %a, i32 noundef %b) local_unnamed_addr #5 { entry: br label %tailrecurse.outer tailrecurse.outer: ; preds = %if.then, %entry %a.tr.ph = phi i32 [ %call, %if.then ], [ %a, %entry ] %b.tr.ph = phi i32 [ %b.tr.lcssa, %if.then ], [ %b, %entry ] %idx.ext = sext i32 %a.tr.ph to i64 %add.ptr = getelementptr inbounds %struct.person, ptr %data, i64 %idx.ext %0 = load i32, ptr %add.ptr, align 4, !tbaa !5 %cmp47 = icmp sgt i32 %0, -1 br i1 %cmp47, label %if.then, label %if.end.preheader if.end.preheader: ; preds = %tailrecurse.outer %idx.ext1.pn.peel = sext i32 %b.tr.ph to i64 %add.ptr251.peel = getelementptr inbounds %struct.person, ptr %data, i64 %idx.ext1.pn.peel %1 = load i32, ptr %add.ptr251.peel, align 4, !tbaa !5 %cmp5.peel = icmp sgt i32 %1, -1 br i1 %cmp5.peel, label %if.then6.peel, label %if.end10 if.then6.peel: ; preds = %if.end.preheader %call8.peel = tail call i32 @find(ptr noundef nonnull %data, i32 noundef %b.tr.ph) %2 = load i32, ptr %add.ptr, align 4, !tbaa !5 %cmp.peel = icmp sgt i32 %2, -1 br i1 %cmp.peel, label %if.then, label %if.end.preheader90 if.end.preheader90: ; preds = %if.then6.peel %idx.ext1.pn110 = sext i32 %call8.peel to i64 %add.ptr251111 = getelementptr inbounds %struct.person, ptr %data, i64 %idx.ext1.pn110 %3 = load i32, ptr %add.ptr251111, align 4, !tbaa !5 %cmp5112 = icmp sgt i32 %3, -1 br i1 %cmp5112, label %if.then6, label %if.end10 if.then: ; preds = %if.then6, %if.then6.peel, %tailrecurse.outer %b.tr.lcssa = phi i32 [ %b.tr.ph, %tailrecurse.outer ], [ %call8.peel, %if.then6.peel ], [ %call8, %if.then6 ] %call = tail call i32 @find(ptr noundef nonnull %data, i32 noundef %a.tr.ph) br label %tailrecurse.outer if.end: ; preds = %if.then6 %idx.ext1.pn = sext i32 %call8 to i64 %add.ptr251 = getelementptr inbounds %struct.person, ptr %data, i64 %idx.ext1.pn %4 = load i32, ptr %add.ptr251, align 4, !tbaa !5 %cmp5 = icmp sgt i32 %4, -1 br i1 %cmp5, label %if.then6, label %if.end10, !llvm.loop !19 if.then6: ; preds = %if.end.preheader90, %if.end %b.tr48113 = phi i32 [ %call8, %if.end ], [ %call8.peel, %if.end.preheader90 ] %call8 = tail call i32 @find(ptr noundef nonnull %data, i32 noundef %b.tr48113) %5 = load i32, ptr %add.ptr, align 4, !tbaa !5 %cmp = icmp sgt i32 %5, -1 br i1 %cmp, label %if.then, label %if.end, !llvm.loop !19 if.end10: ; preds = %if.end.preheader, %if.end.preheader90, %if.end %.lcssa59 = phi i32 [ %5, %if.end ], [ %0, %if.end.preheader ], [ %2, %if.end.preheader90 ] %b.tr48.lcssa = phi i32 [ %call8, %if.end ], [ %b.tr.ph, %if.end.preheader ], [ %call8.peel, %if.end.preheader90 ] %add.ptr251.lcssa = phi ptr [ %add.ptr251, %if.end ], [ %add.ptr251.peel, %if.end.preheader ], [ %add.ptr251111, %if.end.preheader90 ] %.lcssa = phi i32 [ %4, %if.end ], [ %1, %if.end.preheader ], [ %3, %if.end.preheader90 ] %cmp11 = icmp ult i32 %.lcssa59, %.lcssa %add = add nsw i32 %.lcssa, %.lcssa59 br i1 %cmp11, label %if.then12, label %if.end13 if.then12: ; preds = %if.end10 store i32 %add, ptr %add.ptr, align 4, !tbaa !5 store i32 %a.tr.ph, ptr %add.ptr251.lcssa, align 4, !tbaa !5 br label %cleanup if.end13: ; preds = %if.end10 store i32 %add, ptr %add.ptr251.lcssa, align 4, !tbaa !5 store i32 %b.tr48.lcssa, ptr %add.ptr, align 4, !tbaa !5 br label %cleanup cleanup: ; preds = %if.end13, %if.then12 ret i32 0 } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @find(ptr nocapture noundef %data, i32 noundef %a) local_unnamed_addr #5 { entry: %idx.ext = sext i32 %a to i64 %add.ptr = getelementptr inbounds %struct.person, ptr %data, i64 %idx.ext %0 = load i32, ptr %add.ptr, align 8, !tbaa !9 %cmp = icmp slt i32 %0, 0 br i1 %cmp, label %common.ret18, label %if.end common.ret18: ; preds = %entry, %if.end %common.ret18.op = phi i32 [ %call, %if.end ], [ %a, %entry ] ret i32 %common.ret18.op if.end: ; preds = %entry %call = tail call i32 @find(ptr noundef nonnull %data, i32 noundef %0) store i32 %call, ptr %add.ptr, align 8, !tbaa !9 br label %common.ret18 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: 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 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 #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, !6, i64 0} !10 = !{!"person", !6, i64 0, !11, i64 8, !11, i64 16} !11 = !{!"any pointer", !7, i64 0} !12 = !{!10, !11, i64 8} !13 = !{!14, !6, i64 0} !14 = !{!"relation", !6, i64 0, !11, i64 8} !15 = !{!14, !11, i64 8} !16 = !{!10, !11, i64 16} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"} !19 = distinct !{!19, !20} !20 = !{!"llvm.loop.peeled.count", i32 1} !21 = distinct !{!21, !18} !22 = distinct !{!22, !18} !23 = !{!11, !11, i64 0} !24 = distinct !{!24, !18} !25 = distinct !{!25, !18} !26 = distinct !{!26, !18}
# include"stdio.h" int main(){ int w,a,b; scanf("%d %d %d",&w,&a,&b); if(a==b) printf("0\n"); if(a>b){ b+=w; if(a-b>0) printf("%d\n",a-b); else printf("0\n"); } if(a<b){ a+=w; if(b-a>0) printf("%d\n",b-a); else printf("0\n"); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283684/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283684/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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.4 = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %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 eq i32 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) %.pre = load i32, ptr %a, align 4, !tbaa !5 %.pre26 = load i32, ptr %b, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i32 [ %.pre26, %if.then ], [ %1, %entry ] %3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ] %cmp2 = icmp sgt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.end10 if.then3: ; preds = %if.end %4 = load i32, ptr %w, align 4, !tbaa !5 %add = add nsw i32 %4, %2 store i32 %add, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %3, %add %cmp4 = icmp sgt i32 %sub, 0 br i1 %cmp4, label %if.then5, label %if.else if.then5: ; preds = %if.then3 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub) br label %if.end10 if.else: ; preds = %if.then3 %puts24 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end10 if.end10: ; preds = %if.then5, %if.else, %if.end %5 = load i32, ptr %a, align 4, !tbaa !5 %6 = load i32, ptr %b, align 4, !tbaa !5 %cmp11 = icmp slt i32 %5, %6 br i1 %cmp11, label %if.then12, label %if.end22 if.then12: ; preds = %if.end10 %7 = load i32, ptr %w, align 4, !tbaa !5 %add13 = add nsw i32 %7, %5 store i32 %add13, ptr %a, align 4, !tbaa !5 %sub14 = sub nsw i32 %6, %add13 %cmp15 = icmp sgt i32 %sub14, 0 br i1 %cmp15, label %if.then16, label %if.else19 if.then16: ; preds = %if.then12 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub14) br label %if.end22 if.else19: ; preds = %if.then12 %puts25 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end22 if.end22: ; preds = %if.then16, %if.else19, %if.end10 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 width, point_a, point_b; scanf("%d %d %d", &width, &point_a, &point_b); if(point_a > point_b) { int temp = point_a; point_a = point_b; point_b = temp; } if(point_a + width >= point_b) { printf("0\n"); } else { printf("%d\n", point_b - width - point_a); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283727/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283727/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = 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: %width = alloca i32, align 4 %point_a = alloca i32, align 4 %point_b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %width) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %point_a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %point_b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %width, ptr noundef nonnull %point_a, ptr noundef nonnull %point_b) %0 = load i32, ptr %point_a, align 4, !tbaa !5 %1 = load i32, ptr %point_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 %point_a, align 4, !tbaa !5 store i32 %0, ptr %point_b, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i32 [ %0, %if.then ], [ %1, %entry ] %3 = phi i32 [ %1, %if.then ], [ %0, %entry ] %4 = load i32, ptr %width, align 4, !tbaa !5 %add = add nsw i32 %4, %3 %cmp1.not = icmp slt i32 %add, %2 br i1 %cmp1.not, label %if.else, label %if.then2 if.then2: ; preds = %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end6 if.else: ; preds = %if.end %sub4 = sub i32 %2, %add %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub4) br label %if.end6 if.end6: ; preds = %if.else, %if.then2 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %point_b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %point_a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %width) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void) { int a, b, w; int ans; scanf("%d%d%d", &w, &a, &b); if (a + w <= b) { ans = b - a - w; } else if (a <= b && b <= a + w) { ans = 0; } else if (b <= a && a <= b + w) { ans = 0; } else { ans = a - b - w; } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283770/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283770/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %a = alloca i32, align 4 %b = alloca i32, align 4 %w = 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 %w) #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 %w, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %b, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %add, %2 br i1 %cmp.not, label %if.else, label %if.then if.then: ; preds = %entry %sub1 = sub i32 %2, %add br label %if.end16 if.else: ; preds = %entry %cmp2.not = icmp sgt i32 %0, %2 %add9 = add i32 %2, %1 %cmp10.not = icmp sgt i32 %0, %add9 %or.cond = and i1 %cmp2.not, %cmp10.not %sub14 = sub i32 %0, %add9 %spec.select = select i1 %or.cond, i32 %sub14, i32 0 br label %if.end16 if.end16: ; preds = %if.else, %if.then %ans.0 = phi i32 [ %sub1, %if.then ], [ %spec.select, %if.else ] %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 %w) #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"}
/* B - NarrowRectanglesEasy <http://abc056.contest.atcoder.jp/tasks/abc056_b> */ #include <stdio.h> int main(int argc, char const *argv[]) { int W, a, b; scanf("%d %d %d", &W, &a, &b); if( a < b ){ if( a+W < b ){ printf("%d", b - (a+W)); }else{ printf("%d", 0); } }else{ if( b+W < a ){ printf("%d", a-(b+W)); }else{ printf("%d", 0); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283813/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283813/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %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 slt i32 %0, %1 %2 = load i32, ptr %W, align 4, !tbaa !5 br i1 %cmp, label %if.then, label %if.else6 if.then: ; preds = %entry %add = add nsw i32 %2, %0 %cmp1 = icmp slt i32 %add, %1 %sub = sub nsw i32 %1, %add %spec.select = select i1 %cmp1, i32 %sub, i32 0 br label %if.end16 if.else6: ; preds = %entry %add7 = add nsw i32 %2, %1 %cmp8 = icmp slt i32 %add7, %0 %sub11 = sub nsw i32 %0, %add7 %spec.select18 = select i1 %cmp8, i32 %sub11, i32 0 br label %if.end16 if.end16: ; preds = %if.else6, %if.then %sub11.sink = phi i32 [ %spec.select, %if.then ], [ %spec.select18, %if.else6 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub11.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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() { int a,b,w,flag; while(scanf("%d%d%d",&w,&a,&b)!=EOF) { if(b>a+w) flag=b-a-w; if(b+w<a) flag=a-b-w; if(a==(b+w)||(a+w)==b) flag=0; if(a<=b&&b<=a+w) flag=0; if(a<=b+w&&b<=a) flag=0; printf("%d\n",flag); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283857/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283857/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %a = alloca i32, align 4 %b = alloca i32, align 4 %w = 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 %w) #3 %call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b) %cmp.not34 = icmp eq i32 %call33, -1 br i1 %cmp.not34, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %flag.035 = phi i32 [ %flag.5, %while.body ], [ undef, %entry ] %0 = load i32, ptr %b, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %w, align 4 %add = add i32 %2, %1 %cmp1 = icmp sgt i32 %0, %add %sub2 = sub i32 %0, %add %flag.1 = select i1 %cmp1, i32 %sub2, i32 %flag.035 %add3 = add i32 %2, %0 %cmp4 = icmp slt i32 %add3, %1 %sub7 = sub i32 %1, %add3 %flag.2 = select i1 %cmp4, i32 %sub7, i32 %flag.1 %cmp10 = icmp eq i32 %1, %add3 %cmp12 = icmp eq i32 %add, %0 %or.cond = or i1 %cmp10, %cmp12 %flag.3 = select i1 %or.cond, i32 0, i32 %flag.2 %cmp15.not = icmp sgt i32 %1, %0 %3 = or i1 %cmp15.not, %cmp1 %cmp23.not = icmp sgt i32 %0, %1 %or.cond32 = or i1 %cmp23.not, %cmp4 %4 = and i1 %or.cond32, %3 %flag.5 = select i1 %4, i32 %flag.3, i32 0 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %flag.5) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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> #define max 1000000 int p[200],m[200][200]; int mat(int); int min(int,int); int main(){ int n,i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d%d",&p[i],&p[i+1]); } mat(n); return 0; } int mat(int n){ int i,j,l,k,q; 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] = max; 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]=min(m[i][j],q); } } } printf("%d\n",m[1][n]); } int min(int a,int b){ if(a>b) return b; else return a; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283907/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283907/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @p = dso_local global [200 x i32] zeroinitializer, align 16 @m = dso_local local_unnamed_addr global [200 x [200 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) #5 %call = 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 %mat.exit for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %indvars.iv %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2 = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %indvars.iv.next %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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 %cmp.not85.i = icmp slt i32 %1, 1 br i1 %cmp.not85.i, label %mat.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end %3 = add nuw i32 %1, 1 %wide.trip.count.i = zext i32 %3 to i64 %4 = add nsw i64 %wide.trip.count.i, -1 %5 = add nsw i64 %wide.trip.count.i, -2 %xtraiter = and i64 %4, 3 %6 = icmp ult i64 %5, 3 br i1 %6, 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 %4, -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 [200 x [200 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 !11 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not92.i = icmp slt i32 %1, 2 br i1 %cmp4.not92.i, label %mat.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 [200 x [200 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 [200 x [200 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 [200 x [200 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 [200 x [200 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 !13 for.cond6.preheader.i: ; preds = %for.cond3.preheader.i, %for.inc52.i %indvars.iv104.i = phi i64 [ %indvars.iv.next105.i, %for.inc52.i ], [ 2, %for.cond3.preheader.i ] %indvars117.i = trunc i64 %indvars.iv104.i to i32 %add.i = sub i32 %3, %indvars117.i %cmp7.not90.i = icmp slt i32 %add.i, 1 br i1 %cmp7.not90.i, label %for.inc52.i, label %for.body18.lr.ph.i.preheader for.body18.lr.ph.i.preheader: ; preds = %for.cond6.preheader.i %7 = add nsw i64 %indvars.iv104.i, -1 br label %for.body18.lr.ph.i for.body18.lr.ph.i: ; preds = %for.body18.lr.ph.i.preheader, %for.inc49.i %indvars.iv106.i = phi i64 [ %indvars.iv.next107.i, %for.inc49.i ], [ %indvars.iv104.i, %for.body18.lr.ph.i.preheader ] %indvars.iv95.i = phi i64 [ %indvars.iv.next96.i, %for.inc49.i ], [ 1, %for.body18.lr.ph.i.preheader ] %8 = add nuw nsw i64 %7, %indvars.iv95.i %arrayidx14.i = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv95.i, i64 %8 store i32 1000000, ptr %arrayidx14.i, align 4, !tbaa !5 %9 = add nsw i64 %indvars.iv95.i, -1 %arrayidx31.i = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %9 %10 = load i32, ptr %arrayidx31.i, align 4, !tbaa !5 %arrayidx35.i = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %8 %11 = load i32, ptr %arrayidx35.i, align 4, !tbaa !5 %mul.i = mul i32 %11, %10 br label %for.body18.i for.body18.i: ; preds = %for.body18.i, %for.body18.lr.ph.i %indvars.iv97.i = phi i64 [ %indvars.iv95.i, %for.body18.lr.ph.i ], [ %indvars.iv.next98.i, %for.body18.i ] %storemerge88.i = phi i32 [ 1000000, %for.body18.lr.ph.i ], [ %b.a.i.i, %for.body18.i ] %arrayidx22.i = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv95.i, i64 %indvars.iv97.i %12 = load i32, ptr %arrayidx22.i, align 4, !tbaa !5 %indvars.iv.next98.i = add nuw nsw i64 %indvars.iv97.i, 1 %arrayidx27.i = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv.next98.i, i64 %8 %13 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %add28.i = add nsw i32 %13, %12 %arrayidx33.i = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %indvars.iv97.i %14 = load i32, ptr %arrayidx33.i, align 4, !tbaa !5 %mul36.i = mul i32 %mul.i, %14 %add37.i = add nsw i32 %add28.i, %mul36.i %b.a.i.i = call i32 @llvm.smin.i32(i32 %storemerge88.i, i32 %add37.i) store i32 %b.a.i.i, ptr %arrayidx14.i, align 4, !tbaa !5 %exitcond103.not.i = icmp eq i64 %indvars.iv.next98.i, %indvars.iv106.i br i1 %exitcond103.not.i, label %for.inc49.i, label %for.body18.i, !llvm.loop !14 for.inc49.i: ; preds = %for.body18.i %indvars.iv.next96.i = add nuw nsw i64 %indvars.iv95.i, 1 %indvars.iv.next107.i = add nuw nsw i64 %indvars.iv106.i, 1 %exitcond116.not.i = icmp eq i64 %indvars.iv.next107.i, %wide.trip.count.i br i1 %exitcond116.not.i, label %for.inc52.i, label %for.body18.lr.ph.i, !llvm.loop !15 for.inc52.i: ; preds = %for.inc49.i, %for.cond6.preheader.i %indvars.iv.next105.i = add nuw nsw i64 %indvars.iv104.i, 1 %exitcond119.not.i = icmp eq i64 %indvars.iv.next105.i, %wide.trip.count.i br i1 %exitcond119.not.i, label %mat.exit, label %for.cond6.preheader.i, !llvm.loop !16 mat.exit: ; preds = %for.inc52.i, %entry, %for.end, %for.cond3.preheader.i %.lcssa14 = phi i32 [ %1, %for.end ], [ %1, %for.cond3.preheader.i ], [ %0, %entry ], [ %1, %for.inc52.i ] %idxprom55.i = sext i32 %.lcssa14 to i64 %arrayidx56.i = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom55.i %15 = load i32, ptr %arrayidx56.i, align 4, !tbaa !5 %call57.i = 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) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @mat(i32 noundef %n) local_unnamed_addr #0 { entry: %cmp.not85 = icmp slt i32 %n, 1 br i1 %cmp.not85, label %for.end54, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -1 %2 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.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 [200 x [200 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 !17 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not92 = icmp slt i32 %n, 2 br i1 %cmp4.not92, label %for.end54, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %n, 1 %wide.trip.count118 = 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 [200 x [200 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 [200 x [200 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 [200 x [200 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 [200 x [200 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 !13 for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc52 %indvars.iv104 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next105, %for.inc52 ] %indvars117 = trunc i64 %indvars.iv104 to i32 %add = sub i32 %sub, %indvars117 %cmp7.not90 = icmp slt i32 %add, 1 br i1 %cmp7.not90, label %for.inc52, label %for.body18.lr.ph for.body18.lr.ph: ; preds = %for.cond6.preheader, %for.inc49 %indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.inc49 ], [ %indvars.iv104, %for.cond6.preheader ] %indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.inc49 ], [ 1, %for.cond6.preheader ] %4 = add nuw nsw i64 %indvars.iv95, %indvars.iv104 %5 = add nsw i64 %4, -1 %arrayidx14 = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv95, i64 %5 store i32 1000000, ptr %arrayidx14, align 4, !tbaa !5 %6 = add nsw i64 %indvars.iv95, -1 %arrayidx31 = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %6 %7 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx35 = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %5 %8 = load i32, ptr %arrayidx35, align 4, !tbaa !5 br label %for.body18 for.body18: ; preds = %for.body18.lr.ph, %for.body18 %indvars.iv97 = phi i64 [ %indvars.iv95, %for.body18.lr.ph ], [ %indvars.iv.next98, %for.body18 ] %storemerge88 = phi i32 [ 1000000, %for.body18.lr.ph ], [ %b.a.i, %for.body18 ] %arrayidx22 = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv95, i64 %indvars.iv97 %9 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1 %arrayidx27 = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 %indvars.iv.next98, i64 %5 %10 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %add28 = add nsw i32 %10, %9 %arrayidx33 = getelementptr inbounds [200 x i32], ptr @p, i64 0, i64 %indvars.iv97 %11 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %mul = mul nsw i32 %11, %7 %mul36 = mul nsw i32 %mul, %8 %add37 = add nsw i32 %add28, %mul36 %b.a.i = tail call i32 @llvm.smin.i32(i32 %storemerge88, i32 %add37) store i32 %b.a.i, ptr %arrayidx14, align 4, !tbaa !5 %exitcond103.not = icmp eq i64 %indvars.iv.next98, %indvars.iv106 br i1 %exitcond103.not, label %for.inc49, label %for.body18, !llvm.loop !14 for.inc49: ; preds = %for.body18 %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1 %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %exitcond116.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count118 br i1 %exitcond116.not, label %for.inc52, label %for.body18.lr.ph, !llvm.loop !15 for.inc52: ; preds = %for.inc49, %for.cond6.preheader %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1 %exitcond119.not = icmp eq i64 %indvars.iv.next105, %wide.trip.count118 br i1 %exitcond119.not, label %for.end54, label %for.cond6.preheader, !llvm.loop !16 for.end54: ; preds = %for.inc52, %entry, %for.cond3.preheader %idxprom55 = sext i32 %n to i64 %arrayidx56 = getelementptr inbounds [200 x [200 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom55 %12 = load i32, ptr %arrayidx56, align 4, !tbaa !5 %call57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12) ret i32 undef } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local 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: 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} !17 = distinct !{!17, !12}
#include<stdio.h> #include<math.h> static int N=100; int main(){ int i,l,j,k,num,p[N+1],m[N+1][N+1]; scanf("%d",&num); for(i=1;i<=num;i++){ scanf("%d",&p[i-1]); scanf("%d",&p[i]); } for(i=1;i<=num;i++)m[i][i]=0; for(l=2;l<=num;l++){ for(i=1;i<=num-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",m[1][num]); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283950/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283950/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6 %0 = tail call ptr @llvm.stacksave.p0() %vla107 = alloca [101 x i32], align 16 %vla3108 = alloca [10201 x i32], align 16 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %1 = load i32, ptr %num, align 4, !tbaa !5 %cmp.not109 = icmp slt i32 %1, 1 br i1 %cmp.not109, label %for.end73, label %for.body.preheader for.body.preheader: ; preds = %entry %invariant.gep157 = getelementptr i32, ptr %vla107, i64 -1 br label %for.body for.cond8.preheader: ; preds = %for.body %cmp9.not111 = icmp slt i32 %6, 1 br i1 %cmp9.not111, label %for.end73, label %for.body10.preheader for.body10.preheader: ; preds = %for.cond8.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.cond18.preheader.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %3, -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 ] %gep158 = getelementptr i32, ptr %invariant.gep157, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gep158) %arrayidx6 = getelementptr inbounds i32, ptr %vla107, 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 %6 = load i32, ptr %num, 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.cond8.preheader, !llvm.loop !9 for.cond18.preheader.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %indvars.iv123.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next124.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.iv123.epil = phi i64 [ %indvars.iv.next124.epil, %for.body10.epil ], [ %indvars.iv123.unr, %for.cond18.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.cond18.preheader.unr-lcssa ] %8 = mul nuw nsw i64 %indvars.iv123.epil, 101 %arrayidx12.epil = getelementptr inbounds i32, ptr %vla3108, i64 %8 %arrayidx14.epil = getelementptr inbounds i32, ptr %arrayidx12.epil, i64 %indvars.iv123.epil store i32 0, ptr %arrayidx14.epil, align 4, !tbaa !5 %indvars.iv.next124.epil = add nuw nsw i64 %indvars.iv123.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.not118 = icmp slt i32 %6, 2 br i1 %cmp19.not118, label %for.end73, label %for.cond21.preheader.lr.ph for.cond21.preheader.lr.ph: ; preds = %for.cond18.preheader %sub22 = add nuw i32 %6, 1 %wide.trip.count149 = zext i32 %sub22 to i64 %invariant.gep159 = getelementptr i32, ptr %vla107, i64 -1 br label %for.cond21.preheader for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv123 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next124.3, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.3, %for.body10 ] %9 = mul nuw nsw i64 %indvars.iv123, 101 %arrayidx12 = getelementptr inbounds i32, ptr %vla3108, i64 %9 %arrayidx14 = getelementptr inbounds i32, ptr %arrayidx12, i64 %indvars.iv123 store i32 0, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1 %10 = mul nuw nsw i64 %indvars.iv.next124, 101 %arrayidx12.1 = getelementptr inbounds i32, ptr %vla3108, i64 %10 %arrayidx14.1 = getelementptr inbounds i32, ptr %arrayidx12.1, i64 %indvars.iv.next124 store i32 0, ptr %arrayidx14.1, align 4, !tbaa !5 %indvars.iv.next124.1 = add nuw nsw i64 %indvars.iv123, 2 %11 = mul nuw nsw i64 %indvars.iv.next124.1, 101 %arrayidx12.2 = getelementptr inbounds i32, ptr %vla3108, i64 %11 %arrayidx14.2 = getelementptr inbounds i32, ptr %arrayidx12.2, i64 %indvars.iv.next124.1 store i32 0, ptr %arrayidx14.2, align 4, !tbaa !5 %indvars.iv.next124.2 = add nuw nsw i64 %indvars.iv123, 3 %12 = mul nuw nsw i64 %indvars.iv.next124.2, 101 %arrayidx12.3 = getelementptr inbounds i32, ptr %vla3108, i64 %12 %arrayidx14.3 = getelementptr inbounds i32, ptr %arrayidx12.3, i64 %indvars.iv.next124.2 store i32 0, ptr %arrayidx14.3, align 4, !tbaa !5 %indvars.iv.next124.3 = add nuw nsw i64 %indvars.iv123, 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.inc71 %indvars.iv135 = phi i64 [ 2, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next136, %for.inc71 ] %indvars148 = trunc i64 %indvars.iv135 to i32 %add23 = sub i32 %sub22, %indvars148 %cmp24.not116 = icmp slt i32 %add23, 1 br i1 %cmp24.not116, label %for.inc71, label %for.body35.lr.ph for.body35.lr.ph: ; preds = %for.cond21.preheader, %for.inc68 %indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.inc68 ], [ %indvars.iv135, %for.cond21.preheader ] %indvars.iv126 = phi i64 [ %indvars.iv.next127, %for.inc68 ], [ 1, %for.cond21.preheader ] %13 = add nuw nsw i64 %indvars.iv126, %indvars.iv135 %14 = add nsw i64 %13, -1 %15 = mul nuw nsw i64 %indvars.iv126, 101 %arrayidx29 = getelementptr inbounds i32, ptr %vla3108, i64 %15 %arrayidx31 = getelementptr inbounds i32, ptr %arrayidx29, i64 %14 %invariant.gep = getelementptr i32, ptr %vla3108, i64 %14 store i32 2097152, ptr %arrayidx31, align 4, !tbaa !5 %gep160 = getelementptr i32, ptr %invariant.gep159, i64 %indvars.iv126 %16 = load i32, ptr %gep160, align 4, !tbaa !5 %arrayidx56 = getelementptr inbounds i32, ptr %vla107, i64 %14 %17 = load i32, ptr %arrayidx56, align 4, !tbaa !5 br label %for.body35 for.body35: ; preds = %for.body35.lr.ph, %for.body35 %indvars.iv128 = phi i64 [ %indvars.iv126, %for.body35.lr.ph ], [ %indvars.iv.next129, %for.body35 ] %storemerge114 = phi i32 [ 2097152, %for.body35.lr.ph ], [ %conv60, %for.body35 ] %conv = sitofp i32 %storemerge114 to double %arrayidx43 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv128 %18 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %19 = mul nuw nsw i64 %indvars.iv.next129, 101 %gep = getelementptr i32, ptr %invariant.gep, i64 %19 %20 = load i32, ptr %gep, align 4, !tbaa !5 %add49 = add nsw i32 %20, %18 %arrayidx54 = getelementptr inbounds i32, ptr %vla107, i64 %indvars.iv128 %21 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %mul = mul nsw i32 %21, %16 %mul57 = mul nsw i32 %mul, %17 %add58 = add nsw i32 %add49, %mul57 %conv59 = sitofp i32 %add58 to double %22 = call double @llvm.minnum.f64(double %conv, double %conv59) %conv60 = fptosi double %22 to i32 store i32 %conv60, ptr %arrayidx31, align 4, !tbaa !5 %exitcond134.not = icmp eq i64 %indvars.iv.next129, %indvars.iv137 br i1 %exitcond134.not, label %for.inc68, label %for.body35, !llvm.loop !14 for.inc68: ; preds = %for.body35 %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1 %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1 %exitcond147.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count149 br i1 %exitcond147.not, label %for.inc71, label %for.body35.lr.ph, !llvm.loop !15 for.inc71: ; preds = %for.inc68, %for.cond21.preheader %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1 %exitcond150.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count149 br i1 %exitcond150.not, label %for.end73, label %for.cond21.preheader, !llvm.loop !16 for.end73: ; preds = %for.inc71, %entry, %for.cond8.preheader, %for.cond18.preheader %.lcssa153156 = phi i32 [ %6, %for.cond18.preheader ], [ %6, %for.cond8.preheader ], [ %1, %entry ], [ %6, %for.inc71 ] %arrayidx74 = getelementptr inbounds i32, ptr %vla3108, i64 101 %idxprom75 = sext i32 %.lcssa153156 to i64 %arrayidx76 = getelementptr inbounds i32, ptr %arrayidx74, i64 %idxprom75 %23 = load i32, ptr %arrayidx76, align 4, !tbaa !5 %call77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23) %putchar = call i32 @putchar(i32 10) call void @llvm.stackrestore.p0(ptr %0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 ; 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 = { 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 = { 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, !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; scanf("%d",&t); while(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)) printf("NO\n"); else printf("YES\n"); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28400/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28400/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec9 = add nsw i32 %0, -1 store i32 %dec9, ptr %t, align 4, !tbaa !5 %tobool.not10 = icmp eq i32 %0, 0 br i1 %tobool.not10, 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 %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 %cmp = icmp slt i32 %mul, %sub br i1 %cmp, label %if.end, label %lor.lhs.false lor.lhs.false: ; preds = %while.body %sub2 = sub nsw i32 %2, %3 %mul3 = mul nsw i32 %sub2, %1 %add4 = add nsw i32 %5, %4 %cmp5 = icmp sgt i32 %mul3, %add4 %spec.select = select i1 %cmp5, 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> #define MAX 100 int main() { int i,j,ryoma,hira,sawa,pine[MAX], m[MAX][MAX],que; scanf("%d",&sawa); for ( i = 1; i <= sawa; i++ ) { scanf("%d %d",&pine[i-1],&pine[i]); } for ( i = 1; i <= sawa; i++ ) m[i][i] = 0; for ( hira = 2; hira <= sawa; hira++ ) { for ( i = 1; i <= sawa - hira + 1; i++ ) { j = i + hira - 1; m[i][j] = 100000000; for ( ryoma = i; ryoma <= j - 1; ryoma++ ) { que = m[i][ryoma] + m[ryoma + 1][j] + pine[i - 1] * pine[ryoma] * pine[j]; if(m[i][j] > que) m[i][j] = que; } } } printf("%d\n",m[1][sawa]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284094/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284094/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %sawa = alloca i32, align 4 %pine = alloca [100 x i32], align 16 %m = alloca [100 x [100 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sawa) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %pine) #4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %m) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sawa) %0 = load i32, ptr %sawa, align 4, !tbaa !5 %cmp.not101 = icmp slt i32 %0, 1 br i1 %cmp.not101, label %for.end67, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not103 = icmp slt i32 %6, 1 br i1 %cmp5.not103, 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 [100 x i32], ptr %pine, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [100 x i32], ptr %pine, 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 %sawa, 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.iv115.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next116.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.iv115.epil = phi i64 [ %indvars.iv.next116.epil, %for.body6.epil ], [ %indvars.iv115.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 [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv115.epil, i64 %indvars.iv115.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next116.epil = add nuw nsw i64 %indvars.iv115.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.not110 = icmp slt i32 %6, 2 br i1 %cmp15.not110, 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.count141 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv115 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next116.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.iv115, i64 %indvars.iv115 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1 %arrayidx10.1 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next116, i64 %indvars.iv.next116 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next116.1 = add nuw nsw i64 %indvars.iv115, 2 %arrayidx10.2 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next116.1, i64 %indvars.iv.next116.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next116.2 = add nuw nsw i64 %indvars.iv115, 3 %arrayidx10.3 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next116.2, i64 %indvars.iv.next116.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next116.3 = add nuw nsw i64 %indvars.iv115, 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.iv127 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next128, %for.inc65 ] %indvars140 = trunc i64 %indvars.iv127 to i32 %add = sub i32 %sub18, %indvars140 %cmp19.not108 = icmp slt i32 %add, 1 br i1 %cmp19.not108, label %for.inc65, label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc62 %indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.inc62 ], [ %indvars.iv127, %for.cond17.preheader ] %indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.inc62 ], [ 1, %for.cond17.preheader ] %8 = add nuw nsw i64 %indvars.iv118, %indvars.iv127 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv118, i64 %9 store i32 100000000, ptr %arrayidx26, align 4 %10 = add nsw i64 %indvars.iv118, -1 %arrayidx43 = getelementptr inbounds [100 x i32], ptr %pine, i64 0, i64 %10 %11 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %arrayidx47 = getelementptr inbounds [100 x i32], ptr %pine, i64 0, i64 %9 %12 = load i32, ptr %arrayidx47, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv120 = phi i64 [ %indvars.iv118, %for.body30.lr.ph ], [ %indvars.iv.next121, %for.body30 ] %storemerge106 = phi i32 [ 100000000, %for.body30.lr.ph ], [ %spec.store.select, %for.body30 ] %arrayidx34 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv118, i64 %indvars.iv120 %13 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %arrayidx39 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next121, i64 %9 %14 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %add40 = add nsw i32 %14, %13 %arrayidx45 = getelementptr inbounds [100 x i32], ptr %pine, i64 0, i64 %indvars.iv120 %15 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul48 = mul nsw i32 %mul, %12 %add49 = add nsw i32 %add40, %mul48 %spec.store.select = call i32 @llvm.smin.i32(i32 %storemerge106, i32 %add49) store i32 %spec.store.select, ptr %arrayidx26, align 4 %exitcond126.not = icmp eq i64 %indvars.iv.next121, %indvars.iv129 br i1 %exitcond126.not, label %for.inc62, label %for.body30, !llvm.loop !14 for.inc62: ; preds = %for.body30 %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count141 br i1 %exitcond139.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15 for.inc65: ; preds = %for.inc62, %for.cond17.preheader %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count141 br i1 %exitcond142.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16 for.end67: ; preds = %for.inc65, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa145148 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc65 ] %idxprom69 = sext i32 %.lcssa145148 to i64 %arrayidx70 = getelementptr inbounds [100 x [100 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 40000, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %pine) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sawa) #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> int main(void){ int i, j, k, l, q, n; scanf("%d", &n); int m[n+1][n+1]; for(i = 0; i < n+1; i++) for(j = 0; j < n+1; j++) m[i][j] = -1; int r[n], c[n]; for(i = 0; i < n; i++) scanf("%d%d", &r[i], &c[i]); int p[n+1]; p[0] = r[0]; p[n] = c[n-1]; for(i = 1; i < n+1; i++) p[i] = c[i-1]; //matrixChainOrder for(i = 1; i < n+1; i++) m[i][i] = 0; for(l = 2; l < n+1; l++){ for(i = 1; i < n-l+2; i++){ j = i+l-1; m[i][j] = 100000000; for(k = i; k < j; 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; } } } } printf("%d\n", m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284137/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284137/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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 %add = add i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %3 = mul nuw i64 %1, %1 %vla = alloca i32, i64 %3, align 16 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not157 = icmp slt i32 %4, 0 br i1 %cmp.not157, label %for.end11.thread, label %for.cond3.preheader.preheader for.end11.thread: ; preds = %entry %5 = zext i32 %4 to i64 %vla13213 = alloca i32, i64 %5, align 16 br label %for.end11.for.end24_crit_edge for.cond3.preheader.preheader: ; preds = %entry %6 = shl nuw nsw i64 %1, 2 %7 = add nuw i32 %4, 1 %8 = zext i32 %7 to i64 %9 = shl nuw nsw i64 %8, 2 %xtraiter = and i64 %8, 7 %10 = icmp ult i32 %4, 7 br i1 %10, label %for.end11.unr-lcssa, label %for.cond3.preheader.preheader.new for.cond3.preheader.preheader.new: ; preds = %for.cond3.preheader.preheader %unroll_iter = and i64 %8, 4294967288 br label %for.cond3.preheader for.cond3.preheader: ; preds = %for.cond3.preheader, %for.cond3.preheader.preheader.new %indvar = phi i64 [ 0, %for.cond3.preheader.preheader.new ], [ %indvar.next.7, %for.cond3.preheader ] %niter = phi i64 [ 0, %for.cond3.preheader.preheader.new ], [ %niter.next.7, %for.cond3.preheader ] %11 = mul nuw nsw i64 %6, %indvar %scevgep = getelementptr i8, ptr %vla, i64 %11 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %scevgep, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next = or i64 %indvar, 1 %12 = mul nuw nsw i64 %6, %indvar.next %scevgep.1 = getelementptr i8, ptr %vla, i64 %12 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.1, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.1 = or i64 %indvar, 2 %13 = mul nuw nsw i64 %6, %indvar.next.1 %scevgep.2 = getelementptr i8, ptr %vla, i64 %13 call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %scevgep.2, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.2 = or i64 %indvar, 3 %14 = mul nuw nsw i64 %6, %indvar.next.2 %scevgep.3 = getelementptr i8, ptr %vla, i64 %14 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.3, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.3 = or i64 %indvar, 4 %15 = mul nuw nsw i64 %6, %indvar.next.3 %scevgep.4 = getelementptr i8, ptr %vla, i64 %15 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %scevgep.4, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.4 = or i64 %indvar, 5 %16 = mul nuw nsw i64 %6, %indvar.next.4 %scevgep.5 = getelementptr i8, ptr %vla, i64 %16 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.5, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.5 = or i64 %indvar, 6 %17 = mul nuw nsw i64 %6, %indvar.next.5 %scevgep.6 = getelementptr i8, ptr %vla, i64 %17 call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %scevgep.6, i8 -1, i64 %9, i1 false), !tbaa !5 %indvar.next.6 = or i64 %indvar, 7 %18 = mul nuw nsw i64 %6, %indvar.next.6 %scevgep.7 = getelementptr i8, ptr %vla, i64 %18 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.7, i8 -1, i64 %9, 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.end11.unr-lcssa, label %for.cond3.preheader, !llvm.loop !9 for.end11.unr-lcssa: ; preds = %for.cond3.preheader, %for.cond3.preheader.preheader %indvar.unr = phi i64 [ 0, %for.cond3.preheader.preheader ], [ %indvar.next.7, %for.cond3.preheader ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end11, label %for.cond3.preheader.epil for.cond3.preheader.epil: ; preds = %for.end11.unr-lcssa, %for.cond3.preheader.epil %indvar.epil = phi i64 [ %indvar.next.epil, %for.cond3.preheader.epil ], [ %indvar.unr, %for.end11.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.cond3.preheader.epil ], [ 0, %for.end11.unr-lcssa ] %19 = mul nuw nsw i64 %6, %indvar.epil %scevgep.epil = getelementptr i8, ptr %vla, i64 %19 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.epil, i8 -1, i64 %9, 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.end11, label %for.cond3.preheader.epil, !llvm.loop !11 for.end11: ; preds = %for.cond3.preheader.epil, %for.end11.unr-lcssa %20 = zext i32 %4 to i64 %vla12 = alloca i32, i64 %20, align 16 %vla13 = alloca i32, i64 %20, align 16 %cmp15159 = icmp sgt i32 %4, 0 br i1 %cmp15159, label %for.body16, label %for.end11.for.end24_crit_edge for.end11.for.end24_crit_edge: ; preds = %for.end11.thread, %for.end11 %vla13216 = phi ptr [ %vla13213, %for.end11.thread ], [ %vla13, %for.end11 ] %.pre211 = sext i32 %4 to i64 br label %for.end24 for.body16: ; preds = %for.end11, %for.body16 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body16 ], [ 0, %for.end11 ] %arrayidx18 = getelementptr inbounds i32, ptr %vla12, i64 %indvars.iv %arrayidx20 = getelementptr inbounds i32, ptr %vla13, i64 %indvars.iv %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx18, ptr noundef nonnull %arrayidx20) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %21 = load i32, ptr %n, align 4, !tbaa !5 %22 = sext i32 %21 to i64 %cmp15 = icmp slt i64 %indvars.iv.next, %22 br i1 %cmp15, label %for.body16, label %for.end24.loopexit, !llvm.loop !13 for.end24.loopexit: ; preds = %for.body16 %.pre = load i32, ptr %vla12, align 16, !tbaa !5 br label %for.end24 for.end24: ; preds = %for.end11.for.end24_crit_edge, %for.end24.loopexit %vla13215 = phi ptr [ %vla13216, %for.end11.for.end24_crit_edge ], [ %vla13, %for.end24.loopexit ] %idxprom31.pre-phi = phi i64 [ %.pre211, %for.end11.for.end24_crit_edge ], [ %22, %for.end24.loopexit ] %23 = phi i32 [ undef, %for.end11.for.end24_crit_edge ], [ %.pre, %for.end24.loopexit ] %.lcssa = phi i32 [ %4, %for.end11.for.end24_crit_edge ], [ %21, %for.end24.loopexit ] %add25 = add i32 %.lcssa, 1 %24 = zext i32 %add25 to i64 %vla26 = alloca i32, i64 %24, align 16 store i32 %23, ptr %vla26, align 16, !tbaa !5 %sub = add nsw i32 %.lcssa, -1 %idxprom29 = sext i32 %sub to i64 %arrayidx30 = getelementptr inbounds i32, ptr %vla13215, i64 %idxprom29 %25 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %arrayidx32 = getelementptr inbounds i32, ptr %vla26, i64 %idxprom31.pre-phi store i32 %25, ptr %arrayidx32, align 4, !tbaa !5 %cmp35.not162 = icmp slt i32 %.lcssa, 1 br i1 %cmp35.not162, label %for.end110, label %for.body48.preheader for.body48.preheader: ; preds = %for.end24 %scevgep177 = getelementptr i8, ptr %vla26, i64 4 %26 = zext i32 %.lcssa to i64 %27 = shl nuw nsw i64 %26, 2 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep177, ptr nonnull align 16 %vla13215, i64 %27, i1 false), !tbaa !5 %28 = add nsw i64 %24, -1 %29 = add nsw i64 %24, -2 %xtraiter226 = and i64 %28, 3 %30 = icmp ult i64 %29, 3 br i1 %30, label %for.cond56.preheader.unr-lcssa, label %for.body48.preheader.new for.body48.preheader.new: ; preds = %for.body48.preheader %unroll_iter229 = and i64 %28, -4 br label %for.body48 for.cond56.preheader.unr-lcssa: ; preds = %for.body48, %for.body48.preheader %indvars.iv182.unr = phi i64 [ 1, %for.body48.preheader ], [ %indvars.iv.next183.3, %for.body48 ] %lcmp.mod228.not = icmp eq i64 %xtraiter226, 0 br i1 %lcmp.mod228.not, label %for.cond56.preheader, label %for.body48.epil for.body48.epil: ; preds = %for.cond56.preheader.unr-lcssa, %for.body48.epil %indvars.iv182.epil = phi i64 [ %indvars.iv.next183.epil, %for.body48.epil ], [ %indvars.iv182.unr, %for.cond56.preheader.unr-lcssa ] %epil.iter227 = phi i64 [ %epil.iter227.next, %for.body48.epil ], [ 0, %for.cond56.preheader.unr-lcssa ] %31 = mul nuw nsw i64 %indvars.iv182.epil, %1 %arrayidx50.epil = getelementptr inbounds i32, ptr %vla, i64 %31 %arrayidx52.epil = getelementptr inbounds i32, ptr %arrayidx50.epil, i64 %indvars.iv182.epil store i32 0, ptr %arrayidx52.epil, align 4, !tbaa !5 %indvars.iv.next183.epil = add nuw nsw i64 %indvars.iv182.epil, 1 %epil.iter227.next = add i64 %epil.iter227, 1 %epil.iter227.cmp.not = icmp eq i64 %epil.iter227.next, %xtraiter226 br i1 %epil.iter227.cmp.not, label %for.cond56.preheader, label %for.body48.epil, !llvm.loop !14 for.cond56.preheader: ; preds = %for.body48.epil, %for.cond56.preheader.unr-lcssa %cmp58.not171 = icmp slt i32 %.lcssa, 2 br i1 %cmp58.not171, label %for.end110, label %for.cond60.preheader.lr.ph for.cond60.preheader.lr.ph: ; preds = %for.cond56.preheader %sub61 = add nuw i32 %.lcssa, 2 %invariant.gep220 = getelementptr i32, ptr %vla26, i64 -1 br label %for.cond60.preheader for.body48: ; preds = %for.body48, %for.body48.preheader.new %indvars.iv182 = phi i64 [ 1, %for.body48.preheader.new ], [ %indvars.iv.next183.3, %for.body48 ] %niter230 = phi i64 [ 0, %for.body48.preheader.new ], [ %niter230.next.3, %for.body48 ] %32 = mul nuw nsw i64 %indvars.iv182, %1 %arrayidx50 = getelementptr inbounds i32, ptr %vla, i64 %32 %arrayidx52 = getelementptr inbounds i32, ptr %arrayidx50, i64 %indvars.iv182 store i32 0, ptr %arrayidx52, align 4, !tbaa !5 %indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1 %33 = mul nuw nsw i64 %indvars.iv.next183, %1 %arrayidx50.1 = getelementptr inbounds i32, ptr %vla, i64 %33 %arrayidx52.1 = getelementptr inbounds i32, ptr %arrayidx50.1, i64 %indvars.iv.next183 store i32 0, ptr %arrayidx52.1, align 4, !tbaa !5 %indvars.iv.next183.1 = add nuw nsw i64 %indvars.iv182, 2 %34 = mul nuw nsw i64 %indvars.iv.next183.1, %1 %arrayidx50.2 = getelementptr inbounds i32, ptr %vla, i64 %34 %arrayidx52.2 = getelementptr inbounds i32, ptr %arrayidx50.2, i64 %indvars.iv.next183.1 store i32 0, ptr %arrayidx52.2, align 4, !tbaa !5 %indvars.iv.next183.2 = add nuw nsw i64 %indvars.iv182, 3 %35 = mul nuw nsw i64 %indvars.iv.next183.2, %1 %arrayidx50.3 = getelementptr inbounds i32, ptr %vla, i64 %35 %arrayidx52.3 = getelementptr inbounds i32, ptr %arrayidx50.3, i64 %indvars.iv.next183.2 store i32 0, ptr %arrayidx52.3, align 4, !tbaa !5 %indvars.iv.next183.3 = add nuw nsw i64 %indvars.iv182, 4 %niter230.next.3 = add i64 %niter230, 4 %niter230.ncmp.3 = icmp eq i64 %niter230.next.3, %unroll_iter229 br i1 %niter230.ncmp.3, label %for.cond56.preheader.unr-lcssa, label %for.body48, !llvm.loop !15 for.cond60.preheader: ; preds = %for.cond60.preheader.lr.ph, %for.inc108 %indvar231 = phi i64 [ 0, %for.cond60.preheader.lr.ph ], [ %indvar.next232, %for.inc108 ] %indvars.iv196 = phi i64 [ 2, %for.cond60.preheader.lr.ph ], [ %indvars.iv.next197, %for.inc108 ] %36 = add i64 %indvar231, 1 %indvars208 = trunc i64 %indvars.iv196 to i32 %add62 = sub i32 %sub61, %indvars208 %cmp63169 = icmp sgt i32 %add62, 1 br i1 %cmp63169, label %for.body64.lr.ph, label %for.inc108 for.body64.lr.ph: ; preds = %for.cond60.preheader %37 = add nuw i64 %indvars.iv196, 4294967295 %xtraiter233 = and i64 %36, 1 %38 = icmp eq i64 %indvar231, 0 %unroll_iter236 = and i64 %36, -2 %lcmp.mod235.not = icmp eq i64 %xtraiter233, 0 br label %for.body64 for.body64: ; preds = %for.body64.lr.ph, %for.inc105 %indvars.iv198 = phi i64 [ %indvars.iv196, %for.body64.lr.ph ], [ %indvars.iv.next199, %for.inc105 ] %indvars.iv187 = phi i64 [ 1, %for.body64.lr.ph ], [ %indvars.iv.next188, %for.inc105 ] %39 = add i64 %37, %indvars.iv187 %40 = mul nuw nsw i64 %indvars.iv187, %1 %arrayidx68 = getelementptr inbounds i32, ptr %vla, i64 %40 %sext = shl i64 %39, 32 %idxprom69 = ashr exact i64 %sext, 32 %arrayidx70 = getelementptr inbounds i32, ptr %arrayidx68, i64 %idxprom69 %invariant.gep = getelementptr i32, ptr %vla, i64 %idxprom69 store i32 100000000, ptr %arrayidx70, align 4 %cmp72166 = icmp slt i64 %indvars.iv187, %idxprom69 br i1 %cmp72166, label %for.body73.lr.ph, label %for.inc105 for.body73.lr.ph: ; preds = %for.body64 %gep221 = getelementptr i32, ptr %invariant.gep220, i64 %indvars.iv187 %41 = load i32, ptr %gep221, align 4, !tbaa !5 %arrayidx90 = getelementptr inbounds i32, ptr %vla26, i64 %idxprom69 %42 = load i32, ptr %arrayidx90, align 4, !tbaa !5 br i1 %38, label %for.inc105.loopexit.unr-lcssa, label %for.body73 for.body73: ; preds = %for.body73.lr.ph, %for.body73 %indvars.iv189 = phi i64 [ %indvars.iv.next190.1, %for.body73 ], [ %indvars.iv187, %for.body73.lr.ph ] %storemerge167 = phi i32 [ %spec.store.select.1, %for.body73 ], [ 100000000, %for.body73.lr.ph ] %niter237 = phi i64 [ %niter237.next.1, %for.body73 ], [ 0, %for.body73.lr.ph ] %arrayidx77 = getelementptr inbounds i32, ptr %arrayidx68, i64 %indvars.iv189 %43 = load i32, ptr %arrayidx77, align 4, !tbaa !5 %indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1 %44 = mul nuw nsw i64 %indvars.iv.next190, %1 %gep = getelementptr i32, ptr %invariant.gep, i64 %44 %45 = load i32, ptr %gep, align 4, !tbaa !5 %add83 = add nsw i32 %45, %43 %arrayidx88 = getelementptr inbounds i32, ptr %vla26, i64 %indvars.iv189 %46 = load i32, ptr %arrayidx88, align 4, !tbaa !5 %mul = mul nsw i32 %46, %41 %mul91 = mul nsw i32 %mul, %42 %add92 = add nsw i32 %add83, %mul91 %spec.store.select = call i32 @llvm.smin.i32(i32 %storemerge167, i32 %add92) store i32 %spec.store.select, ptr %arrayidx70, align 4 %arrayidx77.1 = getelementptr inbounds i32, ptr %arrayidx68, i64 %indvars.iv.next190 %47 = load i32, ptr %arrayidx77.1, align 4, !tbaa !5 %indvars.iv.next190.1 = add nuw nsw i64 %indvars.iv189, 2 %48 = mul nuw nsw i64 %indvars.iv.next190.1, %1 %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %48 %49 = load i32, ptr %gep.1, align 4, !tbaa !5 %add83.1 = add nsw i32 %49, %47 %arrayidx88.1 = getelementptr inbounds i32, ptr %vla26, i64 %indvars.iv.next190 %50 = load i32, ptr %arrayidx88.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %50, %41 %mul91.1 = mul nsw i32 %mul.1, %42 %add92.1 = add nsw i32 %add83.1, %mul91.1 %spec.store.select.1 = call i32 @llvm.smin.i32(i32 %spec.store.select, i32 %add92.1) store i32 %spec.store.select.1, ptr %arrayidx70, align 4 %niter237.next.1 = add i64 %niter237, 2 %niter237.ncmp.1 = icmp eq i64 %niter237.next.1, %unroll_iter236 br i1 %niter237.ncmp.1, label %for.inc105.loopexit.unr-lcssa, label %for.body73, !llvm.loop !16 for.inc105.loopexit.unr-lcssa: ; preds = %for.body73, %for.body73.lr.ph %indvars.iv189.unr = phi i64 [ %indvars.iv187, %for.body73.lr.ph ], [ %indvars.iv.next190.1, %for.body73 ] %storemerge167.unr = phi i32 [ 100000000, %for.body73.lr.ph ], [ %spec.store.select.1, %for.body73 ] br i1 %lcmp.mod235.not, label %for.inc105, label %for.body73.epil for.body73.epil: ; preds = %for.inc105.loopexit.unr-lcssa %arrayidx77.epil = getelementptr inbounds i32, ptr %arrayidx68, i64 %indvars.iv189.unr %51 = load i32, ptr %arrayidx77.epil, align 4, !tbaa !5 %indvars.iv.next190.epil = add nuw nsw i64 %indvars.iv189.unr, 1 %52 = mul nuw nsw i64 %indvars.iv.next190.epil, %1 %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %52 %53 = load i32, ptr %gep.epil, align 4, !tbaa !5 %add83.epil = add nsw i32 %53, %51 %arrayidx88.epil = getelementptr inbounds i32, ptr %vla26, i64 %indvars.iv189.unr %54 = load i32, ptr %arrayidx88.epil, align 4, !tbaa !5 %mul.epil = mul nsw i32 %54, %41 %mul91.epil = mul nsw i32 %mul.epil, %42 %add92.epil = add nsw i32 %add83.epil, %mul91.epil %spec.store.select.epil = call i32 @llvm.smin.i32(i32 %storemerge167.unr, i32 %add92.epil) store i32 %spec.store.select.epil, ptr %arrayidx70, align 4 br label %for.inc105 for.inc105: ; preds = %for.body73.epil, %for.inc105.loopexit.unr-lcssa, %for.body64 %indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1 %indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1 %exitcond206.not = icmp eq i64 %indvars.iv.next199, %24 br i1 %exitcond206.not, label %for.inc108, label %for.body64, !llvm.loop !17 for.inc108: ; preds = %for.inc105, %for.cond60.preheader %indvars.iv.next197 = add nuw nsw i64 %indvars.iv196, 1 %exitcond210.not = icmp eq i64 %indvars.iv.next197, %24 %indvar.next232 = add i64 %indvar231, 1 br i1 %exitcond210.not, label %for.end110, label %for.cond60.preheader, !llvm.loop !18 for.end110: ; preds = %for.inc108, %for.end24, %for.cond56.preheader %arrayidx111 = getelementptr inbounds i32, ptr %vla, i64 %1 %arrayidx113 = getelementptr inbounds i32, ptr %arrayidx111, i64 %idxprom31.pre-phi %55 = load i32, ptr %arrayidx113, align 4, !tbaa !5 %call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %55) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !12} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10}
#include<stdio.h> #define MAX 101 int main(){ int i,j,k,n,a,b,A[MAX],B[MAX][MAX]; scanf("%d",&n); for(i=1; i<=n; i++) scanf("%d%d",&A[i-1],&A[i]); for(i=1; i<=n; i++) B[i][i] = 0; for(j=2; j<=n; j++){ for(i=1; i<=n-j+1; i++){ a = i + j -1; B[i][a] = 1000000; for(k=i; k<=a-1; k++){ b = B[i][k] + B[k+1][a] + A[i-1]*A[k]*A[a]; if(B[i][a] >= b) B[i][a] = b; } } } printf("%d\n",B[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284188/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284188/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [101 x i32], align 16 %B = 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 %A) #4 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %B) #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.not101 = icmp slt i32 %0, 1 br i1 %cmp.not101, label %for.end67, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not103 = icmp slt i32 %6, 1 br i1 %cmp5.not103, 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 %A, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 x i32], ptr %A, 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.iv115.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next116.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.iv115.epil = phi i64 [ %indvars.iv.next116.epil, %for.body6.epil ], [ %indvars.iv115.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 %B, i64 0, i64 %indvars.iv115.epil, i64 %indvars.iv115.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next116.epil = add nuw nsw i64 %indvars.iv115.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.not110 = icmp slt i32 %6, 2 br i1 %cmp15.not110, 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.count141 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv115 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next116.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 %B, i64 0, i64 %indvars.iv115, i64 %indvars.iv115 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv.next116, i64 %indvars.iv.next116 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next116.1 = add nuw nsw i64 %indvars.iv115, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv.next116.1, i64 %indvars.iv.next116.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next116.2 = add nuw nsw i64 %indvars.iv115, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv.next116.2, i64 %indvars.iv.next116.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next116.3 = add nuw nsw i64 %indvars.iv115, 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.iv127 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next128, %for.inc65 ] %indvars140 = trunc i64 %indvars.iv127 to i32 %add = sub i32 %sub18, %indvars140 %cmp19.not108 = icmp slt i32 %add, 1 br i1 %cmp19.not108, label %for.inc65, label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc62 %indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.inc62 ], [ %indvars.iv127, %for.cond17.preheader ] %indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.inc62 ], [ 1, %for.cond17.preheader ] %8 = add nuw nsw i64 %indvars.iv118, %indvars.iv127 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv118, i64 %9 store i32 1000000, ptr %arrayidx26, align 4 %10 = add nsw i64 %indvars.iv118, -1 %arrayidx43 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %10 %11 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %arrayidx47 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %9 %12 = load i32, ptr %arrayidx47, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv120 = phi i64 [ %indvars.iv118, %for.body30.lr.ph ], [ %indvars.iv.next121, %for.body30 ] %storemerge106 = phi i32 [ 1000000, %for.body30.lr.ph ], [ %spec.store.select, %for.body30 ] %arrayidx34 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv118, i64 %indvars.iv120 %13 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %arrayidx39 = getelementptr inbounds [101 x [101 x i32]], ptr %B, i64 0, i64 %indvars.iv.next121, i64 %9 %14 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %add40 = add nsw i32 %14, %13 %arrayidx45 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv120 %15 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul48 = mul nsw i32 %mul, %12 %add49 = add nsw i32 %add40, %mul48 %spec.store.select = call i32 @llvm.smin.i32(i32 %storemerge106, i32 %add49) store i32 %spec.store.select, ptr %arrayidx26, align 4 %exitcond126.not = icmp eq i64 %indvars.iv.next121, %indvars.iv129 br i1 %exitcond126.not, label %for.inc62, label %for.body30, !llvm.loop !14 for.inc62: ; preds = %for.body30 %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count141 br i1 %exitcond139.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15 for.inc65: ; preds = %for.inc62, %for.cond17.preheader %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count141 br i1 %exitcond142.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16 for.end67: ; preds = %for.inc65, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa145148 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc65 ] %idxprom69 = sext i32 %.lcssa145148 to i64 %arrayidx70 = getelementptr inbounds [101 x [101 x i32]], ptr %B, 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 %B) #4 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: 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> int N=100; int min(int x,int y){ if(x<=y) return x; else return y; } int main(){ int n,p[N+1],m[N+1][N+1],j,l,i,k; 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=1;i<=n-l+1;i++){ j=i+l-1; m[i][j]=2000000000; 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_284230/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284230/source.c" target datalayout = "e-m:e-p270: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 %x, i32 noundef %y) local_unnamed_addr #0 { entry: %y.x = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %y.x } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %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.gep153 = 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 ] %gep154 = getelementptr i32, ptr %invariant.gep153, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gep154) %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.count145 = zext i32 %sub22 to i64 %invariant.gep155 = 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.iv131 = phi i64 [ 2, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next132, %for.inc70 ] %18 = add i64 %indvar, 1 %indvars144 = trunc i64 %indvars.iv131 to i32 %add23 = sub i32 %sub22, %indvars144 %cmp24.not112 = icmp slt i32 %add23, 1 br i1 %cmp24.not112, label %for.inc70, label %for.body35.lr.ph.preheader for.body35.lr.ph.preheader: ; preds = %for.cond21.preheader %xtraiter157 = and i64 %18, 1 %19 = icmp eq i64 %indvar, 0 %unroll_iter160 = and i64 %18, -2 %lcmp.mod159.not = icmp eq i64 %xtraiter157, 0 br label %for.body35.lr.ph for.body35.lr.ph: ; preds = %for.body35.lr.ph.preheader, %for.inc67 %indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.inc67 ], [ %indvars.iv131, %for.body35.lr.ph.preheader ] %indvars.iv122 = phi i64 [ %indvars.iv.next123, %for.inc67 ], [ 1, %for.body35.lr.ph.preheader ] %20 = add nuw nsw i64 %indvars.iv122, %indvars.iv131 %21 = add nsw i64 %20, -1 %22 = mul nuw nsw i64 %indvars.iv122, %4 %arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %22 %arrayidx31 = getelementptr inbounds i32, ptr %arrayidx29, i64 %21 %invariant.gep = getelementptr i32, ptr %vla3, i64 %21 store i32 2000000000, ptr %arrayidx31, align 4, !tbaa !5 %gep156 = getelementptr i32, ptr %invariant.gep155, i64 %indvars.iv122 %23 = load i32, ptr %gep156, align 4, !tbaa !5 %arrayidx56 = getelementptr inbounds i32, ptr %vla, i64 %21 %24 = load i32, ptr %arrayidx56, align 4, !tbaa !5 br i1 %19, 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 [ %y.x.i.1, %for.body35 ], [ 2000000000, %for.body35.lr.ph ] %niter161 = phi i64 [ %niter161.next.1, %for.body35 ], [ 0, %for.body35.lr.ph ] %arrayidx43 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv124 %25 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %26 = mul nuw nsw i64 %indvars.iv.next125, %4 %gep = getelementptr i32, ptr %invariant.gep, i64 %26 %27 = load i32, ptr %gep, align 4, !tbaa !5 %add49 = add nsw i32 %27, %25 %arrayidx54 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv124 %28 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %mul = mul nsw i32 %28, %23 %mul57 = mul nsw i32 %mul, %24 %add58 = add nsw i32 %add49, %mul57 %y.x.i = call i32 @llvm.smin.i32(i32 %storemerge110, i32 %add58) store i32 %y.x.i, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx43.1 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv.next125 %29 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5 %indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124, 2 %30 = mul nuw nsw i64 %indvars.iv.next125.1, %4 %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %30 %31 = load i32, ptr %gep.1, align 4, !tbaa !5 %add49.1 = add nsw i32 %31, %29 %arrayidx54.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next125 %32 = load i32, ptr %arrayidx54.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %32, %23 %mul57.1 = mul nsw i32 %mul.1, %24 %add58.1 = add nsw i32 %add49.1, %mul57.1 %y.x.i.1 = call i32 @llvm.smin.i32(i32 %y.x.i, i32 %add58.1) store i32 %y.x.i.1, ptr %arrayidx31, align 4, !tbaa !5 %niter161.next.1 = add i64 %niter161, 2 %niter161.ncmp.1 = icmp eq i64 %niter161.next.1, %unroll_iter160 br i1 %niter161.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 [ 2000000000, %for.body35.lr.ph ], [ %y.x.i.1, %for.body35 ] br i1 %lcmp.mod159.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 %33 = load i32, ptr %arrayidx43.epil, align 4, !tbaa !5 %indvars.iv.next125.epil = add nuw nsw i64 %indvars.iv124.unr, 1 %34 = mul nuw nsw i64 %indvars.iv.next125.epil, %4 %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %34 %35 = load i32, ptr %gep.epil, align 4, !tbaa !5 %add49.epil = add nsw i32 %35, %33 %arrayidx54.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv124.unr %36 = load i32, ptr %arrayidx54.epil, align 4, !tbaa !5 %mul.epil = mul nsw i32 %36, %23 %mul57.epil = mul nsw i32 %mul.epil, %24 %add58.epil = add nsw i32 %add49.epil, %mul57.epil %y.x.i.epil = call i32 @llvm.smin.i32(i32 %storemerge110.unr, i32 %add58.epil) store i32 %y.x.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 %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1 %exitcond143.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count145 br i1 %exitcond143.not, label %for.inc70, label %for.body35.lr.ph, !llvm.loop !15 for.inc70: ; preds = %for.inc67, %for.cond21.preheader %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1 %exitcond146.not = icmp eq i64 %indvars.iv.next132, %wide.trip.count145 %indvar.next = add i64 %indvar, 1 br i1 %exitcond146.not, label %for.end72, label %for.cond21.preheader, !llvm.loop !16 for.end72: ; preds = %for.inc70, %entry, %for.cond8.preheader, %for.cond18.preheader %.lcssa149152 = 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 %.lcssa149152 to i64 %arrayidx75 = getelementptr inbounds i32, ptr %arrayidx73, i64 %idxprom74 %37 = load i32, ptr %arrayidx75, align 4, !tbaa !5 %call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %37) 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 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) #3 ; 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 #define INF 1<<21 int G[N][N],p[N],H[N],L[N]; int min(int c,int r){ if(c<r) return c; else return r; } int main(){ int x,i,j,l,a,b,c; scanf("%d",&x); for(i=1;i<=x;i++){ G[i][i]=0; } for(i=1;i<=x;i++){ scanf("%d%d",&H[i],&L[i]); } p[0]=H[1]; p[1] = L[1]; for(i=2;i<=x;i++){ p[i] = L[i]; } for(i=2;i<=x;i++){ for(j = 1;j<=x-i+1;j++){ a=j+i-1; G[j][a] = INF; for(l = j;l<=a-1;l++){ b = G[j][l] + G[l+1][a] + p[j-1]*p[l]*p[a]; G[j][a] = min(G[j][a],b); } } } printf("%d\n",G[1][x]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284274/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284274/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @H = dso_local global [100 x i32] zeroinitializer, align 16 @L = dso_local global [100 x i32] zeroinitializer, align 16 @p = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.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 %c, i32 noundef %r) local_unnamed_addr #0 { entry: %c.r = tail call i32 @llvm.smin.i32(i32 %c, i32 %r) ret i32 %c.r } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp.not112 = icmp slt i32 %0, 1 br i1 %cmp.not112, label %for.cond24.preheader, 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 @G, 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.not112, label %for.cond24.preheader, 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 @G, 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 @G, 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 @G, 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 @G, 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.body5: ; preds = %for.cond3.preheader, %for.body5 %indvars.iv127 = phi i64 [ %indvars.iv.next128, %for.body5 ], [ 1, %for.cond3.preheader ] %arrayidx7 = getelementptr inbounds [100 x i32], ptr @H, i64 0, i64 %indvars.iv127 %arrayidx9 = getelementptr inbounds [100 x i32], ptr @L, i64 0, i64 %indvars.iv127 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx9) %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %5 = load i32, ptr %x, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp4.not.not = icmp slt i64 %indvars.iv127, %6 br i1 %cmp4.not.not, label %for.body5, label %for.end13, !llvm.loop !13 for.end13: ; preds = %for.body5 %7 = load i32, ptr getelementptr inbounds ([100 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5 store i32 %7, ptr @p, align 16, !tbaa !5 %8 = load i32, ptr getelementptr inbounds ([100 x i32], ptr @L, i64 0, i64 1), align 4, !tbaa !5 store i32 %8, ptr getelementptr inbounds ([100 x i32], ptr @p, i64 0, i64 1), align 4, !tbaa !5 %cmp15.not116 = icmp slt i32 %5, 2 br i1 %cmp15.not116, label %for.end76, label %for.cond27.preheader.lr.ph for.cond24.preheader: ; preds = %entry, %for.cond3.preheader %9 = load i32, ptr getelementptr inbounds ([100 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5 store i32 %9, ptr @p, align 16, !tbaa !5 %10 = load i32, ptr getelementptr inbounds ([100 x i32], ptr @L, i64 0, i64 1), align 4, !tbaa !5 store i32 %10, ptr getelementptr inbounds ([100 x i32], ptr @p, i64 0, i64 1), align 4, !tbaa !5 br label %for.end76 for.cond27.preheader.lr.ph: ; preds = %for.end13 %11 = add nsw i32 %5, -1 %12 = zext i32 %11 to i64 %13 = shl nuw nsw i64 %12, 2 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 getelementptr inbounds ([100 x i32], ptr @p, i64 0, i64 2), ptr nonnull align 8 getelementptr inbounds ([100 x i32], ptr @L, i64 0, i64 2), i64 %13, i1 false), !tbaa !5 %sub = add nuw i32 %5, 1 %wide.trip.count156 = zext i32 %sub to i64 br label %for.cond27.preheader for.cond27.preheader: ; preds = %for.cond27.preheader.lr.ph, %for.inc74 %indvars.iv142 = phi i64 [ 2, %for.cond27.preheader.lr.ph ], [ %indvars.iv.next143, %for.inc74 ] %indvars155 = trunc i64 %indvars.iv142 to i32 %add = sub i32 %sub, %indvars155 %cmp28.not121 = icmp slt i32 %add, 1 br i1 %cmp28.not121, label %for.inc74, label %for.body39.lr.ph for.body39.lr.ph: ; preds = %for.cond27.preheader, %for.inc71 %indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.inc71 ], [ %indvars.iv142, %for.cond27.preheader ] %indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.inc71 ], [ 1, %for.cond27.preheader ] %14 = add nuw nsw i64 %indvars.iv133, %indvars.iv142 %15 = add nsw i64 %14, -1 %arrayidx35 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv133, i64 %15 store i32 2097152, ptr %arrayidx35, align 4, !tbaa !5 %16 = add nsw i64 %indvars.iv133, -1 %arrayidx52 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %16 %17 = load i32, ptr %arrayidx52, align 4, !tbaa !5 %arrayidx56 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %15 %18 = load i32, ptr %arrayidx56, align 4, !tbaa !5 br label %for.body39 for.body39: ; preds = %for.body39.lr.ph, %for.body39 %indvars.iv135 = phi i64 [ %indvars.iv133, %for.body39.lr.ph ], [ %indvars.iv.next136, %for.body39 ] %storemerge119 = phi i32 [ 2097152, %for.body39.lr.ph ], [ %c.r.i, %for.body39 ] %arrayidx43 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv133, i64 %indvars.iv135 %19 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1 %arrayidx48 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv.next136, i64 %15 %20 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %add49 = add nsw i32 %20, %19 %arrayidx54 = getelementptr inbounds [100 x i32], ptr @p, i64 0, i64 %indvars.iv135 %21 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %mul = mul nsw i32 %21, %17 %mul57 = mul nsw i32 %mul, %18 %add58 = add nsw i32 %add49, %mul57 %c.r.i = call i32 @llvm.smin.i32(i32 %storemerge119, i32 %add58) store i32 %c.r.i, ptr %arrayidx35, align 4, !tbaa !5 %exitcond141.not = icmp eq i64 %indvars.iv.next136, %indvars.iv144 br i1 %exitcond141.not, label %for.inc71, label %for.body39, !llvm.loop !14 for.inc71: ; preds = %for.body39 %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1 %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1 %exitcond154.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count156 br i1 %exitcond154.not, label %for.inc74, label %for.body39.lr.ph, !llvm.loop !15 for.inc74: ; preds = %for.inc71, %for.cond27.preheader %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1 %exitcond157.not = icmp eq i64 %indvars.iv.next143, %wide.trip.count156 br i1 %exitcond157.not, label %for.end76, label %for.cond27.preheader, !llvm.loop !16 for.end76: ; preds = %for.inc74, %for.end13, %for.cond24.preheader %.lcssa160164 = phi i32 [ %0, %for.cond24.preheader ], [ %5, %for.end13 ], [ %5, %for.inc74 ] %idxprom77 = sext i32 %.lcssa160164 to i64 %arrayidx78 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 1, i64 %idxprom77 %22 = load i32, ptr %arrayidx78, align 4, !tbaa !5 %call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree 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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5 attributes #0 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = 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 N 100 #define INF 10000000 int min(int,int); int main(){ int i,j,k,l,n,p[N+1],m[N+1][N+1]; 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; } for(l = 2;l <= n;l++){ for(i = 1;i <= n-l+1;i++){ j=i+l-1; m[i][j]=INF; for(k = i;k < j;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; } int min(int x,int y){ if(x > y){ return y; } else return x; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284324/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284324/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %p = 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 %p) #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.not99 = icmp slt i32 %0, 1 br i1 %cmp.not99, label %for.end66, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not101 = icmp slt i32 %6, 1 br i1 %cmp5.not101, label %for.end66, 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 %p, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 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 !9 for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv113.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next114.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.iv113.epil = phi i64 [ %indvars.iv.next114.epil, %for.body6.epil ], [ %indvars.iv113.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.iv113.epil, i64 %indvars.iv113.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next114.epil = add nuw nsw i64 %indvars.iv113.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.not108 = icmp slt i32 %6, 2 br i1 %cmp15.not108, label %for.end66, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub18 = add nuw i32 %6, 1 %wide.trip.count138 = zext i32 %sub18 to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv113 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next114.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.iv113, i64 %indvars.iv113 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next114, i64 %indvars.iv.next114 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next114.1 = add nuw nsw i64 %indvars.iv113, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next114.1, i64 %indvars.iv.next114.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next114.2 = add nuw nsw i64 %indvars.iv113, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next114.2, i64 %indvars.iv.next114.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next114.3 = add nuw nsw i64 %indvars.iv113, 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.inc64 %indvars.iv125 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next126, %for.inc64 ] %indvars137 = trunc i64 %indvars.iv125 to i32 %add = sub i32 %sub18, %indvars137 %cmp19.not106 = icmp slt i32 %add, 1 br i1 %cmp19.not106, label %for.inc64, label %for.body20.lr.ph for.body20.lr.ph: ; preds = %for.cond17.preheader %8 = add nuw i64 %indvars.iv125, 4294967295 br label %for.body20 for.body20: ; preds = %for.body20.lr.ph, %for.inc61 %indvars.iv127 = phi i64 [ %indvars.iv125, %for.body20.lr.ph ], [ %indvars.iv.next128, %for.inc61 ] %indvars.iv116 = phi i64 [ 1, %for.body20.lr.ph ], [ %indvars.iv.next117, %for.inc61 ] %9 = add i64 %8, %indvars.iv116 %sext = shl i64 %9, 32 %idxprom25 = ashr exact i64 %sext, 32 %arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv116, i64 %idxprom25 store i32 10000000, ptr %arrayidx26, align 4, !tbaa !5 %cmp28103 = icmp slt i64 %indvars.iv116, %idxprom25 br i1 %cmp28103, label %for.body29.lr.ph, label %for.inc61 for.body29.lr.ph: ; preds = %for.body20 %10 = add nsw i64 %indvars.iv116, -1 %arrayidx46 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %arrayidx50 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %idxprom25 %12 = load i32, ptr %arrayidx50, align 4, !tbaa !5 br label %for.body29 for.body29: ; preds = %for.body29.lr.ph, %for.body29 %indvars.iv118 = phi i64 [ %indvars.iv116, %for.body29.lr.ph ], [ %indvars.iv.next119, %for.body29 ] %storemerge104 = phi i32 [ 10000000, %for.body29.lr.ph ], [ %y.x.i, %for.body29 ] %arrayidx37 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv116, i64 %indvars.iv118 %13 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %arrayidx42 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next119, i64 %idxprom25 %14 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %add43 = add nsw i32 %14, %13 %arrayidx48 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv118 %15 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %mul = mul nsw i32 %15, %11 %mul51 = mul nsw i32 %mul, %12 %add52 = add nsw i32 %add43, %mul51 %y.x.i = call i32 @llvm.smin.i32(i32 %storemerge104, i32 %add52) store i32 %y.x.i, ptr %arrayidx26, align 4, !tbaa !5 %exitcond124.not = icmp eq i64 %indvars.iv.next119, %indvars.iv127 br i1 %exitcond124.not, label %for.inc61, label %for.body29, !llvm.loop !14 for.inc61: ; preds = %for.body29, %for.body20 %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1 %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %exitcond135.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count138 br i1 %exitcond135.not, label %for.inc64, label %for.body20, !llvm.loop !15 for.inc64: ; preds = %for.inc61, %for.cond17.preheader %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count138 br i1 %exitcond139.not, label %for.end66, label %for.cond17.preheader, !llvm.loop !16 for.end66: ; preds = %for.inc64, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa142145 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc64 ] %idxprom68 = sext i32 %.lcssa142145 to i64 %arrayidx69 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom68 %16 = load i32, ptr %arrayidx69, align 4, !tbaa !5 %call70 = 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 %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 %x, i32 noundef %y) local_unnamed_addr #3 { entry: %y.x = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %y.x } ; 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 MIN(x, y) ((x) < (y) ? (x) : (y)) int get_uint() { int n = 0; int c = getchar_unlocked(); if(c < 48 || 57 < c) return c; while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked(); return n; } void put_uint(int n) { if(!n) { putchar_unlocked('0'); return; } char buf[11]; int i = 0; while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10; while(i--)putchar_unlocked(buf[i]); } int mcm(int *first, const int N) { int dp[N][N]; for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) dp[i][j] = 1 << 28; for(int i = 0; i < N; ++i) dp[i][i] = 0; for(int l = 0; l < N; ++l) for(int i = 0; i < N - l; ++i) { int j = i + l; for(int k = i; k < j; ++k) dp[i][j] = MIN(dp[i][j], dp[i][k] + dp[k + 1][j] + first[i] * first[k + 1] * first[j + 1]); } return dp[0][N - 1]; } int main(int argc, char **argv) { int n = get_uint(); int m[n + 1]; for(int i = 0; i < n; ++i) m[i] = get_uint(), m[i + 1] = get_uint(); put_uint(mcm(m, n)); putchar_unlocked('\n'); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284368/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284368/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] } @stdin = external local_unnamed_addr global ptr, align 8 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nounwind uwtable define dso_local i32 @get_uint() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 br label %getchar_unlocked.exit cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %getchar_unlocked.exit getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ] %4 = add i32 %cond.i, -58 %or.cond = icmp ult i32 %4, -10 br i1 %or.cond, label %cleanup, label %while.body.preheader while.body.preheader: ; preds = %getchar_unlocked.exit %.pre24 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit21 %5 = phi ptr [ %9, %getchar_unlocked.exit21 ], [ %.pre24, %while.body.preheader ] %c.023 = phi i32 [ %cond.i17, %getchar_unlocked.exit21 ], [ %cond.i, %while.body.preheader ] %n.022 = phi i32 [ %add, %getchar_unlocked.exit21 ], [ 0, %while.body.preheader ] %mul = mul nsw i32 %n.022, 10 %and = and i32 %c.023, 15 %add = add nsw i32 %and, %mul %_IO_read_ptr.i12 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1 %6 = load ptr, ptr %_IO_read_ptr.i12, align 8, !tbaa !9 %_IO_read_end.i13 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2 %7 = load ptr, ptr %_IO_read_end.i13, align 8, !tbaa !14 %cmp.not.i14 = icmp ult ptr %6, %7 br i1 %cmp.not.i14, label %cond.false.i18, label %cond.true.i15, !prof !15 cond.true.i15: ; preds = %while.body %call.i16 = tail call i32 @__uflow(ptr noundef nonnull %5) #5 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit21 cond.false.i18: ; preds = %while.body %incdec.ptr.i19 = getelementptr inbounds i8, ptr %6, i64 1 store ptr %incdec.ptr.i19, ptr %_IO_read_ptr.i12, align 8, !tbaa !9 %8 = load i8, ptr %6, align 1, !tbaa !16 %conv3.i20 = zext i8 %8 to i32 br label %getchar_unlocked.exit21 getchar_unlocked.exit21: ; preds = %cond.true.i15, %cond.false.i18 %9 = phi ptr [ %.pre, %cond.true.i15 ], [ %5, %cond.false.i18 ] %cond.i17 = phi i32 [ %call.i16, %cond.true.i15 ], [ %conv3.i20, %cond.false.i18 ] %10 = add i32 %cond.i17, -48 %11 = icmp ult i32 %10, 10 br i1 %11, label %while.body, label %cleanup, !llvm.loop !17 cleanup: ; preds = %getchar_unlocked.exit21, %getchar_unlocked.exit %retval.0 = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %add, %getchar_unlocked.exit21 ] 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: nounwind uwtable define dso_local void @put_uint(i32 noundef %n) local_unnamed_addr #0 { entry: %buf = alloca [11 x i8], align 1 %tobool.not = icmp eq i32 %n, 0 br i1 %tobool.not, label %if.then, label %if.end if.then: ; preds = %entry %0 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5 %1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6 %2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %if.then %call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 48) #5 br label %return cond.false.i: ; preds = %if.then %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19 store i8 48, ptr %1, align 1, !tbaa !16 br label %return if.end: ; preds = %entry call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf) #5 br label %while.body while.body: ; preds = %if.end, %while.body %indvars.iv28 = phi i32 [ 1, %if.end ], [ %indvars.iv.next29, %while.body ] %indvars.iv = phi i64 [ 0, %if.end ], [ %indvars.iv.next, %while.body ] %n.addr.024 = phi i32 [ %n, %if.end ], [ %div, %while.body ] %rem = srem i32 %n.addr.024, 10 %3 = trunc i32 %rem to i8 %conv = add nsw i8 %3, 48 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv store i8 %conv, ptr %arrayidx, align 1, !tbaa !16 %div = sdiv i32 %n.addr.024, 10 %n.addr.024.off = add i32 %n.addr.024, 9 %tobool1.not = icmp ult i32 %n.addr.024.off, 19 %indvars.iv.next29 = add nuw i32 %indvars.iv28, 1 br i1 %tobool1.not, label %while.body4.preheader, label %while.body, !llvm.loop !21 while.body4.preheader: ; preds = %while.body %4 = sext i32 %indvars.iv28 to i64 br label %while.body4 while.body4: ; preds = %while.body4.preheader, %putchar_unlocked.exit23 %indvars.iv30 = phi i64 [ %4, %while.body4.preheader ], [ %indvars.iv.next31, %putchar_unlocked.exit23 ] %indvars.iv.next31 = add nsw i64 %indvars.iv30, -1 %arrayidx6 = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv.next31 %5 = load i8, ptr %arrayidx6, align 1, !tbaa !16 %6 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i15 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 5 %7 = load ptr, ptr %_IO_write_ptr.i15, align 8, !tbaa !19 %_IO_write_end.i16 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 6 %8 = load ptr, ptr %_IO_write_end.i16, align 8, !tbaa !20 %cmp.not.i17 = icmp ult ptr %7, %8 br i1 %cmp.not.i17, label %cond.false.i21, label %cond.true.i18, !prof !15 cond.true.i18: ; preds = %while.body4 %conv7 = zext i8 %5 to i32 %call.i19 = tail call i32 @__overflow(ptr noundef nonnull %6, i32 noundef %conv7) #5 br label %putchar_unlocked.exit23 cond.false.i21: ; preds = %while.body4 %incdec.ptr.i22 = getelementptr inbounds i8, ptr %7, i64 1 store ptr %incdec.ptr.i22, ptr %_IO_write_ptr.i15, align 8, !tbaa !19 store i8 %5, ptr %7, align 1, !tbaa !16 br label %putchar_unlocked.exit23 putchar_unlocked.exit23: ; preds = %cond.true.i18, %cond.false.i21 %9 = and i64 %indvars.iv.next31, 4294967295 %tobool3.not = icmp eq i64 %9, 0 br i1 %tobool3.not, label %while.end9, label %while.body4, !llvm.loop !22 while.end9: ; preds = %putchar_unlocked.exit23 call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf) #5 br label %return return: ; preds = %cond.false.i, %cond.true.i, %while.end9 ret void } ; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable define dso_local i32 @mcm(ptr nocapture noundef readonly %first, i32 noundef %N) local_unnamed_addr #2 { entry: %0 = zext i32 %N to i64 %1 = mul nuw i64 %0, %0 %vla = alloca i32, i64 %1, align 16 %cmp151 = icmp sgt i32 %N, 0 br i1 %cmp151, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup24 for.cond1.preheader.us.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %N, 8 %n.vec = and i64 %0, 4294967288 %cmp.n = icmp eq i64 %n.vec, %0 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us %indvars.iv163 = phi i64 [ %indvars.iv.next164, %for.cond1.for.cond.cleanup3_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ] %2 = mul nuw nsw i64 %indvars.iv163, %0 %arrayidx.us = getelementptr inbounds i32, ptr %vla, i64 %2 br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %3 = getelementptr inbounds i32, ptr %arrayidx.us, i64 %index store <4 x i32> <i32 268435456, i32 268435456, i32 268435456, i32 268435456>, ptr %3, align 4, !tbaa !23 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 268435456, i32 268435456, i32 268435456, i32 268435456>, ptr %4, align 4, !tbaa !23 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !24 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body4.us for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ] %arrayidx6.us = getelementptr inbounds i32, ptr %arrayidx.us, i64 %indvars.iv store i32 268435456, ptr %arrayidx6.us, align 4, !tbaa !23 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %0 br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !27 for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1 %exitcond167.not = icmp eq i64 %indvars.iv.next164, %0 br i1 %exitcond167.not, label %for.cond11.preheader, label %for.cond1.preheader.us, !llvm.loop !28 for.cond11.preheader: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us br i1 %cmp151, label %for.body14.preheader, label %for.cond.cleanup24 for.body14.preheader: ; preds = %for.cond11.preheader %xtraiter = and i64 %0, 3 %6 = icmp ult i32 %N, 4 br i1 %6, label %for.cond22.preheader.unr-lcssa, label %for.body14.preheader.new for.body14.preheader.new: ; preds = %for.body14.preheader %unroll_iter = and i64 %0, 4294967292 br label %for.body14 for.cond22.preheader.unr-lcssa: ; preds = %for.body14, %for.body14.preheader %indvars.iv168.unr = phi i64 [ 0, %for.body14.preheader ], [ %indvars.iv.next169.3, %for.body14 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond22.preheader, label %for.body14.epil for.body14.epil: ; preds = %for.cond22.preheader.unr-lcssa, %for.body14.epil %indvars.iv168.epil = phi i64 [ %indvars.iv.next169.epil, %for.body14.epil ], [ %indvars.iv168.unr, %for.cond22.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body14.epil ], [ 0, %for.cond22.preheader.unr-lcssa ] %7 = mul nuw nsw i64 %indvars.iv168.epil, %0 %arrayidx16.epil = getelementptr inbounds i32, ptr %vla, i64 %7 %arrayidx18.epil = getelementptr inbounds i32, ptr %arrayidx16.epil, i64 %indvars.iv168.epil store i32 0, ptr %arrayidx18.epil, align 4, !tbaa !23 %indvars.iv.next169.epil = add nuw nsw i64 %indvars.iv168.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.cond22.preheader, label %for.body14.epil, !llvm.loop !29 for.cond22.preheader: ; preds = %for.body14.epil, %for.cond22.preheader.unr-lcssa br i1 %cmp151, label %for.cond27.preheader.preheader, label %for.cond.cleanup24 for.cond27.preheader.preheader: ; preds = %for.cond22.preheader %8 = zext i32 %N to i64 %invariant.gep191 = getelementptr i32, ptr %first, i64 1 br label %for.cond27.preheader for.body14: ; preds = %for.body14, %for.body14.preheader.new %indvars.iv168 = phi i64 [ 0, %for.body14.preheader.new ], [ %indvars.iv.next169.3, %for.body14 ] %niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.3, %for.body14 ] %9 = mul nuw nsw i64 %indvars.iv168, %0 %arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %9 %arrayidx18 = getelementptr inbounds i32, ptr %arrayidx16, i64 %indvars.iv168 store i32 0, ptr %arrayidx18, align 16, !tbaa !23 %indvars.iv.next169 = or i64 %indvars.iv168, 1 %10 = mul nuw nsw i64 %indvars.iv.next169, %0 %arrayidx16.1 = getelementptr inbounds i32, ptr %vla, i64 %10 %arrayidx18.1 = getelementptr inbounds i32, ptr %arrayidx16.1, i64 %indvars.iv.next169 store i32 0, ptr %arrayidx18.1, align 4, !tbaa !23 %indvars.iv.next169.1 = or i64 %indvars.iv168, 2 %11 = mul nuw nsw i64 %indvars.iv.next169.1, %0 %arrayidx16.2 = getelementptr inbounds i32, ptr %vla, i64 %11 %arrayidx18.2 = getelementptr inbounds i32, ptr %arrayidx16.2, i64 %indvars.iv.next169.1 store i32 0, ptr %arrayidx18.2, align 8, !tbaa !23 %indvars.iv.next169.2 = or i64 %indvars.iv168, 3 %12 = mul nuw nsw i64 %indvars.iv.next169.2, %0 %arrayidx16.3 = getelementptr inbounds i32, ptr %vla, i64 %12 %arrayidx18.3 = getelementptr inbounds i32, ptr %arrayidx16.3, i64 %indvars.iv.next169.2 store i32 0, ptr %arrayidx18.3, align 4, !tbaa !23 %indvars.iv.next169.3 = add nuw nsw i64 %indvars.iv168, 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.cond22.preheader.unr-lcssa, label %for.body14, !llvm.loop !31 for.cond27.preheader: ; preds = %for.cond27.preheader.preheader, %for.cond.cleanup29 %indvars.iv185 = phi i64 [ 0, %for.cond27.preheader.preheader ], [ %indvars.iv.next186, %for.cond.cleanup29 ] %indvars.iv181 = phi i32 [ %N, %for.cond27.preheader.preheader ], [ %indvars.iv.next182, %for.cond.cleanup29 ] %cmp28158 = icmp ult i64 %indvars.iv185, %8 br i1 %cmp28158, label %for.body30.preheader, label %for.cond.cleanup29 for.body30.preheader: ; preds = %for.cond27.preheader %wide.trip.count183 = zext i32 %indvars.iv181 to i64 %cmp33155.not = icmp eq i64 %indvars.iv185, 0 br label %for.body30 for.cond.cleanup24: ; preds = %for.cond.cleanup29, %entry, %for.cond11.preheader, %for.cond22.preheader %sub100 = add nsw i32 %N, -1 %idxprom101 = sext i32 %sub100 to i64 %arrayidx102 = getelementptr inbounds i32, ptr %vla, i64 %idxprom101 %13 = load i32, ptr %arrayidx102, align 4, !tbaa !23 ret i32 %13 for.cond.cleanup29: ; preds = %for.cond.cleanup34, %for.cond27.preheader %indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1 %indvars.iv.next182 = add i32 %indvars.iv181, -1 %exitcond190.not = icmp eq i64 %indvars.iv.next186, %0 br i1 %exitcond190.not, label %for.cond.cleanup24, label %for.cond27.preheader, !llvm.loop !32 for.body30: ; preds = %for.body30.preheader, %for.cond.cleanup34 %indvars.iv173 = phi i64 [ 0, %for.body30.preheader ], [ %indvars.iv.next174, %for.cond.cleanup34 ] %14 = add nuw nsw i64 %indvars.iv173, %indvars.iv185 br i1 %cmp33155.not, label %for.cond.cleanup34, label %for.body35.lr.ph for.body35.lr.ph: ; preds = %for.body30 %15 = mul nuw nsw i64 %indvars.iv173, %0 %arrayidx37 = getelementptr inbounds i32, ptr %vla, i64 %15 %arrayidx39 = getelementptr inbounds i32, ptr %arrayidx37, i64 %14 %invariant.gep = getelementptr inbounds i32, ptr %vla, i64 %14 %arrayidx51 = getelementptr inbounds i32, ptr %first, i64 %indvars.iv173 %16 = load i32, ptr %arrayidx51, align 4, !tbaa !23 %gep192 = getelementptr i32, ptr %invariant.gep191, i64 %14 %17 = load i32, ptr %gep192, align 4, !tbaa !23 %arrayidx39.promoted = load i32, ptr %arrayidx39, align 4, !tbaa !23 br label %for.body35 for.cond.cleanup34: ; preds = %for.body35, %for.body30 %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1 %exitcond184.not = icmp eq i64 %indvars.iv.next174, %wide.trip.count183 br i1 %exitcond184.not, label %for.cond.cleanup29, label %for.body30, !llvm.loop !33 for.body35: ; preds = %for.body35.lr.ph, %for.body35 %indvars.iv175 = phi i64 [ %indvars.iv173, %for.body35.lr.ph ], [ %indvars.iv.next176, %for.body35 ] %.add59157 = phi i32 [ %arrayidx39.promoted, %for.body35.lr.ph ], [ %.add59, %for.body35 ] %arrayidx43 = getelementptr inbounds i32, ptr %arrayidx37, i64 %indvars.iv175 %18 = load i32, ptr %arrayidx43, align 4, !tbaa !23 %indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1 %19 = mul nuw nsw i64 %indvars.iv.next176, %0 %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %19 %20 = load i32, ptr %gep, align 4, !tbaa !23 %add49 = add nsw i32 %20, %18 %arrayidx54 = getelementptr inbounds i32, ptr %first, i64 %indvars.iv.next176 %21 = load i32, ptr %arrayidx54, align 4, !tbaa !23 %mul = mul nsw i32 %21, %16 %mul58 = mul nsw i32 %mul, %17 %add59 = add nsw i32 %add49, %mul58 %.add59 = tail call i32 @llvm.smin.i32(i32 %.add59157, i32 %add59) store i32 %.add59, ptr %arrayidx39, align 4, !tbaa !23 %cmp33 = icmp ult i64 %indvars.iv.next176, %14 br i1 %cmp33, label %for.body35, label %for.cond.cleanup34, !llvm.loop !34 } ; Function Attrs: nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %buf.i = alloca [11 x i8], align 1 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14 %cmp.not.i.i = icmp ult ptr %1, %2 br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15 cond.true.i.i: ; preds = %entry %call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 br label %getchar_unlocked.exit.i cond.false.i.i: ; preds = %entry %incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i.i = zext i8 %3 to i32 br label %getchar_unlocked.exit.i getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i %cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ] %4 = add i32 %cond.i.i, -58 %or.cond.i = icmp ult i32 %4, -10 br i1 %or.cond.i, label %get_uint.exit, label %while.body.preheader.i while.body.preheader.i: ; preds = %getchar_unlocked.exit.i %.pre24.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body.i while.body.i: ; preds = %getchar_unlocked.exit21.i, %while.body.preheader.i %5 = phi ptr [ %9, %getchar_unlocked.exit21.i ], [ %.pre24.i, %while.body.preheader.i ] %c.023.i = phi i32 [ %cond.i17.i, %getchar_unlocked.exit21.i ], [ %cond.i.i, %while.body.preheader.i ] %n.022.i = phi i32 [ %add.i, %getchar_unlocked.exit21.i ], [ 0, %while.body.preheader.i ] %mul.i = mul nsw i32 %n.022.i, 10 %and.i = and i32 %c.023.i, 15 %add.i = add nsw i32 %mul.i, %and.i %_IO_read_ptr.i12.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1 %6 = load ptr, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9 %_IO_read_end.i13.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2 %7 = load ptr, ptr %_IO_read_end.i13.i, align 8, !tbaa !14 %cmp.not.i14.i = icmp ult ptr %6, %7 br i1 %cmp.not.i14.i, label %cond.false.i18.i, label %cond.true.i15.i, !prof !15 cond.true.i15.i: ; preds = %while.body.i %call.i16.i = tail call i32 @__uflow(ptr noundef nonnull %5) #5 %.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit21.i cond.false.i18.i: ; preds = %while.body.i %incdec.ptr.i19.i = getelementptr inbounds i8, ptr %6, i64 1 store ptr %incdec.ptr.i19.i, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9 %8 = load i8, ptr %6, align 1, !tbaa !16 %conv3.i20.i = zext i8 %8 to i32 br label %getchar_unlocked.exit21.i getchar_unlocked.exit21.i: ; preds = %cond.false.i18.i, %cond.true.i15.i %9 = phi ptr [ %.pre.i, %cond.true.i15.i ], [ %5, %cond.false.i18.i ] %cond.i17.i = phi i32 [ %call.i16.i, %cond.true.i15.i ], [ %conv3.i20.i, %cond.false.i18.i ] %10 = add i32 %cond.i17.i, -48 %11 = icmp ult i32 %10, 10 br i1 %11, label %while.body.i, label %get_uint.exit, !llvm.loop !17 get_uint.exit: ; preds = %getchar_unlocked.exit21.i, %getchar_unlocked.exit.i %retval.0.i = phi i32 [ %cond.i.i, %getchar_unlocked.exit.i ], [ %add.i, %getchar_unlocked.exit21.i ] %add = add nsw i32 %retval.0.i, 1 %12 = zext i32 %add to i64 %vla = alloca i32, i64 %12, align 16 %cmp83 = icmp sgt i32 %retval.0.i, 0 br i1 %cmp83, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %get_uint.exit %wide.trip.count = zext i32 %retval.0.i to i64 %.pre86 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %for.body for.cond.cleanup: ; preds = %get_uint.exit82, %get_uint.exit %call6 = call i32 @mcm(ptr noundef nonnull %vla, i32 noundef %retval.0.i) %tobool.not.i = icmp eq i32 %call6, 0 br i1 %tobool.not.i, label %if.then.i, label %if.end.i if.then.i: ; preds = %for.cond.cleanup %13 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 5 %14 = load ptr, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19 %_IO_write_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 6 %15 = load ptr, ptr %_IO_write_end.i.i, align 8, !tbaa !20 %cmp.not.i.i14 = icmp ult ptr %14, %15 br i1 %cmp.not.i.i14, label %cond.false.i.i17, label %cond.true.i.i15, !prof !15 cond.true.i.i15: ; preds = %if.then.i %call.i.i16 = tail call i32 @__overflow(ptr noundef nonnull %13, i32 noundef 48) #5 br label %put_uint.exit cond.false.i.i17: ; preds = %if.then.i %incdec.ptr.i.i18 = getelementptr inbounds i8, ptr %14, i64 1 store ptr %incdec.ptr.i.i18, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19 store i8 48, ptr %14, align 1, !tbaa !16 br label %put_uint.exit if.end.i: ; preds = %for.cond.cleanup call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf.i) #5 br label %while.body.i13 while.body.i13: ; preds = %while.body.i13, %if.end.i %indvars.iv28.i = phi i32 [ 1, %if.end.i ], [ %indvars.iv.next29.i, %while.body.i13 ] %indvars.iv.i = phi i64 [ 0, %if.end.i ], [ %indvars.iv.next.i, %while.body.i13 ] %n.addr.024.i = phi i32 [ %call6, %if.end.i ], [ %div.i, %while.body.i13 ] %rem.i = srem i32 %n.addr.024.i, 10 %16 = trunc i32 %rem.i to i8 %conv.i = add nsw i8 %16, 48 %indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1 %arrayidx.i = getelementptr inbounds [11 x i8], ptr %buf.i, i64 0, i64 %indvars.iv.i store i8 %conv.i, ptr %arrayidx.i, align 1, !tbaa !16 %div.i = sdiv i32 %n.addr.024.i, 10 %n.addr.024.off.i = add i32 %n.addr.024.i, 9 %tobool1.not.i = icmp ult i32 %n.addr.024.off.i, 19 %indvars.iv.next29.i = add nuw i32 %indvars.iv28.i, 1 br i1 %tobool1.not.i, label %while.body4.preheader.i, label %while.body.i13, !llvm.loop !21 while.body4.preheader.i: ; preds = %while.body.i13 %17 = sext i32 %indvars.iv28.i to i64 br label %while.body4.i while.body4.i: ; preds = %putchar_unlocked.exit23.i, %while.body4.preheader.i %indvars.iv30.i = phi i64 [ %17, %while.body4.preheader.i ], [ %indvars.iv.next31.i, %putchar_unlocked.exit23.i ] %indvars.iv.next31.i = add nsw i64 %indvars.iv30.i, -1 %arrayidx6.i = getelementptr inbounds [11 x i8], ptr %buf.i, i64 0, i64 %indvars.iv.next31.i %18 = load i8, ptr %arrayidx6.i, align 1, !tbaa !16 %19 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i15.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 5 %20 = load ptr, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19 %_IO_write_end.i16.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 6 %21 = load ptr, ptr %_IO_write_end.i16.i, align 8, !tbaa !20 %cmp.not.i17.i = icmp ult ptr %20, %21 br i1 %cmp.not.i17.i, label %cond.false.i21.i, label %cond.true.i18.i, !prof !15 cond.true.i18.i: ; preds = %while.body4.i %conv7.i = zext i8 %18 to i32 %call.i19.i = tail call i32 @__overflow(ptr noundef nonnull %19, i32 noundef %conv7.i) #5 br label %putchar_unlocked.exit23.i cond.false.i21.i: ; preds = %while.body4.i %incdec.ptr.i22.i = getelementptr inbounds i8, ptr %20, i64 1 store ptr %incdec.ptr.i22.i, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19 store i8 %18, ptr %20, align 1, !tbaa !16 br label %putchar_unlocked.exit23.i putchar_unlocked.exit23.i: ; preds = %cond.false.i21.i, %cond.true.i18.i %22 = and i64 %indvars.iv.next31.i, 4294967295 %tobool3.not.i = icmp eq i64 %22, 0 br i1 %tobool3.not.i, label %while.end9.i, label %while.body4.i, !llvm.loop !22 while.end9.i: ; preds = %putchar_unlocked.exit23.i call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf.i) #5 br label %put_uint.exit put_uint.exit: ; preds = %cond.true.i.i15, %cond.false.i.i17, %while.end9.i %23 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %23, i64 0, i32 5 %24 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %23, i64 0, i32 6 %25 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20 %cmp.not.i = icmp ult ptr %24, %25 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %put_uint.exit %call.i = tail call i32 @__overflow(ptr noundef nonnull %23, i32 noundef 10) #5 br label %putchar_unlocked.exit cond.false.i: ; preds = %put_uint.exit %incdec.ptr.i = getelementptr inbounds i8, ptr %24, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19 store i8 10, ptr %24, align 1, !tbaa !16 br label %putchar_unlocked.exit putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i ret i32 0 for.body: ; preds = %for.body.preheader, %get_uint.exit82 %.pre8792 = phi ptr [ %.pre86, %for.body.preheader ], [ %.pre8793, %get_uint.exit82 ] %26 = phi ptr [ %.pre86, %for.body.preheader ], [ %50, %get_uint.exit82 ] %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %get_uint.exit82 ] %_IO_read_ptr.i.i19 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 1 %27 = load ptr, ptr %_IO_read_ptr.i.i19, align 8, !tbaa !9 %_IO_read_end.i.i20 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 2 %28 = load ptr, ptr %_IO_read_end.i.i20, align 8, !tbaa !14 %cmp.not.i.i21 = icmp ult ptr %27, %28 br i1 %cmp.not.i.i21, label %cond.false.i.i47, label %cond.true.i.i22, !prof !15 cond.true.i.i22: ; preds = %for.body %call.i.i23 = tail call i32 @__uflow(ptr noundef nonnull %26) #5 %.pre87.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit.i24 cond.false.i.i47: ; preds = %for.body %incdec.ptr.i.i48 = getelementptr inbounds i8, ptr %27, i64 1 store ptr %incdec.ptr.i.i48, ptr %_IO_read_ptr.i.i19, align 8, !tbaa !9 %29 = load i8, ptr %27, align 1, !tbaa !16 %conv3.i.i49 = zext i8 %29 to i32 br label %getchar_unlocked.exit.i24 getchar_unlocked.exit.i24: ; preds = %cond.false.i.i47, %cond.true.i.i22 %.pre87 = phi ptr [ %.pre87.pre, %cond.true.i.i22 ], [ %.pre8792, %cond.false.i.i47 ] %cond.i.i25 = phi i32 [ %call.i.i23, %cond.true.i.i22 ], [ %conv3.i.i49, %cond.false.i.i47 ] %30 = add i32 %cond.i.i25, -58 %or.cond.i26 = icmp ult i32 %30, -10 br i1 %or.cond.i26, label %get_uint.exit50, label %while.body.i29 while.body.i29: ; preds = %getchar_unlocked.exit.i24, %getchar_unlocked.exit21.i41 %.pre8789 = phi ptr [ %.pre8788, %getchar_unlocked.exit21.i41 ], [ %.pre87, %getchar_unlocked.exit.i24 ] %31 = phi ptr [ %35, %getchar_unlocked.exit21.i41 ], [ %.pre87, %getchar_unlocked.exit.i24 ] %c.023.i30 = phi i32 [ %cond.i17.i42, %getchar_unlocked.exit21.i41 ], [ %cond.i.i25, %getchar_unlocked.exit.i24 ] %n.022.i31 = phi i32 [ %add.i34, %getchar_unlocked.exit21.i41 ], [ 0, %getchar_unlocked.exit.i24 ] %mul.i32 = mul nsw i32 %n.022.i31, 10 %and.i33 = and i32 %c.023.i30, 15 %add.i34 = add nsw i32 %mul.i32, %and.i33 %_IO_read_ptr.i12.i35 = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 1 %32 = load ptr, ptr %_IO_read_ptr.i12.i35, align 8, !tbaa !9 %_IO_read_end.i13.i36 = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 2 %33 = load ptr, ptr %_IO_read_end.i13.i36, align 8, !tbaa !14 %cmp.not.i14.i37 = icmp ult ptr %32, %33 br i1 %cmp.not.i14.i37, label %cond.false.i18.i44, label %cond.true.i15.i38, !prof !15 cond.true.i15.i38: ; preds = %while.body.i29 %call.i16.i39 = tail call i32 @__uflow(ptr noundef nonnull %31) #5 %.pre.i40 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit21.i41 cond.false.i18.i44: ; preds = %while.body.i29 %incdec.ptr.i19.i45 = getelementptr inbounds i8, ptr %32, i64 1 store ptr %incdec.ptr.i19.i45, ptr %_IO_read_ptr.i12.i35, align 8, !tbaa !9 %34 = load i8, ptr %32, align 1, !tbaa !16 %conv3.i20.i46 = zext i8 %34 to i32 br label %getchar_unlocked.exit21.i41 getchar_unlocked.exit21.i41: ; preds = %cond.false.i18.i44, %cond.true.i15.i38 %.pre8788 = phi ptr [ %.pre.i40, %cond.true.i15.i38 ], [ %.pre8789, %cond.false.i18.i44 ] %35 = phi ptr [ %.pre.i40, %cond.true.i15.i38 ], [ %31, %cond.false.i18.i44 ] %cond.i17.i42 = phi i32 [ %call.i16.i39, %cond.true.i15.i38 ], [ %conv3.i20.i46, %cond.false.i18.i44 ] %36 = add i32 %cond.i17.i42, -48 %37 = icmp ult i32 %36, 10 br i1 %37, label %while.body.i29, label %get_uint.exit50, !llvm.loop !17 get_uint.exit50: ; preds = %getchar_unlocked.exit21.i41, %getchar_unlocked.exit.i24 %.pre8795 = phi ptr [ %.pre87, %getchar_unlocked.exit.i24 ], [ %.pre8788, %getchar_unlocked.exit21.i41 ] %38 = phi ptr [ %.pre87, %getchar_unlocked.exit.i24 ], [ %35, %getchar_unlocked.exit21.i41 ] %retval.0.i43 = phi i32 [ %cond.i.i25, %getchar_unlocked.exit.i24 ], [ %add.i34, %getchar_unlocked.exit21.i41 ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %retval.0.i43, ptr %arrayidx, align 4, !tbaa !23 %_IO_read_ptr.i.i51 = getelementptr inbounds %struct._IO_FILE, ptr %38, i64 0, i32 1 %39 = load ptr, ptr %_IO_read_ptr.i.i51, align 8, !tbaa !9 %_IO_read_end.i.i52 = getelementptr inbounds %struct._IO_FILE, ptr %38, i64 0, i32 2 %40 = load ptr, ptr %_IO_read_end.i.i52, align 8, !tbaa !14 %cmp.not.i.i53 = icmp ult ptr %39, %40 br i1 %cmp.not.i.i53, label %cond.false.i.i79, label %cond.true.i.i54, !prof !15 cond.true.i.i54: ; preds = %get_uint.exit50 %call.i.i55 = tail call i32 @__uflow(ptr noundef nonnull %38) #5 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit.i56 cond.false.i.i79: ; preds = %get_uint.exit50 %incdec.ptr.i.i80 = getelementptr inbounds i8, ptr %39, i64 1 store ptr %incdec.ptr.i.i80, ptr %_IO_read_ptr.i.i51, align 8, !tbaa !9 %41 = load i8, ptr %39, align 1, !tbaa !16 %conv3.i.i81 = zext i8 %41 to i32 br label %getchar_unlocked.exit.i56 getchar_unlocked.exit.i56: ; preds = %cond.false.i.i79, %cond.true.i.i54 %.pre8794 = phi ptr [ %.pre, %cond.true.i.i54 ], [ %.pre8795, %cond.false.i.i79 ] %.pre24.i60 = phi ptr [ %.pre, %cond.true.i.i54 ], [ %38, %cond.false.i.i79 ] %cond.i.i57 = phi i32 [ %call.i.i55, %cond.true.i.i54 ], [ %conv3.i.i81, %cond.false.i.i79 ] %42 = add i32 %cond.i.i57, -58 %or.cond.i58 = icmp ult i32 %42, -10 br i1 %or.cond.i58, label %get_uint.exit82, label %while.body.i61 while.body.i61: ; preds = %getchar_unlocked.exit.i56, %getchar_unlocked.exit21.i73 %.pre8791 = phi ptr [ %.pre8790, %getchar_unlocked.exit21.i73 ], [ %.pre8794, %getchar_unlocked.exit.i56 ] %43 = phi ptr [ %47, %getchar_unlocked.exit21.i73 ], [ %.pre24.i60, %getchar_unlocked.exit.i56 ] %c.023.i62 = phi i32 [ %cond.i17.i74, %getchar_unlocked.exit21.i73 ], [ %cond.i.i57, %getchar_unlocked.exit.i56 ] %n.022.i63 = phi i32 [ %add.i66, %getchar_unlocked.exit21.i73 ], [ 0, %getchar_unlocked.exit.i56 ] %mul.i64 = mul nsw i32 %n.022.i63, 10 %and.i65 = and i32 %c.023.i62, 15 %add.i66 = add nsw i32 %mul.i64, %and.i65 %_IO_read_ptr.i12.i67 = getelementptr inbounds %struct._IO_FILE, ptr %43, i64 0, i32 1 %44 = load ptr, ptr %_IO_read_ptr.i12.i67, align 8, !tbaa !9 %_IO_read_end.i13.i68 = getelementptr inbounds %struct._IO_FILE, ptr %43, i64 0, i32 2 %45 = load ptr, ptr %_IO_read_end.i13.i68, align 8, !tbaa !14 %cmp.not.i14.i69 = icmp ult ptr %44, %45 br i1 %cmp.not.i14.i69, label %cond.false.i18.i76, label %cond.true.i15.i70, !prof !15 cond.true.i15.i70: ; preds = %while.body.i61 %call.i16.i71 = tail call i32 @__uflow(ptr noundef nonnull %43) #5 %.pre.i72 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit21.i73 cond.false.i18.i76: ; preds = %while.body.i61 %incdec.ptr.i19.i77 = getelementptr inbounds i8, ptr %44, i64 1 store ptr %incdec.ptr.i19.i77, ptr %_IO_read_ptr.i12.i67, align 8, !tbaa !9 %46 = load i8, ptr %44, align 1, !tbaa !16 %conv3.i20.i78 = zext i8 %46 to i32 br label %getchar_unlocked.exit21.i73 getchar_unlocked.exit21.i73: ; preds = %cond.false.i18.i76, %cond.true.i15.i70 %.pre8790 = phi ptr [ %.pre.i72, %cond.true.i15.i70 ], [ %.pre8791, %cond.false.i18.i76 ] %47 = phi ptr [ %.pre.i72, %cond.true.i15.i70 ], [ %43, %cond.false.i18.i76 ] %cond.i17.i74 = phi i32 [ %call.i16.i71, %cond.true.i15.i70 ], [ %conv3.i20.i78, %cond.false.i18.i76 ] %48 = add i32 %cond.i17.i74, -48 %49 = icmp ult i32 %48, 10 br i1 %49, label %while.body.i61, label %get_uint.exit82, !llvm.loop !17 get_uint.exit82: ; preds = %getchar_unlocked.exit21.i73, %getchar_unlocked.exit.i56 %.pre8793 = phi ptr [ %.pre8794, %getchar_unlocked.exit.i56 ], [ %.pre8790, %getchar_unlocked.exit21.i73 ] %50 = phi ptr [ %.pre24.i60, %getchar_unlocked.exit.i56 ], [ %47, %getchar_unlocked.exit21.i73 ] %retval.0.i75 = phi i32 [ %cond.i.i57, %getchar_unlocked.exit.i56 ], [ %add.i66, %getchar_unlocked.exit21.i73 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next store i32 %retval.0.i75, ptr %arrayidx5, align 4, !tbaa !23 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !35 } declare i32 @__uflow(ptr noundef) local_unnamed_addr #3 declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !6, i64 8} !10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196} !11 = !{!"int", !7, i64 0} !12 = !{!"long", !7, i64 0} !13 = !{!"short", !7, i64 0} !14 = !{!10, !6, i64 16} !15 = !{!"branch_weights", i32 2000, i32 1} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"} !19 = !{!10, !6, i64 40} !20 = !{!10, !6, i64 48} !21 = distinct !{!21, !18} !22 = distinct !{!22, !18} !23 = !{!11, !11, i64 0} !24 = distinct !{!24, !18, !25, !26} !25 = !{!"llvm.loop.isvectorized", i32 1} !26 = !{!"llvm.loop.unroll.runtime.disable"} !27 = distinct !{!27, !18, !26, !25} !28 = distinct !{!28, !18} !29 = distinct !{!29, !30} !30 = !{!"llvm.loop.unroll.disable"} !31 = distinct !{!31, !18} !32 = distinct !{!32, !18} !33 = distinct !{!33, !18} !34 = distinct !{!34, !18} !35 = distinct !{!35, !18}
#include<stdio.h> #define MAX 2147483647 int dp[100][100],num[101]; int rensa(int); int main(){ int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d%d",num+i,num+i+1); printf("%d\n",rensa(n)); return 0; } int rensa(int n){ int i,j,k,l,min; for(i=0;i<n;i++) dp[i][i]=0; for(l=1;l<n;l++){ for(i=0;i<n-l;i++){ j=i+l; dp[i][j]=MAX; for(k=i;k<j;k++){ min=dp[i][k]+dp[k+1][j]+num[i]*num[k+1]*num[j+1]; if(dp[i][j]>min) dp[i][j]=min; } } } return dp[0][n-1]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284410/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284410/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @num = dso_local global [101 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @dp = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp10 = icmp sgt i32 %0, 0 br i1 %cmp10, label %for.body, label %for.cond3.preheader.for.end53_crit_edge.i for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %add.ptr = getelementptr inbounds i32, ptr @num, i64 %indvars.iv %add.ptr3 = getelementptr inbounds i32, ptr %add.ptr, i64 1 %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3) %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 %cmp85.i = icmp sgt i32 %1, 0 br i1 %cmp85.i, label %for.body.preheader.i, label %for.cond3.preheader.for.end53_crit_edge.i for.body.preheader.i: ; preds = %for.end %wide.trip.count.i = zext i32 %1 to i64 %xtraiter = and i64 %wide.trip.count.i, 3 %3 = icmp ult i32 %1, 4 br i1 %3, 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 @dp, 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 !11 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp490.i = icmp sgt i32 %1, 1 br i1 %cmp490.i, label %for.cond6.preheader.preheader.i, label %for.cond3.preheader.for.end53_crit_edge.i for.cond3.preheader.for.end53_crit_edge.i: ; preds = %entry, %for.cond3.preheader.i, %for.end %.lcssa16 = phi i32 [ %1, %for.cond3.preheader.i ], [ %1, %for.end ], [ %0, %entry ] %.pre.i = add nsw i32 %.lcssa16, -1 br label %rensa.exit for.cond6.preheader.preheader.i: ; preds = %for.cond3.preheader.i %4 = add nsw i32 %1, -1 br 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 @dp, 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 @dp, 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 @dp, 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 @dp, 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 !13 for.cond6.preheader.i: ; preds = %for.inc51.i, %for.cond6.preheader.preheader.i %indvars.iv111.i = phi i32 [ %4, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next112.i, %for.inc51.i ] %indvars.iv102.i = phi i64 [ 1, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next103.i, %for.inc51.i ] %cmp788.i = icmp ult i64 %indvars.iv102.i, %wide.trip.count.i br i1 %cmp788.i, label %for.body8.preheader.i, label %for.inc51.i for.body8.preheader.i: ; preds = %for.cond6.preheader.i %wide.trip.count113.i = zext i32 %indvars.iv111.i to i64 br label %for.body8.i for.body8.i: ; preds = %for.inc48.i, %for.body8.preheader.i %indvars.iv104.i = phi i64 [ %indvars.iv102.i, %for.body8.preheader.i ], [ %indvars.iv.next105.i, %for.inc48.i ] %indvars.iv93.i = phi i64 [ 0, %for.body8.preheader.i ], [ %indvars.iv.next94.i, %for.inc48.i ] %5 = add nuw nsw i64 %indvars.iv93.i, %indvars.iv102.i %arrayidx12.i = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv93.i, i64 %5 store i32 2147483647, ptr %arrayidx12.i, align 4, !tbaa !5 %arrayidx27.i = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %indvars.iv93.i %6 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %7 = add nuw nsw i64 %5, 1 %arrayidx33.i = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %7 %8 = load i32, ptr %arrayidx33.i, align 4, !tbaa !5 %mul.i = mul i32 %8, %6 br label %for.body15.i for.body15.i: ; preds = %for.inc45.i, %for.body8.i %indvars.iv95.i = phi i64 [ %indvars.iv93.i, %for.body8.i ], [ %indvars.iv.next96.i, %for.inc45.i ] %9 = phi i32 [ 2147483647, %for.body8.i ], [ %13, %for.inc45.i ] %arrayidx19.i = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv93.i, i64 %indvars.iv95.i %10 = load i32, ptr %arrayidx19.i, align 4, !tbaa !5 %indvars.iv.next96.i = add nuw nsw i64 %indvars.iv95.i, 1 %arrayidx24.i = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next96.i, i64 %5 %11 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5 %add25.i = add nsw i32 %11, %10 %arrayidx30.i = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %indvars.iv.next96.i %12 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5 %mul34.i = mul i32 %mul.i, %12 %add35.i = add nsw i32 %add25.i, %mul34.i %cmp40.i = icmp sgt i32 %9, %add35.i br i1 %cmp40.i, label %if.then.i, label %for.inc45.i if.then.i: ; preds = %for.body15.i store i32 %add35.i, ptr %arrayidx12.i, align 4, !tbaa !5 br label %for.inc45.i for.inc45.i: ; preds = %if.then.i, %for.body15.i %13 = phi i32 [ %9, %for.body15.i ], [ %add35.i, %if.then.i ] %exitcond101.not.i = icmp eq i64 %indvars.iv.next96.i, %indvars.iv104.i br i1 %exitcond101.not.i, label %for.inc48.i, label %for.body15.i, !llvm.loop !14 for.inc48.i: ; preds = %for.inc45.i %indvars.iv.next94.i = add nuw nsw i64 %indvars.iv93.i, 1 %indvars.iv.next105.i = add nuw nsw i64 %indvars.iv104.i, 1 %exitcond114.not.i = icmp eq i64 %indvars.iv.next94.i, %wide.trip.count113.i br i1 %exitcond114.not.i, label %for.inc51.i, label %for.body8.i, !llvm.loop !15 for.inc51.i: ; preds = %for.inc48.i, %for.cond6.preheader.i %indvars.iv.next103.i = add nuw nsw i64 %indvars.iv102.i, 1 %indvars.iv.next112.i = add i32 %indvars.iv111.i, -1 %exitcond118.not.i = icmp eq i64 %indvars.iv.next103.i, %wide.trip.count.i br i1 %exitcond118.not.i, label %rensa.exit, label %for.cond6.preheader.i, !llvm.loop !16 rensa.exit: ; preds = %for.inc51.i, %for.cond3.preheader.for.end53_crit_edge.i %sub54.pre-phi.i = phi i32 [ %.pre.i, %for.cond3.preheader.for.end53_crit_edge.i ], [ %4, %for.inc51.i ] %idxprom55.i = sext i32 %sub54.pre-phi.i to i64 %arrayidx56.i = getelementptr inbounds [100 x i32], ptr @dp, i64 0, i64 %idxprom55.i %14 = load i32, ptr %arrayidx56.i, align 4, !tbaa !5 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @rensa(i32 noundef %n) local_unnamed_addr #3 { entry: %cmp85 = icmp sgt i32 %n, 0 br i1 %cmp85, label %for.body.preheader, label %for.cond3.preheader.for.end53_crit_edge for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %xtraiter = and i64 %wide.trip.count, 3 %0 = icmp ult i32 %n, 4 br i1 %0, label %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 @dp, 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 !17 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp490 = icmp sgt i32 %n, 1 br i1 %cmp490, label %for.cond6.preheader.preheader, label %for.cond3.preheader.for.end53_crit_edge for.cond3.preheader.for.end53_crit_edge: ; preds = %entry, %for.cond3.preheader %.pre = add nsw i32 %n, -1 br label %for.end53 for.cond6.preheader.preheader: ; preds = %for.cond3.preheader %1 = add nsw i32 %n, -1 %2 = zext i32 %n to i64 %wide.trip.count117 = zext i32 %n to i64 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 @dp, 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 @dp, 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 @dp, 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 @dp, 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 !13 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc51 %indvars.iv111 = phi i32 [ %1, %for.cond6.preheader.preheader ], [ %indvars.iv.next112, %for.inc51 ] %indvars.iv102 = phi i64 [ 1, %for.cond6.preheader.preheader ], [ %indvars.iv.next103, %for.inc51 ] %cmp788 = icmp ult i64 %indvars.iv102, %2 br i1 %cmp788, label %for.body8.preheader, label %for.inc51 for.body8.preheader: ; preds = %for.cond6.preheader %wide.trip.count113 = zext i32 %indvars.iv111 to i64 br label %for.body8 for.body8: ; preds = %for.body8.preheader, %for.inc48 %indvars.iv104 = phi i64 [ %indvars.iv102, %for.body8.preheader ], [ %indvars.iv.next105, %for.inc48 ] %indvars.iv93 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next94, %for.inc48 ] %3 = add nuw nsw i64 %indvars.iv93, %indvars.iv102 %arrayidx12 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv93, i64 %3 store i32 2147483647, ptr %arrayidx12, align 4, !tbaa !5 %arrayidx27 = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %indvars.iv93 %4 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %5 = add nuw nsw i64 %3, 1 %arrayidx33 = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %5 %6 = load i32, ptr %arrayidx33, align 4, !tbaa !5 br label %for.body15 for.body15: ; preds = %for.body8, %for.inc45 %indvars.iv95 = phi i64 [ %indvars.iv93, %for.body8 ], [ %indvars.iv.next96, %for.inc45 ] %7 = phi i32 [ 2147483647, %for.body8 ], [ %11, %for.inc45 ] %arrayidx19 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv93, i64 %indvars.iv95 %8 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1 %arrayidx24 = getelementptr inbounds [100 x [100 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next96, i64 %3 %9 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %add25 = add nsw i32 %9, %8 %arrayidx30 = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %indvars.iv.next96 %10 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %mul = mul nsw i32 %10, %4 %mul34 = mul nsw i32 %mul, %6 %add35 = add nsw i32 %add25, %mul34 %cmp40 = icmp sgt i32 %7, %add35 br i1 %cmp40, label %if.then, label %for.inc45 if.then: ; preds = %for.body15 store i32 %add35, ptr %arrayidx12, align 4, !tbaa !5 br label %for.inc45 for.inc45: ; preds = %for.body15, %if.then %11 = phi i32 [ %7, %for.body15 ], [ %add35, %if.then ] %exitcond101.not = icmp eq i64 %indvars.iv.next96, %indvars.iv104 br i1 %exitcond101.not, label %for.inc48, label %for.body15, !llvm.loop !14 for.inc48: ; preds = %for.inc45 %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1 %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1 %exitcond114.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count113 br i1 %exitcond114.not, label %for.inc51, label %for.body8, !llvm.loop !15 for.inc51: ; preds = %for.inc48, %for.cond6.preheader %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1 %indvars.iv.next112 = add i32 %indvars.iv111, -1 %exitcond118.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count117 br i1 %exitcond118.not, label %for.end53, label %for.cond6.preheader, !llvm.loop !16 for.end53: ; preds = %for.inc51, %for.cond3.preheader.for.end53_crit_edge %sub54.pre-phi = phi i32 [ %.pre, %for.cond3.preheader.for.end53_crit_edge ], [ %1, %for.inc51 ] %idxprom55 = sext i32 %sub54.pre-phi to i64 %arrayidx56 = getelementptr inbounds [100 x i32], ptr @dp, i64 0, i64 %idxprom55 %12 = load i32, ptr %arrayidx56, align 4, !tbaa !5 ret i32 %12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !12}
#include <stdio.h> #define Max 100 #define INF 10000 int c[Max]; //連鎖行列積を求める int matrixChainOrder(int n){ int i,j,k,l,q; int m[Max][Max]; 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] = INF; for(k = i ; k < j ; k++){ q = m[i][k] + m[k+1][j] + c[i-1] * c[k] * c[j]; if(k == i){ m[i][j] = q; } else if(m[i][j] > q){ m[i][j] = q; } } } } return m[1][n]; } int main(){ int i, n, ans; scanf("%d",&n); for(i = 1 ; i <= n ; i++){ scanf("%d %d",&c[i-1], &c[i]); } ans = matrixChainOrder(n); printf("%d\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284461/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284461/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @c = dso_local 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 [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(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @matrixChainOrder(i32 noundef %n) local_unnamed_addr #0 { entry: %m = alloca [100 x [100 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %m) #5 %cmp.not99 = icmp slt i32 %n, 1 br i1 %cmp.not99, label %for.end61, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -1 %2 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.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 %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.not106 = icmp slt i32 %n, 2 br i1 %cmp4.not106, label %for.end61, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %n, 1 %wide.trip.count132 = 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 [100 x [100 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 [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 = add nuw nsw 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 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw 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.inc59 %indvars.iv119 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next120, %for.inc59 ] %indvars131 = trunc i64 %indvars.iv119 to i32 %add = sub i32 %sub, %indvars131 %cmp7.not104 = icmp slt i32 %add, 1 br i1 %cmp7.not104, label %for.inc59, label %for.body8.lr.ph for.body8.lr.ph: ; preds = %for.cond6.preheader %4 = add nuw i64 %indvars.iv119, 4294967295 br label %for.body8 for.body8: ; preds = %for.body8.lr.ph, %for.inc56 %indvars.iv121 = phi i64 [ %indvars.iv119, %for.body8.lr.ph ], [ %indvars.iv.next122, %for.inc56 ] %indvars.iv109 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next110.pre-phi, %for.inc56 ] %5 = add i64 %4, %indvars.iv109 %sext = shl i64 %5, 32 %idxprom13 = ashr exact i64 %sext, 32 %arrayidx14 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv109, i64 %idxprom13 store i32 10000, ptr %arrayidx14, align 4 %cmp16101 = icmp slt i64 %indvars.iv109, %idxprom13 br i1 %cmp16101, label %for.body17.lr.ph, label %for.body8.for.inc56_crit_edge for.body8.for.inc56_crit_edge: ; preds = %for.body8 %.pre = add nuw nsw i64 %indvars.iv109, 1 br label %for.inc56 for.body17.lr.ph: ; preds = %for.body8 %6 = add nsw i64 %indvars.iv109, -1 %arrayidx30 = getelementptr inbounds [100 x i32], ptr @c, i64 0, i64 %6 %7 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %arrayidx34 = getelementptr inbounds [100 x i32], ptr @c, i64 0, i64 %idxprom13 %8 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %arrayidx21.peel = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv109, i64 %indvars.iv109 %9 = load i32, ptr %arrayidx21.peel, align 4, !tbaa !5 %indvars.iv.next112.peel = add nuw nsw i64 %indvars.iv109, 1 %arrayidx26.peel = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next112.peel, i64 %idxprom13 %10 = load i32, ptr %arrayidx26.peel, align 4, !tbaa !5 %add27.peel = add nsw i32 %10, %9 %arrayidx32.peel = getelementptr inbounds [100 x i32], ptr @c, i64 0, i64 %indvars.iv109 %11 = load i32, ptr %arrayidx32.peel, align 4, !tbaa !5 %mul.peel = mul nsw i32 %11, %7 %mul35.peel = mul nsw i32 %mul.peel, %8 %add36.peel = add nsw i32 %add27.peel, %mul35.peel store i32 %add36.peel, ptr %arrayidx14, align 4 %exitcond117.peel.not = icmp eq i64 %indvars.iv.next112.peel, %indvars.iv121 br i1 %exitcond117.peel.not, label %for.inc56, label %for.body17 for.body17: ; preds = %for.body17.lr.ph, %for.body17 %indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.body17 ], [ %indvars.iv.next112.peel, %for.body17.lr.ph ] %storemerge98102 = phi i32 [ %storemerge, %for.body17 ], [ %add36.peel, %for.body17.lr.ph ] %arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv109, i64 %indvars.iv111 %12 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1 %arrayidx26 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 %indvars.iv.next112, i64 %idxprom13 %13 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %add27 = add nsw i32 %13, %12 %arrayidx32 = getelementptr inbounds [100 x i32], ptr @c, i64 0, i64 %indvars.iv111 %14 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %mul = mul nsw i32 %14, %7 %mul35 = mul nsw i32 %mul, %8 %add36 = add nsw i32 %add27, %mul35 %cmp37 = icmp eq i64 %indvars.iv111, %indvars.iv109 %spec.store.select = tail call i32 @llvm.smin.i32(i32 %storemerge98102, i32 %add36) %storemerge = select i1 %cmp37, i32 %add36, i32 %spec.store.select store i32 %storemerge, ptr %arrayidx14, align 4 %exitcond117.not = icmp eq i64 %indvars.iv.next112, %indvars.iv121 br i1 %exitcond117.not, label %for.inc56, label %for.body17, !llvm.loop !13 for.inc56: ; preds = %for.body17, %for.body17.lr.ph, %for.body8.for.inc56_crit_edge %indvars.iv.next110.pre-phi = phi i64 [ %.pre, %for.body8.for.inc56_crit_edge ], [ %indvars.iv.next112.peel, %for.body17.lr.ph ], [ %indvars.iv.next112.peel, %for.body17 ] %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1 %exitcond129.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count132 br i1 %exitcond129.not, label %for.inc59, label %for.body8, !llvm.loop !15 for.inc59: ; preds = %for.inc56, %for.cond6.preheader %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %exitcond133.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count132 br i1 %exitcond133.not, label %for.end61, label %for.cond6.preheader, !llvm.loop !16 for.end61: ; preds = %for.inc59, %entry, %for.cond3.preheader %idxprom63 = sext i32 %n to i64 %arrayidx64 = getelementptr inbounds [100 x [100 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom63 %15 = load i32, ptr %arrayidx64, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %m) #5 ret i32 %15 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not9 = icmp slt i32 %0, 1 br i1 %cmp.not9, label %for.end, 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 [100 x i32], ptr @c, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [100 x i32], ptr @c, 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 %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 !17 for.end: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ] %call4 = call i32 @matrixChainOrder(i32 noundef %.lcssa) %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12, !14} !14 = !{!"llvm.loop.peeled.count", i32 1} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12}
#include <stdio.h> int main(){ int num,arraynum,i,j,k,array1[101],array2[101][101]; scanf("%d",&num); for(i=1;i<=num;i++) { scanf("%d%d",&array1[i-1],&array1[i]); array2[i][i]=0; } for(arraynum=2;arraynum<=num;arraynum++){ for(i=1;i<=num-arraynum+1;i++){ j=i+arraynum-1; array2[i][j]=10000000; for(k=i;k<j;k++){ if(array2[i][j]>=array2[i][k]+array2[k+1][j]+array1[i-1]*array1[k]*array1[j]) array2[i][j]=array2[i][k]+array2[k+1][j]+array1[i-1]*array1[k]*array1[j]; } } } printf("%d\n",array2[1][num]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284504/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284504/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %num = alloca i32, align 4 %array1 = alloca [101 x i32], align 16 %array2 = alloca [101 x [101 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %array1) #3 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %array2) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %0 = load i32, ptr %num, align 4, !tbaa !5 %cmp.not118 = icmp slt i32 %0, 1 br i1 %cmp.not118, label %for.end80, label %for.body for.cond8.preheader: ; preds = %for.body %cmp9.not124 = icmp slt i32 %2, 2 br i1 %cmp9.not124, label %for.end80, 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 [101 x i32], ptr %array1, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [101 x i32], ptr %array1, 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 [101 x [101 x i32]], ptr %array2, 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 %num, 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.inc78 %indvars.iv136 = phi i64 [ 2, %for.cond11.preheader.lr.ph ], [ %indvars.iv.next137, %for.inc78 ] %indvars148 = trunc i64 %indvars.iv136 to i32 %add = sub i32 %sub12, %indvars148 %cmp13.not122 = icmp slt i32 %add, 1 br i1 %cmp13.not122, label %for.inc78, label %for.body14.lr.ph for.body14.lr.ph: ; preds = %for.cond11.preheader %4 = add nuw i64 %indvars.iv136, 4294967295 br label %for.body14 for.body14: ; preds = %for.body14.lr.ph, %for.inc75 %indvars.iv138 = phi i64 [ %indvars.iv136, %for.body14.lr.ph ], [ %indvars.iv.next139, %for.inc75 ] %indvars.iv129 = phi i64 [ 1, %for.body14.lr.ph ], [ %indvars.iv.next130, %for.inc75 ] %5 = add i64 %4, %indvars.iv129 %sext = shl i64 %5, 32 %idxprom19 = ashr exact i64 %sext, 32 %arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv129, i64 %idxprom19 store i32 10000000, ptr %arrayidx20, align 4, !tbaa !5 %cmp22120 = icmp slt i64 %indvars.iv129, %idxprom19 br i1 %cmp22120, label %for.body23.lr.ph, label %for.inc75 for.body23.lr.ph: ; preds = %for.body14 %6 = add nsw i64 %indvars.iv129, -1 %arrayidx40 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %6 %7 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %arrayidx44 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %idxprom19 %8 = load i32, ptr %arrayidx44, align 4, !tbaa !5 br label %for.body23 for.body23: ; preds = %for.body23.lr.ph, %for.inc72 %indvars.iv131 = phi i64 [ %indvars.iv129, %for.body23.lr.ph ], [ %indvars.iv.next132, %for.inc72 ] %9 = phi i32 [ 10000000, %for.body23.lr.ph ], [ %13, %for.inc72 ] %arrayidx31 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv129, i64 %indvars.iv131 %10 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1 %arrayidx36 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv.next132, i64 %idxprom19 %11 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %add37 = add nsw i32 %11, %10 %arrayidx42 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %indvars.iv131 %12 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %mul = mul nsw i32 %12, %7 %mul45 = mul nsw i32 %mul, %8 %add46 = add nsw i32 %add37, %mul45 %cmp47.not = icmp slt i32 %9, %add46 br i1 %cmp47.not, label %for.inc72, label %if.then if.then: ; preds = %for.body23 store i32 %add46, ptr %arrayidx20, align 4, !tbaa !5 br label %for.inc72 for.inc72: ; preds = %for.body23, %if.then %13 = phi i32 [ %9, %for.body23 ], [ %add46, %if.then ] %exitcond.not = icmp eq i64 %indvars.iv.next132, %indvars.iv138 br i1 %exitcond.not, label %for.inc75, label %for.body23, !llvm.loop !11 for.inc75: ; preds = %for.inc72, %for.body14 %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1 %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1 %exitcond146.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count br i1 %exitcond146.not, label %for.inc78, label %for.body14, !llvm.loop !12 for.inc78: ; preds = %for.inc75, %for.cond11.preheader %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1 %exitcond149.not = icmp eq i64 %indvars.iv.next137, %wide.trip.count br i1 %exitcond149.not, label %for.end80, label %for.cond11.preheader, !llvm.loop !13 for.end80: ; preds = %for.inc78, %entry, %for.cond8.preheader %.lcssa152 = phi i32 [ %2, %for.cond8.preheader ], [ %0, %entry ], [ %2, %for.inc78 ] %idxprom82 = sext i32 %.lcssa152 to i64 %arrayidx83 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 1, i64 %idxprom82 %14 = load i32, ptr %arrayidx83, align 4, !tbaa !5 %call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14) call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %array2) #3 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %array1) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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<string.h> #include<stdlib.h> #define N 10000 int min(int,int); void kan(void); int n,m[N+1][N+1],a[N+1]; int main(){ int i; scanf("%d",&n); for(i = 1; i <= n; i++){ scanf("%d %d",&a[i-1],&a[i]); } kan(); printf("%d\n", m[1][n]); return 0; } void kan(){ 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; i++){ j = i + l -1; m[i][j]=99999999; for(k = i; k <= j; k++){ m[i][j] = min(m[i][j],m[i][k]+m[k+1][j] + a[i-1]*a[k]*a[j]); } } } } int min(int x, int y){ if(x >= y){ return y; } else{ return x; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284548/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284548/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @a = dso_local global [10001 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @m = dso_local local_unnamed_addr global [10001 x [10001 x i32]] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not10 = icmp slt i32 %0, 1 br i1 %cmp.not10, label %kan.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 [10001 x i32], ptr @a, i64 0, i64 %1 %arrayidx2 = getelementptr inbounds [10001 x i32], ptr @a, 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 !9 for.end: ; preds = %for.body %cmp.not75.i = icmp slt i32 %2, 1 br i1 %cmp.not75.i, label %kan.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 [10001 x [10001 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 !11 for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa %cmp4.not81.i = icmp slt i32 %2, 2 br i1 %cmp4.not81.i, label %kan.exit, label %for.cond6.preheader.preheader.i for.cond6.preheader.preheader.i: ; preds = %for.cond3.preheader.i %8 = add nuw i32 %2, 3 br 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 [10001 x [10001 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 [10001 x [10001 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 [10001 x [10001 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 [10001 x [10001 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 !13 for.cond6.preheader.i: ; preds = %for.cond6.for.inc49_crit_edge.i, %for.cond6.preheader.preheader.i %indvars.iv110.i = phi i64 [ 2, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next111.i, %for.cond6.for.inc49_crit_edge.i ] %indvars.iv106.i = phi i32 [ %8, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next107.i, %for.cond6.for.inc49_crit_edge.i ] %indvars.iv96.i = phi i64 [ 3, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next97.i, %for.cond6.for.inc49_crit_edge.i ] %wide.trip.count108.i = zext i32 %indvars.iv106.i to i64 %9 = add nsw i64 %indvars.iv110.i, -1 br label %for.body8.i for.body8.i: ; preds = %for.inc46.i, %for.cond6.preheader.i %indvars.iv98.i = phi i64 [ %indvars.iv96.i, %for.cond6.preheader.i ], [ %indvars.iv.next99.i, %for.inc46.i ] %indvars.iv85.i = phi i64 [ 1, %for.cond6.preheader.i ], [ %indvars.iv.next86.i, %for.inc46.i ] %10 = add nuw i64 %9, %indvars.iv85.i %arrayidx12.i = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv85.i, i64 %10 %11 = add nsw i64 %indvars.iv85.i, -1 %arrayidx32.i = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %11 %12 = load i32, ptr %arrayidx32.i, align 4, !tbaa !5 %arrayidx36.i = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %10 %13 = load i32, ptr %arrayidx36.i, align 4, !tbaa !5 store i32 99999999, ptr %arrayidx12.i, align 4, !tbaa !5 %mul.i = mul i32 %13, %12 br label %for.body15.i for.body15.i: ; preds = %for.body15.i, %for.body8.i %indvars.iv87.i = phi i64 [ %indvars.iv85.i, %for.body8.i ], [ %indvars.iv.next88.i, %for.body15.i ] %storemerge77.i = phi i32 [ 99999999, %for.body8.i ], [ %x.y.i.i, %for.body15.i ] %arrayidx23.i = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv85.i, i64 %indvars.iv87.i %14 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5 %indvars.iv.next88.i = add nuw nsw i64 %indvars.iv87.i, 1 %arrayidx28.i = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv.next88.i, i64 %10 %15 = load i32, ptr %arrayidx28.i, align 4, !tbaa !5 %add29.i = add nsw i32 %15, %14 %arrayidx34.i = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv87.i %16 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5 %mul37.i = mul i32 %mul.i, %16 %add38.i = add nsw i32 %add29.i, %mul37.i %x.y.i.i = tail call i32 @llvm.smin.i32(i32 %storemerge77.i, i32 %add38.i) store i32 %x.y.i.i, ptr %arrayidx12.i, align 4, !tbaa !5 %exitcond95.not.i = icmp eq i64 %indvars.iv.next88.i, %indvars.iv98.i br i1 %exitcond95.not.i, label %for.inc46.i, label %for.body15.i, !llvm.loop !14 for.inc46.i: ; preds = %for.body15.i %indvars.iv.next86.i = add nuw nsw i64 %indvars.iv85.i, 1 %indvars.iv.next99.i = add nuw nsw i64 %indvars.iv98.i, 1 %exitcond109.not.i = icmp eq i64 %indvars.iv.next99.i, %wide.trip.count108.i br i1 %exitcond109.not.i, label %for.cond6.for.inc49_crit_edge.i, label %for.body8.i, !llvm.loop !15 for.cond6.for.inc49_crit_edge.i: ; preds = %for.inc46.i %indvars.iv.next111.i = add nuw nsw i64 %indvars.iv110.i, 1 %indvars.iv.next97.i = add nuw nsw i64 %indvars.iv96.i, 1 %indvars.iv.next107.i = add i32 %indvars.iv106.i, 1 %exitcond116.not.i = icmp eq i64 %indvars.iv.next111.i, %wide.trip.count.i br i1 %exitcond116.not.i, label %kan.exit, label %for.cond6.preheader.i, !llvm.loop !16 kan.exit: ; preds = %for.cond6.for.inc49_crit_edge.i, %entry, %for.end, %for.cond3.preheader.i %.lcssa17 = phi i32 [ %2, %for.end ], [ %2, %for.cond3.preheader.i ], [ %0, %entry ], [ %2, %for.cond6.for.inc49_crit_edge.i ] %idxprom4 = sext i32 %.lcssa17 to i64 %arrayidx5 = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom4 %17 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @kan() local_unnamed_addr #2 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not75 = icmp slt i32 %0, 1 br i1 %cmp.not75, label %for.end51, 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 [10001 x [10001 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 !17 for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa %cmp4.not81 = icmp slt i32 %0, 2 br i1 %cmp4.not81, label %for.end51, label %for.cond6.preheader.preheader for.cond6.preheader.preheader: ; preds = %for.cond3.preheader %5 = add nuw i32 %0, 3 %6 = add nuw i32 %0, 1 %wide.trip.count115 = zext i32 %6 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 [10001 x [10001 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 [10001 x [10001 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 [10001 x [10001 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 [10001 x [10001 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 !13 for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.cond6.for.inc49_crit_edge %indvars.iv110 = phi i64 [ 2, %for.cond6.preheader.preheader ], [ %indvars.iv.next111, %for.cond6.for.inc49_crit_edge ] %indvars.iv106 = phi i32 [ %5, %for.cond6.preheader.preheader ], [ %indvars.iv.next107, %for.cond6.for.inc49_crit_edge ] %indvars.iv96 = phi i64 [ 3, %for.cond6.preheader.preheader ], [ %indvars.iv.next97, %for.cond6.for.inc49_crit_edge ] %wide.trip.count108 = zext i32 %indvars.iv106 to i64 br label %for.body8 for.body8: ; preds = %for.cond6.preheader, %for.inc46 %indvars.iv98 = phi i64 [ %indvars.iv96, %for.cond6.preheader ], [ %indvars.iv.next99, %for.inc46 ] %indvars.iv85 = phi i64 [ 1, %for.cond6.preheader ], [ %indvars.iv.next86, %for.inc46 ] %7 = add nuw nsw i64 %indvars.iv85, %indvars.iv110 %8 = add nsw i64 %7, -1 %arrayidx12 = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv85, i64 %8 %9 = add nsw i64 %indvars.iv85, -1 %arrayidx32 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %9 %10 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %arrayidx36 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %8 %11 = load i32, ptr %arrayidx36, align 4, !tbaa !5 store i32 99999999, ptr %arrayidx12, align 4, !tbaa !5 br label %for.body15 for.body15: ; preds = %for.body8, %for.body15 %indvars.iv87 = phi i64 [ %indvars.iv85, %for.body8 ], [ %indvars.iv.next88, %for.body15 ] %storemerge77 = phi i32 [ 99999999, %for.body8 ], [ %x.y.i, %for.body15 ] %arrayidx23 = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv85, i64 %indvars.iv87 %12 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1 %arrayidx28 = getelementptr inbounds [10001 x [10001 x i32]], ptr @m, i64 0, i64 %indvars.iv.next88, i64 %8 %13 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %add29 = add nsw i32 %13, %12 %arrayidx34 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv87 %14 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %mul = mul nsw i32 %14, %10 %mul37 = mul nsw i32 %mul, %11 %add38 = add nsw i32 %add29, %mul37 %x.y.i = tail call i32 @llvm.smin.i32(i32 %storemerge77, i32 %add38) store i32 %x.y.i, ptr %arrayidx12, align 4, !tbaa !5 %exitcond95.not = icmp eq i64 %indvars.iv.next88, %indvars.iv98 br i1 %exitcond95.not, label %for.inc46, label %for.body15, !llvm.loop !14 for.inc46: ; preds = %for.body15 %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1 %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1 %exitcond109.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count108 br i1 %exitcond109.not, label %for.cond6.for.inc49_crit_edge, label %for.body8, !llvm.loop !15 for.cond6.for.inc49_crit_edge: ; preds = %for.inc46 %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1 %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1 %indvars.iv.next107 = add i32 %indvars.iv106, 1 %exitcond116.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count115 br i1 %exitcond116.not, label %for.end51, label %for.cond6.preheader, !llvm.loop !16 for.end51: ; preds = %for.cond6.for.inc49_crit_edge, %entry, %for.cond3.preheader ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 { entry: %x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %x.y } ; 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 = { nofree nounwind "no-trapping-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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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} !17 = distinct !{!17, !12}
#include<stdio.h> #define N 100 int min(int x,int y){ if(x<y){ return x; }else{ return y; } } int main( void ){ int n , p[N+1],m[N+1][N+1]; scanf("%d" , &n); for(int i = 1;i<= n;i++ ){ scanf("%d",&p[i-1]); scanf("%d",&p[i]); } for(int i = 1; i <= n; i++) m[i][i] = 0; for(int l=2;l<= n;l++){ for( int i = 1; i <= n-l+1; i++ ){ int j = i+l-1; m[i][j] = (1<<21); for( int 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_284591/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284591/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 { entry: %x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %x.y } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %p = 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 %p) #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.not105 = icmp slt i32 %0, 1 br i1 %cmp.not105, label %for.cond.cleanup19, label %for.body for.cond6.preheader: ; preds = %for.body %cmp7.not107 = icmp slt i32 %6, 1 br i1 %cmp7.not107, label %for.cond.cleanup19, label %for.body9.preheader for.body9.preheader: ; preds = %for.cond6.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.cond17.preheader.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %2, -4 br label %for.body9 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 %p, i64 0, i64 %5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %arrayidx3 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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.cond6.preheader, !llvm.loop !9 for.cond17.preheader.unr-lcssa: ; preds = %for.body9, %for.body9.preheader %indvars.iv119.unr = phi i64 [ 1, %for.body9.preheader ], [ %indvars.iv.next120.3, %for.body9 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond17.preheader, label %for.body9.epil for.body9.epil: ; preds = %for.cond17.preheader.unr-lcssa, %for.body9.epil %indvars.iv119.epil = phi i64 [ %indvars.iv.next120.epil, %for.body9.epil ], [ %indvars.iv119.unr, %for.cond17.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.cond17.preheader.unr-lcssa ] %arrayidx13.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv119.epil, i64 %indvars.iv119.epil store i32 0, ptr %arrayidx13.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.cond17.preheader, label %for.body9.epil, !llvm.loop !11 for.cond17.preheader: ; preds = %for.body9.epil, %for.cond17.preheader.unr-lcssa %cmp18.not114 = icmp slt i32 %6, 2 br i1 %cmp18.not114, label %for.cond.cleanup19, label %for.cond22.preheader.lr.ph for.cond22.preheader.lr.ph: ; preds = %for.cond17.preheader %sub23 = add nuw i32 %6, 1 %wide.trip.count145 = zext i32 %sub23 to i64 br label %for.cond22.preheader for.body9: ; preds = %for.body9, %for.body9.preheader.new %indvars.iv119 = phi i64 [ 1, %for.body9.preheader.new ], [ %indvars.iv.next120.3, %for.body9 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ] %arrayidx13 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv119, i64 %indvars.iv119 store i32 0, ptr %arrayidx13, align 4, !tbaa !5 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %arrayidx13.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120, i64 %indvars.iv.next120 store i32 0, ptr %arrayidx13.1, align 4, !tbaa !5 %indvars.iv.next120.1 = add nuw nsw i64 %indvars.iv119, 2 %arrayidx13.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120.1, i64 %indvars.iv.next120.1 store i32 0, ptr %arrayidx13.2, align 4, !tbaa !5 %indvars.iv.next120.2 = add nuw nsw i64 %indvars.iv119, 3 %arrayidx13.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120.2, i64 %indvars.iv.next120.2 store i32 0, ptr %arrayidx13.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.cond17.preheader.unr-lcssa, label %for.body9, !llvm.loop !13 for.cond22.preheader: ; preds = %for.cond22.preheader.lr.ph, %for.cond.cleanup25 %indvars.iv131 = phi i64 [ 2, %for.cond22.preheader.lr.ph ], [ %indvars.iv.next132, %for.cond.cleanup25 ] %indvars144 = trunc i64 %indvars.iv131 to i32 %add = sub i32 %sub23, %indvars144 %cmp24.not112 = icmp slt i32 %add, 1 br i1 %cmp24.not112, label %for.cond.cleanup25, label %for.body37.lr.ph for.cond.cleanup19: ; preds = %for.cond.cleanup25, %entry, %for.cond6.preheader, %for.cond17.preheader %.lcssa149152 = phi i32 [ %6, %for.cond17.preheader ], [ %6, %for.cond6.preheader ], [ %0, %entry ], [ %6, %for.cond.cleanup25 ] %idxprom76 = sext i32 %.lcssa149152 to i64 %arrayidx77 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom76 %8 = load i32, ptr %arrayidx77, align 4, !tbaa !5 %call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #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 for.cond.cleanup25: ; preds = %for.cond.cleanup36, %for.cond22.preheader %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1 %exitcond146.not = icmp eq i64 %indvars.iv.next132, %wide.trip.count145 br i1 %exitcond146.not, label %for.cond.cleanup19, label %for.cond22.preheader, !llvm.loop !14 for.body37.lr.ph: ; preds = %for.cond22.preheader, %for.cond.cleanup36 %indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.cond.cleanup36 ], [ %indvars.iv131, %for.cond22.preheader ] %indvars.iv122 = phi i64 [ %indvars.iv.next123, %for.cond.cleanup36 ], [ 1, %for.cond22.preheader ] %9 = add nuw nsw i64 %indvars.iv122, %indvars.iv131 %10 = add nsw i64 %9, -1 %arrayidx32 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv122, i64 %10 store i32 2097152, ptr %arrayidx32, align 4, !tbaa !5 %11 = add nsw i64 %indvars.iv122, -1 %arrayidx54 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %11 %12 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %arrayidx58 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10 %13 = load i32, ptr %arrayidx58, align 4, !tbaa !5 br label %for.body37 for.cond.cleanup36: ; preds = %for.body37 %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1 %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1 %exitcond143.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count145 br i1 %exitcond143.not, label %for.cond.cleanup25, label %for.body37.lr.ph, !llvm.loop !15 for.body37: ; preds = %for.body37.lr.ph, %for.body37 %indvars.iv124 = phi i64 [ %indvars.iv122, %for.body37.lr.ph ], [ %indvars.iv.next125, %for.body37 ] %storemerge110 = phi i32 [ 2097152, %for.body37.lr.ph ], [ %x.y.i, %for.body37 ] %arrayidx45 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv122, i64 %indvars.iv124 %14 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %arrayidx50 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next125, i64 %10 %15 = load i32, ptr %arrayidx50, align 4, !tbaa !5 %add51 = add nsw i32 %15, %14 %arrayidx56 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv124 %16 = load i32, ptr %arrayidx56, align 4, !tbaa !5 %mul = mul nsw i32 %16, %12 %mul59 = mul nsw i32 %mul, %13 %add60 = add nsw i32 %add51, %mul59 %x.y.i = call i32 @llvm.smin.i32(i32 %storemerge110, i32 %add60) store i32 %x.y.i, ptr %arrayidx32, align 4, !tbaa !5 %exitcond130.not = icmp eq i64 %indvars.iv.next125, %indvars.iv133 br i1 %exitcond130.not, label %for.cond.cleanup36, label %for.body37, !llvm.loop !16 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.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> #define MAX 100 #define INF 100000000 int main() { int n, m, i, j, k, l, M[MAX][MAX], r[MAX], c[MAX], p[MAX]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &r[i], &c[i]); } p[0] = r[0]; for (i = 1; i <= n; i++) { p[i] = c[i - 1]; } for (i = 0; i <= n; i++) { M[i][i] = 0; } for (i = 2; i <= n; i++) { for (j = 1; j <= n - i + 1; j++) { k = i + j - 1; M[j][k] = INF; for (l = j; l <= k - 1; l++) { m = M[j][l] + M[l + 1][k] + p[j - 1] * p[l] * p[k]; if (m < M[j][k]) { M[j][k] = m; } } } } printf("%d\n", M[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284634/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284634/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100 x [100 x i32]], align 16 %r = alloca [100 x i32], align 16 %c = alloca [100 x i32], align 16 %p = 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 %M) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %r) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %p) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp117 = icmp sgt i32 %0, 0 br i1 %cmp117, label %for.body, label %for.cond16.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 %r, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [100 x i32], ptr %c, 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 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %r, align 16, !tbaa !5 store i32 %.pre, ptr %p, align 16, !tbaa !5 %cmp7.not119 = icmp slt i32 %1, 1 br i1 %cmp7.not119, label %for.cond16.preheader, label %for.cond16.preheader.thread for.cond16.preheader.thread: ; preds = %for.end %scevgep = getelementptr inbounds i8, ptr %p, i64 4 %3 = zext i32 %1 to i64 %4 = shl nuw nsw i64 %3, 2 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %scevgep, ptr nonnull align 16 %c, i64 %4, i1 false), !tbaa !5 br label %for.body18.preheader for.cond16.preheader: ; preds = %entry, %for.end %.lcssa166 = phi i32 [ %1, %for.end ], [ %0, %entry ] %cmp17.not121 = icmp slt i32 %.lcssa166, 0 br i1 %cmp17.not121, label %for.end79, label %for.body18.preheader for.body18.preheader: ; preds = %for.cond16.preheader.thread, %for.cond16.preheader %.lcssa166169 = phi i32 [ %1, %for.cond16.preheader.thread ], [ 0, %for.cond16.preheader ] %5 = add nuw i32 %.lcssa166169, 1 %wide.trip.count = zext i32 %5 to i64 %xtraiter = and i64 %wide.trip.count, 3 %6 = icmp ult i32 %.lcssa166169, 3 br i1 %6, label %for.cond26.preheader.unr-lcssa, label %for.body18.preheader.new for.body18.preheader.new: ; preds = %for.body18.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body18 for.cond26.preheader.unr-lcssa: ; preds = %for.body18, %for.body18.preheader %indvars.iv136.unr = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next137.3, %for.body18 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond26.preheader, label %for.body18.epil for.body18.epil: ; preds = %for.cond26.preheader.unr-lcssa, %for.body18.epil %indvars.iv136.epil = phi i64 [ %indvars.iv.next137.epil, %for.body18.epil ], [ %indvars.iv136.unr, %for.cond26.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body18.epil ], [ 0, %for.cond26.preheader.unr-lcssa ] %arrayidx22.epil = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv136.epil, i64 %indvars.iv136.epil store i32 0, ptr %arrayidx22.epil, align 4, !tbaa !5 %indvars.iv.next137.epil = add nuw nsw i64 %indvars.iv136.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.cond26.preheader, label %for.body18.epil, !llvm.loop !11 for.cond26.preheader: ; preds = %for.body18.epil, %for.cond26.preheader.unr-lcssa %cmp27.not128 = icmp slt i32 %.lcssa166169, 2 br i1 %cmp27.not128, label %for.end79, label %for.cond29.preheader.lr.ph for.cond29.preheader.lr.ph: ; preds = %for.cond26.preheader %sub30 = add nuw i32 %.lcssa166169, 1 %wide.trip.count162 = zext i32 %sub30 to i64 br label %for.cond29.preheader for.body18: ; preds = %for.body18, %for.body18.preheader.new %indvars.iv136 = phi i64 [ 0, %for.body18.preheader.new ], [ %indvars.iv.next137.3, %for.body18 ] %niter = phi i64 [ 0, %for.body18.preheader.new ], [ %niter.next.3, %for.body18 ] %arrayidx22 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv136, i64 %indvars.iv136 store i32 0, ptr %arrayidx22, align 16, !tbaa !5 %indvars.iv.next137 = or i64 %indvars.iv136, 1 %arrayidx22.1 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv.next137, i64 %indvars.iv.next137 store i32 0, ptr %arrayidx22.1, align 4, !tbaa !5 %indvars.iv.next137.1 = or i64 %indvars.iv136, 2 %arrayidx22.2 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv.next137.1, i64 %indvars.iv.next137.1 store i32 0, ptr %arrayidx22.2, align 8, !tbaa !5 %indvars.iv.next137.2 = or i64 %indvars.iv136, 3 %arrayidx22.3 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv.next137.2, i64 %indvars.iv.next137.2 store i32 0, ptr %arrayidx22.3, align 4, !tbaa !5 %indvars.iv.next137.3 = add nuw nsw i64 %indvars.iv136, 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.cond26.preheader.unr-lcssa, label %for.body18, !llvm.loop !13 for.cond29.preheader: ; preds = %for.cond29.preheader.lr.ph, %for.inc77 %indvars.iv148 = phi i64 [ 2, %for.cond29.preheader.lr.ph ], [ %indvars.iv.next149, %for.inc77 ] %indvars161 = trunc i64 %indvars.iv148 to i32 %add = sub i32 %sub30, %indvars161 %cmp31.not126 = icmp slt i32 %add, 1 br i1 %cmp31.not126, label %for.inc77, label %for.body42.lr.ph for.body42.lr.ph: ; preds = %for.cond29.preheader, %for.inc74 %indvars.iv150 = phi i64 [ %indvars.iv.next151, %for.inc74 ], [ %indvars.iv148, %for.cond29.preheader ] %indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.inc74 ], [ 1, %for.cond29.preheader ] %7 = add nuw nsw i64 %indvars.iv139, %indvars.iv148 %8 = add nsw i64 %7, -1 %arrayidx38 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv139, i64 %8 store i32 100000000, ptr %arrayidx38, align 4 %9 = add nsw i64 %indvars.iv139, -1 %arrayidx55 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %9 %10 = load i32, ptr %arrayidx55, align 4, !tbaa !5 %arrayidx59 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %8 %11 = load i32, ptr %arrayidx59, align 4, !tbaa !5 br label %for.body42 for.body42: ; preds = %for.body42.lr.ph, %for.body42 %indvars.iv141 = phi i64 [ %indvars.iv139, %for.body42.lr.ph ], [ %indvars.iv.next142, %for.body42 ] %storemerge124 = phi i32 [ 100000000, %for.body42.lr.ph ], [ %spec.store.select, %for.body42 ] %arrayidx46 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv139, i64 %indvars.iv141 %12 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1 %arrayidx51 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv.next142, i64 %8 %13 = load i32, ptr %arrayidx51, align 4, !tbaa !5 %add52 = add nsw i32 %13, %12 %arrayidx57 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv141 %14 = load i32, ptr %arrayidx57, align 4, !tbaa !5 %mul = mul nsw i32 %14, %10 %mul60 = mul nsw i32 %mul, %11 %add61 = add nsw i32 %add52, %mul60 %spec.store.select = call i32 @llvm.smin.i32(i32 %add61, i32 %storemerge124) store i32 %spec.store.select, ptr %arrayidx38, align 4 %exitcond147.not = icmp eq i64 %indvars.iv.next142, %indvars.iv150 br i1 %exitcond147.not, label %for.inc74, label %for.body42, !llvm.loop !14 for.inc74: ; preds = %for.body42 %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1 %indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1 %exitcond160.not = icmp eq i64 %indvars.iv.next151, %wide.trip.count162 br i1 %exitcond160.not, label %for.inc77, label %for.body42.lr.ph, !llvm.loop !15 for.inc77: ; preds = %for.inc74, %for.cond29.preheader %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count162 br i1 %exitcond163.not, label %for.end79, label %for.cond29.preheader, !llvm.loop !16 for.end79: ; preds = %for.inc77, %for.cond16.preheader, %for.cond26.preheader %.lcssa166170173 = phi i32 [ %.lcssa166169, %for.cond26.preheader ], [ %.lcssa166, %for.cond16.preheader ], [ %.lcssa166169, %for.inc77 ] %idxprom81 = sext i32 %.lcssa166170173 to i64 %arrayidx82 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 1, i64 %idxprom81 %15 = load i32, ptr %arrayidx82, align 4, !tbaa !5 %call83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %p) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %M) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 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> #include<math.h> #define MAX 100 int m[MAX][MAX]; void Matrix(int p[],int hp){ int i,j,k,l,q; for(i=1;i<=hp;i++) m[i][i] =0; for(l=2;l<=hp;l++){ for(i=1;i<=hp-l+1;i++){ j=i+l-1; m[i][j]=100000; 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; } } } } int main(){ int i,n; int col[MAX],row[MAX],p[MAX+100]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&col[i],&row[i]); } for(i=0;i<n+1;i++){ if(i==0) p[i]=col[0]; else if(i==n) p[i]=row[n-1]; else p[i]=col[i]; } Matrix(p,n); printf("%d\n",m[1][n]); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284678/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284678/source.c" target datalayout = "e-m:e-p270: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 @.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: read, inaccessiblemem: none) uwtable define dso_local void @Matrix(ptr nocapture noundef readonly %p, i32 noundef %hp) local_unnamed_addr #0 { entry: %cmp.not85 = icmp slt i32 %hp, 1 br i1 %cmp.not85, label %for.end55, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %hp, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -1 %2 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.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 @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 %hp, 2 br i1 %cmp4.not91, label %for.end55, label %for.cond6.preheader.lr.ph for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader %sub = add nuw i32 %hp, 1 %wide.trip.count117 = zext i32 %sub 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 [ 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 @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 [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 = add nuw nsw 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 4, !tbaa !5 %indvars.iv.next.2 = add nuw nsw 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.inc53 %indvars.iv103 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next104, %for.inc53 ] %indvars116 = trunc i64 %indvars.iv103 to i32 %add = sub i32 %sub, %indvars116 %cmp7.not89 = icmp slt i32 %add, 1 br i1 %cmp7.not89, label %for.inc53, label %for.body18.lr.ph for.body18.lr.ph: ; preds = %for.cond6.preheader, %for.inc50 %indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.inc50 ], [ %indvars.iv103, %for.cond6.preheader ] %indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.inc50 ], [ 1, %for.cond6.preheader ] %4 = add nuw nsw i64 %indvars.iv94, %indvars.iv103 %5 = add nsw i64 %4, -1 %arrayidx14 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv94, i64 %5 store i32 100000, ptr %arrayidx14, align 4, !tbaa !5 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv94 %arrayidx35 = getelementptr inbounds i32, ptr %p, i64 %5 br label %for.body18 for.body18: ; preds = %for.body18.lr.ph, %for.inc47 %6 = phi i32 [ 100000, %for.body18.lr.ph ], [ %12, %for.inc47 ] %indvars.iv96 = phi i64 [ %indvars.iv94, %for.body18.lr.ph ], [ %indvars.iv.next97, %for.inc47 ] %arrayidx22 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv94, i64 %indvars.iv96 %7 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1 %arrayidx27 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next97, i64 %5 %8 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %add28 = add nsw i32 %8, %7 %9 = load i32, ptr %gep, align 4, !tbaa !5 %arrayidx33 = getelementptr inbounds i32, ptr %p, i64 %indvars.iv96 %10 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %mul = mul nsw i32 %10, %9 %11 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %mul36 = mul nsw i32 %mul, %11 %add37 = add nsw i32 %add28, %mul36 %cmp42 = icmp sgt i32 %6, %add37 br i1 %cmp42, label %if.then, label %for.inc47 if.then: ; preds = %for.body18 store i32 %add37, ptr %arrayidx14, align 4, !tbaa !5 br label %for.inc47 for.inc47: ; preds = %for.body18, %if.then %12 = phi i32 [ %6, %for.body18 ], [ %add37, %if.then ] %exitcond102.not = icmp eq i64 %indvars.iv.next97, %indvars.iv105 br i1 %exitcond102.not, label %for.inc50, label %for.body18, !llvm.loop !13 for.inc50: ; preds = %for.inc47 %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.inc53, label %for.body18.lr.ph, !llvm.loop !14 for.inc53: ; preds = %for.inc50, %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.end55, label %for.cond6.preheader, !llvm.loop !15 for.end55: ; preds = %for.inc53, %entry, %for.cond3.preheader 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 %col = alloca [100 x i32], align 16 %row = alloca [100 x i32], align 16 %p = alloca [200 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 %col) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %row) #4 call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %p) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp40 = icmp sgt i32 %0, 0 br i1 %cmp40, label %for.body, label %for.cond4.preheader for.cond4.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %7, %for.body ] %cmp5.not43 = icmp slt i32 %.lcssa, 0 br i1 %cmp5.not43, label %Matrix.exit, label %for.inc23.peel for.inc23.peel: ; preds = %for.cond4.preheader %sub = add nsw i32 %.lcssa, -1 %idxprom13 = sext i32 %sub to i64 %arrayidx14 = getelementptr inbounds [100 x i32], ptr %row, i64 0, i64 %idxprom13 %1 = load i32, ptr %col, align 16 %2 = zext i32 %.lcssa to i64 %exitcond.peel.not = icmp eq i32 %.lcssa, 0 br i1 %exitcond.peel.not, label %Matrix.exit, label %for.body6.peel.next for.body6.peel.next: ; preds = %for.inc23.peel %3 = add i32 %.lcssa, 1 %wide.trip.count = zext i32 %3 to i64 %arrayidx16 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %2 %4 = add nsw i64 %wide.trip.count, -1 %5 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %4, 1 %6 = icmp eq i64 %5, 0 br i1 %6, label %for.end25.unr-lcssa, label %for.body6.peel.next.new for.body6.peel.next.new: ; preds = %for.body6.peel.next %unroll_iter = and i64 %4, -2 br label %if.else for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %col, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [100 x i32], ptr %row, 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 %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 %for.cond4.preheader, !llvm.loop !16 if.else: ; preds = %for.inc23.1, %for.body6.peel.next.new %indvars.iv49 = phi i64 [ 1, %for.body6.peel.next.new ], [ %indvars.iv.next50.1, %for.inc23.1 ] %niter = phi i64 [ 0, %for.body6.peel.next.new ], [ %niter.next.1, %for.inc23.1 ] %cmp11 = icmp eq i64 %indvars.iv49, %2 br i1 %cmp11, label %if.then12, label %if.else17 if.then12: ; preds = %if.else %9 = load i32, ptr %arrayidx14, align 4, !tbaa !5 store i32 %9, ptr %arrayidx16, align 4, !tbaa !5 br label %for.inc23 if.else17: ; preds = %if.else %arrayidx19 = getelementptr inbounds [100 x i32], ptr %col, i64 0, i64 %indvars.iv49 %10 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %arrayidx21 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %indvars.iv49 store i32 %10, ptr %arrayidx21, align 4, !tbaa !5 br label %for.inc23 for.inc23: ; preds = %if.else17, %if.then12 %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1 %cmp11.1 = icmp eq i64 %indvars.iv.next50, %2 br i1 %cmp11.1, label %if.then12.1, label %if.else17.1 if.else17.1: ; preds = %for.inc23 %arrayidx19.1 = getelementptr inbounds [100 x i32], ptr %col, i64 0, i64 %indvars.iv.next50 %11 = load i32, ptr %arrayidx19.1, align 4, !tbaa !5 %arrayidx21.1 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %indvars.iv.next50 store i32 %11, ptr %arrayidx21.1, align 4, !tbaa !5 br label %for.inc23.1 if.then12.1: ; preds = %for.inc23 %12 = load i32, ptr %arrayidx14, align 4, !tbaa !5 store i32 %12, ptr %arrayidx16, align 4, !tbaa !5 br label %for.inc23.1 for.inc23.1: ; preds = %if.then12.1, %if.else17.1 %indvars.iv.next50.1 = add nuw nsw i64 %indvars.iv49, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end25.unr-lcssa, label %if.else, !llvm.loop !17 for.end25.unr-lcssa: ; preds = %for.inc23.1, %for.body6.peel.next %indvars.iv49.unr = phi i64 [ 1, %for.body6.peel.next ], [ %indvars.iv.next50.1, %for.inc23.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end25, label %if.else.epil if.else.epil: ; preds = %for.end25.unr-lcssa %cmp11.epil = icmp eq i64 %indvars.iv49.unr, %2 br i1 %cmp11.epil, label %if.then12.epil, label %if.else17.epil if.else17.epil: ; preds = %if.else.epil %arrayidx19.epil = getelementptr inbounds [100 x i32], ptr %col, i64 0, i64 %indvars.iv49.unr %13 = load i32, ptr %arrayidx19.epil, align 4, !tbaa !5 %arrayidx21.epil = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %indvars.iv49.unr store i32 %13, ptr %arrayidx21.epil, align 4, !tbaa !5 br label %for.end25 if.then12.epil: ; preds = %if.else.epil %14 = load i32, ptr %arrayidx14, align 4, !tbaa !5 store i32 %14, ptr %arrayidx16, align 4, !tbaa !5 br label %for.end25 for.end25: ; preds = %if.else17.epil, %if.then12.epil, %for.end25.unr-lcssa store i32 %1, ptr %p, align 16, !tbaa !5 %cmp.not85.i = icmp slt i32 %.lcssa, 1 br i1 %cmp.not85.i, label %Matrix.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end25 %15 = add nuw nsw i32 %.lcssa, 1 %wide.trip.count.i = zext i32 %15 to i64 %xtraiter58 = and i64 %4, 3 %16 = icmp ult i64 %5, 3 br i1 %16, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter60 = and i64 %4, -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.mod59.not = icmp eq i64 %xtraiter58, 0 br i1 %lcmp.mod59.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, %xtraiter58 br i1 %epil.iter.cmp.not, label %for.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !19 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 %Matrix.exit, label %for.cond6.preheader.lr.ph.i for.cond6.preheader.lr.ph.i: ; preds = %for.cond3.preheader.i %invariant.gep.i = getelementptr i32, ptr %p, i64 -1 br 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 ] %niter61 = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter61.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 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw 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 = add nuw nsw 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 4, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw 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 %niter61.next.3 = add i64 %niter61, 4 %niter61.ncmp.3 = icmp eq i64 %niter61.next.3, %unroll_iter60 br i1 %niter61.ncmp.3, label %for.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !11 for.cond6.preheader.i: ; preds = %for.inc53.i, %for.cond6.preheader.lr.ph.i %indvars.iv103.i = phi i64 [ 2, %for.cond6.preheader.lr.ph.i ], [ %indvars.iv.next104.i, %for.inc53.i ] %indvars116.i = trunc i64 %indvars.iv103.i to i32 %add.i = sub i32 %15, %indvars116.i %cmp7.not89.i = icmp slt i32 %add.i, 1 br i1 %cmp7.not89.i, label %for.inc53.i, label %for.body18.lr.ph.i.preheader for.body18.lr.ph.i.preheader: ; preds = %for.cond6.preheader.i %17 = add nsw i64 %indvars.iv103.i, -1 br label %for.body18.lr.ph.i for.body18.lr.ph.i: ; preds = %for.body18.lr.ph.i.preheader, %for.inc50.i %indvars.iv105.i = phi i64 [ %indvars.iv.next106.i, %for.inc50.i ], [ %indvars.iv103.i, %for.body18.lr.ph.i.preheader ] %indvars.iv94.i = phi i64 [ %indvars.iv.next95.i, %for.inc50.i ], [ 1, %for.body18.lr.ph.i.preheader ] %18 = add nuw nsw i64 %17, %indvars.iv94.i %arrayidx14.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv94.i, i64 %18 store i32 100000, ptr %arrayidx14.i, align 4, !tbaa !5 %gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv94.i %arrayidx35.i = getelementptr inbounds i32, ptr %p, i64 %18 %19 = load i32, ptr %gep.i, align 4, !tbaa !5 %20 = load i32, ptr %arrayidx35.i, align 4, !tbaa !5 br label %for.body18.i for.body18.i: ; preds = %for.inc47.i, %for.body18.lr.ph.i %21 = phi i32 [ 100000, %for.body18.lr.ph.i ], [ %25, %for.inc47.i ] %indvars.iv96.i = phi i64 [ %indvars.iv94.i, %for.body18.lr.ph.i ], [ %indvars.iv.next97.i, %for.inc47.i ] %arrayidx22.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv94.i, i64 %indvars.iv96.i %22 = load i32, ptr %arrayidx22.i, align 4, !tbaa !5 %indvars.iv.next97.i = add nuw nsw i64 %indvars.iv96.i, 1 %arrayidx27.i = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv.next97.i, i64 %18 %23 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5 %add28.i = add nsw i32 %23, %22 %arrayidx33.i = getelementptr inbounds i32, ptr %p, i64 %indvars.iv96.i %24 = load i32, ptr %arrayidx33.i, align 4, !tbaa !5 %mul.i = mul nsw i32 %24, %19 %mul36.i = mul nsw i32 %mul.i, %20 %add37.i = add nsw i32 %add28.i, %mul36.i %cmp42.i = icmp sgt i32 %21, %add37.i br i1 %cmp42.i, label %if.then.i, label %for.inc47.i if.then.i: ; preds = %for.body18.i store i32 %add37.i, ptr %arrayidx14.i, align 4, !tbaa !5 br label %for.inc47.i for.inc47.i: ; preds = %if.then.i, %for.body18.i %25 = phi i32 [ %21, %for.body18.i ], [ %add37.i, %if.then.i ] %exitcond102.not.i = icmp eq i64 %indvars.iv.next97.i, %indvars.iv105.i br i1 %exitcond102.not.i, label %for.inc50.i, label %for.body18.i, !llvm.loop !13 for.inc50.i: ; preds = %for.inc47.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.inc53.i, label %for.body18.lr.ph.i, !llvm.loop !14 for.inc53.i: ; preds = %for.inc50.i, %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 %Matrix.exit, label %for.cond6.preheader.i, !llvm.loop !15 Matrix.exit: ; preds = %for.inc53.i, %for.cond4.preheader, %for.inc23.peel, %for.end25, %for.cond3.preheader.i %idxprom26 = sext i32 %.lcssa to i64 %arrayidx27 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 1, i64 %idxprom26 %26 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26) call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %row) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %col) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(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, !12, !18} !18 = !{!"llvm.loop.peeled.count", i32 1} !19 = distinct !{!19, !10}
#include <stdio.h> #include<math.h> #define N 100 #define INFTY 2000000 int main() { int i,j,l,k,n,p[N+1],m[N+1][N+1],q; scanf("%d",&n); for(i=0 ; i< n ; i++) { scanf("%d%d",&p[i],&j); } p[n]=j; 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-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; } } } printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284720/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284720/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %j = alloca i32, align 4 %n = alloca i32, align 4 %p = 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 %j) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #4 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp95 = icmp sgt i32 %0, 0 br i1 %cmp95, label %for.body, label %for.end.thread for.end.thread: ; preds = %entry %.pre135 = sext i32 %0 to i64 br label %for.end66 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [101 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 %j) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %j, align 4, !tbaa !5 %arrayidx3 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %2 store i32 %.pre, ptr %arrayidx3, align 4, !tbaa !5 %cmp5.not97 = icmp slt i32 %1, 1 br i1 %cmp5.not97, label %for.end66, label %for.body6.preheader for.body6.preheader: ; preds = %for.end %3 = add nuw i32 %1, 1 %wide.trip.count = zext i32 %3 to i64 %4 = add nsw i64 %wide.trip.count, -1 %5 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %4, 3 %6 = icmp ult i64 %5, 3 br i1 %6, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %4, -4 br label %for.body6 for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %indvars.iv108.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next109.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.iv108.epil = phi i64 [ %indvars.iv.next109.epil, %for.body6.epil ], [ %indvars.iv108.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.iv108.epil, i64 %indvars.iv108.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next109.epil = add nuw nsw i64 %indvars.iv108.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.not104 = icmp slt i32 %1, 2 br i1 %cmp15.not104, label %for.end66, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub = add nuw i32 %1, 1 %wide.trip.count133 = zext i32 %sub to i64 br label %for.cond17.preheader for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv108 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next109.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.iv108, i64 %indvars.iv108 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1 %arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next109, i64 %indvars.iv.next109 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108, 2 %arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next109.1, i64 %indvars.iv.next109.1 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %indvars.iv.next109.2 = add nuw nsw i64 %indvars.iv108, 3 %arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next109.2, i64 %indvars.iv.next109.2 store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5 %indvars.iv.next109.3 = add nuw nsw i64 %indvars.iv108, 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.inc64 %indvars.iv120 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next121, %for.inc64 ] %indvars132 = trunc i64 %indvars.iv120 to i32 %add = sub i32 %sub, %indvars132 %cmp18.not102 = icmp slt i32 %add, 1 br i1 %cmp18.not102, label %for.inc64, label %for.body19.lr.ph for.body19.lr.ph: ; preds = %for.cond17.preheader %7 = add nuw i64 %indvars.iv120, 4294967295 br label %for.body19 for.body19: ; preds = %for.body19.lr.ph, %for.inc61 %indvars.iv122 = phi i64 [ %indvars.iv120, %for.body19.lr.ph ], [ %indvars.iv.next123, %for.inc61 ] %indvars.iv111 = phi i64 [ 1, %for.body19.lr.ph ], [ %indvars.iv.next112, %for.inc61 ] %8 = add i64 %7, %indvars.iv111 %sext = shl i64 %8, 32 %idxprom24 = ashr exact i64 %sext, 32 %arrayidx25 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv111, i64 %idxprom24 store i32 2000000, ptr %arrayidx25, align 4 %cmp28.not.not99 = icmp slt i64 %indvars.iv111, %idxprom24 br i1 %cmp28.not.not99, label %for.body29.lr.ph, label %for.inc61 for.body29.lr.ph: ; preds = %for.body19 %9 = add nsw i64 %indvars.iv111, -1 %arrayidx42 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9 %10 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %arrayidx46 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %idxprom24 %11 = load i32, ptr %arrayidx46, align 4, !tbaa !5 br label %for.body29 for.body29: ; preds = %for.body29.lr.ph, %for.body29 %indvars.iv113 = phi i64 [ %indvars.iv111, %for.body29.lr.ph ], [ %indvars.iv.next114, %for.body29 ] %storemerge100 = phi i32 [ 2000000, %for.body29.lr.ph ], [ %spec.store.select, %for.body29 ] %arrayidx33 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv111, i64 %indvars.iv113 %12 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next114, i64 %idxprom24 %13 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %add39 = add nsw i32 %13, %12 %arrayidx44 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv113 %14 = load i32, ptr %arrayidx44, align 4, !tbaa !5 %mul = mul nsw i32 %14, %10 %mul47 = mul nsw i32 %mul, %11 %add48 = add nsw i32 %add39, %mul47 %spec.store.select = call i32 @llvm.smin.i32(i32 %storemerge100, i32 %add48) store i32 %spec.store.select, ptr %arrayidx25, align 4 %exitcond119.not = icmp eq i64 %indvars.iv.next114, %indvars.iv122 br i1 %exitcond119.not, label %for.inc61, label %for.body29, !llvm.loop !14 for.inc61: ; preds = %for.body29, %for.body19 %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1 %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1 %exitcond130.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count133 br i1 %exitcond130.not, label %for.cond17.for.inc64_crit_edge, label %for.body19, !llvm.loop !15 for.cond17.for.inc64_crit_edge: ; preds = %for.inc61 %15 = trunc i64 %8 to i32 store i32 %15, ptr %j, align 4, !tbaa !5 br label %for.inc64 for.inc64: ; preds = %for.cond17.for.inc64_crit_edge, %for.cond17.preheader %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %exitcond134.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count133 br i1 %exitcond134.not, label %for.end66, label %for.cond17.preheader, !llvm.loop !16 for.end66: ; preds = %for.inc64, %for.end, %for.end.thread, %for.cond14.preheader %idxprom2.pre-phi140145 = phi i64 [ %2, %for.cond14.preheader ], [ %2, %for.end ], [ %.pre135, %for.end.thread ], [ %2, %for.inc64 ] %arrayidx69 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom2.pre-phi140145 %16 = load i32, ptr %arrayidx69, align 4, !tbaa !5 %call70 = 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) #4 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #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> #define N 100 #define INFTY 1e9 int main(void) { int n, i, j, k, t, l, mul; int p[N+1],m[N+1][N+1]; 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; for(i = 2; i <= n; i++){ for(j = 1; j<= n-i+1; j++ ) { t = i + j -1; m[j][t] = INFTY; for(k = j; k <= t-1 ;k++) { mul = m[j][k]+m[k+1][t] + p[j-1]*p[k]*p[t]; if(mul < m[j][t]) m[j][t] = mul; } } } printf("%d\n",m[1][n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284764/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284764/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %m = 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 %p) #4 call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #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 %p, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [101 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 !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 %m, 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 %cmp15.not111 = icmp slt i32 %6, 2 br i1 %cmp15.not111, label %for.end68, label %for.cond17.preheader.lr.ph for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader %sub18 = add nuw i32 %6, 1 %wide.trip.count142 = zext i32 %sub18 to i64 br label %for.cond17.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 %m, 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 %m, 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 %m, 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 %m, 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.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc66 %indvars.iv128 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next129, %for.inc66 ] %indvars141 = trunc i64 %indvars.iv128 to i32 %add = sub i32 %sub18, %indvars141 %cmp19.not109 = icmp slt i32 %add, 1 br i1 %cmp19.not109, label %for.inc66, label %for.body30.lr.ph for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc63 %indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.inc63 ], [ %indvars.iv128, %for.cond17.preheader ] %indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.inc63 ], [ 1, %for.cond17.preheader ] %8 = add nuw nsw i64 %indvars.iv119, %indvars.iv128 %9 = add nsw i64 %8, -1 %arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv119, i64 %9 store i32 1000000000, ptr %arrayidx26, align 4 %10 = add nsw i64 %indvars.iv119, -1 %arrayidx43 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10 %11 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %arrayidx48 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9 %12 = load i32, ptr %arrayidx48, align 4, !tbaa !5 br label %for.body30 for.body30: ; preds = %for.body30.lr.ph, %for.body30 %indvars.iv121 = phi i64 [ %indvars.iv119, %for.body30.lr.ph ], [ %indvars.iv.next122, %for.body30 ] %storemerge107 = phi i32 [ 1000000000, %for.body30.lr.ph ], [ %spec.store.select, %for.body30 ] %arrayidx34 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv119, i64 %indvars.iv121 %13 = load i32, ptr %arrayidx34, align 4, !tbaa !5 %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1 %arrayidx39 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next122, i64 %9 %14 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %add40 = add nsw i32 %14, %13 %arrayidx45 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv121 %15 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %mul46 = mul nsw i32 %15, %11 %mul49 = mul nsw i32 %mul46, %12 %add50 = add nsw i32 %add40, %mul49 %spec.store.select = call i32 @llvm.smin.i32(i32 %add50, i32 %storemerge107) store i32 %spec.store.select, ptr %arrayidx26, align 4 %exitcond127.not = icmp eq i64 %indvars.iv.next122, %indvars.iv130 br i1 %exitcond127.not, label %for.inc63, label %for.body30, !llvm.loop !14 for.inc63: ; preds = %for.body30 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond140.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count142 br i1 %exitcond140.not, label %for.inc66, label %for.body30.lr.ph, !llvm.loop !15 for.inc66: ; preds = %for.inc63, %for.cond17.preheader %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %exitcond143.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count142 br i1 %exitcond143.not, label %for.end68, label %for.cond17.preheader, !llvm.loop !16 for.end68: ; preds = %for.inc66, %entry, %for.cond4.preheader, %for.cond14.preheader %.lcssa146149 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc66 ] %idxprom70 = sext i32 %.lcssa146149 to i64 %arrayidx71 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom70 %16 = load i32, ptr %arrayidx71, align 4, !tbaa !5 %call72 = 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) #4 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #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<math.h> #define MAX 100 int min(int x, int y); int main(){ int i,j,n,k,c,r; int a[MAX]; int b[MAX][MAX]; scanf("%d",&n); for(i = 1; i<=n; i++){ scanf("%d%d", &a[i-1],&a[i]); } for(i = 0; i<=n; i++){ for(j=0; j<=n; j++){ b[i][j] =0; } } for ( c =2 ; c<=n; c++){ for(i =1; i<=n-c +1;i++){ j = i+c-1; b[i][j] = 1<<21; for(k = i; k<=j-1; k++){ r = b[i][k] + b[k + 1][j] + a[i-1]*a[k] *a[j]; b[i][j] = min(b[i][j],r); } } } printf("%d\n",b[1][n]); return 0; } int min(int x, int y){ if(x < y){ return(x); } else{ return(y); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284807/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284807/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32], align 16 %b = alloca [100 x [100 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not108 = icmp slt i32 %0, 1 br i1 %cmp.not108, label %for.cond4.preheader, label %for.body for.cond4.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %6, %for.body ] %cmp5.not112 = icmp slt i32 %.lcssa, 0 br i1 %cmp5.not112, label %for.end73, label %for.cond7.preheader.preheader for.cond7.preheader.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %.lcssa, 1 %2 = zext i32 %1 to i64 %3 = shl nuw nsw i64 %2, 2 %xtraiter = and i64 %2, 7 %4 = icmp ult i32 %.lcssa, 7 br i1 %4, label %for.cond20.preheader.unr-lcssa, label %for.cond7.preheader.preheader.new for.cond7.preheader.preheader.new: ; preds = %for.cond7.preheader.preheader %unroll_iter = and i64 %2, 4294967288 %invariant.gep = getelementptr i8, ptr %b, i64 400 %invariant.gep158 = getelementptr i8, ptr %b, i64 800 %invariant.gep160 = getelementptr i8, ptr %b, i64 1200 %invariant.gep162 = getelementptr i8, ptr %b, i64 1600 %invariant.gep164 = getelementptr i8, ptr %b, i64 2000 %invariant.gep166 = getelementptr i8, ptr %b, i64 2400 %invariant.gep168 = getelementptr i8, ptr %b, i64 2800 br label %for.cond7.preheader 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 %a, i64 0, i64 %5 %arrayidx2 = getelementptr inbounds [100 x i32], ptr %a, 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.cond7.preheader: ; preds = %for.cond7.preheader, %for.cond7.preheader.preheader.new %indvar = phi i64 [ 0, %for.cond7.preheader.preheader.new ], [ %indvar.next.7, %for.cond7.preheader ] %niter = phi i64 [ 0, %for.cond7.preheader.preheader.new ], [ %niter.next.7, %for.cond7.preheader ] %8 = mul nuw nsw i64 %indvar, 400 %scevgep = getelementptr i8, ptr %b, i64 %8 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %scevgep, i8 0, i64 %3, i1 false), !tbaa !5 %9 = mul nuw i64 %indvar, 400 %gep = getelementptr i8, ptr %invariant.gep, i64 %9 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep, i8 0, i64 %3, i1 false), !tbaa !5 %10 = mul nuw i64 %indvar, 400 %gep159 = getelementptr i8, ptr %invariant.gep158, i64 %10 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep159, i8 0, i64 %3, i1 false), !tbaa !5 %11 = mul nuw i64 %indvar, 400 %gep161 = getelementptr i8, ptr %invariant.gep160, i64 %11 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep161, i8 0, i64 %3, i1 false), !tbaa !5 %12 = mul nuw i64 %indvar, 400 %gep163 = getelementptr i8, ptr %invariant.gep162, i64 %12 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep163, i8 0, i64 %3, i1 false), !tbaa !5 %13 = mul nuw i64 %indvar, 400 %gep165 = getelementptr i8, ptr %invariant.gep164, i64 %13 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep165, i8 0, i64 %3, i1 false), !tbaa !5 %14 = mul nuw i64 %indvar, 400 %gep167 = getelementptr i8, ptr %invariant.gep166, i64 %14 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep167, i8 0, i64 %3, i1 false), !tbaa !5 %15 = mul nuw i64 %indvar, 400 %gep169 = getelementptr i8, ptr %invariant.gep168, i64 %15 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep169, i8 0, i64 %3, 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.cond20.preheader.unr-lcssa, label %for.cond7.preheader, !llvm.loop !11 for.cond20.preheader.unr-lcssa: ; preds = %for.cond7.preheader, %for.cond7.preheader.preheader %indvar.unr = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvar.next.7, %for.cond7.preheader ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond20.preheader, label %for.cond7.preheader.epil for.cond7.preheader.epil: ; preds = %for.cond20.preheader.unr-lcssa, %for.cond7.preheader.epil %indvar.epil = phi i64 [ %indvar.next.epil, %for.cond7.preheader.epil ], [ %indvar.unr, %for.cond20.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.cond7.preheader.epil ], [ 0, %for.cond20.preheader.unr-lcssa ] %16 = mul nuw nsw i64 %indvar.epil, 400 %scevgep.epil = getelementptr i8, ptr %b, i64 %16 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %scevgep.epil, i8 0, i64 %3, 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.cond20.preheader, label %for.cond7.preheader.epil, !llvm.loop !12 for.cond20.preheader: ; preds = %for.cond7.preheader.epil, %for.cond20.preheader.unr-lcssa %cmp21.not119 = icmp slt i32 %.lcssa, 2 br i1 %cmp21.not119, label %for.end73, label %for.cond23.preheader.lr.ph for.cond23.preheader.lr.ph: ; preds = %for.cond20.preheader %sub24 = add nuw i32 %.lcssa, 1 %wide.trip.count151 = zext i32 %sub24 to i64 br label %for.cond23.preheader for.cond23.preheader: ; preds = %for.cond23.preheader.lr.ph, %for.inc71 %indvars.iv137 = phi i64 [ 2, %for.cond23.preheader.lr.ph ], [ %indvars.iv.next138, %for.inc71 ] %indvars150 = trunc i64 %indvars.iv137 to i32 %add = sub i32 %sub24, %indvars150 %cmp25.not117 = icmp slt i32 %add, 1 br i1 %cmp25.not117, label %for.inc71, label %for.body36.lr.ph for.body36.lr.ph: ; preds = %for.cond23.preheader, %for.inc68 %indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.inc68 ], [ %indvars.iv137, %for.cond23.preheader ] %indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc68 ], [ 1, %for.cond23.preheader ] %17 = add nuw nsw i64 %indvars.iv128, %indvars.iv137 %18 = add nsw i64 %17, -1 %arrayidx32 = getelementptr inbounds [100 x [100 x i32]], ptr %b, i64 0, i64 %indvars.iv128, i64 %18 store i32 2097152, ptr %arrayidx32, align 4, !tbaa !5 %19 = add nsw i64 %indvars.iv128, -1 %arrayidx49 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %19 %20 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %arrayidx53 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %18 %21 = load i32, ptr %arrayidx53, align 4, !tbaa !5 br label %for.body36 for.body36: ; preds = %for.body36.lr.ph, %for.body36 %indvars.iv130 = phi i64 [ %indvars.iv128, %for.body36.lr.ph ], [ %indvars.iv.next131, %for.body36 ] %storemerge115 = phi i32 [ 2097152, %for.body36.lr.ph ], [ %x.y.i, %for.body36 ] %arrayidx40 = getelementptr inbounds [100 x [100 x i32]], ptr %b, i64 0, i64 %indvars.iv128, i64 %indvars.iv130 %22 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %arrayidx45 = getelementptr inbounds [100 x [100 x i32]], ptr %b, i64 0, i64 %indvars.iv.next131, i64 %18 %23 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %add46 = add nsw i32 %23, %22 %arrayidx51 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv130 %24 = load i32, ptr %arrayidx51, align 4, !tbaa !5 %mul = mul nsw i32 %24, %20 %mul54 = mul nsw i32 %mul, %21 %add55 = add nsw i32 %add46, %mul54 %x.y.i = call i32 @llvm.smin.i32(i32 %storemerge115, i32 %add55) store i32 %x.y.i, ptr %arrayidx32, align 4, !tbaa !5 %exitcond136.not = icmp eq i64 %indvars.iv.next131, %indvars.iv139 br i1 %exitcond136.not, label %for.inc68, label %for.body36, !llvm.loop !14 for.inc68: ; preds = %for.body36 %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1 %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1 %exitcond149.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count151 br i1 %exitcond149.not, label %for.inc71, label %for.body36.lr.ph, !llvm.loop !15 for.inc71: ; preds = %for.inc68, %for.cond23.preheader %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1 %exitcond152.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count151 br i1 %exitcond152.not, label %for.end73, label %for.cond23.preheader, !llvm.loop !16 for.end73: ; preds = %for.inc71, %for.cond4.preheader, %for.cond20.preheader %idxprom75 = sext i32 %.lcssa to i64 %arrayidx76 = getelementptr inbounds [100 x [100 x i32]], ptr %b, i64 0, i64 1, i64 %idxprom75 %25 = load i32, ptr %arrayidx76, align 4, !tbaa !5 %call77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 { entry: %x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %x.y } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.unroll.disable"} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include <stdio.h> int main(void) { int num[3]; int swap; int i; int j; for (i = 0; i < 3; i++){ scanf("%d", &num[i]); } for (i = 0; i < 2; i++){ for (j = 0; j < 2; j++){ if (num[j] > num[j + 1]){ swap = num[j + 1]; num[j + 1] = num[j]; num[j] = swap; } } } for (i = 0; i < 3; i ++){ printf("%d", num[i]); if (i != 2){ printf(" "); } } printf("\n"); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284858/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284858/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %num) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %arrayidx.1 = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %0 = load i32, ptr %num, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %0, %1 br i1 %cmp11, label %if.then, label %for.inc22 if.then: ; preds = %entry store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %1, ptr %num, align 4, !tbaa !5 br label %for.inc22 for.inc22: ; preds = %entry, %if.then %2 = phi i32 [ %0, %entry ], [ %1, %if.then ] %3 = phi i32 [ %1, %entry ], [ %0, %if.then ] %4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp11.1 = icmp sgt i32 %3, %4 br i1 %cmp11.1, label %if.then.1, label %for.inc22.1 if.then.1: ; preds = %for.inc22 store i32 %3, ptr %arrayidx.2, align 4, !tbaa !5 store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc22.1 for.inc22.1: ; preds = %if.then.1, %for.inc22 %5 = phi i32 [ %3, %if.then.1 ], [ %4, %for.inc22 ] %6 = phi i32 [ %4, %if.then.1 ], [ %3, %for.inc22 ] %cmp11.166 = icmp sgt i32 %2, %6 br i1 %cmp11.166, label %if.then.167, label %for.inc22.168 if.then.167: ; preds = %for.inc22.1 store i32 %2, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %6, ptr %num, align 4, !tbaa !5 br label %for.inc22.168 for.inc22.168: ; preds = %if.then.167, %for.inc22.1 %7 = phi i32 [ %6, %if.then.167 ], [ %2, %for.inc22.1 ] %8 = phi i32 [ %2, %if.then.167 ], [ %6, %for.inc22.1 ] %cmp11.1.1 = icmp sgt i32 %8, %5 br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc38.2 if.then.1.1: ; preds = %for.inc22.168 store i32 %8, ptr %arrayidx.2, align 4, !tbaa !5 store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc38.2 for.inc38.2: ; preds = %for.inc22.168, %if.then.1.1 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7) %putchar58 = call i32 @putchar(i32 32) %9 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) %putchar58.1 = call i32 @putchar(i32 32) %10 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %call33.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %num) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int s[3]; int a,b; scanf("%d %d %d",&s[0],&s[1],&s[2]); for(a=0;a<2;a++){ for(b=0;b<2;b++){ if(s[b]>s[b+1]){ int temp=s[b]; s[b]=s[b+1]; s[b+1]=temp; } } } printf("%d %d %d\n",s[0],s[1],s[2]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284900/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284900/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %s = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #3 %arrayidx1 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 1 %arrayidx2 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 2 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2) %0 = load i32, ptr %s, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %0, %1 br i1 %cmp9, label %if.then, label %for.inc if.then: ; preds = %entry store i32 %1, ptr %s, align 4, !tbaa !5 store i32 %0, ptr %arrayidx1, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %entry, %if.then %2 = phi i32 [ %0, %entry ], [ %1, %if.then ] %3 = phi i32 [ %1, %entry ], [ %0, %if.then ] %4 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp9.1 = icmp sgt i32 %3, %4 br i1 %cmp9.1, label %if.then.1, label %for.inc.1 if.then.1: ; preds = %for.inc store i32 %4, ptr %arrayidx1, align 4, !tbaa !5 store i32 %3, ptr %arrayidx2, align 4, !tbaa !5 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.inc %5 = phi i32 [ %3, %if.then.1 ], [ %4, %for.inc ] %6 = phi i32 [ %4, %if.then.1 ], [ %3, %for.inc ] %cmp9.140 = icmp sgt i32 %2, %6 br i1 %cmp9.140, label %if.then.141, label %for.inc.142 if.then.141: ; preds = %for.inc.1 store i32 %6, ptr %s, align 4, !tbaa !5 store i32 %2, ptr %arrayidx1, align 4, !tbaa !5 br label %for.inc.142 for.inc.142: ; preds = %if.then.141, %for.inc.1 %7 = phi i32 [ %6, %if.then.141 ], [ %2, %for.inc.1 ] %8 = phi i32 [ %2, %if.then.141 ], [ %6, %for.inc.1 ] %cmp9.1.1 = icmp sgt i32 %8, %5 br i1 %cmp9.1.1, label %if.then.1.1, label %for.inc.1.1 if.then.1.1: ; preds = %for.inc.142 store i32 %5, ptr %arrayidx1, align 4, !tbaa !5 store i32 %8, ptr %arrayidx2, align 4, !tbaa !5 br label %for.inc.1.1 for.inc.1.1: ; preds = %if.then.1.1, %for.inc.142 %9 = phi i32 [ %8, %if.then.1.1 ], [ %5, %for.inc.142 ] %10 = phi i32 [ %5, %if.then.1.1 ], [ %8, %for.inc.142 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %10, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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; scanf("%d %d %d",&a,&b,&c); if(a<=b && b<=c){ printf("%d %d %d\n",a,b,c); } else if(a<=c && c<=b){ printf("%d %d %d\n",a,c,b); } else if(b<=a && a<=c){ printf("%d %d %d\n",b,a,c); } else if(b<=c && c<=a){ printf("%d %d %d\n",b,c,a); } else if(c<=a && a<=b){ printf("%d %d %d\n",c,a,b); } else if(c<=b && b<=a){ printf("%d %d %d\n",c,b,a); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284951/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284951/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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.not = icmp sgt i32 %0, %1 %.pre = load i32, ptr %c, align 4, !tbaa !5 %cmp1.not = icmp sgt i32 %1, %.pre %or.cond59 = select i1 %cmp.not, i1 true, i1 %cmp1.not br i1 %or.cond59, label %if.else, label %if.then if.then: ; preds = %entry %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0, i32 noundef %1, i32 noundef %.pre) br label %if.end36 if.else: ; preds = %entry %cmp3.not = icmp sgt i32 %0, %.pre br i1 %cmp3.not, label %if.else8, label %land.lhs.true4 land.lhs.true4: ; preds = %if.else %cmp5.not = icmp sgt i32 %.pre, %1 br i1 %cmp5.not, label %if.else8.thread, label %if.then6 if.then6: ; preds = %land.lhs.true4 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0, i32 noundef %.pre, i32 noundef %1) br label %if.end36 if.else8: ; preds = %if.else %cmp9.not = icmp sgt i32 %1, %0 br label %if.else14 if.else8.thread: ; preds = %land.lhs.true4 %cmp9.not54 = icmp sgt i32 %1, %0 br i1 %cmp9.not54, label %if.else14, label %if.then12 if.then12: ; preds = %if.else8.thread %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %0, i32 noundef %.pre) br label %if.end36 if.else14: ; preds = %if.else8, %if.else8.thread %cmp9.not56 = phi i1 [ true, %if.else8.thread ], [ %cmp9.not, %if.else8 ] %cmp15.not = icmp sgt i32 %1, %.pre %cmp17.not = icmp sgt i32 %.pre, %0 %or.cond = or i1 %cmp15.not, %cmp17.not br i1 %or.cond, label %if.else20, label %if.then18 if.then18: ; preds = %if.else14 %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %.pre, i32 noundef %0) br label %if.end36 if.else20: ; preds = %if.else14 %brmerge = or i1 %cmp.not, %cmp17.not br i1 %brmerge, label %if.else26, label %if.then24 if.then24: ; preds = %if.else20 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre, i32 noundef %0, i32 noundef %1) br label %if.end36 if.else26: ; preds = %if.else20 %cmp27.not = icmp sgt i32 %.pre, %1 %brmerge58 = or i1 %cmp27.not, %cmp9.not56 br i1 %brmerge58, label %if.end36, label %if.then30 if.then30: ; preds = %if.else26 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre, i32 noundef %1, i32 noundef %0) br label %if.end36 if.end36: ; preds = %if.else26, %if.then6, %if.then18, %if.then30, %if.then24, %if.then12, %if.then 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,t; scanf("%d %d %d",&a,&b,&c); if(a>b){ t=a; a=b; b=t; } if(b>c){ t=b; b=c; c=t; } if(a>b){ t=a; a=b; b=t; } printf("%d %d %d\n",a,b,c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284995/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284995/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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() { int a=0; int b=0; int c=0; int tmp=0; scanf("%d %d %d", &a, &b, &c); if (a>b) { tmp=b; b=a; a=tmp; } if (b>c) { tmp=c; c=b; b=tmp; } if (a>b) { tmp=b; b=a; a=tmp; } printf("%d %d %d\n",a ,b ,c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285037/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285037/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 store i32 0, ptr %a, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 store i32 0, ptr %b, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 store i32 0, ptr %c, align 4, !tbaa !5 %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 %0, ptr %b, align 4, !tbaa !5 store i32 %1, ptr %a, 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 %3, ptr %c, align 4, !tbaa !5 store i32 %4, ptr %b, 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 %2, ptr %b, align 4, !tbaa !5 store i32 %6, ptr %a, 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() { int i, j, num[3], tmp; for(i = 0; i < 3; i++) scanf("%d", &num[i]); for(i = 0; i < 3; i++) { for(j = 0; j < 2; j++) { if(num[j] > num[j + 1]) { tmp = num[j]; num[j] = num[j + 1]; num[j + 1] = tmp; } } } printf("%d %d %d\n", num[0], num[1], num[2]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285080/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285080/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %num) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %arrayidx.1 = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %0 = load i32, ptr %num, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %0, %1 br i1 %cmp11, label %if.then, label %for.inc22 if.then: ; preds = %entry store i32 %1, ptr %num, align 4, !tbaa !5 store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc22 for.inc22: ; preds = %entry, %if.then %2 = phi i32 [ %0, %entry ], [ %1, %if.then ] %3 = phi i32 [ %1, %entry ], [ %0, %if.then ] %4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp11.1 = icmp sgt i32 %3, %4 br i1 %cmp11.1, label %if.then.1, label %for.inc22.1 if.then.1: ; preds = %for.inc22 store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %3, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.inc22.1 for.inc22.1: ; preds = %if.then.1, %for.inc22 %5 = phi i32 [ %3, %if.then.1 ], [ %4, %for.inc22 ] %6 = phi i32 [ %4, %if.then.1 ], [ %3, %for.inc22 ] %cmp11.150 = icmp sgt i32 %2, %6 br i1 %cmp11.150, label %if.then.151, label %for.inc22.152 if.then.151: ; preds = %for.inc22.1 store i32 %6, ptr %num, align 4, !tbaa !5 store i32 %2, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc22.152 for.inc22.152: ; preds = %if.then.151, %for.inc22.1 %7 = phi i32 [ %6, %if.then.151 ], [ %2, %for.inc22.1 ] %8 = phi i32 [ %2, %if.then.151 ], [ %6, %for.inc22.1 ] %cmp11.1.1 = icmp sgt i32 %8, %5 br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc22.1.1 if.then.1.1: ; preds = %for.inc22.152 store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %8, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.inc22.1.1 for.inc22.1.1: ; preds = %if.then.1.1, %for.inc22.152 %9 = phi i32 [ %8, %if.then.1.1 ], [ %5, %for.inc22.152 ] %10 = phi i32 [ %5, %if.then.1.1 ], [ %8, %for.inc22.152 ] %cmp11.2 = icmp sgt i32 %7, %10 br i1 %cmp11.2, label %if.then.2, label %for.inc22.2 if.then.2: ; preds = %for.inc22.1.1 store i32 %10, ptr %num, align 4, !tbaa !5 store i32 %7, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc22.2 for.inc22.2: ; preds = %if.then.2, %for.inc22.1.1 %11 = phi i32 [ %10, %if.then.2 ], [ %7, %for.inc22.1.1 ] %12 = phi i32 [ %7, %if.then.2 ], [ %10, %for.inc22.1.1 ] %cmp11.1.2 = icmp sgt i32 %12, %9 br i1 %cmp11.1.2, label %if.then.1.2, label %for.inc22.1.2 if.then.1.2: ; preds = %for.inc22.2 store i32 %9, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %12, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.inc22.1.2 for.inc22.1.2: ; preds = %if.then.1.2, %for.inc22.2 %13 = phi i32 [ %12, %if.then.1.2 ], [ %9, %for.inc22.2 ] %14 = phi i32 [ %9, %if.then.1.2 ], [ %12, %for.inc22.2 ] %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11, i32 noundef %14, i32 noundef %13) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %num) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int a[3]; int b,c,d; for(b=0;b<3;b++){ scanf("%d",&a[b]); } for(b=0;b<2;b++){ for(c=b+1;c<=2;c++){ if(a[b] > a[c]){ d = a[b]; a[b] = a[c]; a[c] = d; } } } printf("%d %d %d\n",a[0],a[1],a[2]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285123/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285123/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { for.body6.lr.ph: %a = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %arrayidx.1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %0, %1 br i1 %cmp11, label %if.then, label %for.inc20 for.body6.lr.ph.1: ; preds = %if.then.157, %for.inc20 %2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %3 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp11.1 = icmp sgt i32 %2, %3 br i1 %cmp11.1, label %if.then.1, label %for.cond1.loopexit.1 if.then.1: ; preds = %for.body6.lr.ph.1 store i32 %3, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %2, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.cond1.loopexit.1 for.cond1.loopexit.1: ; preds = %for.body6.lr.ph.1, %if.then.1 %4 = phi i32 [ %2, %if.then.1 ], [ %3, %for.body6.lr.ph.1 ] %5 = phi i32 [ %3, %if.then.1 ], [ %2, %for.body6.lr.ph.1 ] %6 = load i32, ptr %a, align 4, !tbaa !5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6, i32 noundef %5, i32 noundef %4) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %a) #3 ret i32 0 if.then: ; preds = %for.body6.lr.ph store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc20 for.inc20: ; preds = %for.body6.lr.ph, %if.then %7 = phi i32 [ %0, %for.body6.lr.ph ], [ %1, %if.then ] %8 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp11.155 = icmp sgt i32 %7, %8 br i1 %cmp11.155, label %if.then.157, label %for.body6.lr.ph.1 if.then.157: ; preds = %for.inc20 store i32 %8, ptr %a, align 4, !tbaa !5 store i32 %7, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.body6.lr.ph.1 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(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 numbers[3], i, j, temp; scanf("%d %d %d", &numbers[0], &numbers[1], &numbers[2]); for (i = 0; i < 3; i++) { for (j = i + 1; j < 3; j++) { if (numbers[i] > numbers[j]) { temp = numbers[i]; numbers[i] = numbers[j]; numbers[j] = temp; } } } printf("%d %d %d\n", numbers[0], numbers[1], numbers[2]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285167/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285167/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 { for.body5.lr.ph: %numbers = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %numbers) #3 %arrayidx1 = getelementptr inbounds [3 x i32], ptr %numbers, i64 0, i64 1 %arrayidx2 = getelementptr inbounds [3 x i32], ptr %numbers, i64 0, i64 2 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numbers, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2) %0 = load i32, ptr %numbers, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %0, %1 br i1 %cmp9, label %if.then, label %for.inc for.body5.lr.ph.1: ; preds = %if.then.148, %for.inc %2 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %3 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp9.1 = icmp sgt i32 %2, %3 br i1 %cmp9.1, label %if.then.1, label %for.cond.loopexit.2 if.then.1: ; preds = %for.body5.lr.ph.1 store i32 %3, ptr %arrayidx1, align 4, !tbaa !5 store i32 %2, ptr %arrayidx2, align 4, !tbaa !5 br label %for.cond.loopexit.2 for.cond.loopexit.2: ; preds = %if.then.1, %for.body5.lr.ph.1 %4 = load i32, ptr %numbers, align 4, !tbaa !5 %5 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %6 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef %5, i32 noundef %6) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %numbers) #3 ret i32 0 if.then: ; preds = %for.body5.lr.ph store i32 %1, ptr %numbers, align 4, !tbaa !5 store i32 %0, ptr %arrayidx1, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body5.lr.ph, %if.then %7 = phi i32 [ %0, %for.body5.lr.ph ], [ %1, %if.then ] %8 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp9.146 = icmp sgt i32 %7, %8 br i1 %cmp9.146, label %if.then.148, label %for.body5.lr.ph.1 if.then.148: ; preds = %for.inc store i32 %8, ptr %numbers, align 4, !tbaa !5 store i32 %7, ptr %arrayidx2, align 4, !tbaa !5 br label %for.body5.lr.ph.1 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(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, temp; scanf( "%d %d %d", &a, &b, &c ); if ( b > c ) { temp = b; b = c; c = temp; } if ( a > b ) { temp = a; a = b; b = temp; } if ( b > c ) { temp = b; b = c; c = temp; } printf( "%d %d %d\n", a, b, c ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285217/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285217/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5 %1 = load i32, ptr %c, 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 %b, align 4, !tbaa !5 store i32 %0, ptr %c, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i32 [ %0, %if.then ], [ %1, %entry ] %3 = phi i32 [ %1, %if.then ], [ %0, %entry ] %4 = load i32, ptr %a, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %4, %3 br i1 %cmp1, label %if.then2, label %if.end3 if.then2: ; preds = %if.end store i32 %3, ptr %a, align 4, !tbaa !5 store i32 %4, ptr %b, 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 %6, %2 br i1 %cmp4, label %if.then5, label %if.end6 if.then5: ; preds = %if.end3 store i32 %2, ptr %b, align 4, !tbaa !5 store i32 %6, ptr %c, align 4, !tbaa !5 br label %if.end6 if.end6: ; preds = %if.then5, %if.end3 %7 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ] %8 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %8, i32 noundef %7) 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",a,b,c); puts(""); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285260/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285260/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %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) #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 = 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) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<string.h> int main(){ int n,l; scanf("%d %d",&n,&l); char temp[101]; char str[100][101]; int i,j; for(i=0;i<n;i++){ scanf("%s",&str[i]); } for(i=0;i<(n-1);i++){ for(j=(n-1);j>i;j--){ if(strcmp(str[j-1],str[j])>0){ strcpy(temp,str[j-1]); strcpy(str[j-1],str[j]); strcpy(str[j],temp); } } } for(i=0;i<n;i++){ printf("%s",str[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285325/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285325/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %l = alloca i32, align 4 %temp = alloca [101 x i8], align 16 %str = alloca [100 x [101 x i8]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l) call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %temp) #5 call void @llvm.lifetime.start.p0(i64 10100, ptr nonnull %str) #5 %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp66 = icmp sgt i32 %0, 0 br i1 %cmp66, label %for.body, label %for.end50 for.cond2.preheader: ; preds = %for.body %cmp369 = icmp sgt i32 %3, 1 br i1 %cmp369, label %for.cond6.preheader.preheader, label %for.cond41.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 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 [101 x i8]], ptr %str, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = 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.inc38 %indvars.iv78 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next79, %for.inc38 ] br label %for.body8 for.cond41.preheader: ; preds = %for.inc38, %for.cond2.preheader %cmp4271 = icmp sgt i32 %3, 0 br i1 %cmp4271, label %for.body43, label %for.end50 for.body8: ; preds = %for.cond6.preheader, %for.inc36 %indvars.iv75 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next76, %for.inc36 ] %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1 %arrayidx11 = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv.next76 %arrayidx13 = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv75 %call15 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx13) #6 %cmp16 = icmp sgt i32 %call15, 0 br i1 %cmp16, label %if.then, label %for.inc36 if.then: ; preds = %for.body8 %call22 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %arrayidx11) #5 %call30 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx13) #5 %call35 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx13, ptr noundef nonnull dereferenceable(1) %temp) #5 br label %for.inc36 for.inc36: ; preds = %for.body8, %if.then %cmp7 = icmp sgt i64 %indvars.iv.next76, %indvars.iv78 br i1 %cmp7, label %for.body8, label %for.inc38, !llvm.loop !11 for.inc38: ; preds = %for.inc36 %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.cond41.preheader, label %for.cond6.preheader, !llvm.loop !12 for.body43: ; preds = %for.cond41.preheader, %for.body43 %indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body43 ], [ 0, %for.cond41.preheader ] %arrayidx45 = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv81 %call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx45) %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %5 = load i32, ptr %n, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp42 = icmp slt i64 %indvars.iv.next82, %6 br i1 %cmp42, label %for.body43, label %for.end50, !llvm.loop !13 for.end50: ; preds = %for.body43, %entry, %for.cond41.preheader call void @llvm.lifetime.end.p0(i64 10100, ptr nonnull %str) #5 call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %temp) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<string.h> int main(){ int N,L=0; scanf("%d %d",&N,&L); char S[N][L+1],tmp[L+1]; for(int i=0; i<N; i++){ scanf("%s",S[i]); } for(int k=0; k<N-1; k++){ for(int j=0; j<N-1; j++){ if(strcmp(S[j],S[j+1])>0){ strcpy(tmp,S[j+1]); strcpy(S[j+1],S[j]); strcpy(S[j],tmp); } } } for(int y=0; y<N; y++){ printf("%s",S[y]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285383/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285383/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %L = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #6 store i32 0, ptr %L, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %L) %0 = load i32, ptr %N, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = load i32, ptr %L, align 4, !tbaa !5 %add = add nsw i32 %2, 1 %3 = zext i32 %add to i64 %4 = call ptr @llvm.stacksave.p0() %5 = mul nuw i64 %3, %1 %vla = alloca i8, i64 %5, align 16 %6 = load i32, ptr %L, align 4, !tbaa !5 %add1 = add nsw i32 %6, 1 %7 = zext i32 %add1 to i64 %vla2 = alloca i8, i64 %7, align 16 %8 = load i32, ptr %N, align 4, !tbaa !5 %cmp61 = icmp sgt i32 %8, 0 br i1 %cmp61, label %for.body, label %for.cond.cleanup41 for.cond4.preheader: ; preds = %for.body %sub = add i32 %12, -1 %cmp565 = icmp sgt i32 %12, 1 br i1 %cmp565, label %for.cond8.preheader.us.preheader, label %for.cond39.preheader for.cond8.preheader.us.preheader: ; preds = %for.cond4.preheader %wide.trip.count = zext i32 %sub to i64 br label %for.cond8.preheader.us for.cond8.preheader.us: ; preds = %for.cond8.preheader.us.preheader, %for.cond8.for.cond.cleanup11_crit_edge.us %k.066.us = phi i32 [ %inc37.us, %for.cond8.for.cond.cleanup11_crit_edge.us ], [ 0, %for.cond8.preheader.us.preheader ] br label %for.body12.us for.body12.us: ; preds = %for.cond8.preheader.us, %for.inc33.us %indvars.iv71 = phi i64 [ 0, %for.cond8.preheader.us ], [ %indvars.iv.next72, %for.inc33.us ] %9 = mul nuw nsw i64 %indvars.iv71, %3 %arrayidx14.us = getelementptr inbounds i8, ptr %vla, i64 %9 %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %10 = mul nuw nsw i64 %indvars.iv.next72, %3 %arrayidx17.us = getelementptr inbounds i8, ptr %vla, i64 %10 %call18.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx14.us, ptr noundef nonnull dereferenceable(1) %arrayidx17.us) #7 %cmp19.us = icmp sgt i32 %call18.us, 0 br i1 %cmp19.us, label %if.then.us, label %for.inc33.us if.then.us: ; preds = %for.body12.us %call23.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %vla2, ptr noundef nonnull dereferenceable(1) %arrayidx17.us) #6 %call29.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx17.us, ptr noundef nonnull dereferenceable(1) %arrayidx14.us) #6 %call32.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx14.us, ptr noundef nonnull dereferenceable(1) %vla2) #6 br label %for.inc33.us for.inc33.us: ; preds = %if.then.us, %for.body12.us %exitcond.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count br i1 %exitcond.not, label %for.cond8.for.cond.cleanup11_crit_edge.us, label %for.body12.us, !llvm.loop !9 for.cond8.for.cond.cleanup11_crit_edge.us: ; preds = %for.inc33.us %inc37.us = add nuw nsw i32 %k.066.us, 1 %exitcond74.not = icmp eq i32 %inc37.us, %sub br i1 %exitcond74.not, label %for.cond39.preheader, label %for.cond8.preheader.us, !llvm.loop !11 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %11 = mul nuw nsw i64 %indvars.iv, %3 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %11 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %12 = load i32, ptr %N, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp = icmp slt i64 %indvars.iv.next, %13 br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12 for.cond39.preheader: ; preds = %for.cond8.for.cond.cleanup11_crit_edge.us, %for.cond4.preheader %cmp4067 = icmp sgt i32 %12, 0 br i1 %cmp4067, label %for.body42, label %for.cond.cleanup41 for.cond.cleanup41: ; preds = %for.body42, %entry, %for.cond39.preheader call void @llvm.stackrestore.p0(ptr %4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6 ret i32 0 for.body42: ; preds = %for.cond39.preheader, %for.body42 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body42 ], [ 0, %for.cond39.preheader ] %14 = mul nuw nsw i64 %indvars.iv75, %3 %arrayidx44 = getelementptr inbounds i8, ptr %vla, i64 %14 %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx44) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %15 = load i32, ptr %N, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp40 = icmp slt i64 %indvars.iv.next76, %16 br i1 %cmp40, label %for.body42, label %for.cond.cleanup41, !llvm.loop !13 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } attributes #7 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> char str[101][101]; int strOrder[101]; int N; int L; int strcmp(char a[101], char b[101]) { int i; for (i = 0; i < L; i++) { if (a[i] > b[i]) return 1; else if (a[i] < b[i]) return 0; } return 0; } int main(void) { //freopen("in.txt", "r", stdin); int i, j, k; scanf("%d %d", &N, &L); for (i = 1; i <= N; ++i) { scanf("%s", str[i]); strOrder[i] = i; } for (i = 1; i <= N - 1; i++) { for (j = i + 1; j <= N; j++) { if (strcmp(str[i], str[j]) > 0) { for (k = 0; k < L; k++) { char tmp = str[i][k]; str[i][k] = str[j][k]; str[j][k] = tmp; } } } } for (i = 1; i <= N; i++) { printf("%s", str[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285426/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285426/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @L = dso_local global i32 0, align 4 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @N = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @str = dso_local global [101 x [101 x i8]] zeroinitializer, align 16 @strOrder = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16 ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @strcmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr @L, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %for.body.preheader, label %cleanup for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %0 to i64 br label %for.body for.body: ; preds = %if.else, %for.body.preheader %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.else ] %arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %indvars.iv %2 = load i8, ptr %arrayidx2, align 1, !tbaa !9 %cmp4 = icmp sgt i8 %1, %2 br i1 %cmp4, label %cleanup, label %if.else if.else: ; preds = %for.body %cmp12 = icmp slt i8 %1, %2 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count %or.cond = select i1 %cmp12, i1 true, i1 %exitcond.not br i1 %or.cond, label %cleanup, label %for.body, !llvm.loop !10 cleanup: ; preds = %for.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %for.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @L) %0 = load i32, ptr @N, align 4, !tbaa !5 %cmp.not81 = icmp slt i32 %0, 1 br i1 %cmp.not81, label %for.end55, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not.not87 = icmp sgt i32 %30, 1 br i1 %cmp5.not.not87, label %for.body6.lr.ph, label %for.cond46.preheader for.body6.lr.ph: ; preds = %for.cond4.preheader %1 = load i32, ptr @L, align 4 %.fr = freeze i32 %1 %cmp23.i = icmp sgt i32 %.fr, 0 %wide.trip.count.i = zext i32 %.fr to i64 br i1 %cmp23.i, label %for.body6.us.us.preheader, label %for.body48.preheader for.body6.us.us.preheader: ; preds = %for.body6.lr.ph %2 = add nuw i32 %30, 1 %wide.trip.count140 = zext i32 %30 to i64 %wide.trip.count135 = zext i32 %2 to i64 %3 = getelementptr i8, ptr @str, i64 %wide.trip.count.i %4 = getelementptr i8, ptr %3, i64 101 %5 = getelementptr i8, ptr @str, i64 %wide.trip.count.i %6 = getelementptr i8, ptr %5, i64 202 %min.iters.check = icmp ult i32 %.fr, 8 %min.iters.check156 = icmp ult i32 %.fr, 32 %n.vec = and i64 %wide.trip.count.i, 4294967264 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i %n.vec.remaining = and i64 %wide.trip.count.i, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 %n.vec161 = and i64 %wide.trip.count.i, 4294967288 %cmp.n162 = icmp eq i64 %n.vec161, %wide.trip.count.i %xtraiter = and i64 %wide.trip.count.i, 1 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 %7 = sub nsw i64 0, %wide.trip.count.i br label %for.body9.lr.ph.us.us for.cond4.loopexit.us.us: ; preds = %for.inc40.us.us.us.us %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond141.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count140 %indvar.next = add i64 %indvar, 1 br i1 %exitcond141.not, label %for.cond46.preheader, label %for.body9.lr.ph.us.us, !llvm.loop !12 for.body9.lr.ph.us.us: ; preds = %for.cond4.loopexit.us.us, %for.body6.us.us.preheader %indvar = phi i64 [ %indvar.next, %for.cond4.loopexit.us.us ], [ 0, %for.body6.us.us.preheader ] %indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.cond4.loopexit.us.us ], [ 1, %for.body6.us.us.preheader ] %indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.cond4.loopexit.us.us ], [ 2, %for.body6.us.us.preheader ] %8 = mul nuw nsw i64 %indvar, 101 %gep = getelementptr i8, ptr getelementptr (i8, ptr @str, i64 101), i64 %8 %scevgep151 = getelementptr i8, ptr %4, i64 %8 %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1 %arrayidx11.us.us = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137 %gep168 = getelementptr i8, ptr getelementptr (i8, ptr @str, i64 202), i64 %8 %9 = getelementptr i8, ptr %6, i64 %8 br label %for.body9.us.us.us.us for.body9.us.us.us.us: ; preds = %for.inc40.us.us.us.us, %for.body9.lr.ph.us.us %indvar152 = phi i64 [ %indvar.next153, %for.inc40.us.us.us.us ], [ 0, %for.body9.lr.ph.us.us ] %indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.inc40.us.us.us.us ], [ %indvars.iv130, %for.body9.lr.ph.us.us ] %10 = mul i64 %indvar152, 101 %scevgep154 = getelementptr i8, ptr %gep168, i64 %10 %scevgep155 = getelementptr i8, ptr %9, i64 %10 %arrayidx14.us.us.us.us = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132 br label %for.body.i.us.us.us.us for.body.i.us.us.us.us: ; preds = %if.else.i.us.us.us.us, %for.body9.us.us.us.us %indvars.iv.i.us.us.us.us = phi i64 [ 0, %for.body9.us.us.us.us ], [ %indvars.iv.next.i.us.us.us.us, %if.else.i.us.us.us.us ] %arrayidx.i.us.us.us.us = getelementptr inbounds i8, ptr %arrayidx11.us.us, i64 %indvars.iv.i.us.us.us.us %11 = load i8, ptr %arrayidx.i.us.us.us.us, align 1, !tbaa !9 %arrayidx2.i.us.us.us.us = getelementptr inbounds i8, ptr %arrayidx14.us.us.us.us, i64 %indvars.iv.i.us.us.us.us %12 = load i8, ptr %arrayidx2.i.us.us.us.us, align 1, !tbaa !9 %cmp4.i.us.us.us.us = icmp sgt i8 %11, %12 br i1 %cmp4.i.us.us.us.us, label %iter.check, label %if.else.i.us.us.us.us iter.check: ; preds = %for.body.i.us.us.us.us br i1 %min.iters.check, label %for.body20.us.us.us.us.preheader, label %vector.memcheck vector.memcheck: ; preds = %iter.check %bound0 = icmp ult ptr %gep, %scevgep155 %bound1 = icmp ult ptr %scevgep154, %scevgep151 %found.conflict = and i1 %bound0, %bound1 br i1 %found.conflict, label %for.body20.us.us.us.us.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.memcheck br i1 %min.iters.check156, label %vec.epilog.ph, label %vector.body vector.body: ; preds = %vector.main.loop.iter.check, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ] %13 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137, i64 %index %wide.load = load <16 x i8>, ptr %13, align 1, !tbaa !9, !alias.scope !13, !noalias !16 %14 = getelementptr inbounds i8, ptr %13, i64 16 %wide.load157 = load <16 x i8>, ptr %14, align 1, !tbaa !9, !alias.scope !13, !noalias !16 %15 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132, i64 %index %wide.load158 = load <16 x i8>, ptr %15, align 1, !tbaa !9, !alias.scope !16 %16 = getelementptr inbounds i8, ptr %15, i64 16 %wide.load159 = load <16 x i8>, ptr %16, align 1, !tbaa !9, !alias.scope !16 store <16 x i8> %wide.load158, ptr %13, align 1, !tbaa !9, !alias.scope !13, !noalias !16 store <16 x i8> %wide.load159, ptr %14, align 1, !tbaa !9, !alias.scope !13, !noalias !16 store <16 x i8> %wide.load, ptr %15, align 1, !tbaa !9, !alias.scope !16 store <16 x i8> %wide.load157, ptr %16, align 1, !tbaa !9, !alias.scope !16 %index.next = add nuw i64 %index, 32 %17 = icmp eq i64 %index.next, %n.vec br i1 %17, label %middle.block, label %vector.body, !llvm.loop !18 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.inc40.us.us.us.us, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block br i1 %min.epilog.iters.check, label %for.body20.us.us.us.us.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index163 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next166, %vec.epilog.vector.body ] %18 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137, i64 %index163 %wide.load164 = load <8 x i8>, ptr %18, align 1, !tbaa !9, !alias.scope !21, !noalias !24 %19 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132, i64 %index163 %wide.load165 = load <8 x i8>, ptr %19, align 1, !tbaa !9, !alias.scope !24 store <8 x i8> %wide.load165, ptr %18, align 1, !tbaa !9, !alias.scope !21, !noalias !24 store <8 x i8> %wide.load164, ptr %19, align 1, !tbaa !9, !alias.scope !24 %index.next166 = add nuw i64 %index163, 8 %20 = icmp eq i64 %index.next166, %n.vec161 br i1 %20, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !26 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body br i1 %cmp.n162, label %for.inc40.us.us.us.us, label %for.body20.us.us.us.us.preheader for.body20.us.us.us.us.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv127.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec161, %vec.epilog.middle.block ] br i1 %lcmp.mod.not, label %for.body20.us.us.us.us.prol.loopexit, label %for.body20.us.us.us.us.prol for.body20.us.us.us.us.prol: ; preds = %for.body20.us.us.us.us.preheader %arrayidx24.us.us.us.us.prol = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137, i64 %indvars.iv127.ph %21 = load i8, ptr %arrayidx24.us.us.us.us.prol, align 1, !tbaa !9 %arrayidx28.us.us.us.us.prol = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132, i64 %indvars.iv127.ph %22 = load i8, ptr %arrayidx28.us.us.us.us.prol, align 1, !tbaa !9 store i8 %22, ptr %arrayidx24.us.us.us.us.prol, align 1, !tbaa !9 store i8 %21, ptr %arrayidx28.us.us.us.us.prol, align 1, !tbaa !9 %indvars.iv.next128.prol = or i64 %indvars.iv127.ph, 1 br label %for.body20.us.us.us.us.prol.loopexit for.body20.us.us.us.us.prol.loopexit: ; preds = %for.body20.us.us.us.us.prol, %for.body20.us.us.us.us.preheader %indvars.iv127.unr = phi i64 [ %indvars.iv127.ph, %for.body20.us.us.us.us.preheader ], [ %indvars.iv.next128.prol, %for.body20.us.us.us.us.prol ] %23 = xor i64 %indvars.iv127.ph, %7 %24 = icmp eq i64 %23, -1 br i1 %24, label %for.inc40.us.us.us.us, label %for.body20.us.us.us.us if.else.i.us.us.us.us: ; preds = %for.body.i.us.us.us.us %cmp12.i.us.us.us.us = icmp slt i8 %11, %12 %indvars.iv.next.i.us.us.us.us = add nuw nsw i64 %indvars.iv.i.us.us.us.us, 1 %exitcond.not.i.us.us.us.us = icmp eq i64 %indvars.iv.next.i.us.us.us.us, %wide.trip.count.i %or.cond.i.us.us.us.us = select i1 %cmp12.i.us.us.us.us, i1 true, i1 %exitcond.not.i.us.us.us.us br i1 %or.cond.i.us.us.us.us, label %for.inc40.us.us.us.us, label %for.body.i.us.us.us.us, !llvm.loop !10 for.inc40.us.us.us.us: ; preds = %if.else.i.us.us.us.us, %for.body20.us.us.us.us.prol.loopexit, %for.body20.us.us.us.us, %middle.block, %vec.epilog.middle.block %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1 %exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135 %indvar.next153 = add i64 %indvar152, 1 br i1 %exitcond136.not, label %for.cond4.loopexit.us.us, label %for.body9.us.us.us.us, !llvm.loop !27 for.body20.us.us.us.us: ; preds = %for.body20.us.us.us.us.prol.loopexit, %for.body20.us.us.us.us %indvars.iv127 = phi i64 [ %indvars.iv.next128.1, %for.body20.us.us.us.us ], [ %indvars.iv127.unr, %for.body20.us.us.us.us.prol.loopexit ] %arrayidx24.us.us.us.us = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137, i64 %indvars.iv127 %25 = load i8, ptr %arrayidx24.us.us.us.us, align 1, !tbaa !9 %arrayidx28.us.us.us.us = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132, i64 %indvars.iv127 %26 = load i8, ptr %arrayidx28.us.us.us.us, align 1, !tbaa !9 store i8 %26, ptr %arrayidx24.us.us.us.us, align 1, !tbaa !9 store i8 %25, ptr %arrayidx28.us.us.us.us, align 1, !tbaa !9 %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %arrayidx24.us.us.us.us.1 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv137, i64 %indvars.iv.next128 %27 = load i8, ptr %arrayidx24.us.us.us.us.1, align 1, !tbaa !9 %arrayidx28.us.us.us.us.1 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv132, i64 %indvars.iv.next128 %28 = load i8, ptr %arrayidx28.us.us.us.us.1, align 1, !tbaa !9 store i8 %28, ptr %arrayidx24.us.us.us.us.1, align 1, !tbaa !9 store i8 %27, ptr %arrayidx28.us.us.us.us.1, align 1, !tbaa !9 %indvars.iv.next128.1 = add nuw nsw i64 %indvars.iv127, 2 %exitcond.not.1 = icmp eq i64 %indvars.iv.next128.1, %wide.trip.count.i br i1 %exitcond.not.1, label %for.inc40.us.us.us.us, label %for.body20.us.us.us.us, !llvm.loop !28 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %arrayidx3 = getelementptr inbounds [101 x i32], ptr @strOrder, i64 0, i64 %indvars.iv %29 = trunc i64 %indvars.iv to i32 store i32 %29, ptr %arrayidx3, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %30 = load i32, ptr @N, align 4, !tbaa !5 %31 = sext i32 %30 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %31 br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !29 for.cond46.preheader: ; preds = %for.cond4.loopexit.us.us, %for.cond4.preheader %cmp47.not110 = icmp slt i32 %30, 1 br i1 %cmp47.not110, label %for.end55, label %for.body48.preheader for.body48.preheader: ; preds = %for.body6.lr.ph, %for.cond46.preheader br label %for.body48 for.body48: ; preds = %for.body48.preheader, %for.body48 %indvars.iv142 = phi i64 [ %indvars.iv.next143, %for.body48 ], [ 1, %for.body48.preheader ] %arrayidx50 = getelementptr inbounds [101 x [101 x i8]], ptr @str, i64 0, i64 %indvars.iv142 %call52 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx50) %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1 %32 = load i32, ptr @N, align 4, !tbaa !5 %33 = sext i32 %32 to i64 %cmp47.not.not = icmp slt i64 %indvars.iv142, %33 br i1 %cmp47.not.not, label %for.body48, label %for.end55, !llvm.loop !30 for.end55: ; preds = %for.body48, %entry, %for.cond46.preheader 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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = !{!14} !14 = distinct !{!14, !15} !15 = distinct !{!15, !"LVerDomain"} !16 = !{!17} !17 = distinct !{!17, !15} !18 = distinct !{!18, !11, !19, !20} !19 = !{!"llvm.loop.isvectorized", i32 1} !20 = !{!"llvm.loop.unroll.runtime.disable"} !21 = !{!22} !22 = distinct !{!22, !23} !23 = distinct !{!23, !"LVerDomain"} !24 = !{!25} !25 = distinct !{!25, !23} !26 = distinct !{!26, !11, !19, !20} !27 = distinct !{!27, !11} !28 = distinct !{!28, !11, !19} !29 = distinct !{!29, !11} !30 = distinct !{!30, !11}
#include<stdio.h> #include<string.h> int main(){ int t; scanf("%d",&t); while(t--){ char c[51]; scanf("%s",c); int l=strlen(c); int counte=0,countn=0; for(int i=0;i<l;i++){ if(c[i]=='N') countn++; else counte++; } if((countn==1)&&(counte>0)) printf("NO\n"); else printf("YES\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28547/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28547/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @str = 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 %c = alloca [51 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec29 = add nsw i32 %0, -1 store i32 %dec29, ptr %t, align 4, !tbaa !5 %tobool.not30 = icmp eq i32 %0, 0 br i1 %tobool.not30, label %while.end, label %while.body while.body: ; preds = %entry, %if.end18 call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %c) #6 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c) %call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %c) #7 %conv = trunc i64 %call3 to i32 %cmp24 = icmp sgt i32 %conv, 0 br i1 %cmp24, label %for.body.preheader, label %if.else16 for.body.preheader: ; preds = %while.body %wide.trip.count = and i64 %call3, 4294967295 %min.iters.check = icmp ult i64 %wide.trip.count, 8 br i1 %min.iters.check, label %for.body.preheader43, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.mod.vf = and i64 %call3, 7 %n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ] %vec.phi37 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %vec.phi38 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ] %vec.phi39 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %1 = getelementptr inbounds [51 x i8], ptr %c, i64 0, i64 %index %wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9 %2 = getelementptr inbounds i8, ptr %1, i64 4 %wide.load40 = load <4 x i8>, ptr %2, align 4, !tbaa !9 %3 = icmp ne <4 x i8> %wide.load, <i8 78, i8 78, i8 78, i8 78> %4 = icmp ne <4 x i8> %wide.load40, <i8 78, i8 78, i8 78, i8 78> %5 = zext <4 x i1> %3 to <4 x i32> %6 = zext <4 x i1> %4 to <4 x i32> %7 = add <4 x i32> %vec.phi38, %5 %8 = add <4 x i32> %vec.phi39, %6 %9 = xor <4 x i1> %3, <i1 true, i1 true, i1 true, i1 true> %10 = xor <4 x i1> %4, <i1 true, i1 true, i1 true, i1 true> %11 = zext <4 x i1> %9 to <4 x i32> %12 = zext <4 x i1> %10 to <4 x i32> %13 = add <4 x i32> %vec.phi, %11 %14 = add <4 x i32> %vec.phi37, %12 %index.next = add nuw i64 %index, 8 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10 middle.block: ; preds = %vector.body %bin.rdx41 = add <4 x i32> %8, %7 %16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx41) %bin.rdx = add <4 x i32> %14, %13 %17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.mod.vf, 0 br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader43 for.body.preheader43: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] %countn.026.ph = phi i32 [ 0, %for.body.preheader ], [ %17, %middle.block ] %counte.025.ph = phi i32 [ 0, %for.body.preheader ], [ %16, %middle.block ] br label %for.body for.cond.cleanup: ; preds = %for.body, %middle.block %counte.1.lcssa = phi i32 [ %16, %middle.block ], [ %counte.1, %for.body ] %countn.1.lcssa = phi i32 [ %17, %middle.block ], [ %countn.1, %for.body ] %cmp10 = icmp eq i32 %countn.1.lcssa, 1 %cmp12 = icmp ne i32 %counte.1.lcssa, 0 %or.cond = select i1 %cmp10, i1 %cmp12, i1 false br i1 %or.cond, label %if.end18, label %if.else16 for.body: ; preds = %for.body.preheader43, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader43 ] %countn.026 = phi i32 [ %countn.1, %for.body ], [ %countn.026.ph, %for.body.preheader43 ] %counte.025 = phi i32 [ %counte.1, %for.body ], [ %counte.025.ph, %for.body.preheader43 ] %arrayidx = getelementptr inbounds [51 x i8], ptr %c, i64 0, i64 %indvars.iv %18 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp6 = icmp ne i8 %18, 78 %inc8 = zext i1 %cmp6 to i32 %counte.1 = add nuw nsw i32 %counte.025, %inc8 %not.cmp6 = xor i1 %cmp6, true %inc = zext i1 %not.cmp6 to i32 %countn.1 = add nuw nsw i32 %countn.026, %inc %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 !14 if.else16: ; preds = %while.body, %for.cond.cleanup br label %if.end18 if.end18: ; preds = %for.cond.cleanup, %if.else16 %str.sink = phi ptr [ @str, %if.else16 ], [ @str.4, %for.cond.cleanup ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %c) #6 %19 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %19, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %19, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15 while.end: ; preds = %if.end18, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11, !12, !13} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !11, !13, !12} !15 = distinct !{!15, !11}
#include <string.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #define REP(a) for(i = 0; i < a; i++) int main(void) { int a,l,i,j; scanf("%d%d",&a,&l); char s[a+1][l+1],d[l]; REP(a) { scanf("%s",s[i]); } REP(a) { for(j=1;j<a;j++){ if(strcmp(s[j-1], s[j])>0){ strcpy(d, s[j-1]); strcpy(s[j-1], s[j]); strcpy(s[j], d); } } } REP(a) { printf("%s",s[i]); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285534/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285534/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %l = 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 %l) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %l) %0 = load i32, ptr %a, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = load i32, ptr %l, align 4, !tbaa !5 %add1 = add nsw i32 %2, 1 %3 = zext i32 %add1 to i64 %4 = call ptr @llvm.stacksave.p0() %5 = mul nuw i64 %3, %1 %vla = alloca i8, i64 %5, align 16 %6 = load i32, ptr %l, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %vla2 = alloca i8, i64 %7, align 16 %8 = load i32, ptr %a, align 4, !tbaa !5 %cmp59 = icmp sgt i32 %8, 0 br i1 %cmp59, label %for.body, label %for.end43 for.cond4.preheader: ; preds = %for.body %cmp563 = icmp sgt i32 %13, 0 br i1 %cmp563, label %for.cond7.preheader.lr.ph, label %for.end43 for.cond7.preheader.lr.ph: ; preds = %for.cond4.preheader %cmp861.not = icmp eq i32 %13, 1 br i1 %cmp861.not, label %for.body37.preheader, label %for.cond7.preheader.us.preheader for.cond7.preheader.us.preheader: ; preds = %for.cond7.preheader.lr.ph %wide.trip.count = zext i32 %13 to i64 br label %for.cond7.preheader.us for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.inc32_crit_edge.us %i.164.us = phi i32 [ %inc33.us, %for.cond7.for.inc32_crit_edge.us ], [ 0, %for.cond7.preheader.us.preheader ] br label %for.body9.us for.body9.us: ; preds = %for.cond7.preheader.us, %for.inc29.us %indvars.iv70 = phi i64 [ 1, %for.cond7.preheader.us ], [ %indvars.iv.next71, %for.inc29.us ] %9 = add nsw i64 %indvars.iv70, -1 %10 = mul nuw nsw i64 %9, %3 %arrayidx11.us = getelementptr inbounds i8, ptr %vla, i64 %10 %11 = mul nuw nsw i64 %indvars.iv70, %3 %arrayidx13.us = getelementptr inbounds i8, ptr %vla, i64 %11 %call14.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx11.us, ptr noundef nonnull dereferenceable(1) %arrayidx13.us) #8 %cmp15.us = icmp sgt i32 %call14.us, 0 br i1 %cmp15.us, label %if.then.us, label %for.inc29.us if.then.us: ; preds = %for.body9.us %call19.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %vla2, ptr noundef nonnull dereferenceable(1) %arrayidx11.us) #7 %call25.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11.us, ptr noundef nonnull dereferenceable(1) %arrayidx13.us) #7 %call28.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx13.us, ptr noundef nonnull dereferenceable(1) %vla2) #7 br label %for.inc29.us for.inc29.us: ; preds = %if.then.us, %for.body9.us %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1 %exitcond.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count br i1 %exitcond.not, label %for.cond7.for.inc32_crit_edge.us, label %for.body9.us, !llvm.loop !9 for.cond7.for.inc32_crit_edge.us: ; preds = %for.inc29.us %inc33.us = add nuw nsw i32 %i.164.us, 1 %exitcond74.not = icmp eq i32 %inc33.us, %13 br i1 %exitcond74.not, label %for.cond35.preheader, label %for.cond7.preheader.us, !llvm.loop !11 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %12 = mul nuw nsw i64 %indvars.iv, %3 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %12 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %13 = load i32, ptr %a, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp = icmp slt i64 %indvars.iv.next, %14 br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12 for.cond35.preheader: ; preds = %for.cond7.for.inc32_crit_edge.us br i1 %cmp563, label %for.body37.preheader, label %for.end43 for.body37.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond35.preheader br label %for.body37 for.body37: ; preds = %for.body37.preheader, %for.body37 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body37 ], [ 0, %for.body37.preheader ] %15 = mul nuw nsw i64 %indvars.iv75, %3 %arrayidx39 = getelementptr inbounds i8, ptr %vla, i64 %15 %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx39) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %16 = load i32, ptr %a, align 4, !tbaa !5 %17 = sext i32 %16 to i64 %cmp36 = icmp slt i64 %indvars.iv.next76, %17 br i1 %cmp36, label %for.body37, label %for.end43, !llvm.loop !13 for.end43: ; preds = %for.body37, %entry, %for.cond4.preheader, %for.cond35.preheader %putchar = call i32 @putchar(i32 10) call void @llvm.stackrestore.p0(ptr %4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5 ; 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind } attributes #7 = { nounwind } attributes #8 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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}
//set many funcs template //Ver.20190820 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #include<assert.h> #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int min(int a,int b){if(a<b){return a;}return b;} int zt(int a,int b){return max(a,b)-min(a,b);} int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} int nHr(int a,int b){return nCr(a+b-1,b);} int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} int sankaku(int x){return ((1+x)*x)/2;} void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;} long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;} double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;} void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;} int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);} int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);} int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} void shuffledget(int x[],int n){ int i,b[524288],p,c; for(i=0;i<n;i++){ b[i]=i; } for(i=n;i>=1;i--){ p=rand()%i; c=b[i-1];b[i-1]=b[p];b[p]=c; } for(i=0;i<n;i++){ scanf("%d",&x[b[i]]); } } int dx4[4]={1,-1,0,0}; int dy4[4]={0,0,1,-1}; int dx8[8]={-1,-1,-1,0,0,1,1,1}; int dy8[8]={-1,0,1,-1,1,-1,0,1}; int search(int x,int a[],int n){ int st=0,fi=n-1,te; while(st<=fi){ te=(st+fi)/2; if(a[te]<x){st=te+1;}else{fi=te-1;} } return st; } void prarr(int arr[],int n){ int i; for(i=0;i<n;i++){ if(i){printf(" ");} printf("%d",arr[i]); } printf("\n"); return; } void getperm(int a[],int n){ int i,p; for(i=0;i<n;i++){ a[i]=i; } for(i=n-1;i>=1;i--){ p=rand()%(i+1); swap(&a[p],&a[i]); } } typedef struct{ int val; int node; }sd; int sdsortfnc(const void *a,const void *b){ if(((sd*)a)->val < ((sd*)b)->val){return -1;} if(((sd*)a)->val > ((sd*)b)->val){return 1;} return 0; } void coordinate_comp(int a[],int n){ int i,c=0; sd dat[524288]; for(i=0;i<n;i++){ dat[i].val=a[i]; dat[i].node=i; } qsort(dat,n,sizeof(dat[0]),sdsortfnc); a[dat[0].node]=c; for(i=1;i<n;i++){ if(dat[i-1].val!=dat[i].val){c++;} a[dat[i].node]=c; } } int main(void){ int i,j,n,m,k,c,h,w,r=0,l,t,d; int a,b,na,nb; char s[1048576]; scanf("%s",&s[1]); s[0]='0'; l=strlen(s); a=inf;b=0; for(i=l-1;i>=0;i--){ d=(s[i]-'0'); na=inf;nb=inf; for(j=0;j<=9;j++){ if(j<d){na=min(b+j+(10+j-d),na);} else{nb=min(b+j+(j-d),nb);} } for(j=0;j<=9;j++){ if(j<=d){na=min(a+j+(10+(j-1)-d),na);} else{nb=min(a+j+((j-1)-d),nb);} } a=na;b=nb; } printf("%d\n",min(a,b)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285585/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285585/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.sd = type { i32, i32 } @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16 @dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16 @dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16 @dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16 @.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %sub5 = sub nsw i32 %a, %b %sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true) ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i32 %a, %b %mul = shl nsw i32 %rem, 1 %cmp.not = icmp sge i32 %mul, %b %div1 = sdiv i32 %a, %b %add = zext i1 %cmp.not to i32 %retval.0 = add nsw i32 %div1, %add ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i32 %a, %b %cmp = icmp ne i32 %rem, 0 %div = sdiv i32 %a, %b %add = zext i1 %cmp to i32 %retval.0 = add nsw i32 %div, %add ret i32 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4 = icmp eq i32 %b, 0 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ] %b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ] %rem = srem i32 %a.addr.06, %b.addr.05 %cmp.not = icmp eq i32 %rem, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %entry %a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ] ret i32 %a.addr.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4.i = icmp eq i32 %b, 0 br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i while.body.i: ; preds = %entry, %while.body.i %a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ] %b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ] %rem.i = srem i32 %a.addr.06.i, %b.addr.05.i %cmp.not.i = icmp eq i32 %rem.i, 0 br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5 gcd.exit: ; preds = %while.body.i, %entry %a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ] %div = sdiv i32 %a, %a.addr.0.lcssa.i %mul = mul nsw i32 %div, %b ret i32 %mul } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not6 = icmp slt i32 %b, 1 br i1 %cmp.not6, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %add = add nsw i32 %a, 1 %xtraiter = and i32 %b, 1 %0 = icmp eq i32 %b, 1 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i32 %b, -2 br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph.new %r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ] %i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ] %niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %sub = sub i32 %add, %i.07 %mul = mul nsw i32 %r.08, %sub %div = sdiv i32 %mul, %i.07 %inc = add nuw i32 %i.07, 1 %sub.1 = sub i32 %add, %inc %mul.1 = mul nsw i32 %div, %sub.1 %div.1 = sdiv i32 %mul.1, %inc %inc.1 = add nuw i32 %i.07, 2 %niter.next.1 = add i32 %niter, 2 %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ] %r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ] %i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %sub.epil = sub i32 %add, %i.07.unr %mul.epil = mul nsw i32 %r.08.unr, %sub.epil %div.epil = sdiv i32 %mul.epil, %i.07.unr br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %add = add nsw i32 %b, %a %cmp.not6.i = icmp slt i32 %b, 1 br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %entry %xtraiter = and i32 %b, 1 %0 = icmp eq i32 %b, 1 br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new for.body.i.preheader.new: ; preds = %for.body.i.preheader %unroll_iter = and i32 %b, -2 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new %r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ] %i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ] %niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ] %sub.i = sub i32 %add, %i.07.i %mul.i = mul nsw i32 %sub.i, %r.08.i %div.i = sdiv i32 %mul.i, %i.07.i %inc.i = add nuw i32 %i.07.i, 1 %sub.i.1 = sub i32 %add, %inc.i %mul.i.1 = mul nsw i32 %sub.i.1, %div.i %div.i.1 = sdiv i32 %mul.i.1, %inc.i %inc.i.1 = add nuw i32 %i.07.i, 2 %niter.next.1 = add i32 %niter, 2 %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7 nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader %div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa %sub.i.epil = sub i32 %add, %i.07.i.unr %mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr %div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr br label %nCr.exit nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry %r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ] ret i32 %r.0.lcssa.i } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 { entry: %cmp.not4 = icmp slt i32 %a, 1 br i1 %cmp.not4, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %a, 8 br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %a, -8 %ind.end = or i32 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ] %vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = mul <4 x i32> %vec.phi, %vec.ind %1 = mul <4 x i32> %vec.phi7, %step.add %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i32 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %1, %0 %3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %n.vec, %a br i1 %cmp.n, label %for.end, label %for.body.preheader9 for.body.preheader9: ; preds = %for.body.preheader, %middle.block %r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ] %i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader9, %for.body %r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ] %i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ] %mul = mul nsw i32 %r.06, %i.05 %inc = add nuw i32 %i.05, 1 %exitcond.not = icmp eq i32 %i.05, %a br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11 for.end: ; preds = %for.body, %middle.block, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 { entry: %cmp.not3 = icmp slt i32 %b, 1 br i1 %cmp.not3, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %b, 8 br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %b, -8 %ind.end = or i32 %n.vec, 1 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ] %vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ] %0 = mul <4 x i32> %vec.phi, %broadcast.splat %1 = mul <4 x i32> %vec.phi6, %broadcast.splat %index.next = add nuw i32 %index, 8 %2 = icmp eq i32 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %1, %0 %3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %n.vec, %b br i1 %cmp.n, label %for.end, label %for.body.preheader7 for.body.preheader7: ; preds = %for.body.preheader, %middle.block %r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ] %i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader7, %for.body %r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ] %i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ] %mul = mul nsw i32 %r.05, %a %inc = add nuw i32 %i.04, 1 %exitcond.not = icmp eq i32 %i.04, %b br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block, %entry %r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 { entry: %tobool.not4 = icmp eq i32 %x, 0 br i1 %tobool.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ] %x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ] %rem = srem i32 %x.addr.05, 10 %add = add nsw i32 %r.06, %rem %div = sdiv i32 %x.addr.05, 10 %x.addr.05.off = add i32 %x.addr.05, 9 %tobool.not = icmp ult i32 %x.addr.05.off, 19 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ] ret i32 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 { entry: %tobool.not5 = icmp eq i32 %x, 0 br i1 %tobool.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ] %x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ] %rem = srem i32 %x.addr.06, %b %add = add nsw i32 %rem, %r.07 %div = sdiv i32 %x.addr.06, %b %tobool.not = icmp eq i32 %div, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ] ret i32 %r.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 { entry: %add = add nsw i32 %x, 1 %mul = mul nsw i32 %add, %x %div = sdiv i32 %mul, 2 ret i32 %div } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 store i32 %1, ptr %a, align 4, !tbaa !16 store i32 %0, ptr %b, align 4, !tbaa !16 ret void } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %sub5 = sub nsw i64 %a, %b %sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true) ret i64 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i64 %a, %b %mul = shl nsw i64 %rem, 1 %cmp.not = icmp sge i64 %mul, %b %div1 = sdiv i64 %a, %b %add = zext i1 %cmp.not to i64 %retval.0 = add nsw i64 %div1, %add ret i64 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: %rem = srem i64 %a, %b %cmp = icmp ne i64 %rem, 0 %div = sdiv i64 %a, %b %add = zext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %add ret i64 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4 = icmp eq i64 %b, 0 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ] %b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ] %rem = srem i64 %a.addr.06, %b.addr.05 %cmp.not = icmp eq i64 %rem, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !20 while.end: ; preds = %while.body, %entry %a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ] ret i64 %a.addr.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not4.i = icmp eq i64 %b, 0 br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i while.body.i: ; preds = %entry, %while.body.i %a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ] %b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ] %rem.i = srem i64 %a.addr.06.i, %b.addr.05.i %cmp.not.i = icmp eq i64 %rem.i, 0 br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !20 llgcd.exit: ; preds = %while.body.i, %entry %a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ] %div = sdiv i64 %a, %a.addr.0.lcssa.i %mul = mul nsw i64 %div, %b ret i64 %mul } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not6 = icmp slt i64 %b, 1 br i1 %cmp.not6, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %add = add nsw i64 %a, 1 %xtraiter = and i64 %b, 1 %0 = icmp eq i64 %b, 1 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %b, -2 br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph.new %r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ] %i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %sub = sub i64 %add, %i.07 %mul = mul nsw i64 %r.08, %sub %div = sdiv i64 %mul, %i.07 %inc = add nuw i64 %i.07, 1 %sub.1 = sub i64 %add, %inc %mul.1 = mul nsw i64 %div, %sub.1 %div.1 = sdiv i64 %mul.1, %inc %inc.1 = add nuw i64 %i.07, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ] %r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ] %i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %sub.epil = sub i64 %add, %i.07.unr %mul.epil = mul nsw i64 %r.08.unr, %sub.epil %div.epil = sdiv i64 %mul.epil, %i.07.unr br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %add = add nsw i64 %b, %a %cmp.not6.i = icmp slt i64 %b, 1 br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %entry %xtraiter = and i64 %b, 1 %0 = icmp eq i64 %b, 1 br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new for.body.i.preheader.new: ; preds = %for.body.i.preheader %unroll_iter = and i64 %b, -2 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new %r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ] %i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ] %sub.i = sub i64 %add, %i.07.i %mul.i = mul nsw i64 %sub.i, %r.08.i %div.i = sdiv i64 %mul.i, %i.07.i %inc.i = add nuw i64 %i.07.i, 1 %sub.i.1 = sub i64 %add, %inc.i %mul.i.1 = mul nsw i64 %sub.i.1, %div.i %div.i.1 = sdiv i64 %mul.i.1, %inc.i %inc.i.1 = add nuw i64 %i.07.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21 llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader %div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ] %i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa %sub.i.epil = sub i64 %add, %i.07.i.unr %mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr %div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr br label %llnCr.exit llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry %r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ] ret i64 %r.0.lcssa.i } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 { entry: %cmp.not4 = icmp slt i64 %a, 1 br i1 %cmp.not4, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %a, 7 %0 = icmp ult i64 %a, 8 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %a, -8 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ] %i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ] %mul = mul nsw i64 %r.06, %i.05 %inc = add nuw nsw i64 %i.05, 1 %mul.1 = mul nsw i64 %mul, %inc %inc.1 = add nuw nsw i64 %i.05, 2 %mul.2 = mul nsw i64 %mul.1, %inc.1 %inc.2 = add nuw nsw i64 %i.05, 3 %mul.3 = mul nsw i64 %mul.2, %inc.2 %inc.3 = add nuw nsw i64 %i.05, 4 %mul.4 = mul nsw i64 %mul.3, %inc.3 %inc.4 = add nuw nsw i64 %i.05, 5 %mul.5 = mul nsw i64 %mul.4, %inc.4 %inc.5 = add nuw nsw i64 %i.05, 6 %mul.6 = mul nsw i64 %mul.5, %inc.5 %inc.6 = add nuw i64 %i.05, 7 %mul.7 = mul nsw i64 %mul.6, %inc.6 %inc.7 = add nuw i64 %i.05, 8 %niter.next.7 = add i64 %niter, 8 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ] %r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ] %i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ] %i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %r.06.epil, %i.05.epil %inc.epil = add nuw i64 %i.05.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not3 = icmp slt i64 %b, 1 br i1 %cmp.not3, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %b, 7 %0 = icmp ult i64 %b, 8 br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %b, -8 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ] %mul = mul nsw i64 %r.05, %a %mul.1 = mul nsw i64 %mul, %a %mul.2 = mul nsw i64 %mul.1, %a %mul.3 = mul nsw i64 %mul.2, %a %mul.4 = mul nsw i64 %mul.3, %a %mul.5 = mul nsw i64 %mul.4, %a %mul.6 = mul nsw i64 %mul.5, %a %mul.7 = mul nsw i64 %mul.6, %a %niter.next.7 = add i64 %niter, 8 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ] %r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %r.05.epil, %a %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 { entry: %tobool.not4 = icmp eq i64 %x, 0 br i1 %tobool.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ] %x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ] %rem = srem i64 %x.addr.05, 10 %add = add nsw i64 %r.06, %rem %div = sdiv i64 %x.addr.05, 10 %x.addr.05.off = add i64 %x.addr.05, 9 %tobool.not = icmp ult i64 %x.addr.05.off, 19 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ] ret i64 %r.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 { entry: %tobool.not5 = icmp eq i64 %x, 0 br i1 %tobool.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ] %x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ] %rem = srem i64 %x.addr.06, %b %add = add nsw i64 %rem, %r.07 %div = sdiv i64 %x.addr.06, %b %tobool.not = icmp eq i64 %div, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28 while.end: ; preds = %while.body, %entry %r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ] ret i64 %r.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 { entry: %add = add nsw i64 %x, 1 %mul = mul nsw i64 %add, %x %div = sdiv i64 %mul, 2 ret i64 %div } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 store i64 %1, ptr %a, align 8, !tbaa !29 store i64 %0, ptr %b, align 8, !tbaa !29 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp = fcmp ogt double %a, %b %a.b = select i1 %cmp, double %a, double %b ret double %a.b } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp = fcmp olt double %a, %b %a.b = select i1 %cmp, double %a, double %b ret double %a.b } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 { entry: %cmp.i = fcmp ogt double %a, %b %a.b.i = select i1 %cmp.i, double %a, double %b %cmp.i4 = fcmp olt double %a, %b %a.b.i5 = select i1 %cmp.i4, double %a, double %b %sub = fsub double %a.b.i, %a.b.i5 ret double %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 store double %1, ptr %a, align 8, !tbaa !31 store double %0, ptr %b, align 8, !tbaa !31 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 store i8 %1, ptr %a, align 1, !tbaa !33 store i8 %0, ptr %b, align 1, !tbaa !33 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %cmp = icmp sgt i32 %0, %1 %cmp1 = icmp ne i32 %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %cmp = icmp slt i32 %0, %1 %cmp1 = icmp ne i32 %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 %cmp = icmp sgt i64 %0, %1 %cmp1 = icmp ne i64 %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp ne i64 %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 %cmp = fcmp ogt double %0, %1 %cmp1 = fcmp une double %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 %cmp = fcmp olt double %0, %1 %cmp1 = fcmp une double %0, %1 %. = sext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16 ret i32 %call } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp sgt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp slt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 { entry: %b = alloca [524288 x i32], align 16 call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17 %cmp40 = icmp sgt i32 %n, 0 br i1 %cmp40, label %for.body.preheader, label %for.end25 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %for.body.preheader57, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57 for.body.preheader57: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block br i1 %cmp40, label %for.body3.preheader, label %for.end25 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader57, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ] %arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv %4 = trunc i64 %indvars.iv to i32 store i32 %4, ptr %arrayidx, align 4, !tbaa !16 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !35 for.cond15.preheader: ; preds = %for.body3 br i1 %cmp40, label %for.body17.preheader, label %for.end25 for.body17.preheader: ; preds = %for.cond15.preheader %wide.trip.count54 = zext i32 %n to i64 br label %for.body17 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ] %call = tail call i32 @rand() #17 %5 = trunc i64 %indvars.iv47 to i32 %rem = srem i32 %call, %5 %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1 %idxprom4 = and i64 %indvars.iv.next48, 4294967295 %arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %idxprom6 = sext i32 %rem to i64 %arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv47, 1 br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36 for.body17: ; preds = %for.body17.preheader, %for.body17 %indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ] %arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50 %8 = load i32, ptr %arrayidx19, align 4, !tbaa !16 %idxprom20 = sext i32 %8 to i64 %arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20 %call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21) %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54 br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37 for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17 ret void } ; Function Attrs: nounwind declare i32 @rand() local_unnamed_addr #9 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 { entry: %cmp.not9 = icmp slt i32 %n, 1 br i1 %cmp.not9, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ] %fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ] %add = add nsw i32 %st.011, %fi.010 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !16 %cmp1 = icmp slt i32 %0, %x %add2 = add nsw i32 %div, 1 %sub3 = add nsw i32 %div, -1 %fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3 %st.1 = select i1 %cmp1, i32 %add2, i32 %st.011 %cmp.not = icmp sgt i32 %st.1, %fi.1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38 while.end: ; preds = %while.body, %entry %st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ] ret i32 %st.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 { entry: %cmp7 = icmp sgt i32 %n, 0 br i1 %cmp7, label %if.end.peel, label %for.end if.end.peel: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %.pre = load i32, ptr %arr, align 4, !tbaa !16 %call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %exitcond.peel.not = icmp eq i32 %n, 1 br i1 %exitcond.peel.not, label %for.end, label %if.end if.end: ; preds = %if.end.peel, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ] %putchar6 = tail call i32 @putchar(i32 32) %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv %0 = load i32, ptr %arrayidx, align 4, !tbaa !16 %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39 for.end: ; preds = %if.end, %if.end.peel, %entry %putchar = tail call i32 @putchar(i32 10) ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; Function Attrs: nounwind uwtable define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 { entry: %cmp20 = icmp sgt i32 %n, 0 br i1 %cmp20, label %for.body.preheader, label %for.end9 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %for.body.preheader30, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %0 = getelementptr inbounds i32, ptr %a, i64 %index store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30 for.body.preheader30: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block %cmp222 = icmp sgt i32 %n, 1 br i1 %cmp222, label %for.body3.preheader, label %for.end9 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader30, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %4 = trunc i64 %indvars.iv to i32 store i32 %4, ptr %arrayidx, align 4, !tbaa !16 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !42 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ] %indvars.iv.next26 = add nsw i64 %indvars.iv25, -1 %call = tail call i32 @rand() #17 %5 = trunc i64 %indvars.iv25 to i32 %rem = srem i32 %call, %5 %idxprom4 = sext i32 %rem to i64 %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4 %idxprom6 = and i64 %indvars.iv.next26, 4294967295 %arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv25, 2 br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43 for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !44 %1 = load i32, ptr %b, align 4, !tbaa !44 %cmp = icmp slt i32 %0, %1 %cmp4 = icmp sgt i32 %0, %1 %. = zext i1 %cmp4 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 { entry: %dat = alloca [524288 x %struct.sd], align 16 call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #17 %cmp46 = icmp sgt i32 %n, 0 br i1 %cmp46, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %min.iters.check = icmp ult i32 %n, 4 br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %wide.trip.count, 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> %0 = or i64 %index, 2 %1 = getelementptr inbounds i32, ptr %a, i64 %index %wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16 %2 = getelementptr inbounds i32, ptr %1, i64 2 %wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16 %3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index %4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0 %interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16 %interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16 %index.next = add nuw i64 %index, 4 %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4> %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %for.body.preheader61 for.body.preheader61: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader61, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %6 = load i32, ptr %arrayidx, align 4, !tbaa !16 %arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv store i32 %6, ptr %arrayidx2, align 8, !tbaa !44 %node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1 %7 = trunc i64 %indvars.iv to i32 store i32 %7, ptr %node, align 4, !tbaa !47 %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 !48 for.end: ; preds = %for.body, %middle.block, %entry %conv = sext i32 %n to i64 call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #17 %node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1 %8 = load i32, ptr %node6, align 4, !tbaa !47 %idxprom7 = sext i32 %8 to i64 %arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7 store i32 0, ptr %arrayidx8, align 4, !tbaa !16 %cmp1048 = icmp sgt i32 %n, 1 br i1 %cmp1048, label %for.body12.preheader, label %for.end29 for.body12.preheader: ; preds = %for.end %wide.trip.count56 = zext i32 %n to i64 %.pre = load i32, ptr %dat, align 16, !tbaa !44 %9 = add nsw i64 %wide.trip.count56, -1 %xtraiter = and i64 %9, 1 %10 = icmp eq i32 %n, 2 br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new for.body12.preheader.new: ; preds = %for.body12.preheader %unroll_iter = and i64 %9, -2 br label %for.body12 for.body12: ; preds = %for.body12, %for.body12.preheader.new %11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ] %indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ] %c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ] %niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ] %arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52 %12 = load i32, ptr %arrayidx17, align 8, !tbaa !44 %cmp19.not = icmp ne i32 %11, %12 %inc21 = zext i1 %cmp19.not to i32 %spec.select = add nuw nsw i32 %c.050, %inc21 %node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1 %13 = load i32, ptr %node24, align 4, !tbaa !47 %idxprom25 = sext i32 %13 to i64 %arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25 store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16 %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53 %14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44 %cmp19.not.1 = icmp ne i32 %12, %14 %inc21.1 = zext i1 %cmp19.not.1 to i32 %spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1 %node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1 %15 = load i32, ptr %node24.1, align 4, !tbaa !47 %idxprom25.1 = sext i32 %15 to i64 %arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1 store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16 %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 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.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49 for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader %.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ] %indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ] %c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa %arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr %16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44 %cmp19.not.epil = icmp ne i32 %.unr, %16 %inc21.epil = zext i1 %cmp19.not.epil to i32 %spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil %node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1 %17 = load i32, ptr %node24.epil, align 4, !tbaa !47 %idxprom25.epil = sext i32 %17 to i64 %arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16 br label %for.end29 for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #17 ret void } ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #12 { entry: %s = alloca [1048576 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1048576, ptr nonnull %s) #17 %arrayidx = getelementptr inbounds [1048576 x i8], ptr %s, i64 0, i64 1 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx) store i8 48, ptr %s, align 16, !tbaa !33 %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #16 %conv = trunc i64 %call2 to i32 %cmp90 = icmp sgt i32 %conv, 0 br i1 %cmp90, label %for.body.preheader, label %for.end45 for.body.preheader: ; preds = %entry %0 = and i64 %call2, 4294967295 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc41.9 %indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.inc41.9 ] %b.092 = phi i32 [ 0, %for.body.preheader ], [ %nb.3.9, %for.inc41.9 ] %a.091 = phi i32 [ 1072114514, %for.body.preheader ], [ %na.3.9, %for.inc41.9 ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom = and i64 %indvars.iv.next, 4294967295 %arrayidx4 = getelementptr inbounds [1048576 x i8], ptr %s, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx4, align 1, !tbaa !33 %conv5 = sext i8 %1 to i32 %reass.sub = sub i32 %b.092, %conv5 %add = add i32 %reass.sub, 58 %cmp11 = icmp sgt i8 %1, 48 br i1 %cmp11, label %for.inc, label %for.inc.thread for.inc.thread: ; preds = %for.body %add17 = add i32 %reass.sub, 48 %a.b.i76 = call i32 @llvm.smin.i32(i32 %add17, i32 1072114514) br label %for.inc.1.thread for.inc: ; preds = %for.body %a.b.i = call i32 @llvm.smin.i32(i32 %add, i32 1072114514) %cmp11.1.not = icmp eq i8 %1, 49 br i1 %cmp11.1.not, label %for.inc.1.thread, label %for.inc.1 for.inc.1.thread: ; preds = %for.inc, %for.inc.thread %nb.1100 = phi i32 [ %a.b.i76, %for.inc.thread ], [ 1072114514, %for.inc ] %na.199 = phi i32 [ 1072114514, %for.inc.thread ], [ %a.b.i, %for.inc ] %add19.1 = add i32 %reass.sub, 50 %a.b.i76.1 = call i32 @llvm.smin.i32(i32 %add19.1, i32 %nb.1100) br label %for.inc.2.thread for.inc.1: ; preds = %for.inc %add15.1 = add i32 %reass.sub, 60 %a.b.i.1 = call i32 @llvm.smin.i32(i32 %add15.1, i32 %a.b.i) %cmp11.2 = icmp ugt i8 %1, 50 br i1 %cmp11.2, label %for.inc.2, label %for.inc.2.thread for.inc.2.thread: ; preds = %for.inc.1, %for.inc.1.thread %nb.1.1105 = phi i32 [ %a.b.i76.1, %for.inc.1.thread ], [ 1072114514, %for.inc.1 ] %na.1.1104 = phi i32 [ %na.199, %for.inc.1.thread ], [ %a.b.i.1, %for.inc.1 ] %add19.2 = add i32 %reass.sub, 52 %a.b.i76.2 = call i32 @llvm.smin.i32(i32 %add19.2, i32 %nb.1.1105) br label %for.inc.3.thread for.inc.2: ; preds = %for.inc.1 %add15.2 = add i32 %reass.sub, 62 %a.b.i.2 = call i32 @llvm.smin.i32(i32 %add15.2, i32 %a.b.i.1) %cmp11.3.not = icmp eq i8 %1, 51 br i1 %cmp11.3.not, label %for.inc.3.thread, label %for.inc.3 for.inc.3.thread: ; preds = %for.inc.2, %for.inc.2.thread %nb.1.2110 = phi i32 [ %a.b.i76.2, %for.inc.2.thread ], [ 1072114514, %for.inc.2 ] %na.1.2109 = phi i32 [ %na.1.1104, %for.inc.2.thread ], [ %a.b.i.2, %for.inc.2 ] %add19.3 = add i32 %reass.sub, 54 %a.b.i76.3 = call i32 @llvm.smin.i32(i32 %add19.3, i32 %nb.1.2110) br label %for.inc.4.thread for.inc.3: ; preds = %for.inc.2 %add15.3 = add i32 %reass.sub, 64 %a.b.i.3 = call i32 @llvm.smin.i32(i32 %add15.3, i32 %a.b.i.2) %cmp11.4 = icmp ugt i8 %1, 52 br i1 %cmp11.4, label %for.inc.4, label %for.inc.4.thread for.inc.4.thread: ; preds = %for.inc.3, %for.inc.3.thread %nb.1.3115 = phi i32 [ %a.b.i76.3, %for.inc.3.thread ], [ 1072114514, %for.inc.3 ] %na.1.3114 = phi i32 [ %na.1.2109, %for.inc.3.thread ], [ %a.b.i.3, %for.inc.3 ] %add19.4 = add i32 %reass.sub, 56 %a.b.i76.4 = call i32 @llvm.smin.i32(i32 %add19.4, i32 %nb.1.3115) br label %for.inc.5.thread for.inc.4: ; preds = %for.inc.3 %add15.4 = add i32 %reass.sub, 66 %a.b.i.4 = call i32 @llvm.smin.i32(i32 %add15.4, i32 %a.b.i.3) %cmp11.5.not = icmp eq i8 %1, 53 br i1 %cmp11.5.not, label %for.inc.5.thread, label %for.inc.5 for.inc.5.thread: ; preds = %for.inc.4, %for.inc.4.thread %nb.1.4120 = phi i32 [ %a.b.i76.4, %for.inc.4.thread ], [ 1072114514, %for.inc.4 ] %na.1.4119 = phi i32 [ %na.1.3114, %for.inc.4.thread ], [ %a.b.i.4, %for.inc.4 ] %a.b.i76.5 = call i32 @llvm.smin.i32(i32 %add, i32 %nb.1.4120) br label %for.inc.6.thread for.inc.5: ; preds = %for.inc.4 %add15.5 = add i32 %reass.sub, 68 %a.b.i.5 = call i32 @llvm.smin.i32(i32 %add15.5, i32 %a.b.i.4) %cmp11.6 = icmp ugt i8 %1, 54 br i1 %cmp11.6, label %for.inc.6, label %for.inc.6.thread for.inc.6.thread: ; preds = %for.inc.5, %for.inc.5.thread %nb.1.5125 = phi i32 [ %a.b.i76.5, %for.inc.5.thread ], [ 1072114514, %for.inc.5 ] %na.1.5124 = phi i32 [ %na.1.4119, %for.inc.5.thread ], [ %a.b.i.5, %for.inc.5 ] %add19.6 = add i32 %reass.sub, 60 %a.b.i76.6 = call i32 @llvm.smin.i32(i32 %add19.6, i32 %nb.1.5125) br label %for.inc.7.thread for.inc.6: ; preds = %for.inc.5 %add15.6 = add i32 %reass.sub, 70 %a.b.i.6 = call i32 @llvm.smin.i32(i32 %add15.6, i32 %a.b.i.5) %cmp11.7.not = icmp eq i8 %1, 55 br i1 %cmp11.7.not, label %for.inc.7.thread, label %for.inc.7 for.inc.7.thread: ; preds = %for.inc.6, %for.inc.6.thread %nb.1.6130 = phi i32 [ %a.b.i76.6, %for.inc.6.thread ], [ 1072114514, %for.inc.6 ] %na.1.6129 = phi i32 [ %na.1.5124, %for.inc.6.thread ], [ %a.b.i.6, %for.inc.6 ] %add19.7 = add i32 %reass.sub, 62 %a.b.i76.7 = call i32 @llvm.smin.i32(i32 %add19.7, i32 %nb.1.6130) br label %for.inc.8.thread for.inc.7: ; preds = %for.inc.6 %add15.7 = add i32 %reass.sub, 72 %a.b.i.7 = call i32 @llvm.smin.i32(i32 %add15.7, i32 %a.b.i.6) %cmp11.8 = icmp ugt i8 %1, 56 br i1 %cmp11.8, label %for.inc.8, label %for.inc.8.thread for.inc.8.thread: ; preds = %for.inc.7, %for.inc.7.thread %nb.1.7135 = phi i32 [ %a.b.i76.7, %for.inc.7.thread ], [ 1072114514, %for.inc.7 ] %na.1.7134 = phi i32 [ %na.1.6129, %for.inc.7.thread ], [ %a.b.i.7, %for.inc.7 ] %add19.8 = add i32 %reass.sub, 64 %a.b.i76.8 = call i32 @llvm.smin.i32(i32 %add19.8, i32 %nb.1.7135) br label %for.inc.9 for.inc.8: ; preds = %for.inc.7 %add15.8 = add i32 %reass.sub, 74 %a.b.i.8 = call i32 @llvm.smin.i32(i32 %add15.8, i32 %a.b.i.7) %cmp11.9.not = icmp eq i8 %1, 57 br i1 %cmp11.9.not, label %for.inc.9, label %for.inc41.8.thread301 for.inc41.8.thread301: ; preds = %for.inc.8 %add15.9 = add i32 %reass.sub, 76 %2 = sub i32 %a.091, %conv5 %3 = insertelement <8 x i32> poison, i32 %2, i64 0 %4 = shufflevector <8 x i32> %3, <8 x i32> poison, <8 x i32> zeroinitializer %5 = add <8 x i32> %4, <i32 57, i32 59, i32 61, i32 63, i32 65, i32 67, i32 69, i32 71> %add32.8305 = add i32 %2, 73 %6 = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> %5) %7 = call i32 @llvm.smin.i32(i32 %6, i32 %add15.9) %8 = call i32 @llvm.smin.i32(i32 %add32.8305, i32 %a.b.i.8) %9 = call i32 @llvm.smin.i32(i32 %7, i32 %8) br label %if.then27.9 for.inc.9: ; preds = %for.inc.8, %for.inc.8.thread %nb.1.8140 = phi i32 [ %a.b.i76.8, %for.inc.8.thread ], [ 1072114514, %for.inc.8 ] %na.1.8139 = phi i32 [ %na.1.7134, %for.inc.8.thread ], [ %a.b.i.8, %for.inc.8 ] %add19.9 = add i32 %reass.sub, 66 %a.b.i76.9 = call i32 @llvm.smin.i32(i32 %add19.9, i32 %nb.1.8140) %10 = sub i32 %a.091, %conv5 %sub37 = add nsw i32 %a.091, 47 %add35 = sub i32 %sub37, %conv5 %cmp25.not = icmp slt i8 %1, 48 br i1 %cmp25.not, label %for.inc41.thread, label %for.inc41 for.inc41.thread: ; preds = %for.inc.9 %a.b.i78 = call i32 @llvm.smin.i32(i32 %add35, i32 %a.b.i76.9) br label %for.inc41.1.thread for.inc41: ; preds = %for.inc.9 %add28 = add i32 %10, 57 %a.b.i77 = call i32 @llvm.smin.i32(i32 %add28, i32 %na.1.8139) %cmp25.not.1 = icmp eq i8 %1, 48 br i1 %cmp25.not.1, label %for.inc41.1.thread, label %for.inc41.1 for.inc41.1.thread: ; preds = %for.inc41, %for.inc41.thread %nb.3157 = phi i32 [ %a.b.i78, %for.inc41.thread ], [ %a.b.i76.9, %for.inc41 ] %na.3156 = phi i32 [ %na.1.8139, %for.inc41.thread ], [ %a.b.i77, %for.inc41 ] %add38.1 = add i32 %add35, 2 %a.b.i78.1 = call i32 @llvm.smin.i32(i32 %add38.1, i32 %nb.3157) br label %for.inc41.2.thread for.inc41.1: ; preds = %for.inc41 %add32.1 = add i32 %10, 59 %a.b.i77.1 = call i32 @llvm.smin.i32(i32 %add32.1, i32 %a.b.i77) %cmp25.not.2 = icmp ult i8 %1, 50 br i1 %cmp25.not.2, label %for.inc41.2.thread, label %for.inc41.2 for.inc41.2.thread: ; preds = %for.inc41.1, %for.inc41.1.thread %nb.3.1175 = phi i32 [ %a.b.i78.1, %for.inc41.1.thread ], [ %a.b.i76.9, %for.inc41.1 ] %na.3.1174 = phi i32 [ %na.3156, %for.inc41.1.thread ], [ %a.b.i77.1, %for.inc41.1 ] %add38.2 = add i32 %add35, 4 %a.b.i78.2 = call i32 @llvm.smin.i32(i32 %add38.2, i32 %nb.3.1175) br label %for.inc41.3.thread for.inc41.2: ; preds = %for.inc41.1 %add32.2 = add i32 %10, 61 %a.b.i77.2 = call i32 @llvm.smin.i32(i32 %add32.2, i32 %a.b.i77.1) %cmp25.not.3 = icmp eq i8 %1, 50 br i1 %cmp25.not.3, label %for.inc41.3.thread, label %for.inc41.3 for.inc41.3.thread: ; preds = %for.inc41.2, %for.inc41.2.thread %nb.3.2193 = phi i32 [ %a.b.i78.2, %for.inc41.2.thread ], [ %a.b.i76.9, %for.inc41.2 ] %na.3.2192 = phi i32 [ %na.3.1174, %for.inc41.2.thread ], [ %a.b.i77.2, %for.inc41.2 ] %add38.3 = add i32 %add35, 6 %a.b.i78.3 = call i32 @llvm.smin.i32(i32 %add38.3, i32 %nb.3.2193) br label %for.inc41.4.thread for.inc41.3: ; preds = %for.inc41.2 %add32.3 = add i32 %10, 63 %a.b.i77.3 = call i32 @llvm.smin.i32(i32 %add32.3, i32 %a.b.i77.2) %cmp25.not.4 = icmp ult i8 %1, 52 br i1 %cmp25.not.4, label %for.inc41.4.thread, label %for.inc41.4 for.inc41.4.thread: ; preds = %for.inc41.3, %for.inc41.3.thread %nb.3.3211 = phi i32 [ %a.b.i78.3, %for.inc41.3.thread ], [ %a.b.i76.9, %for.inc41.3 ] %na.3.3210 = phi i32 [ %na.3.2192, %for.inc41.3.thread ], [ %a.b.i77.3, %for.inc41.3 ] %add38.4 = add i32 %add35, 8 %a.b.i78.4 = call i32 @llvm.smin.i32(i32 %add38.4, i32 %nb.3.3211) br label %for.inc41.5.thread for.inc41.4: ; preds = %for.inc41.3 %add32.4 = add i32 %10, 65 %a.b.i77.4 = call i32 @llvm.smin.i32(i32 %add32.4, i32 %a.b.i77.3) %cmp25.not.5 = icmp eq i8 %1, 52 br i1 %cmp25.not.5, label %for.inc41.5.thread, label %for.inc41.5 for.inc41.5.thread: ; preds = %for.inc41.4, %for.inc41.4.thread %nb.3.4229 = phi i32 [ %a.b.i78.4, %for.inc41.4.thread ], [ %a.b.i76.9, %for.inc41.4 ] %na.3.4228 = phi i32 [ %na.3.3210, %for.inc41.4.thread ], [ %a.b.i77.4, %for.inc41.4 ] %add38.5 = add i32 %add35, 10 %a.b.i78.5 = call i32 @llvm.smin.i32(i32 %add38.5, i32 %nb.3.4229) br label %for.inc41.6.thread for.inc41.5: ; preds = %for.inc41.4 %add32.5 = add i32 %10, 67 %a.b.i77.5 = call i32 @llvm.smin.i32(i32 %add32.5, i32 %a.b.i77.4) %cmp25.not.6 = icmp ult i8 %1, 54 br i1 %cmp25.not.6, label %for.inc41.6.thread, label %for.inc41.6 for.inc41.6.thread: ; preds = %for.inc41.5, %for.inc41.5.thread %nb.3.5247 = phi i32 [ %a.b.i78.5, %for.inc41.5.thread ], [ %a.b.i76.9, %for.inc41.5 ] %na.3.5246 = phi i32 [ %na.3.4228, %for.inc41.5.thread ], [ %a.b.i77.5, %for.inc41.5 ] %add38.6 = add i32 %add35, 12 %a.b.i78.6 = call i32 @llvm.smin.i32(i32 %add38.6, i32 %nb.3.5247) br label %for.inc41.7.thread for.inc41.6: ; preds = %for.inc41.5 %add32.6 = add i32 %10, 69 %a.b.i77.6 = call i32 @llvm.smin.i32(i32 %add32.6, i32 %a.b.i77.5) %cmp25.not.7 = icmp eq i8 %1, 54 br i1 %cmp25.not.7, label %for.inc41.7.thread, label %for.inc41.7 for.inc41.7.thread: ; preds = %for.inc41.6, %for.inc41.6.thread %nb.3.6265 = phi i32 [ %a.b.i78.6, %for.inc41.6.thread ], [ %a.b.i76.9, %for.inc41.6 ] %na.3.6264 = phi i32 [ %na.3.5246, %for.inc41.6.thread ], [ %a.b.i77.6, %for.inc41.6 ] %add38.7 = add i32 %add35, 14 %a.b.i78.7 = call i32 @llvm.smin.i32(i32 %add38.7, i32 %nb.3.6265) br label %for.inc41.8.thread for.inc41.7: ; preds = %for.inc41.6 %add32.7 = add i32 %10, 71 %a.b.i77.7 = call i32 @llvm.smin.i32(i32 %add32.7, i32 %a.b.i77.6) %cmp25.not.8 = icmp ult i8 %1, 56 br i1 %cmp25.not.8, label %for.inc41.8.thread, label %for.inc41.8 for.inc41.8.thread: ; preds = %for.inc41.7, %for.inc41.7.thread %nb.3.7283 = phi i32 [ %a.b.i78.7, %for.inc41.7.thread ], [ %a.b.i76.9, %for.inc41.7 ] %na.3.7282 = phi i32 [ %na.3.6264, %for.inc41.7.thread ], [ %a.b.i77.7, %for.inc41.7 ] %add38.8 = add i32 %add35, 16 %a.b.i78.8 = call i32 @llvm.smin.i32(i32 %add38.8, i32 %nb.3.7283) br label %if.else34.9 for.inc41.8: ; preds = %for.inc41.7 %add32.8 = add i32 %10, 73 %a.b.i77.8 = call i32 @llvm.smin.i32(i32 %add32.8, i32 %a.b.i77.7) %cmp25.not.9 = icmp eq i8 %1, 56 br i1 %cmp25.not.9, label %if.else34.9, label %if.then27.9 if.then27.9: ; preds = %for.inc41.8.thread301, %for.inc41.8 %a.b.i77.8309 = phi i32 [ %9, %for.inc41.8.thread301 ], [ %a.b.i77.8, %for.inc41.8 ] %nb.1.9147166183202219238255274291308 = phi i32 [ 1072114514, %for.inc41.8.thread301 ], [ %a.b.i76.9, %for.inc41.8 ] %11 = phi i32 [ %2, %for.inc41.8.thread301 ], [ %10, %for.inc41.8 ] %add32.9 = add i32 %11, 75 %a.b.i77.9 = call i32 @llvm.smin.i32(i32 %add32.9, i32 %a.b.i77.8309) br label %for.inc41.9 if.else34.9: ; preds = %for.inc41.8.thread, %for.inc41.8 %nb.3.8300 = phi i32 [ %a.b.i78.8, %for.inc41.8.thread ], [ %a.b.i76.9, %for.inc41.8 ] %na.3.8299 = phi i32 [ %na.3.7282, %for.inc41.8.thread ], [ %a.b.i77.8, %for.inc41.8 ] %add38.9 = add i32 %add35, 18 %a.b.i78.9 = call i32 @llvm.smin.i32(i32 %add38.9, i32 %nb.3.8300) br label %for.inc41.9 for.inc41.9: ; preds = %if.else34.9, %if.then27.9 %na.3.9 = phi i32 [ %a.b.i77.9, %if.then27.9 ], [ %na.3.8299, %if.else34.9 ] %nb.3.9 = phi i32 [ %nb.1.9147166183202219238255274291308, %if.then27.9 ], [ %a.b.i78.9, %if.else34.9 ] %cmp = icmp ugt i64 %indvars.iv, 1 br i1 %cmp, label %for.body, label %for.end45, !llvm.loop !50 for.end45: ; preds = %for.inc41.9, %entry %a.0.lcssa = phi i32 [ 1072114514, %entry ], [ %na.3.9, %for.inc41.9 ] %b.0.lcssa = phi i32 [ 0, %entry ], [ %nb.3.9, %for.inc41.9 ] %a.b.i79 = call i32 @llvm.smin.i32(i32 %a.0.lcssa, i32 %b.0.lcssa) %call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a.b.i79) call void @llvm.lifetime.end.p0(i64 1048576, ptr nonnull %s) #17 ret i32 0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v8i32(<8 x i32>) #15 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #9 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #11 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #14 = { nofree nounwind } attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #16 = { nounwind willreturn memory(read) } attributes #17 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = distinct !{!7, !6} !8 = distinct !{!8, !6, !9, !10} !9 = !{!"llvm.loop.isvectorized", i32 1} !10 = !{!"llvm.loop.unroll.runtime.disable"} !11 = distinct !{!11, !6, !10, !9} !12 = distinct !{!12, !6, !9, !10} !13 = distinct !{!13, !6, !10, !9} !14 = distinct !{!14, !6} !15 = distinct !{!15, !6} !16 = !{!17, !17, i64 0} !17 = !{!"int", !18, i64 0} !18 = !{!"omnipotent char", !19, i64 0} !19 = !{!"Simple C/C++ TBAA"} !20 = distinct !{!20, !6} !21 = distinct !{!21, !6} !22 = distinct !{!22, !6} !23 = distinct !{!23, !24} !24 = !{!"llvm.loop.unroll.disable"} !25 = distinct !{!25, !6} !26 = distinct !{!26, !24} !27 = distinct !{!27, !6} !28 = distinct !{!28, !6} !29 = !{!30, !30, i64 0} !30 = !{!"long long", !18, i64 0} !31 = !{!32, !32, i64 0} !32 = !{!"double", !18, i64 0} !33 = !{!18, !18, i64 0} !34 = distinct !{!34, !6, !9, !10} !35 = distinct !{!35, !6, !10, !9} !36 = distinct !{!36, !6} !37 = distinct !{!37, !6} !38 = distinct !{!38, !6} !39 = distinct !{!39, !6, !40} !40 = !{!"llvm.loop.peeled.count", i32 1} !41 = distinct !{!41, !6, !9, !10} !42 = distinct !{!42, !6, !10, !9} !43 = distinct !{!43, !6} !44 = !{!45, !17, i64 0} !45 = !{!"", !17, i64 0, !17, i64 4} !46 = distinct !{!46, !6, !9, !10} !47 = !{!45, !17, i64 4} !48 = distinct !{!48, !6, !10, !9} !49 = distinct !{!49, !6} !50 = distinct !{!50, !6}
#include <stdio.h> #include <stdlib.h> int value[100]; int sp = 0; void push(const int val) { value[sp++] = val; } int pop() { return value[--sp]; } void operand(const char operand) { int ch, val = operand - '0'; while( (ch = getchar()) != ' ' ){ val = val * 10 + (ch - '0'); } push(val); } void operator(const char operator) { int tmp1 = pop(), tmp2 = pop(); switch( operator ){ case '+': push(tmp2 + tmp1); break; case '-': push(tmp2 - tmp1); break; case '*': push(tmp2 * tmp1); break; default : break; } } int main() { while( 1 ){ int ch = getchar(); if( ch == ' ' || ch == '\n' ) continue; if( ch == EOF ) break; switch( ch ){ case '+': case '-': case '*': operator(ch); break; default : operand(ch); break; } } printf("%d\n", pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285642/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285642/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @sp = dso_local local_unnamed_addr global i32 0, align 4 @value = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %val) local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @sp, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom store i32 %val, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @sp, align 4, !tbaa !5 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local void @operand(i8 noundef signext %operand) local_unnamed_addr #1 { entry: %conv = sext i8 %operand to i32 %sub = add nsw i32 %conv, -48 %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i4 = tail call i32 @getc(ptr noundef %0) %cmp.not5 = icmp eq i32 %call.i4, 32 br i1 %cmp.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %call.i7 = phi i32 [ %call.i, %while.body ], [ %call.i4, %entry ] %val.06 = phi i32 [ %add, %while.body ], [ %sub, %entry ] %mul = mul nsw i32 %val.06, 10 %sub2 = add i32 %mul, -48 %add = add i32 %sub2, %call.i7 %1 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i = tail call i32 @getc(ptr noundef %1) %cmp.not = icmp eq i32 %call.i, 32 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11 while.end: ; preds = %while.body, %entry %val.0.lcssa = phi i32 [ %sub, %entry ], [ %add, %while.body ] %2 = load i32, ptr @sp, align 4, !tbaa !5 %inc.i = add nsw i32 %2, 1 store i32 %inc.i, ptr @sp, align 4, !tbaa !5 %idxprom.i = sext i32 %2 to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i store i32 %val.0.lcssa, ptr %arrayidx.i, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @operator(i8 noundef signext %operator) local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i = add nsw i32 %0, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i %1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %dec.i8 = add nsw i32 %0, -2 store i32 %dec.i8, ptr @sp, align 4, !tbaa !5 %idxprom.i9 = sext i32 %dec.i8 to i64 %arrayidx.i10 = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i9 %2 = load i32, ptr %arrayidx.i10, align 4, !tbaa !5 %conv = sext i8 %operator to i32 switch i32 %conv, label %sw.epilog [ i32 43, label %sw.bb i32 45, label %sw.bb2 i32 42, label %sw.bb3 ] sw.bb: ; preds = %entry %add = add nsw i32 %2, %1 br label %sw.epilog.sink.split sw.bb2: ; preds = %entry %sub = sub nsw i32 %2, %1 br label %sw.epilog.sink.split sw.bb3: ; preds = %entry %mul = mul nsw i32 %2, %1 br label %sw.epilog.sink.split sw.epilog.sink.split: ; preds = %sw.bb, %sw.bb2, %sw.bb3 %mul.sink = phi i32 [ %mul, %sw.bb3 ], [ %sub, %sw.bb2 ], [ %add, %sw.bb ] store i32 %dec.i, ptr @sp, align 4, !tbaa !5 store i32 %mul.sink, ptr %arrayidx.i10, align 4, !tbaa !5 br label %sw.epilog sw.epilog: ; preds = %sw.epilog.sink.split, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: br label %while.body while.body: ; preds = %while.body.backedge, %entry %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i = tail call i32 @getc(ptr noundef %0) switch i32 %call.i, label %sw.default [ i32 32, label %while.body.backedge i32 10, label %while.body.backedge i32 -1, label %while.end i32 43, label %sw.bb i32 45, label %sw.bb i32 42, label %sw.bb ] sw.bb: ; preds = %while.body, %while.body, %while.body %1 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i.i = add nsw i32 %1, -1 %idxprom.i.i = sext i32 %dec.i.i to i64 %arrayidx.i.i = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i.i %2 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5 %dec.i8.i = add nsw i32 %1, -2 store i32 %dec.i8.i, ptr @sp, align 4, !tbaa !5 %idxprom.i9.i = sext i32 %dec.i8.i to i64 %arrayidx.i10.i = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i9.i %3 = load i32, ptr %arrayidx.i10.i, align 4, !tbaa !5 %trunc = trunc i32 %call.i to i8 switch i8 %trunc, label %while.body.backedge [ i8 43, label %sw.bb.i i8 45, label %sw.bb2.i i8 42, label %sw.bb3.i ] sw.bb.i: ; preds = %sw.bb %add.i = add nsw i32 %3, %2 br label %sw.epilog.sink.split.i sw.bb2.i: ; preds = %sw.bb %sub.i = sub nsw i32 %3, %2 br label %sw.epilog.sink.split.i sw.bb3.i: ; preds = %sw.bb %mul.i = mul nsw i32 %3, %2 br label %sw.epilog.sink.split.i sw.epilog.sink.split.i: ; preds = %sw.bb3.i, %sw.bb2.i, %sw.bb.i %mul.sink.i = phi i32 [ %mul.i, %sw.bb3.i ], [ %sub.i, %sw.bb2.i ], [ %add.i, %sw.bb.i ] store i32 %dec.i.i, ptr @sp, align 4, !tbaa !5 store i32 %mul.sink.i, ptr %arrayidx.i10.i, align 4, !tbaa !5 br label %while.body.backedge while.body.backedge: ; preds = %sw.epilog.sink.split.i, %sw.bb, %operand.exit, %while.body, %while.body br label %while.body sw.default: ; preds = %while.body %sext = shl i32 %call.i, 24 %conv.i13 = ashr exact i32 %sext, 24 %sub.i14 = add nsw i32 %conv.i13, -48 %4 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i4.i = tail call i32 @getc(ptr noundef %4) %cmp.not5.i = icmp eq i32 %call.i4.i, 32 br i1 %cmp.not5.i, label %operand.exit, label %while.body.i while.body.i: ; preds = %sw.default, %while.body.i %call.i7.i = phi i32 [ %call.i.i, %while.body.i ], [ %call.i4.i, %sw.default ] %val.06.i = phi i32 [ %add.i16, %while.body.i ], [ %sub.i14, %sw.default ] %mul.i15 = mul nsw i32 %val.06.i, 10 %sub2.i = add i32 %call.i7.i, -48 %add.i16 = add i32 %sub2.i, %mul.i15 %5 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i = tail call i32 @getc(ptr noundef %5) %cmp.not.i = icmp eq i32 %call.i.i, 32 br i1 %cmp.not.i, label %operand.exit, label %while.body.i, !llvm.loop !11 operand.exit: ; preds = %while.body.i, %sw.default %val.0.lcssa.i = phi i32 [ %sub.i14, %sw.default ], [ %add.i16, %while.body.i ] %6 = load i32, ptr @sp, align 4, !tbaa !5 %inc.i.i = add nsw i32 %6, 1 store i32 %inc.i.i, ptr @sp, align 4, !tbaa !5 %idxprom.i.i17 = sext i32 %6 to i64 %arrayidx.i.i18 = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i.i17 store i32 %val.0.lcssa.i, ptr %arrayidx.i.i18, align 4, !tbaa !5 br label %while.body.backedge while.end: ; preds = %while.body %7 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i = add nsw i32 %7, -1 store i32 %dec.i, ptr @sp, align 4, !tbaa !5 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @value, i64 0, i64 %idxprom.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 = !{!10, !10, i64 0} !10 = !{!"any pointer", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main() { int N,L; scanf("%d\n", &N); for(int i=0; i < N; i++) { L = 0; scanf("%d\n", &L); char s[50]; scanf("%[^\n]", s); for(int j = 0; j < strlen(s); j++) { if (s[j] == 'N') L +=1; // else // L -= 1; } if (L == 1) puts("NO"); else puts("YES"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28570/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28570/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%[^\0A]\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %L = alloca i32, align 4 %s = alloca [50 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond.cleanup8, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 for.body: ; preds = %entry, %for.cond.cleanup8 %i.032 = phi i32 [ %inc20, %for.cond.cleanup8 ], [ 0, %entry ] store i32 0, ptr %L, align 4, !tbaa !5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L) call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %s) #4 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5 %L.promoted = load i32, ptr %L, align 4, !tbaa !5 %cmp627.not = icmp eq i64 %call5, 0 br i1 %cmp627.not, label %for.cond.cleanup8, label %for.body9.preheader for.body9.preheader: ; preds = %for.body %xtraiter = and i64 %call5, 1 %1 = icmp eq i64 %call5, 1 br i1 %1, label %for.cond.cleanup8.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %call5, -2 br label %for.body9 for.cond.cleanup8.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body9.preheader %add25.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %add25.1, %for.inc.1 ] %indvars.iv.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next.1, %for.inc.1 ] %add2628.unr = phi i32 [ %L.promoted, %for.body9.preheader ], [ %add25.1, %for.inc.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil for.body9.epil: ; preds = %for.cond.cleanup8.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds [50 x i8], ptr %s, i64 0, i64 %indvars.iv.unr %2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9 %cmp11.epil = icmp eq i8 %2, 78 br i1 %cmp11.epil, label %if.then.epil, label %for.cond.cleanup8 if.then.epil: ; preds = %for.body9.epil %add.epil = add nsw i32 %add2628.unr, 1 store i32 %add.epil, ptr %L, align 4, !tbaa !5 br label %for.cond.cleanup8 for.cond.cleanup8: ; preds = %for.cond.cleanup8.loopexit.unr-lcssa, %if.then.epil, %for.body9.epil, %for.body %3 = phi i32 [ %L.promoted, %for.body ], [ %add25.lcssa.ph, %for.cond.cleanup8.loopexit.unr-lcssa ], [ %add2628.unr, %for.body9.epil ], [ %add.epil, %if.then.epil ] %cmp13 = icmp eq i32 %3, 1 %.str.2..str.3 = select i1 %cmp13, ptr @.str.2, ptr @.str.3 %call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.3) call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %s) #4 %inc20 = add nuw nsw i32 %i.032, 1 %4 = load i32, ptr %N, align 4, !tbaa !5 %cmp = icmp slt i32 %inc20, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 for.body9: ; preds = %for.inc.1, %for.body9.preheader.new %indvars.iv = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ] %add2628 = phi i32 [ %L.promoted, %for.body9.preheader.new ], [ %add25.1, %for.inc.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc.1 ] %arrayidx = getelementptr inbounds [50 x i8], ptr %s, i64 0, i64 %indvars.iv %5 = load i8, ptr %arrayidx, align 2, !tbaa !9 %cmp11 = icmp eq i8 %5, 78 br i1 %cmp11, label %if.then, label %for.inc if.then: ; preds = %for.body9 %add = add nsw i32 %add2628, 1 store i32 %add, ptr %L, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body9, %if.then %add25 = phi i32 [ %add2628, %for.body9 ], [ %add, %if.then ] %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds [50 x i8], ptr %s, i64 0, i64 %indvars.iv.next %6 = load i8, ptr %arrayidx.1, align 1, !tbaa !9 %cmp11.1 = icmp eq i8 %6, 78 br i1 %cmp11.1, label %if.then.1, label %for.inc.1 if.then.1: ; preds = %for.inc %add.1 = add nsw i32 %add25, 1 store i32 %add.1, ptr %L, align 4, !tbaa !5 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.inc %add25.1 = phi i32 [ %add25, %for.inc ], [ %add.1, %if.then.1 ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup8.loopexit.unr-lcssa, label %for.body9, !llvm.loop !12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef 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 #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include <stdio.h> #include <stdlib.h> int top, S[100]; void push(int x){ S[++top] = x; } int pop(){ --top; return S[top+1]; } int main(){ int a, b, x; top = 0; char s[100]; while( scanf("%s", s) != EOF ){ if ( s[0] == '+' ){ a = pop(); b = pop(); push(a + b); } else if ( s[0] == '-' ){ b = pop(); a = pop(); push(a - b); } else if ( s[0] == '*' ){ a = pop(); b = pop(); push(a * b); } else { x = atoi(s); push(x); } } printf("%d\n", pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285765/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285765/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @S = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int x[100],i=0,j=0,k=0; char s[100]; while( scanf("%s", s) != EOF ){ if ( s[0] == '+' ){ x[i-2]+=x[i-1]; i--; } else if ( s[0] == '-' ){ x[i-2]-=x[i-1]; i--; } else if ( s[0] == '*' ){ x[i-2]*=x[i-1]; i--; } else { x[i] = atoi(s); i++; } } printf("%d\n",x[0]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285808/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285808/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca [100 x i32], align 16 %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not53 = icmp ne i32 %call52, -1 call void @llvm.assume(i1 %cmp.not53) br label %while.body while.body: ; preds = %entry, %if.end39 %i.054 = phi i32 [ %i.1, %if.end39 ], [ 0, %entry ] %0 = load i8, ptr %s, align 16, !tbaa !5 switch i8 %0, label %if.else33 [ i8 43, label %if.then i8 45, label %if.then11 i8 42, label %if.then25 ] if.then: ; preds = %while.body %sub = add nsw i32 %i.054, -1 %idxprom = sext i32 %sub to i64 %arrayidx3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx3, align 4, !tbaa !8 %sub4 = add nsw i32 %i.054, -2 %idxprom5 = sext i32 %sub4 to i64 %arrayidx6 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom5 %2 = load i32, ptr %arrayidx6, align 4, !tbaa !8 %add = add nsw i32 %2, %1 store i32 %add, ptr %arrayidx6, align 4, !tbaa !8 br label %if.end39 if.then11: ; preds = %while.body %sub12 = add nsw i32 %i.054, -1 %idxprom13 = sext i32 %sub12 to i64 %arrayidx14 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom13 %3 = load i32, ptr %arrayidx14, align 4, !tbaa !8 %sub15 = add nsw i32 %i.054, -2 %idxprom16 = sext i32 %sub15 to i64 %arrayidx17 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom16 %4 = load i32, ptr %arrayidx17, align 4, !tbaa !8 %sub18 = sub nsw i32 %4, %3 store i32 %sub18, ptr %arrayidx17, align 4, !tbaa !8 br label %if.end39 if.then25: ; preds = %while.body %sub26 = add nsw i32 %i.054, -1 %idxprom27 = sext i32 %sub26 to i64 %arrayidx28 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom27 %5 = load i32, ptr %arrayidx28, align 4, !tbaa !8 %sub29 = add nsw i32 %i.054, -2 %idxprom30 = sext i32 %sub29 to i64 %arrayidx31 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom30 %6 = load i32, ptr %arrayidx31, align 4, !tbaa !8 %mul = mul nsw i32 %6, %5 store i32 %mul, ptr %arrayidx31, align 4, !tbaa !8 br label %if.end39 if.else33: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %idxprom36 = sext i32 %i.054 to i64 %arrayidx37 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom36 store i32 %conv.i, ptr %arrayidx37, align 4, !tbaa !8 %inc = add nsw i32 %i.054, 1 br label %if.end39 if.end39: ; preds = %if.then11, %if.else33, %if.then25, %if.then %i.1 = phi i32 [ %sub, %if.then ], [ %sub12, %if.then11 ], [ %sub26, %if.then25 ], [ %inc, %if.else33 ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10 while.end.loopexit: ; preds = %if.end39 %.pre = load i32, ptr %x, align 16, !tbaa !8 %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int pop(); void push(int); int s2[100],top=0; int main(){ int x,a,b; char s[100]; while( scanf("%s", s) != EOF ){ if ( s[0] == '+' ){ a = pop(); b = pop(); x = a+b; s2[top]=x; top++; } else if ( s[0] == '-' ){ a = pop(); b = pop(); x = b-a; s2[top]=x; top++; } else if ( s[0] == '*' ){ a = pop(); b = pop(); x = a*b; s2[top]=x; top++; } else { x = atoi(s); s2[top]=x; top++; } } printf("%d\n",x); return 0; } int pop(){ top--; return s2[top]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285859/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285859/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @s2 = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6 %call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not60 = icmp ne i32 %call59, -1 call void @llvm.assume(i1 %cmp.not60) br label %while.body while.body: ; preds = %entry, %if.end34 %0 = load i8, ptr %s, align 16, !tbaa !5 switch i8 %0, label %if.else27 [ i8 43, label %if.then i8 45, label %if.then10 i8 42, label %if.then21 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !8 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8 %dec.i44 = add nsw i32 %1, -2 %idxprom.i45 = sext i32 %dec.i44 to i64 %arrayidx.i46 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i45 %3 = load i32, ptr %arrayidx.i46, align 4, !tbaa !8 %add = add nsw i32 %3, %2 store i32 %add, ptr %arrayidx.i46, align 4, !tbaa !8 br label %if.end34 if.then10: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !8 %dec.i47 = add nsw i32 %4, -1 %idxprom.i48 = sext i32 %dec.i47 to i64 %arrayidx.i49 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i48 %5 = load i32, ptr %arrayidx.i49, align 4, !tbaa !8 %dec.i50 = add nsw i32 %4, -2 %idxprom.i51 = sext i32 %dec.i50 to i64 %arrayidx.i52 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i51 %6 = load i32, ptr %arrayidx.i52, align 4, !tbaa !8 %sub = sub nsw i32 %6, %5 store i32 %sub, ptr %arrayidx.i52, align 4, !tbaa !8 br label %if.end34 if.then21: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !8 %dec.i53 = add nsw i32 %7, -1 %idxprom.i54 = sext i32 %dec.i53 to i64 %arrayidx.i55 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i54 %8 = load i32, ptr %arrayidx.i55, align 4, !tbaa !8 %dec.i56 = add nsw i32 %7, -2 %idxprom.i57 = sext i32 %dec.i56 to i64 %arrayidx.i58 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom.i57 %9 = load i32, ptr %arrayidx.i58, align 4, !tbaa !8 %mul = mul nsw i32 %9, %8 store i32 %mul, ptr %arrayidx.i58, align 4, !tbaa !8 br label %if.end34 if.else27: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #6 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !8 %idxprom30 = sext i32 %10 to i64 %arrayidx31 = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom30 store i32 %conv.i, ptr %arrayidx31, align 4, !tbaa !8 %inc32 = add nsw i32 %10, 1 br label %if.end34 if.end34: ; preds = %if.then10, %if.else27, %if.then21, %if.then %dec.i47.sink = phi i32 [ %dec.i47, %if.then10 ], [ %inc32, %if.else27 ], [ %dec.i53, %if.then21 ], [ %dec.i, %if.then ] %x.1 = phi i32 [ %sub, %if.then10 ], [ %conv.i, %if.else27 ], [ %mul, %if.then21 ], [ %add, %if.then ] store i32 %dec.i47.sink, ptr @top, align 4, !tbaa !8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end34 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.1) call void @llvm.lifetime.end.p0(i64 100, 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 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(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !8 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !8 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @s2, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !8 ret i32 %1 } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> void push(int); int pop(void); int isFull(void); int top=0; int a[100]; int main(){ int x,data[2]; char s[100]; while(scanf("%s",&s)!=EOF){ if(s[0]=='+'|| s[0]=='-'||s[0]=='*'){ data[0]=pop(); data[1]=pop(); } if(s[0]=='+'){ push(data[1]+data[0]); }else if(s[0]=='-'){ push(data[1]-data[0]); }else if(s[0]=='*'){ push(data[1]*data[0]); }else { x = atoi(s); push(x); } } printf("%d\n",a[1]); return 0; } int isFull(void){ if(top>=99)return 0; else return 1; } void push(int x){ /* if (isFull()==0){ fprintf(stderr,"オーバーフロー\n"); exit(1);}*/ top++; a[top]=x; } int pop(){ /* if (isFull()==0){fprintf(stderr,"アンダーフロー\n"); exit(2);}*/ top--; return a[top+1]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285901/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285901/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @a = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6 %call63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not64 = icmp eq i32 %call63, -1 br i1 %cmp.not64, label %while.end, label %while.body while.body: ; preds = %entry, %if.end42 %data.sroa.0.066 = phi i32 [ %data.sroa.0.1, %if.end42 ], [ undef, %entry ] %data.sroa.6.065 = phi i32 [ %data.sroa.6.1, %if.end42 ], [ undef, %entry ] %0 = load i8, ptr %s, align 16 switch i8 %0, label %if.end [ i8 45, label %if.then i8 43, label %if.then i8 42, label %if.then ] if.then: ; preds = %while.body, %while.body, %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %dec.i49 = add nsw i32 %1, -2 store i32 %dec.i49, ptr @top, align 4, !tbaa !5 %idxprom.i50 = sext i32 %dec.i to i64 %arrayidx.i51 = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %idxprom.i50 %3 = load i32, ptr %arrayidx.i51, align 4, !tbaa !5 br label %if.end if.end: ; preds = %while.body, %if.then %data.sroa.6.1 = phi i32 [ %3, %if.then ], [ %data.sroa.6.065, %while.body ] %data.sroa.0.1 = phi i32 [ %2, %if.then ], [ %data.sroa.0.066, %while.body ] switch i8 %0, label %if.else38 [ i8 43, label %if.then20 i8 45, label %if.then27 i8 42, label %if.then35 ] if.then20: ; preds = %if.end %add = add nsw i32 %data.sroa.0.1, %data.sroa.6.1 br label %if.end42 if.then27: ; preds = %if.end %sub = sub nsw i32 %data.sroa.6.1, %data.sroa.0.1 br label %if.end42 if.then35: ; preds = %if.end %mul = mul nsw i32 %data.sroa.0.1, %data.sroa.6.1 br label %if.end42 if.else38: ; preds = %if.end %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #6 %conv.i = trunc i64 %call.i to i32 br label %if.end42 if.end42: ; preds = %if.then27, %if.else38, %if.then35, %if.then20 %sub.sink = phi i32 [ %sub, %if.then27 ], [ %conv.i, %if.else38 ], [ %mul, %if.then35 ], [ %add, %if.then20 ] %4 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %4, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %idxprom.i55 store i32 %sub.sink, ptr %arrayidx.i56, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end42, %entry %5 = load i32, ptr getelementptr inbounds ([100 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5 %call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5) call void @llvm.lifetime.end.p0(i64 100, 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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @isFull() local_unnamed_addr #4 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp = icmp slt i32 %0, 99 %. = zext i1 %cmp to i32 ret i32 %. } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int main(void) { int x[100], top = -1; //top????????????????????°????????° char s[100]; while (scanf("%s", s) != EOF) { //???????????????????????? if (s[0]=='+') { //+?????´??? x[top - 1] = x[top - 1] + x[top]; top--; } else if (s[0]=='-') { //????????´??? x[top - 1] = x[top - 1] - x[top]; top--; } else if (s[0]=='*') { //???????´??? x[top - 1] = x[top - 1] * x[top]; top--; } else { //??°????????´??? x[top + 1] = atoi(s); top++; } } printf("%d\n", x[0]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285967/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285967/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca [100 x i32], align 16 %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not63 = icmp ne i32 %call62, -1 call void @llvm.assume(i1 %cmp.not63) br label %while.body while.body: ; preds = %entry, %if.end46 %top.064 = phi i32 [ %top.1, %if.end46 ], [ -1, %entry ] %0 = load i8, ptr %s, align 16, !tbaa !5 switch i8 %0, label %if.else39 [ i8 43, label %if.then i8 45, label %if.then13 i8 42, label %if.then29 ] if.then: ; preds = %while.body %sub = add nsw i32 %top.064, -1 %idxprom = sext i32 %sub to i64 %arrayidx3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx3, align 4, !tbaa !8 %idxprom4 = sext i32 %top.064 to i64 %arrayidx5 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom4 %2 = load i32, ptr %arrayidx5, align 4, !tbaa !8 %add = add nsw i32 %2, %1 store i32 %add, ptr %arrayidx3, align 4, !tbaa !8 br label %if.end46 if.then13: ; preds = %while.body %sub14 = add nsw i32 %top.064, -1 %idxprom15 = sext i32 %sub14 to i64 %arrayidx16 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom15 %3 = load i32, ptr %arrayidx16, align 4, !tbaa !8 %idxprom17 = sext i32 %top.064 to i64 %arrayidx18 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom17 %4 = load i32, ptr %arrayidx18, align 4, !tbaa !8 %sub19 = sub nsw i32 %3, %4 store i32 %sub19, ptr %arrayidx16, align 4, !tbaa !8 br label %if.end46 if.then29: ; preds = %while.body %sub30 = add nsw i32 %top.064, -1 %idxprom31 = sext i32 %sub30 to i64 %arrayidx32 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom31 %5 = load i32, ptr %arrayidx32, align 4, !tbaa !8 %idxprom33 = sext i32 %top.064 to i64 %arrayidx34 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom33 %6 = load i32, ptr %arrayidx34, align 4, !tbaa !8 %mul = mul nsw i32 %6, %5 store i32 %mul, ptr %arrayidx32, align 4, !tbaa !8 br label %if.end46 if.else39: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %add42 = add nsw i32 %top.064, 1 %idxprom43 = sext i32 %add42 to i64 %arrayidx44 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom43 store i32 %conv.i, ptr %arrayidx44, align 4, !tbaa !8 br label %if.end46 if.end46: ; preds = %if.then13, %if.else39, %if.then29, %if.then %top.1 = phi i32 [ %sub, %if.then ], [ %sub14, %if.then13 ], [ %sub30, %if.then29 ], [ %add42, %if.else39 ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10 while.end.loopexit: ; preds = %if.end46 %.pre = load i32, ptr %x, align 16, !tbaa !8 %call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> int top,S[10000]; void push(int x){ S[++top]=x; } int pop(){ return S[top--]; } int main(){ int a,b; char s[50]; top=0; while(scanf("%s",s)!=EOF){ if(s[0]=='+'){ b=pop(); a=pop(); push(a+b); }else if(s[0]=='-'){ b=pop(); a=pop(); push(a-b); }else if(s[0]=='*'){ b=pop(); a=pop(); push(a*b); }else{ push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286009/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286009/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @S = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [50 x i8], align 16 call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %s) #5 store i32 0, ptr @top, align 4, !tbaa !5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 50, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int top; int isEmpty() { return ((top == 0)? 1:0); } void push(int *s, int x) { top++; s[top] = x; } int pop(int *s) { if (isEmpty()) { fprintf(stderr, "underflow\n"); } else { top--; } return s[top + 1]; } int main() { int x,tmp; int stack[101]; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { tmp = pop(stack); x = pop(stack) + tmp; push(stack,x); } else if (s[0] == '-') { tmp = pop(stack); x = pop(stack) - tmp; push(stack,x); } else if (s[0] == '*') { tmp = pop(stack); x = pop(stack) * tmp; push(stack,x); } else { x = atoi(s); push(stack,x); } } printf("%d\n", stack[top]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286052/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286052/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @stderr = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [11 x i8] c"underflow\0A\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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @isEmpty() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 0 %cond = zext i1 %cmp to i32 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) uwtable define dso_local void @push(ptr nocapture noundef writeonly %s, i32 noundef %x) local_unnamed_addr #1 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @pop(ptr nocapture noundef readonly %s) local_unnamed_addr #2 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not = icmp eq i32 %0, 0 br i1 %cmp.i.not, label %if.then, label %if.else if.then: ; preds = %entry %1 = load ptr, ptr @stderr, align 8, !tbaa !9 %2 = tail call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %1) #7 %.pre = load i32, ptr @top, align 4, !tbaa !5 %3 = add nsw i32 %.pre, 1 br label %if.end if.else: ; preds = %entry %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.else, %if.then %add = phi i32 [ %0, %if.else ], [ %3, %if.then ] %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %4 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %stack = alloca [101 x i32], align 16 %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %stack) #8 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #8 %call98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %cmp.not99 = icmp eq i32 %call98, -1 br i1 %cmp.not99, label %while.end, label %while.body while.body: ; preds = %entry, %if.end34 %0 = load i8, ptr %s, align 16, !tbaa !11 switch i8 %0, label %if.else29 [ i8 43, label %if.then i8 45, label %if.then12 i8 42, label %if.then23 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i = icmp eq i32 %1, 0 br i1 %cmp.i.not.i, label %if.then.i, label %if.else.i if.then.i: ; preds = %if.then %2 = load ptr, ptr @stderr, align 8, !tbaa !9 %3 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %2) #7 %.pre.i = load i32, ptr @top, align 4, !tbaa !5 %4 = add nsw i32 %.pre.i, 1 br label %pop.exit if.else.i: ; preds = %if.then %dec.i = add nsw i32 %1, -1 store i32 %dec.i, ptr @top, align 4, !tbaa !5 br label %pop.exit pop.exit: ; preds = %if.then.i, %if.else.i %5 = phi i32 [ %.pre.i, %if.then.i ], [ %dec.i, %if.else.i ] %add.i = phi i32 [ %4, %if.then.i ], [ %1, %if.else.i ] %idxprom.i = sext i32 %add.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp.i.not.i42 = icmp eq i32 %5, 0 br i1 %cmp.i.not.i42, label %if.then.i48, label %pop.exit50 if.then.i48: ; preds = %pop.exit %7 = load ptr, ptr @stderr, align 8, !tbaa !9 %8 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %7) #7 %.pre.i49 = load i32, ptr @top, align 4, !tbaa !5 %9 = add nsw i32 %.pre.i49, 1 br label %pop.exit50 pop.exit50: ; preds = %pop.exit, %if.then.i48 %inc.i.pre-phi = phi i32 [ %9, %if.then.i48 ], [ %5, %pop.exit ] %idxprom.i46 = sext i32 %inc.i.pre-phi to i64 %arrayidx.i47 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i46 %10 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %add = add nsw i32 %10, %6 br label %if.end34 if.then12: ; preds = %while.body %11 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i53 = icmp eq i32 %11, 0 br i1 %cmp.i.not.i53, label %if.then.i59, label %if.else.i54 if.then.i59: ; preds = %if.then12 %12 = load ptr, ptr @stderr, align 8, !tbaa !9 %13 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %12) #7 %.pre.i60 = load i32, ptr @top, align 4, !tbaa !5 %14 = add nsw i32 %.pre.i60, 1 br label %pop.exit61 if.else.i54: ; preds = %if.then12 %dec.i55 = add nsw i32 %11, -1 store i32 %dec.i55, ptr @top, align 4, !tbaa !5 br label %pop.exit61 pop.exit61: ; preds = %if.then.i59, %if.else.i54 %15 = phi i32 [ %.pre.i60, %if.then.i59 ], [ %dec.i55, %if.else.i54 ] %add.i56 = phi i32 [ %14, %if.then.i59 ], [ %11, %if.else.i54 ] %idxprom.i57 = sext i32 %add.i56 to i64 %arrayidx.i58 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i57 %16 = load i32, ptr %arrayidx.i58, align 4, !tbaa !5 %cmp.i.not.i62 = icmp eq i32 %15, 0 br i1 %cmp.i.not.i62, label %if.then.i68, label %pop.exit70 if.then.i68: ; preds = %pop.exit61 %17 = load ptr, ptr @stderr, align 8, !tbaa !9 %18 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %17) #7 %.pre.i69 = load i32, ptr @top, align 4, !tbaa !5 %19 = add nsw i32 %.pre.i69, 1 br label %pop.exit70 pop.exit70: ; preds = %pop.exit61, %if.then.i68 %inc.i71.pre-phi = phi i32 [ %19, %if.then.i68 ], [ %15, %pop.exit61 ] %idxprom.i66 = sext i32 %inc.i71.pre-phi to i64 %arrayidx.i67 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i66 %20 = load i32, ptr %arrayidx.i67, align 4, !tbaa !5 %sub = sub nsw i32 %20, %16 br label %if.end34 if.then23: ; preds = %while.body %21 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i74 = icmp eq i32 %21, 0 br i1 %cmp.i.not.i74, label %if.then.i80, label %if.else.i75 if.then.i80: ; preds = %if.then23 %22 = load ptr, ptr @stderr, align 8, !tbaa !9 %23 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %22) #7 %.pre.i81 = load i32, ptr @top, align 4, !tbaa !5 %24 = add nsw i32 %.pre.i81, 1 br label %pop.exit82 if.else.i75: ; preds = %if.then23 %dec.i76 = add nsw i32 %21, -1 store i32 %dec.i76, ptr @top, align 4, !tbaa !5 br label %pop.exit82 pop.exit82: ; preds = %if.then.i80, %if.else.i75 %25 = phi i32 [ %.pre.i81, %if.then.i80 ], [ %dec.i76, %if.else.i75 ] %add.i77 = phi i32 [ %24, %if.then.i80 ], [ %21, %if.else.i75 ] %idxprom.i78 = sext i32 %add.i77 to i64 %arrayidx.i79 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i78 %26 = load i32, ptr %arrayidx.i79, align 4, !tbaa !5 %cmp.i.not.i83 = icmp eq i32 %25, 0 br i1 %cmp.i.not.i83, label %if.then.i89, label %pop.exit91 if.then.i89: ; preds = %pop.exit82 %27 = load ptr, ptr @stderr, align 8, !tbaa !9 %28 = call i64 @fwrite(ptr nonnull @.str, i64 10, i64 1, ptr %27) #7 %.pre.i90 = load i32, ptr @top, align 4, !tbaa !5 %29 = add nsw i32 %.pre.i90, 1 br label %pop.exit91 pop.exit91: ; preds = %pop.exit82, %if.then.i89 %inc.i92.pre-phi = phi i32 [ %29, %if.then.i89 ], [ %25, %pop.exit82 ] %idxprom.i87 = sext i32 %inc.i92.pre-phi to i64 %arrayidx.i88 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i87 %30 = load i32, ptr %arrayidx.i88, align 4, !tbaa !5 %mul = mul nsw i32 %30, %26 br label %if.end34 if.else29: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #8 %conv.i = trunc i64 %call.i to i32 %31 = load i32, ptr @top, align 4, !tbaa !5 %inc.i95 = add nsw i32 %31, 1 br label %if.end34 if.end34: ; preds = %pop.exit70, %if.else29, %pop.exit91, %pop.exit50 %inc.i71.pre-phi.sink102 = phi i32 [ %inc.i71.pre-phi, %pop.exit70 ], [ %inc.i95, %if.else29 ], [ %inc.i92.pre-phi, %pop.exit91 ], [ %inc.i.pre-phi, %pop.exit50 ] %sub.sink = phi i32 [ %sub, %pop.exit70 ], [ %conv.i, %if.else29 ], [ %mul, %pop.exit91 ], [ %add, %pop.exit50 ] store i32 %inc.i71.pre-phi.sink102, ptr @top, align 4, !tbaa !5 %idxprom.i72 = sext i32 %inc.i71.pre-phi.sink102 to i64 %arrayidx.i73 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i72 store i32 %sub.sink, ptr %arrayidx.i73, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12 while.end: ; preds = %if.end34, %entry %32 = load i32, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %32 to i64 %arrayidx35 = getelementptr inbounds [101 x i32], ptr %stack, i64 0, i64 %idxprom %33 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #8 call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %stack) #8 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6 attributes #0 = { 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 #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind } attributes #7 = { cold } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"any pointer", !7, i64 0} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 #define TRUE 1 #define FALSE 0 int IsEmpty(int); void push(int); int pop(int); int top=1,pocky[N]; char s[N]; int main(){ int x; int i,a,b,Sdata; while( scanf("%s", s) != EOF ){ if ( s[0] == '+' ){ a=pop(pocky[top]); b=pop(pocky[top]); Sdata=a+b; push(Sdata); } else if (s[0] == '-' ){ a=pop(pocky[top]); b=pop(pocky[top]); Sdata=b-a; push(Sdata); } else if (s[0] == '*' ){ a=pop(pocky[top]); b=pop(pocky[top]); Sdata=a*b; push(Sdata); } else { x = atoi(s); push(x); } } printf("%d\n",pocky[top]); return 0; } int IsEmpty(int S){ if(top==0) return 0; else return FALSE; } void push(int x){ top = top+1; pocky[top] = x; } int pop(int S){ if (IsEmpty(S)){ printf("underflow\n"); } else { top = top - 1; } return S; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286102/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286102/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 1, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @s = dso_local global [100 x i8] zeroinitializer, align 16 @pocky = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call55 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s) %cmp.not56 = icmp eq i32 %call55, -1 br i1 %cmp.not56, label %while.end, label %while.body while.body: ; preds = %entry, %if.end31 %0 = load i8, ptr @s, align 16, !tbaa !5 switch i8 %0, label %if.else28 [ i8 43, label %if.then i8 45, label %if.then10 i8 42, label %if.then21 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !8 %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !8 %sub.i = add nsw i32 %1, -1 %idxprom4 = sext i32 %sub.i to i64 %arrayidx5 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom4 %3 = load i32, ptr %arrayidx5, align 4, !tbaa !8 %add = add nsw i32 %3, %2 store i32 %sub.i, ptr @top, align 4, !tbaa !8 store i32 %add, ptr %arrayidx5, align 4, !tbaa !8 br label %if.end31 if.then10: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !8 %idxprom11 = sext i32 %4 to i64 %arrayidx12 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom11 %5 = load i32, ptr %arrayidx12, align 4, !tbaa !8 %sub.i42 = add nsw i32 %4, -1 %idxprom14 = sext i32 %sub.i42 to i64 %arrayidx15 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom14 %6 = load i32, ptr %arrayidx15, align 4, !tbaa !8 %sub = sub nsw i32 %6, %5 store i32 %sub.i42, ptr @top, align 4, !tbaa !8 store i32 %sub, ptr %arrayidx15, align 4, !tbaa !8 br label %if.end31 if.then21: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !8 %idxprom22 = sext i32 %7 to i64 %arrayidx23 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom22 %8 = load i32, ptr %arrayidx23, align 4, !tbaa !8 %sub.i47 = add nsw i32 %7, -1 %idxprom25 = sext i32 %sub.i47 to i64 %arrayidx26 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom25 %9 = load i32, ptr %arrayidx26, align 4, !tbaa !8 %mul = mul nsw i32 %9, %8 store i32 %sub.i47, ptr @top, align 4, !tbaa !8 store i32 %mul, ptr %arrayidx26, align 4, !tbaa !8 br label %if.end31 if.else28: ; preds = %while.body %call.i = tail call i64 @strtol(ptr nocapture noundef nonnull @s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !8 %add.i52 = add nsw i32 %10, 1 store i32 %add.i52, ptr @top, align 4, !tbaa !8 %idxprom.i53 = sext i32 %add.i52 to i64 %arrayidx.i54 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom.i53 store i32 %conv.i, ptr %arrayidx.i54, align 4, !tbaa !8 br label %if.end31 if.end31: ; preds = %if.then10, %if.else28, %if.then21, %if.then %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end31, %entry %11 = load i32, ptr @top, align 4, !tbaa !8 %idxprom32 = sext i32 %11 to i64 %arrayidx33 = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom32 %12 = load i32, ptr %arrayidx33, align 4, !tbaa !8 %call34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop(i32 noundef returned %S) local_unnamed_addr #2 { entry: %0 = load i32, ptr @top, align 4, !tbaa !8 %sub = add nsw i32 %0, -1 store i32 %sub, ptr @top, align 4, !tbaa !8 ret i32 %S } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #2 { entry: %0 = load i32, ptr @top, align 4, !tbaa !8 %add = add nsw i32 %0, 1 store i32 %add, ptr @top, align 4, !tbaa !8 %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @pocky, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !8 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @IsEmpty(i32 noundef %S) local_unnamed_addr #3 { entry: ret i32 0 } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 101 void initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int top; int S[MAX]; int main(){ int x,i,j; char s[100]; initialize(); while( scanf("%s", s) != EOF ){ if ( s[0] == '+' ){ i = pop(); j = pop(); push(i+j); } else if ( s[0] == '-' ){ i = pop(); j = pop(); push(j-i); } else if ( s[0] == '*' ){ i = pop(); j = pop(); push(i*j); } else { x = atoi(s); push(x); } } printf("%d\n",S[top]); return 0; } void initialize(void){ top = 0; } int isEmpty(void){ if(top==0) return 1; return 0; } int isFull(void){ if(top >= MAX - 1) return 1; return 0; } void push(int x){ if (isFull()==1){ printf("error(overflow)"); }else{ top++; S[top] = x; } } int pop(void){ if(isEmpty()==1){ printf("error(underflow)"); }else{ top--; return S[top+1]; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286146/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286146/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @S = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str.2 = private unnamed_addr constant [16 x i8] c"error(overflow)\00", align 1 @.str.3 = private unnamed_addr constant [17 x i8] c"error(underflow)\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6 store i32 0, ptr @top, align 4, !tbaa !5 %call110 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not111 = icmp eq i32 %call110, -1 br i1 %cmp.not111, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i = icmp eq i32 %1, 0 br i1 %cmp.i.not.i, label %if.then.i, label %if.else.i if.then.i: ; preds = %if.then %call1.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit if.else.i: ; preds = %if.then %dec.i = add nsw i32 %1, -1 store i32 %dec.i, ptr @top, align 4, !tbaa !5 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 br label %pop.exit pop.exit: ; preds = %if.then.i, %if.else.i %3 = phi i32 [ %.pr, %if.then.i ], [ %dec.i, %if.else.i ] %retval.0.i = phi i32 [ undef, %if.then.i ], [ %2, %if.else.i ] %cmp.i.not.i31 = icmp eq i32 %3, 0 br i1 %cmp.i.not.i31, label %if.then.i37, label %if.else.i32 if.then.i37: ; preds = %pop.exit %call1.i38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr105 = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit39 if.else.i32: ; preds = %pop.exit %dec.i33 = add nsw i32 %3, -1 store i32 %dec.i33, ptr @top, align 4, !tbaa !5 %idxprom.i34 = sext i32 %3 to i64 %arrayidx.i35 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i34 %4 = load i32, ptr %arrayidx.i35, align 4, !tbaa !5 br label %pop.exit39 pop.exit39: ; preds = %if.then.i37, %if.else.i32 %5 = phi i32 [ %.pr105, %if.then.i37 ], [ %dec.i33, %if.else.i32 ] %retval.0.i36 = phi i32 [ undef, %if.then.i37 ], [ %4, %if.else.i32 ] %cmp.i.i = icmp slt i32 %5, 100 br i1 %cmp.i.i, label %if.else.i42, label %if.then.i40 if.then.i40: ; preds = %pop.exit39 %call1.i41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end24 if.else.i42: ; preds = %pop.exit39 %add = add nsw i32 %retval.0.i36, %retval.0.i %inc.i = add nsw i32 %5, 1 store i32 %inc.i, ptr @top, align 4, !tbaa !5 %idxprom.i43 = sext i32 %inc.i to i64 %arrayidx.i44 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i43 store i32 %add, ptr %arrayidx.i44, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %6 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i45 = icmp eq i32 %6, 0 br i1 %cmp.i.not.i45, label %if.then.i51, label %if.else.i46 if.then.i51: ; preds = %if.then9 %call1.i52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr106 = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit53 if.else.i46: ; preds = %if.then9 %dec.i47 = add nsw i32 %6, -1 store i32 %dec.i47, ptr @top, align 4, !tbaa !5 %idxprom.i48 = sext i32 %6 to i64 %arrayidx.i49 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i48 %7 = load i32, ptr %arrayidx.i49, align 4, !tbaa !5 br label %pop.exit53 pop.exit53: ; preds = %if.then.i51, %if.else.i46 %8 = phi i32 [ %.pr106, %if.then.i51 ], [ %dec.i47, %if.else.i46 ] %retval.0.i50 = phi i32 [ undef, %if.then.i51 ], [ %7, %if.else.i46 ] %cmp.i.not.i54 = icmp eq i32 %8, 0 br i1 %cmp.i.not.i54, label %if.then.i60, label %if.else.i55 if.then.i60: ; preds = %pop.exit53 %call1.i61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr107 = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit62 if.else.i55: ; preds = %pop.exit53 %dec.i56 = add nsw i32 %8, -1 store i32 %dec.i56, ptr @top, align 4, !tbaa !5 %idxprom.i57 = sext i32 %8 to i64 %arrayidx.i58 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i57 %9 = load i32, ptr %arrayidx.i58, align 4, !tbaa !5 br label %pop.exit62 pop.exit62: ; preds = %if.then.i60, %if.else.i55 %10 = phi i32 [ %.pr107, %if.then.i60 ], [ %dec.i56, %if.else.i55 ] %retval.0.i59 = phi i32 [ undef, %if.then.i60 ], [ %9, %if.else.i55 ] %cmp.i.i63 = icmp slt i32 %10, 100 br i1 %cmp.i.i63, label %if.else.i66, label %if.then.i64 if.then.i64: ; preds = %pop.exit62 %call1.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end24 if.else.i66: ; preds = %pop.exit62 %sub = sub nsw i32 %retval.0.i59, %retval.0.i50 %inc.i67 = add nsw i32 %10, 1 store i32 %inc.i67, ptr @top, align 4, !tbaa !5 %idxprom.i68 = sext i32 %inc.i67 to i64 %arrayidx.i69 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i68 store i32 %sub, ptr %arrayidx.i69, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %11 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not.i71 = icmp eq i32 %11, 0 br i1 %cmp.i.not.i71, label %if.then.i77, label %if.else.i72 if.then.i77: ; preds = %if.then17 %call1.i78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr108 = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit79 if.else.i72: ; preds = %if.then17 %dec.i73 = add nsw i32 %11, -1 store i32 %dec.i73, ptr @top, align 4, !tbaa !5 %idxprom.i74 = sext i32 %11 to i64 %arrayidx.i75 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i74 %12 = load i32, ptr %arrayidx.i75, align 4, !tbaa !5 br label %pop.exit79 pop.exit79: ; preds = %if.then.i77, %if.else.i72 %13 = phi i32 [ %.pr108, %if.then.i77 ], [ %dec.i73, %if.else.i72 ] %retval.0.i76 = phi i32 [ undef, %if.then.i77 ], [ %12, %if.else.i72 ] %cmp.i.not.i80 = icmp eq i32 %13, 0 br i1 %cmp.i.not.i80, label %if.then.i86, label %if.else.i81 if.then.i86: ; preds = %pop.exit79 %call1.i87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) %.pr109 = load i32, ptr @top, align 4, !tbaa !5 br label %pop.exit88 if.else.i81: ; preds = %pop.exit79 %dec.i82 = add nsw i32 %13, -1 store i32 %dec.i82, ptr @top, align 4, !tbaa !5 %idxprom.i83 = sext i32 %13 to i64 %arrayidx.i84 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i83 %14 = load i32, ptr %arrayidx.i84, align 4, !tbaa !5 br label %pop.exit88 pop.exit88: ; preds = %if.then.i86, %if.else.i81 %15 = phi i32 [ %.pr109, %if.then.i86 ], [ %dec.i82, %if.else.i81 ] %retval.0.i85 = phi i32 [ undef, %if.then.i86 ], [ %14, %if.else.i81 ] %cmp.i.i89 = icmp slt i32 %15, 100 br i1 %cmp.i.i89, label %if.else.i92, label %if.then.i90 if.then.i90: ; preds = %pop.exit88 %call1.i91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end24 if.else.i92: ; preds = %pop.exit88 %mul = mul nsw i32 %retval.0.i85, %retval.0.i76 %inc.i93 = add nsw i32 %15, 1 store i32 %inc.i93, ptr @top, align 4, !tbaa !5 %idxprom.i94 = sext i32 %inc.i93 to i64 %arrayidx.i95 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i94 store i32 %mul, ptr %arrayidx.i95, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #6 %16 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.i97 = icmp slt i32 %16, 100 br i1 %cmp.i.i97, label %if.else.i100, label %if.then.i98 if.then.i98: ; preds = %if.else20 %call1.i99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end24 if.else.i100: ; preds = %if.else20 %conv.i = trunc i64 %call.i to i32 %inc.i101 = add nsw i32 %16, 1 store i32 %inc.i101, ptr @top, align 4, !tbaa !5 %idxprom.i102 = sext i32 %inc.i101 to i64 %arrayidx.i103 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i102 store i32 %conv.i, ptr %arrayidx.i103, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.else.i100, %if.then.i98, %if.else.i92, %if.then.i90, %if.else.i66, %if.then.i64, %if.else.i42, %if.then.i40 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %17 = load i32, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %17 to i64 %arrayidx25 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom %18 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18) call void @llvm.lifetime.end.p0(i64 100, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable define dso_local void @initialize() local_unnamed_addr #2 { entry: store i32 0, ptr @top, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i.not = icmp eq i32 %0, 0 br i1 %cmp.i.not, label %if.then, label %if.else if.then: ; preds = %entry %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) br label %if.end if.else: ; preds = %entry %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.else, %if.then %retval.0 = phi i32 [ undef, %if.then ], [ %1, %if.else ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp.i = icmp slt i32 %0, 100 br i1 %cmp.i, label %if.else, label %if.then if.then: ; preds = %entry %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end if.else: ; preds = %entry %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.else, %if.then ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @isEmpty() local_unnamed_addr #4 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 0 %. = zext i1 %cmp to i32 ret i32 %. } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @isFull() local_unnamed_addr #4 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, 99 %. = zext i1 %cmp to i32 ret i32 %. } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 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 #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main( ) { int n,k; int i, j; int sol[55]; char s[5]; int otv [55]; scanf ("%d %d\n",&n,&k); for (i=1; i<=n-k+1; i++) { scanf ("%s", s); if (s[0] == 'Y') { otv [i] = 1; } else { otv [i] = 0; } } int last; int tek; if (otv[n-k+1] == 1) { for (j=1; j<=k; j++){ sol [n+1-j] = j; } } if (otv[n-k+1] == 0) { for (j=1; j<=k-1; j++){ sol [n+1-j] = j; } sol [n+1-k] = sol[n]; } tek = k+1; for (i=n-k; i>=1; i--) { if (otv[i] == 1) { sol [i] = tek; tek = tek + 1; } else { sol [i] = sol [i+k-1]; } } for (i=1; i<=n-1; i++) { if (sol[i] <= 25) { printf ("A%c ", 96+sol[i]); } else { printf ("B%c ", 96+sol[i]-25); } } if (sol[n] <= 25) { printf ("A%c", 96+sol[n]); } else { printf ("B%c", 96+sol[n]-25); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28619/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28619/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"A%c \00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"B%c \00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"A%c\00", align 1 @.str.5 = private unnamed_addr constant [4 x i8] c"B%c\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 %sol = alloca [55 x i32], align 16 %s = alloca [5 x i8], align 1 %otv = alloca [55 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %sol) #3 call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %otv) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = load i32, ptr %k, align 4, !tbaa !5 %sub142 = sub nsw i32 %0, %1 %cmp.not144 = icmp slt i32 %sub142, 0 br i1 %cmp.not144, label %for.end, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %2 = load i8, ptr %s, align 1, !tbaa !9 %cmp2 = icmp eq i8 %2, 89 %spec.select = zext i1 %cmp2 to i32 %3 = getelementptr inbounds [55 x i32], ptr %otv, i64 0, i64 %indvars.iv store i32 %spec.select, ptr %3, align 4 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %k, align 4, !tbaa !5 %sub = sub nsw i32 %4, %5 %6 = sext i32 %sub to i64 %cmp.not = icmp sgt i64 %indvars.iv, %6 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10 for.end: ; preds = %for.body, %entry %7 = phi i32 [ %0, %entry ], [ %4, %for.body ] %.lcssa140 = phi i32 [ %1, %entry ], [ %5, %for.body ] %sub.lcssa = phi i32 [ %sub142, %entry ], [ %sub, %for.body ] %add.lcssa = add nsw i32 %sub.lcssa, 1 %idxprom9 = sext i32 %add.lcssa to i64 %arrayidx10 = getelementptr inbounds [55 x i32], ptr %otv, i64 0, i64 %idxprom9 %8 = load i32, ptr %arrayidx10, align 4, !tbaa !5 switch i32 %8, label %if.end51 [ i32 1, label %for.cond14.preheader i32 0, label %for.cond33.preheader ] for.cond14.preheader: ; preds = %for.end %cmp15.not149 = icmp slt i32 %.lcssa140, 1 br i1 %cmp15.not149, label %if.end51, label %for.body17.lr.ph for.body17.lr.ph: ; preds = %for.cond14.preheader %add18 = add nsw i32 %7, 1 %9 = add i32 %.lcssa140, 1 %wide.trip.count170 = zext i32 %9 to i64 %10 = add nsw i64 %wide.trip.count170, -1 %min.iters.check196 = icmp ult i32 %.lcssa140, 16 br i1 %min.iters.check196, label %for.body17.preheader, label %vector.scevcheck190 vector.scevcheck190: ; preds = %for.body17.lr.ph %11 = add nsw i64 %wide.trip.count170, -2 %12 = trunc i64 %11 to i32 %13 = sub i32 %7, %12 %14 = icmp sgt i32 %13, %7 %15 = icmp ugt i64 %11, 4294967295 %16 = or i1 %14, %15 br i1 %16, label %for.body17.preheader, label %vector.ph197 vector.ph197: ; preds = %vector.scevcheck190 %n.vec199 = and i64 %10, -8 %ind.end200 = or i64 %n.vec199, 1 br label %vector.body203 vector.body203: ; preds = %vector.body203, %vector.ph197 %index204 = phi i64 [ 0, %vector.ph197 ], [ %index.next212, %vector.body203 ] %vec.ind205 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph197 ], [ %vec.ind.next208, %vector.body203 ] %step.add206 = add <4 x i32> %vec.ind205, <i32 4, i32 4, i32 4, i32 4> %17 = trunc i64 %index204 to i32 %18 = sub i32 %7, %17 %19 = sext i32 %18 to i64 %20 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %19 %reverse210 = shufflevector <4 x i32> %vec.ind205, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %21 = getelementptr inbounds i32, ptr %20, i64 -3 store <4 x i32> %reverse210, ptr %21, align 4, !tbaa !5 %reverse211 = shufflevector <4 x i32> %step.add206, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %22 = getelementptr inbounds i32, ptr %20, i64 -7 store <4 x i32> %reverse211, ptr %22, align 4, !tbaa !5 %index.next212 = add nuw i64 %index204, 8 %vec.ind.next208 = add <4 x i32> %vec.ind205, <i32 8, i32 8, i32 8, i32 8> %23 = icmp eq i64 %index.next212, %n.vec199 br i1 %23, label %middle.block194, label %vector.body203, !llvm.loop !12 middle.block194: ; preds = %vector.body203 %cmp.n202 = icmp eq i64 %10, %n.vec199 br i1 %cmp.n202, label %if.end51, label %for.body17.preheader for.body17.preheader: ; preds = %vector.scevcheck190, %for.body17.lr.ph, %middle.block194 %indvars.iv167.ph = phi i64 [ 1, %vector.scevcheck190 ], [ 1, %for.body17.lr.ph ], [ %ind.end200, %middle.block194 ] %24 = sub nsw i64 %wide.trip.count170, %indvars.iv167.ph %25 = xor i64 %indvars.iv167.ph, -1 %26 = add nsw i64 %25, %wide.trip.count170 %xtraiter216 = and i64 %24, 3 %lcmp.mod217.not = icmp eq i64 %xtraiter216, 0 br i1 %lcmp.mod217.not, label %for.body17.prol.loopexit, label %for.body17.prol for.body17.prol: ; preds = %for.body17.preheader, %for.body17.prol %indvars.iv167.prol = phi i64 [ %indvars.iv.next168.prol, %for.body17.prol ], [ %indvars.iv167.ph, %for.body17.preheader ] %prol.iter218 = phi i64 [ %prol.iter218.next, %for.body17.prol ], [ 0, %for.body17.preheader ] %27 = trunc i64 %indvars.iv167.prol to i32 %sub19.prol = sub i32 %add18, %27 %idxprom20.prol = sext i32 %sub19.prol to i64 %arrayidx21.prol = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom20.prol store i32 %27, ptr %arrayidx21.prol, align 4, !tbaa !5 %indvars.iv.next168.prol = add nuw nsw i64 %indvars.iv167.prol, 1 %prol.iter218.next = add i64 %prol.iter218, 1 %prol.iter218.cmp.not = icmp eq i64 %prol.iter218.next, %xtraiter216 br i1 %prol.iter218.cmp.not, label %for.body17.prol.loopexit, label %for.body17.prol, !llvm.loop !15 for.body17.prol.loopexit: ; preds = %for.body17.prol, %for.body17.preheader %indvars.iv167.unr = phi i64 [ %indvars.iv167.ph, %for.body17.preheader ], [ %indvars.iv.next168.prol, %for.body17.prol ] %28 = icmp ult i64 %26, 3 br i1 %28, label %if.end51, label %for.body17 for.body17: ; preds = %for.body17.prol.loopexit, %for.body17 %indvars.iv167 = phi i64 [ %indvars.iv.next168.3, %for.body17 ], [ %indvars.iv167.unr, %for.body17.prol.loopexit ] %29 = trunc i64 %indvars.iv167 to i32 %sub19 = sub i32 %add18, %29 %idxprom20 = sext i32 %sub19 to i64 %arrayidx21 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom20 store i32 %29, ptr %arrayidx21, align 4, !tbaa !5 %30 = trunc i64 %indvars.iv167 to i32 %31 = add i32 %30, 1 %sub19.1 = sub i32 %add18, %31 %idxprom20.1 = sext i32 %sub19.1 to i64 %arrayidx21.1 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom20.1 store i32 %31, ptr %arrayidx21.1, align 4, !tbaa !5 %32 = trunc i64 %indvars.iv167 to i32 %33 = add i32 %32, 2 %sub19.2 = sub i32 %add18, %33 %idxprom20.2 = sext i32 %sub19.2 to i64 %arrayidx21.2 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom20.2 store i32 %33, ptr %arrayidx21.2, align 4, !tbaa !5 %34 = trunc i64 %indvars.iv167 to i32 %35 = add i32 %34, 3 %sub19.3 = sub i32 %add18, %35 %idxprom20.3 = sext i32 %sub19.3 to i64 %arrayidx21.3 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom20.3 store i32 %35, ptr %arrayidx21.3, align 4, !tbaa !5 %indvars.iv.next168.3 = add nuw nsw i64 %indvars.iv167, 4 %exitcond171.not.3 = icmp eq i64 %indvars.iv.next168.3, %wide.trip.count170 br i1 %exitcond171.not.3, label %if.end51, label %for.body17, !llvm.loop !17 for.cond33.preheader: ; preds = %for.end %cmp35.not.not151 = icmp sgt i32 %.lcssa140, 1 %add38 = add nsw i32 %7, 1 br i1 %cmp35.not.not151, label %for.body37.lr.ph, label %for.end44 for.body37.lr.ph: ; preds = %for.cond33.preheader %wide.trip.count = zext i32 %.lcssa140 to i64 %36 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %.lcssa140, 17 br i1 %min.iters.check, label %for.body37.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %for.body37.lr.ph %37 = add nsw i64 %wide.trip.count, -2 %38 = trunc i64 %37 to i32 %39 = sub i32 %7, %38 %40 = icmp sgt i32 %39, %7 %41 = icmp ugt i64 %37, 4294967295 %42 = or i1 %40, %41 br i1 %42, label %for.body37.preheader, label %vector.ph vector.ph: ; preds = %vector.scevcheck %n.vec = and i64 %36, -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.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %43 = trunc i64 %index to i32 %44 = sub i32 %7, %43 %45 = sext i32 %44 to i64 %46 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %45 %reverse = shufflevector <4 x i32> %vec.ind, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %47 = getelementptr inbounds i32, ptr %46, i64 -3 store <4 x i32> %reverse, ptr %47, align 4, !tbaa !5 %reverse189 = shufflevector <4 x i32> %step.add, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %48 = getelementptr inbounds i32, ptr %46, i64 -7 store <4 x i32> %reverse189, ptr %48, align 4, !tbaa !5 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %49 = icmp eq i64 %index.next, %n.vec br i1 %49, label %middle.block, label %vector.body, !llvm.loop !18 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %36, %n.vec br i1 %cmp.n, label %for.end44, label %for.body37.preheader for.body37.preheader: ; preds = %vector.scevcheck, %for.body37.lr.ph, %middle.block %indvars.iv164.ph = phi i64 [ 1, %vector.scevcheck ], [ 1, %for.body37.lr.ph ], [ %ind.end, %middle.block ] %50 = sub nsw i64 %wide.trip.count, %indvars.iv164.ph %51 = xor i64 %indvars.iv164.ph, -1 %52 = add nsw i64 %51, %wide.trip.count %xtraiter = and i64 %50, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body37.prol.loopexit, label %for.body37.prol for.body37.prol: ; preds = %for.body37.preheader, %for.body37.prol %indvars.iv164.prol = phi i64 [ %indvars.iv.next165.prol, %for.body37.prol ], [ %indvars.iv164.ph, %for.body37.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body37.prol ], [ 0, %for.body37.preheader ] %53 = trunc i64 %indvars.iv164.prol to i32 %sub39.prol = sub i32 %add38, %53 %idxprom40.prol = sext i32 %sub39.prol to i64 %arrayidx41.prol = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom40.prol store i32 %53, ptr %arrayidx41.prol, align 4, !tbaa !5 %indvars.iv.next165.prol = add nuw nsw i64 %indvars.iv164.prol, 1 %prol.iter.next = add i64 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body37.prol.loopexit, label %for.body37.prol, !llvm.loop !19 for.body37.prol.loopexit: ; preds = %for.body37.prol, %for.body37.preheader %indvars.iv164.unr = phi i64 [ %indvars.iv164.ph, %for.body37.preheader ], [ %indvars.iv.next165.prol, %for.body37.prol ] %54 = icmp ult i64 %52, 3 br i1 %54, label %for.end44, label %for.body37 for.body37: ; preds = %for.body37.prol.loopexit, %for.body37 %indvars.iv164 = phi i64 [ %indvars.iv.next165.3, %for.body37 ], [ %indvars.iv164.unr, %for.body37.prol.loopexit ] %55 = trunc i64 %indvars.iv164 to i32 %sub39 = sub i32 %add38, %55 %idxprom40 = sext i32 %sub39 to i64 %arrayidx41 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom40 store i32 %55, ptr %arrayidx41, align 4, !tbaa !5 %56 = trunc i64 %indvars.iv164 to i32 %57 = add i32 %56, 1 %sub39.1 = sub i32 %add38, %57 %idxprom40.1 = sext i32 %sub39.1 to i64 %arrayidx41.1 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom40.1 store i32 %57, ptr %arrayidx41.1, align 4, !tbaa !5 %58 = trunc i64 %indvars.iv164 to i32 %59 = add i32 %58, 2 %sub39.2 = sub i32 %add38, %59 %idxprom40.2 = sext i32 %sub39.2 to i64 %arrayidx41.2 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom40.2 store i32 %59, ptr %arrayidx41.2, align 4, !tbaa !5 %60 = trunc i64 %indvars.iv164 to i32 %61 = add i32 %60, 3 %sub39.3 = sub i32 %add38, %61 %idxprom40.3 = sext i32 %sub39.3 to i64 %arrayidx41.3 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom40.3 store i32 %61, ptr %arrayidx41.3, align 4, !tbaa !5 %indvars.iv.next165.3 = add nuw nsw i64 %indvars.iv164, 4 %exitcond.not.3 = icmp eq i64 %indvars.iv.next165.3, %wide.trip.count br i1 %exitcond.not.3, label %for.end44, label %for.body37, !llvm.loop !20 for.end44: ; preds = %for.body37.prol.loopexit, %for.body37, %middle.block, %for.cond33.preheader %idxprom45 = sext i32 %7 to i64 %arrayidx46 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom45 %62 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %sub48 = sub i32 %add38, %.lcssa140 %idxprom49 = sext i32 %sub48 to i64 %arrayidx50 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom49 store i32 %62, ptr %arrayidx50, align 4, !tbaa !5 br label %if.end51 if.end51: ; preds = %for.body17.prol.loopexit, %for.body17, %middle.block194, %for.cond14.preheader, %for.end, %for.end44 %cmp55153 = icmp sgt i32 %sub.lcssa, 0 br i1 %cmp55153, label %for.body57.lr.ph, label %for.cond76.preheader for.body57.lr.ph: ; preds = %if.end51 %add52 = add nsw i32 %.lcssa140, 1 %add67 = add i32 %.lcssa140, -1 %63 = zext i32 %sub.lcssa to i64 %xtraiter219 = and i64 %63, 1 %lcmp.mod220.not = icmp eq i64 %xtraiter219, 0 br i1 %lcmp.mod220.not, label %for.body57.prol.loopexit, label %for.body57.prol for.body57.prol: ; preds = %for.body57.lr.ph %arrayidx59.prol = getelementptr inbounds [55 x i32], ptr %otv, i64 0, i64 %63 %64 = load i32, ptr %arrayidx59.prol, align 4, !tbaa !5 %cmp60.prol = icmp eq i32 %64, 1 br i1 %cmp60.prol, label %if.then62.prol, label %if.else66.prol if.else66.prol: ; preds = %for.body57.prol %sub68.prol = add i32 %add67, %sub.lcssa %idxprom69.prol = sext i32 %sub68.prol to i64 %arrayidx70.prol = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom69.prol %65 = load i32, ptr %arrayidx70.prol, align 4, !tbaa !5 br label %for.inc74.prol if.then62.prol: ; preds = %for.body57.prol %add65.prol = add nsw i32 %.lcssa140, 2 br label %for.inc74.prol for.inc74.prol: ; preds = %if.then62.prol, %if.else66.prol %.sink178.prol = phi i32 [ %add52, %if.then62.prol ], [ %65, %if.else66.prol ] %tek.1.prol = phi i32 [ %add65.prol, %if.then62.prol ], [ %add52, %if.else66.prol ] %66 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %63 store i32 %.sink178.prol, ptr %66, align 4 %indvars.iv.next173.prol = add nsw i64 %63, -1 br label %for.body57.prol.loopexit for.body57.prol.loopexit: ; preds = %for.inc74.prol, %for.body57.lr.ph %indvars.iv172.unr = phi i64 [ %63, %for.body57.lr.ph ], [ %indvars.iv.next173.prol, %for.inc74.prol ] %tek.0155.unr = phi i32 [ %add52, %for.body57.lr.ph ], [ %tek.1.prol, %for.inc74.prol ] %67 = icmp eq i32 %sub.lcssa, 1 br i1 %67, label %for.cond76.preheader, label %for.body57 for.cond76.preheader: ; preds = %for.body57.prol.loopexit, %for.inc74.1, %if.end51 %cmp78.not.not156 = icmp sgt i32 %7, 1 br i1 %cmp78.not.not156, label %for.body80, label %for.cond76.preheader.for.end99_crit_edge for.cond76.preheader.for.end99_crit_edge: ; preds = %for.cond76.preheader %.pre = sext i32 %7 to i64 br label %for.end99 for.body57: ; preds = %for.body57.prol.loopexit, %for.inc74.1 %indvars.iv172 = phi i64 [ %indvars.iv.next173.1, %for.inc74.1 ], [ %indvars.iv172.unr, %for.body57.prol.loopexit ] %tek.0155 = phi i32 [ %tek.1.1, %for.inc74.1 ], [ %tek.0155.unr, %for.body57.prol.loopexit ] %arrayidx59 = getelementptr inbounds [55 x i32], ptr %otv, i64 0, i64 %indvars.iv172 %68 = load i32, ptr %arrayidx59, align 4, !tbaa !5 %cmp60 = icmp eq i32 %68, 1 br i1 %cmp60, label %if.then62, label %if.else66 if.then62: ; preds = %for.body57 %add65 = add nsw i32 %tek.0155, 1 br label %for.inc74 if.else66: ; preds = %for.body57 %69 = trunc i64 %indvars.iv172 to i32 %sub68 = add i32 %add67, %69 %idxprom69 = sext i32 %sub68 to i64 %arrayidx70 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom69 %70 = load i32, ptr %arrayidx70, align 4, !tbaa !5 br label %for.inc74 for.inc74: ; preds = %if.then62, %if.else66 %.sink178 = phi i32 [ %tek.0155, %if.then62 ], [ %70, %if.else66 ] %tek.1 = phi i32 [ %add65, %if.then62 ], [ %tek.0155, %if.else66 ] %71 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %indvars.iv172 store i32 %.sink178, ptr %71, align 4 %indvars.iv.next173 = add nsw i64 %indvars.iv172, -1 %arrayidx59.1 = getelementptr inbounds [55 x i32], ptr %otv, i64 0, i64 %indvars.iv.next173 %72 = load i32, ptr %arrayidx59.1, align 4, !tbaa !5 %cmp60.1 = icmp eq i32 %72, 1 br i1 %cmp60.1, label %if.then62.1, label %if.else66.1 if.else66.1: ; preds = %for.inc74 %73 = trunc i64 %indvars.iv.next173 to i32 %sub68.1 = add i32 %add67, %73 %idxprom69.1 = sext i32 %sub68.1 to i64 %arrayidx70.1 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom69.1 %74 = load i32, ptr %arrayidx70.1, align 4, !tbaa !5 br label %for.inc74.1 if.then62.1: ; preds = %for.inc74 %add65.1 = add nsw i32 %tek.1, 1 br label %for.inc74.1 for.inc74.1: ; preds = %if.then62.1, %if.else66.1 %.sink178.1 = phi i32 [ %tek.1, %if.then62.1 ], [ %74, %if.else66.1 ] %tek.1.1 = phi i32 [ %add65.1, %if.then62.1 ], [ %tek.1, %if.else66.1 ] %75 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %indvars.iv.next173 store i32 %.sink178.1, ptr %75, align 4 %indvars.iv.next173.1 = add nsw i64 %indvars.iv172, -2 %cmp55.1 = icmp sgt i64 %indvars.iv172, 2 br i1 %cmp55.1, label %for.body57, label %for.cond76.preheader, !llvm.loop !21 for.body80: ; preds = %for.cond76.preheader, %for.body80 %indvars.iv175 = phi i64 [ %indvars.iv.next176, %for.body80 ], [ 1, %for.cond76.preheader ] %arrayidx82 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %indvars.iv175 %76 = load i32, ptr %arrayidx82, align 4, !tbaa !5 %cmp83 = icmp slt i32 %76, 26 %. = select i1 %cmp83, i32 96, i32 71 %.str.2..str.3 = select i1 %cmp83, ptr @.str.2, ptr @.str.3 %add88 = add nsw i32 %76, %. %call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %add88) %indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1 %77 = load i32, ptr %n, align 4, !tbaa !5 %78 = sext i32 %77 to i64 %cmp78.not.not = icmp slt i64 %indvars.iv.next176, %78 br i1 %cmp78.not.not, label %for.body80, label %for.end99, !llvm.loop !22 for.end99: ; preds = %for.body80, %for.cond76.preheader.for.end99_crit_edge %idxprom100.pre-phi = phi i64 [ %.pre, %for.cond76.preheader.for.end99_crit_edge ], [ %78, %for.body80 ] %arrayidx101 = getelementptr inbounds [55 x i32], ptr %sol, i64 0, i64 %idxprom100.pre-phi %79 = load i32, ptr %arrayidx101, align 4, !tbaa !5 %cmp102 = icmp slt i32 %79, 26 %.184 = select i1 %cmp102, i32 96, i32 71 %.str.4..str.5 = select i1 %cmp102, ptr @.str.4, ptr @.str.5 %sub113 = add nsw i32 %79, %.184 %call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4..str.5, i32 noundef %sub113) call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %otv) #3 call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %sol) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !16} !16 = !{!"llvm.loop.unroll.disable"} !17 = distinct !{!17, !11, !13} !18 = distinct !{!18, !11, !13, !14} !19 = distinct !{!19, !16} !20 = distinct !{!20, !11, !13} !21 = distinct !{!21, !11} !22 = distinct !{!22, !11}
#include<stdio.h> #include<stdlib.h> #include<string.h> int top,S[1000]; void push(int x){ top++; S[top]=x; } int pop(){ top--; return S[top+1]; } int main(){ int a,b; top=0; char s[100]; while((scanf("%s",s))!=EOF){ if(s[0]=='+'){ a=pop(); b=pop(); push(a+b); } else if(s[0]=='-'){ b=pop(); a=pop(); push(a-b); } else if(s[0]=='*'){ a=pop(); b=pop(); push(a*b); } else{ push(atoi(s)); //printf("%d",atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286232/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286232/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int main(void){ char c[10000]; int a[2000]; int i=0,j=0; while(scanf("%s",c) != EOF){ switch(c[0]){ case '%': a[i-2]=a[i-1]/a[i-2]; i--; break; case '*': a[i-2]=a[i-1]*a[i-2]; i--; break; case '+': a[i-2]=a[i-1]+a[i-2]; i--; break; case '-': a[i-2]=a[i-2]-a[i-1]; i--; break; default: a[i]=atoi(c); i++; break; } } printf("%d\n",a[i-1]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286283/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286283/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %c = alloca [10000 x i8], align 16 %a = alloca [2000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %a) #4 %call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %cmp.not69 = icmp eq i32 %call68, -1 br i1 %cmp.not69, label %while.end, label %while.body while.body: ; preds = %entry, %sw.epilog %i.070 = phi i32 [ %i.1, %sw.epilog ], [ 0, %entry ] %0 = load i8, ptr %c, align 16, !tbaa !5 %conv = sext i8 %0 to i32 switch i32 %conv, label %sw.default [ i32 37, label %sw.bb i32 42, label %sw.bb8 i32 43, label %sw.bb19 i32 45, label %sw.bb30 ] sw.bb: ; preds = %while.body %sub = add nsw i32 %i.070, -1 %idxprom = sext i32 %sub to i64 %arrayidx1 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx1, align 4, !tbaa !8 %sub2 = add nsw i32 %i.070, -2 %idxprom3 = sext i32 %sub2 to i64 %arrayidx4 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom3 %2 = load i32, ptr %arrayidx4, align 4, !tbaa !8 %div = sdiv i32 %1, %2 store i32 %div, ptr %arrayidx4, align 4, !tbaa !8 br label %sw.epilog sw.bb8: ; preds = %while.body %sub9 = add nsw i32 %i.070, -1 %idxprom10 = sext i32 %sub9 to i64 %arrayidx11 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom10 %3 = load i32, ptr %arrayidx11, align 4, !tbaa !8 %sub12 = add nsw i32 %i.070, -2 %idxprom13 = sext i32 %sub12 to i64 %arrayidx14 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom13 %4 = load i32, ptr %arrayidx14, align 4, !tbaa !8 %mul = mul nsw i32 %4, %3 store i32 %mul, ptr %arrayidx14, align 4, !tbaa !8 br label %sw.epilog sw.bb19: ; preds = %while.body %sub20 = add nsw i32 %i.070, -1 %idxprom21 = sext i32 %sub20 to i64 %arrayidx22 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom21 %5 = load i32, ptr %arrayidx22, align 4, !tbaa !8 %sub23 = add nsw i32 %i.070, -2 %idxprom24 = sext i32 %sub23 to i64 %arrayidx25 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom24 %6 = load i32, ptr %arrayidx25, align 4, !tbaa !8 %add = add nsw i32 %6, %5 store i32 %add, ptr %arrayidx25, align 4, !tbaa !8 br label %sw.epilog sw.bb30: ; preds = %while.body %sub31 = add nsw i32 %i.070, -2 %idxprom32 = sext i32 %sub31 to i64 %arrayidx33 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom32 %7 = load i32, ptr %arrayidx33, align 4, !tbaa !8 %sub34 = add nsw i32 %i.070, -1 %idxprom35 = sext i32 %sub34 to i64 %arrayidx36 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom35 %8 = load i32, ptr %arrayidx36, align 4, !tbaa !8 %sub37 = sub nsw i32 %7, %8 store i32 %sub37, ptr %arrayidx33, align 4, !tbaa !8 br label %sw.epilog sw.default: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %c, ptr noundef null, i32 noundef 10) #4 %conv.i = trunc i64 %call.i to i32 %idxprom44 = sext i32 %i.070 to i64 %arrayidx45 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom44 store i32 %conv.i, ptr %arrayidx45, align 4, !tbaa !8 %inc = add nsw i32 %i.070, 1 br label %sw.epilog sw.epilog: ; preds = %sw.default, %sw.bb30, %sw.bb19, %sw.bb8, %sw.bb %i.1 = phi i32 [ %inc, %sw.default ], [ %sub34, %sw.bb30 ], [ %sub20, %sw.bb19 ], [ %sub9, %sw.bb8 ], [ %sub, %sw.bb ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10 while.end.loopexit: ; preds = %sw.epilog %9 = add nsw i32 %i.1, -1 %10 = sext i32 %9 to i64 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %i.0.lcssa = phi i64 [ -1, %entry ], [ %10, %while.end.loopexit ] %arrayidx48 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %i.0.lcssa %11 = load i32, ptr %arrayidx48, align 4, !tbaa !8 %call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11) call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %c) #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: 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; int pop() { top--; return S[top + 1]; } void push(int x) { S[++top] = x; } int main() { int a, b; top = 0; char s[100]; while(scanf("%s", s) != EOF) { if(s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { a = pop(); b = pop(); push(b - a); } else if (s[0] == '*') { a = pop(); b = pop(); push(a * b); } else { push(atoi(s)); } } printf("%d\n", pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286333/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286333/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int data[200]; int sp=0; void push(int x){ data[sp++] = x; } int pop(){ return data[--sp]; } void stack_plus(){ push( pop() + pop() ); } void stack_minus(){ int x = pop(); push( pop() - x ); } void stack_load(){ push( pop() * pop() ); } int main(){ char ch[100]; int x; while(scanf("%s",ch) != EOF){ if(ch[0] == '+'){ stack_plus(); }else if(ch[0] == '-'){ stack_minus(); }else if(ch[0] == '*'){ stack_load(); }else{ x = atoi(ch); push(x); } //printf("%d\n",data[0]); } printf("%d\n",data[0]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286377/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286377/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @sp = dso_local local_unnamed_addr global i32 0, align 4 @data = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @sp, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @sp, align 4, !tbaa !5 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @stack_plus() local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i = add nsw i32 %0, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i %1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %dec.i2 = add nsw i32 %0, -2 %idxprom.i3 = sext i32 %dec.i2 to i64 %arrayidx.i4 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3 %2 = load i32, ptr %arrayidx.i4, align 4, !tbaa !5 %add = add nsw i32 %2, %1 store i32 %dec.i, ptr @sp, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i4, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @stack_minus() local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i = add nsw i32 %0, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i %1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %dec.i2 = add nsw i32 %0, -2 %idxprom.i3 = sext i32 %dec.i2 to i64 %arrayidx.i4 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3 %2 = load i32, ptr %arrayidx.i4, align 4, !tbaa !5 %sub = sub nsw i32 %2, %1 store i32 %dec.i, ptr @sp, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i4, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @stack_load() local_unnamed_addr #0 { entry: %0 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i = add nsw i32 %0, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i %1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %dec.i2 = add nsw i32 %0, -2 %idxprom.i3 = sext i32 %dec.i2 to i64 %arrayidx.i4 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3 %2 = load i32, ptr %arrayidx.i4, align 4, !tbaa !5 %mul = mul nsw i32 %2, %1 store i32 %dec.i, ptr @sp, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i4, align 4, !tbaa !5 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %ch = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %ch) #5 %call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch) %cmp.not33 = icmp eq i32 %call32, -1 br i1 %cmp.not33, label %while.end, label %while.body while.body: ; preds = %entry, %if.end18 %0 = load i8, ptr %ch, align 16, !tbaa !9 switch i8 %0, label %if.else14 [ i8 43, label %if.then i8 45, label %if.then7 i8 42, label %if.then13 ] if.then: ; preds = %while.body %1 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i.i = add nsw i32 %1, -1 %idxprom.i.i = sext i32 %dec.i.i to i64 %arrayidx.i.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i.i %2 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5 %dec.i2.i = add nsw i32 %1, -2 %idxprom.i3.i = sext i32 %dec.i2.i to i64 %arrayidx.i4.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3.i %3 = load i32, ptr %arrayidx.i4.i, align 4, !tbaa !5 %add.i = add nsw i32 %3, %2 store i32 %dec.i.i, ptr @sp, align 4, !tbaa !5 store i32 %add.i, ptr %arrayidx.i4.i, align 4, !tbaa !5 br label %if.end18 if.then7: ; preds = %while.body %4 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i.i20 = add nsw i32 %4, -1 %idxprom.i.i21 = sext i32 %dec.i.i20 to i64 %arrayidx.i.i22 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i.i21 %5 = load i32, ptr %arrayidx.i.i22, align 4, !tbaa !5 %dec.i2.i23 = add nsw i32 %4, -2 %idxprom.i3.i24 = sext i32 %dec.i2.i23 to i64 %arrayidx.i4.i25 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3.i24 %6 = load i32, ptr %arrayidx.i4.i25, align 4, !tbaa !5 %sub.i = sub nsw i32 %6, %5 store i32 %dec.i.i20, ptr @sp, align 4, !tbaa !5 store i32 %sub.i, ptr %arrayidx.i4.i25, align 4, !tbaa !5 br label %if.end18 if.then13: ; preds = %while.body %7 = load i32, ptr @sp, align 4, !tbaa !5 %dec.i.i26 = add nsw i32 %7, -1 %idxprom.i.i27 = sext i32 %dec.i.i26 to i64 %arrayidx.i.i28 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i.i27 %8 = load i32, ptr %arrayidx.i.i28, align 4, !tbaa !5 %dec.i2.i29 = add nsw i32 %7, -2 %idxprom.i3.i30 = sext i32 %dec.i2.i29 to i64 %arrayidx.i4.i31 = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i3.i30 %9 = load i32, ptr %arrayidx.i4.i31, align 4, !tbaa !5 %mul.i = mul nsw i32 %9, %8 store i32 %dec.i.i26, ptr @sp, align 4, !tbaa !5 store i32 %mul.i, ptr %arrayidx.i4.i31, align 4, !tbaa !5 br label %if.end18 if.else14: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %ch, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @sp, align 4, !tbaa !5 %inc.i = add nsw i32 %10, 1 store i32 %inc.i, ptr @sp, align 4, !tbaa !5 %idxprom.i = sext i32 %10 to i64 %arrayidx.i = getelementptr inbounds [200 x i32], ptr @data, i64 0, i64 %idxprom.i store i32 %conv.i, ptr %arrayidx.i, align 4, !tbaa !5 br label %if.end18 if.end18: ; preds = %if.then7, %if.else14, %if.then13, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end18, %entry %11 = load i32, ptr @data, align 16, !tbaa !5 %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %ch) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int top,S[100]; void push(int x){ top++; S[top] = x; } int pop(void){ top--; return S[top+1]; } int main(void){ int a,b; top = 0; char s[100]; while(scanf("%s", s) != EOF){ if(s[0] == '+'){ a = pop(); b = pop(); push(a + b); }else if(s[0] == '-'){ a = pop(); b = pop(); push(b - a); }else if(s[0] == '*'){ a = pop(); b = pop(); push(a * b); }else{ push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286434/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286434/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #define OPR 100 #define ENZ 99 int stack[OPR+ENZ],pointer; void push(int op){ stack[++pointer]=op; } int pop(void){ pointer--; return stack[pointer+1]; } int main(){ int x,y; pointer=0; char data[OPR]; while(scanf("%s",data)!=EOF){ switch(data[0]){ case '+': x = pop(); y = pop(); push(x+y); break; case '-': x = pop(); y = pop(); push(y-x); break; case '*': x = pop(); y = pop(); push(x*y); break; default : push(atoi(data)); break; } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286485/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286485/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stack = dso_local local_unnamed_addr global [199 x i32] zeroinitializer, align 16 @pointer = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %op) local_unnamed_addr #0 { entry: %0 = load i32, ptr @pointer, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @pointer, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom store i32 %op, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @pointer, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @pointer, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %data = alloca [100 x i8], align 16 store i32 0, ptr @pointer, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %data) #5 %call46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data) %cmp.not47 = icmp eq i32 %call46, -1 br i1 %cmp.not47, label %while.end, label %while.body while.body: ; preds = %entry, %sw.epilog %0 = load i8, ptr %data, align 16, !tbaa !9 %conv = sext i8 %0 to i32 switch i32 %conv, label %sw.default [ i32 43, label %sw.bb i32 45, label %sw.bb3 i32 42, label %sw.bb6 ] sw.bb: ; preds = %while.body %1 = load i32, ptr @pointer, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i18 = sext i32 %dec.i to i64 %arrayidx.i19 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i18 %3 = load i32, ptr %arrayidx.i19, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @pointer, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i19, align 4, !tbaa !5 br label %sw.epilog sw.bb3: ; preds = %while.body %4 = load i32, ptr @pointer, align 4, !tbaa !5 %dec.i22 = add nsw i32 %4, -1 %idxprom.i23 = sext i32 %4 to i64 %arrayidx.i24 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i23 %5 = load i32, ptr %arrayidx.i24, align 4, !tbaa !5 %idxprom.i26 = sext i32 %dec.i22 to i64 %arrayidx.i27 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i26 %6 = load i32, ptr %arrayidx.i27, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i22, ptr @pointer, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i27, align 4, !tbaa !5 br label %sw.epilog sw.bb6: ; preds = %while.body %7 = load i32, ptr @pointer, align 4, !tbaa !5 %dec.i31 = add nsw i32 %7, -1 %idxprom.i32 = sext i32 %7 to i64 %arrayidx.i33 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i32 %8 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %idxprom.i35 = sext i32 %dec.i31 to i64 %arrayidx.i36 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i35 %9 = load i32, ptr %arrayidx.i36, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i31, ptr @pointer, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i36, align 4, !tbaa !5 br label %sw.epilog sw.default: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %data, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @pointer, align 4, !tbaa !5 %inc.i40 = add nsw i32 %10, 1 store i32 %inc.i40, ptr @pointer, align 4, !tbaa !5 %idxprom.i41 = sext i32 %inc.i40 to i64 %arrayidx.i42 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i41 store i32 %conv.i, ptr %arrayidx.i42, align 4, !tbaa !5 br label %sw.epilog sw.epilog: ; preds = %sw.default, %sw.bb6, %sw.bb3, %sw.bb %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %sw.epilog, %entry %11 = load i32, ptr @pointer, align 4, !tbaa !5 %dec.i43 = add nsw i32 %11, -1 store i32 %dec.i43, ptr @pointer, align 4, !tbaa !5 %idxprom.i44 = sext i32 %11 to i64 %arrayidx.i45 = getelementptr inbounds [199 x i32], ptr @stack, i64 0, i64 %idxprom.i44 %12 = load i32, ptr %arrayidx.i45, align 4, !tbaa !5 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %data) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> int top,S[1000]; void push(int x){ S[++top]=x; } int pop(){ top--; return S[top+1]; } int main(){ int a,b; top=0; char s[100]; while(scanf("%s",s)!=EOF){ if(s[0]=='+'){ a=pop(); b=pop(); push(a+b); }else if(s[0]=='-'){ b=pop(); a=pop(); push(a-b); }else if(s[0]=='*'){ a=pop(); b=pop(); push(a*b); }else{ push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286542/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286542/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <ctype.h> int main() { int stack[100],top=0,n1,n2; char buf[1000000],*p; fgets(p=buf,400,stdin); while (*p >= ' ') { while (isspace(*p)) p++; if (isdigit(*p)) { n1=0; while (isdigit(*p))n1=(10*n1)+(*p++ & 0xf); stack[top++] = n1; } else { n1 = stack[--top]; n2 = stack[--top]; if (*p=='+') n2=n2+n1; else if (*p=='-') n2=n2-n1; else if (*p=='*') n2=n2*n1; stack[top++]=n2; p=p+1; } } printf("%d",stack[--top]); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286586/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286586/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %stack = alloca [100 x i32], align 16 %buf = alloca [1000000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %stack) #5 call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %buf) #5 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 400, ptr noundef %0) %1 = load i8, ptr %buf, align 16, !tbaa !9 %cmp99 = icmp sgt i8 %1, 31 br i1 %cmp99, label %while.cond2.preheader.lr.ph, label %while.end56 while.cond2.preheader.lr.ph: ; preds = %entry %call3 = tail call ptr @__ctype_b_loc() #6 %2 = load ptr, ptr %call3, align 8, !tbaa !5 br label %while.cond2.preheader while.cond2.preheader: ; preds = %while.cond2.preheader.lr.ph, %if.end55 %3 = phi i8 [ %1, %while.cond2.preheader.lr.ph ], [ %16, %if.end55 ] %p.0101 = phi ptr [ %buf, %while.cond2.preheader.lr.ph ], [ %p.3, %if.end55 ] %top.0100 = phi i32 [ 0, %while.cond2.preheader.lr.ph ], [ %top.1, %if.end55 ] %idxprom83 = zext i8 %3 to i64 %arrayidx84 = getelementptr inbounds i16, ptr %2, i64 %idxprom83 %4 = load i16, ptr %arrayidx84, align 2, !tbaa !10 %conv585 = zext i16 %4 to i32 %and86 = and i32 %conv585, 8192 %tobool.not87 = icmp eq i32 %and86, 0 br i1 %tobool.not87, label %while.end, label %while.body6 while.body6: ; preds = %while.cond2.preheader, %while.body6 %p.188 = phi ptr [ %incdec.ptr, %while.body6 ], [ %p.0101, %while.cond2.preheader ] %incdec.ptr = getelementptr inbounds i8, ptr %p.188, i64 1 %.pr = load i8, ptr %incdec.ptr, align 1, !tbaa !9 %idxprom = sext i8 %.pr to i64 %arrayidx = getelementptr inbounds i16, ptr %2, i64 %idxprom %5 = load i16, ptr %arrayidx, align 2, !tbaa !10 %conv5 = zext i16 %5 to i32 %and = and i32 %conv5, 8192 %tobool.not = icmp eq i32 %and, 0 br i1 %tobool.not, label %while.end, label %while.body6, !llvm.loop !12 while.end: ; preds = %while.body6, %while.cond2.preheader %6 = phi i16 [ %4, %while.cond2.preheader ], [ %5, %while.body6 ] %7 = phi i8 [ %3, %while.cond2.preheader ], [ %.pr, %while.body6 ] %p.1.lcssa = phi ptr [ %p.0101, %while.cond2.preheader ], [ %incdec.ptr, %while.body6 ] %conv5.lcssa = phi i32 [ %conv585, %while.cond2.preheader ], [ %conv5, %while.body6 ] %and12 = and i32 %conv5.lcssa, 2048 %tobool13.not = icmp eq i32 %and12, 0 br i1 %tobool13.not, label %if.else, label %while.cond14.preheader while.cond14.preheader: ; preds = %while.end %8 = and i16 %6, 2048 %tobool21.not94 = icmp eq i16 %8, 0 br i1 %tobool21.not94, label %while.end26, label %while.body22 while.body22: ; preds = %while.cond14.preheader, %while.body22 %9 = phi i8 [ %11, %while.body22 ], [ %7, %while.cond14.preheader ] %p.296 = phi ptr [ %incdec.ptr23, %while.body22 ], [ %p.1.lcssa, %while.cond14.preheader ] %n1.095 = phi i32 [ %add, %while.body22 ], [ 0, %while.cond14.preheader ] %mul = mul nsw i32 %n1.095, 10 %incdec.ptr23 = getelementptr inbounds i8, ptr %p.296, i64 1 %10 = and i8 %9, 15 %and25 = zext i8 %10 to i32 %add = add nsw i32 %mul, %and25 %11 = load i8, ptr %incdec.ptr23, align 1, !tbaa !9 %idxprom17 = sext i8 %11 to i64 %arrayidx18 = getelementptr inbounds i16, ptr %2, i64 %idxprom17 %12 = load i16, ptr %arrayidx18, align 2, !tbaa !10 %13 = and i16 %12, 2048 %tobool21.not = icmp eq i16 %13, 0 br i1 %tobool21.not, label %while.end26, label %while.body22, !llvm.loop !14 while.end26: ; preds = %while.body22, %while.cond14.preheader %n1.0.lcssa = phi i32 [ 0, %while.cond14.preheader ], [ %add, %while.body22 ] %p.2.lcssa = phi ptr [ %p.1.lcssa, %while.cond14.preheader ], [ %incdec.ptr23, %while.body22 ] %inc = add nsw i32 %top.0100, 1 %idxprom27 = sext i32 %top.0100 to i64 %arrayidx28 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom27 store i32 %n1.0.lcssa, ptr %arrayidx28, align 4, !tbaa !15 br label %if.end55 if.else: ; preds = %while.end %dec = add nsw i32 %top.0100, -1 %idxprom29 = sext i32 %dec to i64 %arrayidx30 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom29 %14 = load i32, ptr %arrayidx30, align 4, !tbaa !15 %dec31 = add nsw i32 %top.0100, -2 %idxprom32 = sext i32 %dec31 to i64 %arrayidx33 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom32 %15 = load i32, ptr %arrayidx33, align 4, !tbaa !15 switch i8 %7, label %if.end51 [ i8 43, label %if.then37 i8 45, label %if.then43 i8 42, label %if.then48 ] if.then37: ; preds = %if.else %add38 = add nsw i32 %15, %14 br label %if.end51 if.then43: ; preds = %if.else %sub = sub nsw i32 %15, %14 br label %if.end51 if.then48: ; preds = %if.else %mul49 = mul nsw i32 %15, %14 br label %if.end51 if.end51: ; preds = %if.else, %if.then43, %if.then48, %if.then37 %n2.0 = phi i32 [ %add38, %if.then37 ], [ %sub, %if.then43 ], [ %mul49, %if.then48 ], [ %15, %if.else ] store i32 %n2.0, ptr %arrayidx33, align 4, !tbaa !15 %add.ptr = getelementptr inbounds i8, ptr %p.1.lcssa, i64 1 br label %if.end55 if.end55: ; preds = %if.end51, %while.end26 %top.1 = phi i32 [ %inc, %while.end26 ], [ %dec, %if.end51 ] %p.3 = phi ptr [ %p.2.lcssa, %while.end26 ], [ %add.ptr, %if.end51 ] %16 = load i8, ptr %p.3, align 1, !tbaa !9 %cmp = icmp sgt i8 %16, 31 br i1 %cmp, label %while.cond2.preheader, label %while.end56.loopexit, !llvm.loop !17 while.end56.loopexit: ; preds = %if.end55 %17 = add nsw i32 %top.1, -1 %18 = sext i32 %17 to i64 br label %while.end56 while.end56: ; preds = %while.end56.loopexit, %entry %top.0.lcssa = phi i64 [ -1, %entry ], [ %18, %while.end56.loopexit ] %arrayidx59 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %top.0.lcssa %19 = load i32, ptr %arrayidx59, align 4, !tbaa !15 %call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %19) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %buf) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %stack) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) declare ptr @__ctype_b_loc() 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: 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 nosync nounwind willreturn memory(none) "no-trapping-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(none) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = !{!11, !11, i64 0} !11 = !{!"short", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13} !15 = !{!16, !16, i64 0} !16 = !{!"int", !7, i64 0} !17 = distinct !{!17, !13}
#include <stdio.h> #include <stdlib.h> int count[199]; int number=0; void push(int x); int pop(); int main(){ char s[199]; int y; while(scanf("%s",s)!=EOF){ switch(s[0]){ case '+': push(pop()+pop()); break; case '*': push(pop()*pop()); break; case '-': y=pop(); push(pop()-y); break; default: push(atoi(s)); break; } } printf("%d\n",pop()); return 0; } void push(int x){ number++; count[number]=x; } int pop(){ number--; return count[number+1]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286629/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286629/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @number = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @count = dso_local local_unnamed_addr global [199 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [199 x i8], align 16 call void @llvm.lifetime.start.p0(i64 199, ptr nonnull %s) #5 %call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not43 = icmp eq i32 %call42, -1 br i1 %cmp.not43, label %while.end, label %while.body while.body: ; preds = %entry, %sw.epilog %0 = load i8, ptr %s, align 16, !tbaa !5 %conv = sext i8 %0 to i32 switch i32 %conv, label %sw.default [ i32 43, label %sw.bb i32 42, label %sw.bb3 i32 45, label %sw.bb6 ] sw.bb: ; preds = %while.body %1 = load i32, ptr @number, align 4, !tbaa !8 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8 %idxprom.i14 = sext i32 %dec.i to i64 %arrayidx.i15 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i14 %3 = load i32, ptr %arrayidx.i15, align 4, !tbaa !8 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @number, align 4, !tbaa !8 store i32 %add, ptr %arrayidx.i15, align 4, !tbaa !8 br label %sw.epilog sw.bb3: ; preds = %while.body %4 = load i32, ptr @number, align 4, !tbaa !8 %dec.i18 = add nsw i32 %4, -1 %idxprom.i19 = sext i32 %4 to i64 %arrayidx.i20 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i19 %5 = load i32, ptr %arrayidx.i20, align 4, !tbaa !8 %idxprom.i22 = sext i32 %dec.i18 to i64 %arrayidx.i23 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i22 %6 = load i32, ptr %arrayidx.i23, align 4, !tbaa !8 %mul = mul nsw i32 %6, %5 store i32 %dec.i18, ptr @number, align 4, !tbaa !8 store i32 %mul, ptr %arrayidx.i23, align 4, !tbaa !8 br label %sw.epilog sw.bb6: ; preds = %while.body %7 = load i32, ptr @number, align 4, !tbaa !8 %dec.i27 = add nsw i32 %7, -1 %idxprom.i28 = sext i32 %7 to i64 %arrayidx.i29 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i28 %8 = load i32, ptr %arrayidx.i29, align 4, !tbaa !8 %idxprom.i31 = sext i32 %dec.i27 to i64 %arrayidx.i32 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i31 %9 = load i32, ptr %arrayidx.i32, align 4, !tbaa !8 %sub = sub nsw i32 %9, %8 store i32 %dec.i27, ptr @number, align 4, !tbaa !8 store i32 %sub, ptr %arrayidx.i32, align 4, !tbaa !8 br label %sw.epilog sw.default: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @number, align 4, !tbaa !8 %inc.i36 = add nsw i32 %10, 1 store i32 %inc.i36, ptr @number, align 4, !tbaa !8 %idxprom.i37 = sext i32 %inc.i36 to i64 %arrayidx.i38 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i37 store i32 %conv.i, ptr %arrayidx.i38, align 4, !tbaa !8 br label %sw.epilog sw.epilog: ; preds = %sw.default, %sw.bb6, %sw.bb3, %sw.bb %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %sw.epilog, %entry %11 = load i32, ptr @number, align 4, !tbaa !8 %dec.i39 = add nsw i32 %11, -1 store i32 %dec.i39, ptr @number, align 4, !tbaa !8 %idxprom.i40 = sext i32 %11 to i64 %arrayidx.i41 = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom.i40 %12 = load i32, ptr %arrayidx.i41, align 4, !tbaa !8 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 199, 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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 { entry: %0 = load i32, ptr @number, align 4, !tbaa !8 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @number, align 4, !tbaa !8 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !8 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(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @number, align 4, !tbaa !8 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @number, align 4, !tbaa !8 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [199 x i32], ptr @count, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !8 ret i32 %1 } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int main(){ char str[16]; int st[100], sn = 0; while(scanf(" %s", str) != EOF){ switch (*str) { case '+': sn--; st[sn - 1] += st[sn]; break; case '-': sn--; st[sn - 1] -= st[sn]; break; case '*': sn--; st[sn - 1] *= st[sn]; break; default: st[sn++] = atoi(str); break; } } printf("%d\n", st[--sn]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286672/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286672/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [16 x i8], align 16 %st = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %str) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %st) #4 %call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not38 = icmp eq i32 %call37, -1 br i1 %cmp.not38, label %while.end, label %while.body while.body: ; preds = %entry, %sw.epilog %sn.039 = phi i32 [ %sn.1, %sw.epilog ], [ 0, %entry ] %0 = load i8, ptr %str, align 16, !tbaa !5 %conv = sext i8 %0 to i32 switch i32 %conv, label %sw.default [ i32 43, label %sw.bb i32 45, label %sw.bb4 i32 42, label %sw.bb12 ] sw.bb: ; preds = %while.body %dec = add nsw i32 %sn.039, -1 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !8 %sub = add nsw i32 %sn.039, -2 %idxprom2 = sext i32 %sub to i64 %arrayidx3 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom2 %2 = load i32, ptr %arrayidx3, align 4, !tbaa !8 %add = add nsw i32 %2, %1 store i32 %add, ptr %arrayidx3, align 4, !tbaa !8 br label %sw.epilog sw.bb4: ; preds = %while.body %dec5 = add nsw i32 %sn.039, -1 %idxprom6 = sext i32 %dec5 to i64 %arrayidx7 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom6 %3 = load i32, ptr %arrayidx7, align 4, !tbaa !8 %sub8 = add nsw i32 %sn.039, -2 %idxprom9 = sext i32 %sub8 to i64 %arrayidx10 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom9 %4 = load i32, ptr %arrayidx10, align 4, !tbaa !8 %sub11 = sub nsw i32 %4, %3 store i32 %sub11, ptr %arrayidx10, align 4, !tbaa !8 br label %sw.epilog sw.bb12: ; preds = %while.body %dec13 = add nsw i32 %sn.039, -1 %idxprom14 = sext i32 %dec13 to i64 %arrayidx15 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom14 %5 = load i32, ptr %arrayidx15, align 4, !tbaa !8 %sub16 = add nsw i32 %sn.039, -2 %idxprom17 = sext i32 %sub16 to i64 %arrayidx18 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom17 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !8 %mul = mul nsw i32 %6, %5 store i32 %mul, ptr %arrayidx18, align 4, !tbaa !8 br label %sw.epilog sw.default: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #4 %conv.i = trunc i64 %call.i to i32 %inc = add nsw i32 %sn.039, 1 %idxprom21 = sext i32 %sn.039 to i64 %arrayidx22 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %idxprom21 store i32 %conv.i, ptr %arrayidx22, align 4, !tbaa !8 br label %sw.epilog sw.epilog: ; preds = %sw.default, %sw.bb12, %sw.bb4, %sw.bb %sn.1 = phi i32 [ %inc, %sw.default ], [ %dec13, %sw.bb12 ], [ %dec5, %sw.bb4 ], [ %dec, %sw.bb ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10 while.end.loopexit: ; preds = %sw.epilog %7 = add nsw i32 %sn.1, -1 %8 = sext i32 %7 to i64 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %sn.0.lcssa = phi i64 [ -1, %entry ], [ %8, %while.end.loopexit ] %arrayidx25 = getelementptr inbounds [100 x i32], ptr %st, i64 0, i64 %sn.0.lcssa %9 = load i32, ptr %arrayidx25, align 4, !tbaa !8 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %st) #4 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %str) #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: 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> void push(int); int pop(void); int stack[100]; int stacksum=0; int main(void) { int i,x,y,data1; char data[100]; for(i=0;scanf("%s",data)!= EOF;i++){ if(data[0]=='+') { x = pop(); y = pop(); push(x+y); } else if(data[0]=='-'){ x = pop(); y = pop(); push(y-x); } else if (data[0] == '*'){ x = pop(); y = pop(); push(x*y); } else{ data1 = atoi(data); push(data1); } } printf("%d\n",stack[0]); return 0; } void push(int data){ stack[stacksum]=data; stacksum++; } int pop(void){ stacksum--; return stack[stacksum]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286715/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286715/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stacksum = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @stack = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %data = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %data) #5 %call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data) %cmp.not57 = icmp eq i32 %call56, -1 br i1 %cmp.not57, label %for.end, label %for.body for.body: ; preds = %entry, %for.inc %0 = load i8, ptr %data, align 16, !tbaa !5 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %for.body %1 = load i32, ptr @stacksum, align 4, !tbaa !8 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %dec.i to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8 %dec.i30 = add nsw i32 %1, -2 %idxprom.i31 = sext i32 %dec.i30 to i64 %arrayidx.i32 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i31 %3 = load i32, ptr %arrayidx.i32, align 4, !tbaa !8 %add = add nsw i32 %3, %2 store i32 %add, ptr %arrayidx.i32, align 4, !tbaa !8 br label %for.inc if.then9: ; preds = %for.body %4 = load i32, ptr @stacksum, align 4, !tbaa !8 %dec.i35 = add nsw i32 %4, -1 %idxprom.i36 = sext i32 %dec.i35 to i64 %arrayidx.i37 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i36 %5 = load i32, ptr %arrayidx.i37, align 4, !tbaa !8 %dec.i38 = add nsw i32 %4, -2 %idxprom.i39 = sext i32 %dec.i38 to i64 %arrayidx.i40 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i39 %6 = load i32, ptr %arrayidx.i40, align 4, !tbaa !8 %sub = sub nsw i32 %6, %5 store i32 %sub, ptr %arrayidx.i40, align 4, !tbaa !8 br label %for.inc if.then17: ; preds = %for.body %7 = load i32, ptr @stacksum, align 4, !tbaa !8 %dec.i44 = add nsw i32 %7, -1 %idxprom.i45 = sext i32 %dec.i44 to i64 %arrayidx.i46 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i45 %8 = load i32, ptr %arrayidx.i46, align 4, !tbaa !8 %dec.i47 = add nsw i32 %7, -2 %idxprom.i48 = sext i32 %dec.i47 to i64 %arrayidx.i49 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i48 %9 = load i32, ptr %arrayidx.i49, align 4, !tbaa !8 %mul = mul nsw i32 %9, %8 store i32 %mul, ptr %arrayidx.i49, align 4, !tbaa !8 br label %for.inc if.else20: ; preds = %for.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %data, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @stacksum, align 4, !tbaa !8 %idxprom.i53 = sext i32 %10 to i64 %arrayidx.i54 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i53 store i32 %conv.i, ptr %arrayidx.i54, align 4, !tbaa !8 %inc.i55 = add nsw i32 %10, 1 br label %for.inc for.inc: ; preds = %if.then, %if.then17, %if.else20, %if.then9 %dec.i.sink = phi i32 [ %dec.i, %if.then ], [ %dec.i44, %if.then17 ], [ %inc.i55, %if.else20 ], [ %dec.i35, %if.then9 ] store i32 %dec.i.sink, ptr @stacksum, align 4, !tbaa !8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10 for.end: ; preds = %for.inc, %entry %11 = load i32, ptr @stack, align 16, !tbaa !8 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %data) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @stacksum, align 4, !tbaa !8 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @stacksum, align 4, !tbaa !8 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !8 ret i32 %1 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %data) local_unnamed_addr #3 { entry: %0 = load i32, ptr @stacksum, align 4, !tbaa !8 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom store i32 %data, ptr %arrayidx, align 4, !tbaa !8 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @stacksum, align 4, !tbaa !8 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 nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int top = 0, S[1000]; void push(int x) { S[++top] = x; } int pop(void) { top--; return S[top+1]; } int main(void) { int a, b; top = 0; char s[100]; while(scanf("%s",s) != EOF) { if(s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if(s[0] == '-') { b = pop(); a = pop(); push(a - b); } else if(s[0] == '*') { a = pop(); b = pop(); push(a * b); } else { push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286766/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286766/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int top = 0, S[1000]; void push(int x){ top += 1; S[top] = x; } int pop(void){ top--; return S[top + 1]; } int main(void){ int a, b; top = 0; char s[100]; while(scanf("%s", s) != EOF){ if(s[0] == '+'){ a = pop(); b = pop(); push(a + b); }else if(s[0] == '-'){ b = pop(); a = pop(); push(a - b); }else if(s[0] == '*'){ a = pop(); b = pop(); push(a * b); }else{ push(atoi(s)); } } printf("%d\n", pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286809/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286809/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %add = add nsw i32 %0, 1 store i32 %add, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %add.i54 = add nsw i32 %10, 1 store i32 %add.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %add.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #include <stdlib.h> int top , S[1000] ; void push(int t){ S[++top] = t ; } int pop(){ top-- ; return S[top + 1] ; } int main(void){ int m , b ; top = 0 ; char a[100] ; while(scanf("%s" , a) != EOF){ if(a[0] == '+'){ m = pop() ; b = pop() ; push(m + b) ; } else if(a[0] == '-'){ m = pop() ; b = pop() ; push(b - m) ; } else if(a[0] == '*'){ m = pop() ; b = pop() ; push(m * b) ; } else push(atoi(a)) ; } printf("%d\n" , pop()) ; return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286852/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286852/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %t) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %t, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %a = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %a) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %a, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %a, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %a) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #include <stdlib.h> int top,S[1000]; void push(int); int pop(); int main(){ int x,y; top=0; char s[100]; while( scanf("%s",s) != EOF){ if( s[0] == '+'){ x = pop(); y = pop(); push(x+y); } else if( s[0] == '-'){ x = pop(); y = pop(); push(y-x); } else if( s[0] == '*'){ x = pop(); y = pop(); push(x*y); } else push(atoi(s)); } printf("%d\n",pop()); return 0; } void push(int t){ S[++top] = t; } int pop(){ top--; return S[top+1]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286902/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286902/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %t) local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %t, ptr %arrayidx, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int top,n[1000]; void push(int x){ n[++top]=x; } int pop(){ top--; return n[top+1]; } int main(){ int a,b; top=0; char s[100]; while( scanf("%s",s) != EOF ){ if ( s[0] == '+'){ a=pop(); b=pop(); push(a+b); } else if ( s[0] == '-'){ b=pop(); a=pop(); push(a-b); } else if ( s[0] == '*'){ a=pop(); b=pop(); push(a*b); } else{ push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286946/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286946/source.c" target datalayout = "e-m:e-p270: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 [1000 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @n, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int par[2000]; int find(int x) { if (par[x] == x) return x; return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; par[x] = y; } int same(int x, int y) { x = find(x); y = find(y); if (x == y) { return 1; } else { return 0; } } int main() { int n, m, k, mod = 1000000007, i, j; long long ans = 1; int a[2000] = {0}; scanf("%d %d %d", &n, &m, &k); for (i = 0; i < n; i++) par[i] = i; for (i = 0; i <= n - k; i++) { for (j = 0; j <= k / 2; j++) { unite(i + j, i + k - j - 1); } } for (i = 0; i < n; i++) a[find(i)]++; for (i = 0; i < n; i++) { if (a[i] > 0) { ans = ans * m % mod; } } printf("%d\n", (int)ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28699/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28699/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @par = dso_local local_unnamed_addr global [2000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [9 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @find(i32 noundef %x) local_unnamed_addr #0 { entry: %idxprom = sext i32 %x to i64 %arrayidx = getelementptr inbounds [2000 x i32], ptr @par, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp = icmp eq i32 %0, %x br i1 %cmp, label %common.ret9, label %if.end common.ret9: ; preds = %entry, %if.end %common.ret9.op = phi i32 [ %call, %if.end ], [ %x, %entry ] ret i32 %common.ret9.op if.end: ; preds = %entry %call = tail call i32 @find(i32 noundef %0) store i32 %call, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret9 } ; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @unite(i32 noundef %x, i32 noundef %y) local_unnamed_addr #1 { entry: %call = tail call i32 @find(i32 noundef %x) %call1 = tail call i32 @find(i32 noundef %y) %cmp = icmp eq i32 %call, %call1 br i1 %cmp, label %return, label %if.end if.end: ; preds = %entry %idxprom = sext i32 %call to i64 %arrayidx = getelementptr inbounds [2000 x i32], ptr @par, i64 0, i64 %idxprom store i32 %call1, ptr %arrayidx, align 4, !tbaa !5 br label %return return: ; preds = %entry, %if.end ret void } ; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local i32 @same(i32 noundef %x, i32 noundef %y) local_unnamed_addr #1 { entry: %call = tail call i32 @find(i32 noundef %x) %call1 = tail call i32 @find(i32 noundef %y) %cmp = icmp eq i32 %call, %call1 %. = zext i1 %cmp to i32 ret i32 %. } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %k = alloca i32, align 4 %a = alloca [2000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6 call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %a) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) %a, i8 0, i64 8000, i1 false) %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 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body.preheader, label %for.cond1.preheader for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader85, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %1 = getelementptr inbounds [2000 x i32], ptr @par, i64 0, i64 %index store <4 x i32> %vec.ind, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> %step.add, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader85 for.body.preheader85: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block, %entry %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp2.not61 = icmp slt i32 %0, %4 br i1 %cmp2.not61, label %for.cond16.preheader, label %for.cond4.preheader for.body: ; preds = %for.body.preheader85, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader85 ] %arrayidx = getelementptr inbounds [2000 x i32], ptr @par, i64 0, i64 %indvars.iv %5 = trunc i64 %indvars.iv to i32 store i32 %5, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !13 for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc13 %6 = phi i32 [ %12, %for.inc13 ], [ %4, %for.cond1.preheader ] %7 = phi i32 [ %13, %for.inc13 ], [ %0, %for.cond1.preheader ] %i.162 = phi i32 [ %inc14, %for.inc13 ], [ 0, %for.cond1.preheader ] %cmp5.not58 = icmp slt i32 %6, -1 br i1 %cmp5.not58, label %for.inc13, label %for.body6 for.cond16.preheader: ; preds = %for.inc13, %for.cond1.preheader %8 = phi i32 [ %0, %for.cond1.preheader ], [ %13, %for.inc13 ] %cmp1763 = icmp sgt i32 %8, 0 br i1 %cmp1763, label %for.body18, label %for.end35 for.body6: ; preds = %for.cond4.preheader, %unite.exit %9 = phi i32 [ %11, %unite.exit ], [ %6, %for.cond4.preheader ] %j.059 = phi i32 [ %inc11, %unite.exit ], [ 0, %for.cond4.preheader ] %add = add nuw nsw i32 %j.059, %i.162 %10 = xor i32 %j.059, -1 %add7 = add nsw i32 %i.162, %10 %sub9 = add i32 %add7, %9 %call.i = call i32 @find(i32 noundef %add) %call1.i = call i32 @find(i32 noundef %sub9) %cmp.i = icmp eq i32 %call.i, %call1.i br i1 %cmp.i, label %unite.exit, label %if.end.i if.end.i: ; preds = %for.body6 %idxprom.i = sext i32 %call.i to i64 %arrayidx.i = getelementptr inbounds [2000 x i32], ptr @par, i64 0, i64 %idxprom.i store i32 %call1.i, ptr %arrayidx.i, align 4, !tbaa !5 br label %unite.exit unite.exit: ; preds = %for.body6, %if.end.i %inc11 = add nuw nsw i32 %j.059, 1 %11 = load i32, ptr %k, align 4, !tbaa !5 %div = sdiv i32 %11, 2 %cmp5.not.not = icmp slt i32 %j.059, %div br i1 %cmp5.not.not, label %for.body6, label %for.inc13.loopexit, !llvm.loop !14 for.inc13.loopexit: ; preds = %unite.exit %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc13 for.inc13: ; preds = %for.inc13.loopexit, %for.cond4.preheader %12 = phi i32 [ %11, %for.inc13.loopexit ], [ %6, %for.cond4.preheader ] %13 = phi i32 [ %.pre, %for.inc13.loopexit ], [ %7, %for.cond4.preheader ] %inc14 = add nuw nsw i32 %i.162, 1 %sub = sub nsw i32 %13, %12 %cmp2.not.not = icmp slt i32 %i.162, %sub br i1 %cmp2.not.not, label %for.cond4.preheader, label %for.cond16.preheader, !llvm.loop !15 for.cond26.preheader: ; preds = %for.body18 %cmp2765 = icmp sgt i32 %17, 0 br i1 %cmp2765, label %for.body28.lr.ph, label %for.end35 for.body28.lr.ph: ; preds = %for.cond26.preheader %14 = load i32, ptr %m, align 4 %conv = sext i32 %14 to i64 %wide.trip.count74 = zext i32 %17 to i64 %xtraiter = and i64 %wide.trip.count74, 1 %15 = icmp eq i32 %17, 1 br i1 %15, label %for.end35.loopexit.unr-lcssa, label %for.body28.lr.ph.new for.body28.lr.ph.new: ; preds = %for.body28.lr.ph %unroll_iter = and i64 %wide.trip.count74, 4294967294 br label %for.body28 for.body18: ; preds = %for.cond16.preheader, %for.body18 %i.264 = phi i32 [ %inc24, %for.body18 ], [ 0, %for.cond16.preheader ] %call19 = call i32 @find(i32 noundef %i.264) %idxprom20 = sext i32 %call19 to i64 %arrayidx21 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom20 %16 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %inc22 = add nsw i32 %16, 1 store i32 %inc22, ptr %arrayidx21, align 4, !tbaa !5 %inc24 = add nuw nsw i32 %i.264, 1 %17 = load i32, ptr %n, align 4, !tbaa !5 %cmp17 = icmp slt i32 %inc24, %17 br i1 %cmp17, label %for.body18, label %for.cond26.preheader, !llvm.loop !16 for.body28: ; preds = %for.inc33.1, %for.body28.lr.ph.new %indvars.iv71 = phi i64 [ 0, %for.body28.lr.ph.new ], [ %indvars.iv.next72.1, %for.inc33.1 ] %ans.067 = phi i64 [ 1, %for.body28.lr.ph.new ], [ %ans.1.1, %for.inc33.1 ] %niter = phi i64 [ 0, %for.body28.lr.ph.new ], [ %niter.next.1, %for.inc33.1 ] %arrayidx30 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %indvars.iv71 %18 = load i32, ptr %arrayidx30, align 8, !tbaa !5 %cmp31 = icmp sgt i32 %18, 0 br i1 %cmp31, label %if.then, label %for.inc33 if.then: ; preds = %for.body28 %mul = mul nsw i64 %ans.067, %conv %rem = srem i64 %mul, 1000000007 br label %for.inc33 for.inc33: ; preds = %for.body28, %if.then %ans.1 = phi i64 [ %rem, %if.then ], [ %ans.067, %for.body28 ] %indvars.iv.next72 = or i64 %indvars.iv71, 1 %arrayidx30.1 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %indvars.iv.next72 %19 = load i32, ptr %arrayidx30.1, align 4, !tbaa !5 %cmp31.1 = icmp sgt i32 %19, 0 br i1 %cmp31.1, label %if.then.1, label %for.inc33.1 if.then.1: ; preds = %for.inc33 %mul.1 = mul nsw i64 %ans.1, %conv %rem.1 = srem i64 %mul.1, 1000000007 br label %for.inc33.1 for.inc33.1: ; preds = %if.then.1, %for.inc33 %ans.1.1 = phi i64 [ %rem.1, %if.then.1 ], [ %ans.1, %for.inc33 ] %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 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.end35.loopexit.unr-lcssa, label %for.body28, !llvm.loop !17 for.end35.loopexit.unr-lcssa: ; preds = %for.inc33.1, %for.body28.lr.ph %ans.1.lcssa.ph = phi i64 [ undef, %for.body28.lr.ph ], [ %ans.1.1, %for.inc33.1 ] %indvars.iv71.unr = phi i64 [ 0, %for.body28.lr.ph ], [ %indvars.iv.next72.1, %for.inc33.1 ] %ans.067.unr = phi i64 [ 1, %for.body28.lr.ph ], [ %ans.1.1, %for.inc33.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end35.loopexit, label %for.body28.epil for.body28.epil: ; preds = %for.end35.loopexit.unr-lcssa %arrayidx30.epil = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %indvars.iv71.unr %20 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !5 %cmp31.epil = icmp sgt i32 %20, 0 br i1 %cmp31.epil, label %if.then.epil, label %for.end35.loopexit if.then.epil: ; preds = %for.body28.epil %mul.epil = mul nsw i64 %ans.067.unr, %conv %rem.epil = srem i64 %mul.epil, 1000000007 br label %for.end35.loopexit for.end35.loopexit: ; preds = %for.body28.epil, %if.then.epil, %for.end35.loopexit.unr-lcssa %ans.1.lcssa = phi i64 [ %ans.1.lcssa.ph, %for.end35.loopexit.unr-lcssa ], [ %rem.epil, %if.then.epil ], [ %ans.067.unr, %for.body28.epil ] %21 = trunc i64 %ans.1.lcssa to i32 br label %for.end35 for.end35: ; preds = %for.cond16.preheader, %for.end35.loopexit, %for.cond26.preheader %ans.0.lcssa = phi i32 [ 1, %for.cond26.preheader ], [ %21, %for.end35.loopexit ], [ 1, %for.cond16.preheader ] %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 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 #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10}
#include <stdio.h> #include <stdlib.h> #define N 100 void push(int); int pop(); int top, calc[10000]; int main(){ top=0; int x, y, result; char str[N]; while( scanf("%s", str) != EOF){ if(str[0]=='+'){ x=pop(); y=pop(); push(x+y); }else if(str[0]=='-'){ x=pop(); y=pop(); push(y-x); }else if(str[0]=='*'){ x=pop(); y=pop(); push(x*y); }else push(atoi(str)); } result=pop(); printf("%d\n", result); return 0; } void push(int a){ calc[++top]=a; } int pop(){ top--; return calc[top+1]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287031/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287031/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @calc = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %str, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %a) local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom store i32 %a, ptr %arrayidx, 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: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #3 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [10000 x i32], ptr @calc, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int top, S[100]; void push(int x){ top++; S[top] = x; } int pop(){ top--; return S[top + 1]; } int main(void){ int a,b; top = 0; char str[11]; while(scanf("%s", str) != EOF){ if(str[0] == '+'){ a = pop(); b = pop(); push(b + a); } else if (str[0] == '-'){ a = pop(); b = pop(); push(b - a); } else if (str[0] == '*'){ a = pop(); b = pop(); push(b * a); } else { push(atoi(str)); } } printf("%d\n", pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287075/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287075/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %str = alloca [11 x i8], align 1 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %str) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %str, align 1, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [100 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %str) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int top, a[1000]; void push(int x){ top++; a[top] = x; } int pop(){ top--; return a[top+1]; } int main(void) { int x, y; top = 0; char c[100]; while( scanf("%s", &c) != EOF ){ if( c[0] == '+' ){ x = pop(); y = pop(); push(x+y); }else if( c[0] == '-' ){ x = pop(); y = pop(); push(y-x); }else if( c[0] == '*' ){ x = pop(); y = pop(); push(x*y); }else{ push(atoi(c)); } } printf( "%d\n", pop() ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287118/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287118/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @a = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %c = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c) #5 %call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %cmp.not60 = icmp eq i32 %call59, -1 br i1 %cmp.not60, label %while.end, label %while.body while.body: ; preds = %entry, %if.end23 %0 = load i8, ptr %c, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i31 = sext i32 %dec.i to i64 %arrayidx.i32 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i31 %3 = load i32, ptr %arrayidx.i32, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i32, align 4, !tbaa !5 br label %if.end23 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i35 = add nsw i32 %4, -1 %idxprom.i36 = sext i32 %4 to i64 %arrayidx.i37 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i36 %5 = load i32, ptr %arrayidx.i37, align 4, !tbaa !5 %idxprom.i39 = sext i32 %dec.i35 to i64 %arrayidx.i40 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i39 %6 = load i32, ptr %arrayidx.i40, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i35, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i40, align 4, !tbaa !5 br label %if.end23 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i44 = add nsw i32 %7, -1 %idxprom.i45 = sext i32 %7 to i64 %arrayidx.i46 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i45 %8 = load i32, ptr %arrayidx.i46, align 4, !tbaa !5 %idxprom.i48 = sext i32 %dec.i44 to i64 %arrayidx.i49 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i48 %9 = load i32, ptr %arrayidx.i49, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i44, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i49, align 4, !tbaa !5 br label %if.end23 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %c, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i53 = add nsw i32 %10, 1 store i32 %inc.i53, ptr @top, align 4, !tbaa !5 %idxprom.i54 = sext i32 %inc.i53 to i64 %arrayidx.i55 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i54 store i32 %conv.i, ptr %arrayidx.i55, align 4, !tbaa !5 br label %if.end23 if.end23: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end23, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i56 = add nsw i32 %11, -1 store i32 %dec.i56, ptr @top, align 4, !tbaa !5 %idxprom.i57 = sext i32 %11 to i64 %arrayidx.i58 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %idxprom.i57 %12 = load i32, ptr %arrayidx.i58, align 4, !tbaa !5 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <math.h> #define Max(a, b) ((a) > (b) ? (a) : (b)) #define Min(a, b) ((a) > (b) ? (b) : (a)) #define abs(x) ((x) > 0 ? (x) : -(x)) #define rep(i, n) for(int i = 0; i < (n); i++) #define INF 1000000000000 //10^12 #define MOD 1000000007 //10^9 + 7 #define endl printf("\n") typedef long long ll; int main(int argc, char *argv[]) { int q[100000]; char s[100000]; fgets(s, 99999, stdin); int n = strlen(s); int qi = 0; int i = 0; while(i < n){ if(s[i] == '+'){ q[qi - 2] = q[qi - 2] + q[qi - 1]; qi--; i += 2; } else if(s[i] == '-'){ q[qi - 2] = q[qi - 2] - q[qi - 1]; qi--; i += 2; } else if(s[i] == '*'){ q[qi - 2] = q[qi - 2] * q[qi - 1]; qi--; i += 2; } else{ int k = 0; int d = 1000000; while(s[i] != ' '){ k += (int)(s[i] - '0') * d; d /= 10; i++; } q[qi] = k / (d * 10); qi++; i++; } } printf("%d\n", q[qi - 1]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287161/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287161/source.c" target datalayout = "e-m:e-p270: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 [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %q = alloca [100000 x i32], align 16 %s = alloca [100000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %s) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 99999, ptr noundef %0) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5 %conv = trunc i64 %call2 to i32 %cmp114 = icmp sgt i32 %conv, 0 br i1 %cmp114, label %while.body, label %while.end74 while.body: ; preds = %entry, %if.end73 %i.0116 = phi i32 [ %i.2, %if.end73 ], [ 0, %entry ] %qi.0115 = phi i32 [ %qi.1, %if.end73 ], [ 0, %entry ] %idxprom = sext i32 %i.0116 to i64 %arrayidx = getelementptr inbounds [100000 x i8], ptr %s, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 switch i8 %1, label %while.body59 [ i8 43, label %if.then i8 45, label %if.then21 i8 42, label %if.then40 i8 32, label %while.end ] if.then: ; preds = %while.body %sub = add nsw i32 %qi.0115, -2 %idxprom7 = sext i32 %sub to i64 %arrayidx8 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom7 %2 = load i32, ptr %arrayidx8, align 4, !tbaa !10 %sub9 = add nsw i32 %qi.0115, -1 %idxprom10 = sext i32 %sub9 to i64 %arrayidx11 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom10 %3 = load i32, ptr %arrayidx11, align 4, !tbaa !10 %add = add nsw i32 %3, %2 store i32 %add, ptr %arrayidx8, align 4, !tbaa !10 %add15 = add nsw i32 %i.0116, 2 br label %if.end73 if.then21: ; preds = %while.body %sub22 = add nsw i32 %qi.0115, -2 %idxprom23 = sext i32 %sub22 to i64 %arrayidx24 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom23 %4 = load i32, ptr %arrayidx24, align 4, !tbaa !10 %sub25 = add nsw i32 %qi.0115, -1 %idxprom26 = sext i32 %sub25 to i64 %arrayidx27 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom26 %5 = load i32, ptr %arrayidx27, align 4, !tbaa !10 %sub28 = sub nsw i32 %4, %5 store i32 %sub28, ptr %arrayidx24, align 4, !tbaa !10 %add33 = add nsw i32 %i.0116, 2 br label %if.end73 if.then40: ; preds = %while.body %sub41 = add nsw i32 %qi.0115, -2 %idxprom42 = sext i32 %sub41 to i64 %arrayidx43 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom42 %6 = load i32, ptr %arrayidx43, align 4, !tbaa !10 %sub44 = add nsw i32 %qi.0115, -1 %idxprom45 = sext i32 %sub44 to i64 %arrayidx46 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom45 %7 = load i32, ptr %arrayidx46, align 4, !tbaa !10 %mul = mul nsw i32 %7, %6 store i32 %mul, ptr %arrayidx43, align 4, !tbaa !10 %add51 = add nsw i32 %i.0116, 2 br label %if.end73 while.body59: ; preds = %while.body, %while.body59 %indvars.iv = phi i64 [ %indvars.iv.next, %while.body59 ], [ %idxprom, %while.body ] %8 = phi i8 [ %9, %while.body59 ], [ %1, %while.body ] %d.0111 = phi i32 [ %div, %while.body59 ], [ 1000000, %while.body ] %k.0110 = phi i32 [ %add65, %while.body59 ], [ 0, %while.body ] %conv56 = sext i8 %8 to i32 %sub63 = add nsw i32 %conv56, -48 %mul64 = mul nsw i32 %sub63, %d.0111 %add65 = add nsw i32 %mul64, %k.0110 %div = sdiv i32 %d.0111, 10 %indvars.iv.next = add i64 %indvars.iv, 1 %arrayidx55 = getelementptr inbounds [100000 x i8], ptr %s, i64 0, i64 %indvars.iv.next %9 = load i8, ptr %arrayidx55, align 1, !tbaa !9 %cmp57.not = icmp eq i8 %9, 32 br i1 %cmp57.not, label %while.end.loopexit, label %while.body59, !llvm.loop !12 while.end.loopexit: ; preds = %while.body59 %10 = trunc i64 %indvars.iv.next to i32 br label %while.end while.end: ; preds = %while.body, %while.end.loopexit %i.1.lcssa = phi i32 [ %10, %while.end.loopexit ], [ %i.0116, %while.body ] %k.0.lcssa = phi i32 [ %add65, %while.end.loopexit ], [ 0, %while.body ] %d.0.lcssa = phi i32 [ %div, %while.end.loopexit ], [ 1000000, %while.body ] %mul66 = mul nsw i32 %d.0.lcssa, 10 %div67 = sdiv i32 %k.0.lcssa, %mul66 %idxprom68 = sext i32 %qi.0115 to i64 %arrayidx69 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %idxprom68 store i32 %div67, ptr %arrayidx69, align 4, !tbaa !10 %inc70 = add nsw i32 %qi.0115, 1 %inc71 = add nsw i32 %i.1.lcssa, 1 br label %if.end73 if.end73: ; preds = %if.then21, %while.end, %if.then40, %if.then %qi.1 = phi i32 [ %sub9, %if.then ], [ %sub25, %if.then21 ], [ %sub44, %if.then40 ], [ %inc70, %while.end ] %i.2 = phi i32 [ %add15, %if.then ], [ %add33, %if.then21 ], [ %add51, %if.then40 ], [ %inc71, %while.end ] %cmp = icmp slt i32 %i.2, %conv br i1 %cmp, label %while.body, label %while.end74.loopexit, !llvm.loop !14 while.end74.loopexit: ; preds = %if.end73 %11 = add nsw i32 %qi.1, -1 %12 = sext i32 %11 to i64 br label %while.end74 while.end74: ; preds = %while.end74.loopexit, %entry %qi.0.lcssa = phi i64 [ -1, %entry ], [ %12, %while.end74.loopexit ] %arrayidx77 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %qi.0.lcssa %13 = load i32, ptr %arrayidx77, align 4, !tbaa !10 %call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13) call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = !{!11, !11, i64 0} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13}
#include <stdio.h> #include <stdlib.h> #include <string.h> int top = 0, S[1000]; void push(int x) { S[++top] = x; } int pop(void) { top--; return S[top+1]; } int main(void) { int a, b; top = 0; char s[100]; while(scanf("%s",s) != EOF) { if(s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if(s[0] == '-') { b = pop(); a = pop(); push(a - b); } else if(s[0] == '*') { a = pop(); b = pop(); push(a * b); } else { push(atoi(s)); } } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287204/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287204/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 0, align 4 @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int top,S[1000]; void push(int x) { S[++top] = x; } int pop() { top--; return S[top+1]; } int main() { int a,b; top = 0; char s[100]; while (scanf("%s",s)!=EOF) { if(s[0]=='+') { a = pop(); b = pop(); push(a+b); } else if(s[0]=='-') { b = pop(); a = pop(); push(a-b); } else if(s[0]=='*') { a = pop(); b = pop(); push(a*b); } else push(atoi(s)); } printf("%d\n",pop()); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287248/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287248/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16 @top = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @pop() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 ret i32 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %s = alloca [100 x i8], align 16 store i32 0, ptr @top, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not61 = icmp eq i32 %call60, -1 br i1 %cmp.not61, label %while.end, label %while.body while.body: ; preds = %entry, %if.end24 %0 = load i8, ptr %s, align 16, !tbaa !9 switch i8 %0, label %if.else20 [ i8 43, label %if.then i8 45, label %if.then9 i8 42, label %if.then17 ] if.then: ; preds = %while.body %1 = load i32, ptr @top, align 4, !tbaa !5 %dec.i = add nsw i32 %1, -1 %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %idxprom.i32 = sext i32 %dec.i to i64 %arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32 %3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !5 store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5 br label %if.end24 if.then9: ; preds = %while.body %4 = load i32, ptr @top, align 4, !tbaa !5 %dec.i36 = add nsw i32 %4, -1 %idxprom.i37 = sext i32 %4 to i64 %arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37 %5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5 %idxprom.i40 = sext i32 %dec.i36 to i64 %arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40 %6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5 %sub = sub nsw i32 %6, %5 store i32 %dec.i36, ptr @top, align 4, !tbaa !5 store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5 br label %if.end24 if.then17: ; preds = %while.body %7 = load i32, ptr @top, align 4, !tbaa !5 %dec.i45 = add nsw i32 %7, -1 %idxprom.i46 = sext i32 %7 to i64 %arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46 %8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %idxprom.i49 = sext i32 %dec.i45 to i64 %arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49 %9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5 %mul = mul nsw i32 %9, %8 store i32 %dec.i45, ptr @top, align 4, !tbaa !5 store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5 br label %if.end24 if.else20: ; preds = %while.body %call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5 %conv.i = trunc i64 %call.i to i32 %10 = load i32, ptr @top, align 4, !tbaa !5 %inc.i54 = add nsw i32 %10, 1 store i32 %inc.i54, ptr @top, align 4, !tbaa !5 %idxprom.i55 = sext i32 %inc.i54 to i64 %arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55 store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10 while.end: ; preds = %if.end24, %entry %11 = load i32, ptr @top, align 4, !tbaa !5 %dec.i57 = add nsw i32 %11, -1 store i32 %dec.i57, ptr @top, align 4, !tbaa !5 %idxprom.i58 = sext i32 %11 to i64 %arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58 %12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> #include <stdlib.h> #define MAX 200 void push(int); int pop1(void); int top = 1; int s[MAX]; int main(){ int x,a,b; char stack[MAX]; while(1){ if(scanf("%s", stack) == EOF) break; if ( stack[0] == '+' ) { a= pop1(); b= pop1(); push(b+a); } else if ( stack[0] == '-' ) { a=pop1(); b=pop1(); push(b-a); } else if ( stack[0] == '*' ) { a=pop1(); b=pop1(); push(b*a); } else { x = atoi(stack); push(x); } } printf("%d\n",pop1()); return 0; } void push(int x) { if(top >= MAX - 1) { printf("Overflow!\n"); exit(1); } top++; s[top] = x; } int pop1(void) { if(top == 0) { printf("Underflow!\n"); exit(1); } return s[top--]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287291/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287291/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @top = dso_local local_unnamed_addr global i32 1, align 4 @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @s = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16 @str = private unnamed_addr constant [11 x i8] c"Underflow!\00", align 1 @str.4 = private unnamed_addr constant [10 x i8] c"Overflow!\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %stack = alloca [200 x i8], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %stack) #6 %call101 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %stack) %cmp102 = icmp eq i32 %call101, -1 br i1 %cmp102, label %while.end, label %if.end if.end: ; preds = %entry, %if.end26 %0 = load i8, ptr %stack, align 16, !tbaa !5 switch i8 %0, label %if.else21 [ i8 43, label %if.then3 i8 45, label %if.then10 i8 42, label %if.then18 ] if.then3: ; preds = %if.end %1 = load i32, ptr @top, align 4, !tbaa !8 %cmp.i = icmp eq i32 %1, 0 br i1 %cmp.i, label %if.then.i, label %pop1.exit if.then.i: ; preds = %if.then3 %puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit: ; preds = %if.then3 %dec.i = add nsw i32 %1, -1 store i32 %dec.i, ptr @top, align 4, !tbaa !8 %cmp.i33 = icmp eq i32 %dec.i, 0 br i1 %cmp.i33, label %if.then.i37, label %pop1.exit39 if.then.i37: ; preds = %pop1.exit %puts.i38 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit39: ; preds = %pop1.exit %idxprom.i = sext i32 %1 to i64 %arrayidx.i = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8 %dec.i34 = add nsw i32 %1, -2 store i32 %dec.i34, ptr @top, align 4, !tbaa !8 %cmp.i40 = icmp sgt i32 %1, 200 br i1 %cmp.i40, label %if.then.i43, label %push.exit if.then.i43: ; preds = %pop1.exit39 %puts.i44 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) call void @exit(i32 noundef 1) #7 unreachable push.exit: ; preds = %pop1.exit39 %idxprom.i35 = sext i32 %dec.i to i64 %arrayidx.i36 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i35 %3 = load i32, ptr %arrayidx.i36, align 4, !tbaa !8 %add = add nsw i32 %3, %2 store i32 %dec.i, ptr @top, align 4, !tbaa !8 store i32 %add, ptr %arrayidx.i36, align 4, !tbaa !8 br label %if.end26 if.then10: ; preds = %if.end %4 = load i32, ptr @top, align 4, !tbaa !8 %cmp.i45 = icmp eq i32 %4, 0 br i1 %cmp.i45, label %if.then.i49, label %pop1.exit51 if.then.i49: ; preds = %if.then10 %puts.i50 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit51: ; preds = %if.then10 %dec.i46 = add nsw i32 %4, -1 store i32 %dec.i46, ptr @top, align 4, !tbaa !8 %cmp.i52 = icmp eq i32 %dec.i46, 0 br i1 %cmp.i52, label %if.then.i56, label %pop1.exit58 if.then.i56: ; preds = %pop1.exit51 %puts.i57 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit58: ; preds = %pop1.exit51 %idxprom.i47 = sext i32 %4 to i64 %arrayidx.i48 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i47 %5 = load i32, ptr %arrayidx.i48, align 4, !tbaa !8 %dec.i53 = add nsw i32 %4, -2 store i32 %dec.i53, ptr @top, align 4, !tbaa !8 %cmp.i59 = icmp sgt i32 %4, 200 br i1 %cmp.i59, label %if.then.i63, label %push.exit65 if.then.i63: ; preds = %pop1.exit58 %puts.i64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) call void @exit(i32 noundef 1) #7 unreachable push.exit65: ; preds = %pop1.exit58 %idxprom.i54 = sext i32 %dec.i46 to i64 %arrayidx.i55 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i54 %6 = load i32, ptr %arrayidx.i55, align 4, !tbaa !8 %sub = sub nsw i32 %6, %5 store i32 %dec.i46, ptr @top, align 4, !tbaa !8 store i32 %sub, ptr %arrayidx.i55, align 4, !tbaa !8 br label %if.end26 if.then18: ; preds = %if.end %7 = load i32, ptr @top, align 4, !tbaa !8 %cmp.i66 = icmp eq i32 %7, 0 br i1 %cmp.i66, label %if.then.i70, label %pop1.exit72 if.then.i70: ; preds = %if.then18 %puts.i71 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit72: ; preds = %if.then18 %dec.i67 = add nsw i32 %7, -1 store i32 %dec.i67, ptr @top, align 4, !tbaa !8 %cmp.i73 = icmp eq i32 %dec.i67, 0 br i1 %cmp.i73, label %if.then.i77, label %pop1.exit79 if.then.i77: ; preds = %pop1.exit72 %puts.i78 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit79: ; preds = %pop1.exit72 %idxprom.i68 = sext i32 %7 to i64 %arrayidx.i69 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i68 %8 = load i32, ptr %arrayidx.i69, align 4, !tbaa !8 %dec.i74 = add nsw i32 %7, -2 store i32 %dec.i74, ptr @top, align 4, !tbaa !8 %cmp.i80 = icmp sgt i32 %7, 200 br i1 %cmp.i80, label %if.then.i84, label %push.exit86 if.then.i84: ; preds = %pop1.exit79 %puts.i85 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) call void @exit(i32 noundef 1) #7 unreachable push.exit86: ; preds = %pop1.exit79 %idxprom.i75 = sext i32 %dec.i67 to i64 %arrayidx.i76 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i75 %9 = load i32, ptr %arrayidx.i76, align 4, !tbaa !8 %mul = mul nsw i32 %9, %8 store i32 %dec.i67, ptr @top, align 4, !tbaa !8 store i32 %mul, ptr %arrayidx.i76, align 4, !tbaa !8 br label %if.end26 if.else21: ; preds = %if.end %call.i = call i64 @strtol(ptr nocapture noundef nonnull %stack, ptr noundef null, i32 noundef 10) #6 %10 = load i32, ptr @top, align 4, !tbaa !8 %cmp.i87 = icmp sgt i32 %10, 198 br i1 %cmp.i87, label %if.then.i91, label %push.exit93 if.then.i91: ; preds = %if.else21 %puts.i92 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) call void @exit(i32 noundef 1) #7 unreachable push.exit93: ; preds = %if.else21 %conv.i = trunc i64 %call.i to i32 %inc.i88 = add nsw i32 %10, 1 store i32 %inc.i88, ptr @top, align 4, !tbaa !8 %idxprom.i89 = sext i32 %inc.i88 to i64 %arrayidx.i90 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i89 store i32 %conv.i, ptr %arrayidx.i90, align 4, !tbaa !8 br label %if.end26 if.end26: ; preds = %push.exit65, %push.exit93, %push.exit86, %push.exit %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %stack) %cmp = icmp eq i32 %call, -1 br i1 %cmp, label %while.end, label %if.end while.end: ; preds = %if.end26, %entry %11 = load i32, ptr @top, align 4, !tbaa !8 %cmp.i94 = icmp eq i32 %11, 0 br i1 %cmp.i94, label %if.then.i98, label %pop1.exit100 if.then.i98: ; preds = %while.end %puts.i99 = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @exit(i32 noundef 1) #7 unreachable pop1.exit100: ; preds = %while.end %dec.i95 = add nsw i32 %11, -1 store i32 %dec.i95, ptr @top, align 4, !tbaa !8 %idxprom.i96 = sext i32 %11 to i64 %arrayidx.i97 = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom.i96 %12 = load i32, ptr %arrayidx.i97, align 4, !tbaa !8 %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12) call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %stack) #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: nounwind uwtable define dso_local i32 @pop1() local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !8 %cmp = icmp eq i32 %0, 0 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) tail call void @exit(i32 noundef 1) #7 unreachable if.end: ; preds = %entry %dec = add nsw i32 %0, -1 store i32 %dec, ptr @top, align 4, !tbaa !8 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !8 ret i32 %1 } ; Function Attrs: nounwind uwtable define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 { entry: %0 = load i32, ptr @top, align 4, !tbaa !8 %cmp = icmp sgt i32 %0, 198 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4) tail call void @exit(i32 noundef 1) #7 unreachable if.end: ; preds = %entry %inc = add nsw i32 %0, 1 store i32 %inc, ptr @top, align 4, !tbaa !8 %idxprom = sext i32 %inc to i64 %arrayidx = getelementptr inbounds [200 x i32], ptr @s, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !8 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: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree 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 #5 = { nofree nounwind } attributes #6 = { nounwind } attributes #7 = { noreturn nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0}