Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int min(int, int);
int main(void){
int h, w, c[10][10], a[200][200];
int i, j, k, s=0;
scanf("%d %d", &h, &w);
for(i = 0; i < 10; i++){
for(j = 0; j < 10; j++){
scanf("%d", &c[i][j]);
}
}
for(i = 0; i < h; i++){
for(j = 0; j < w; j++){
scanf("%d", &a[i][j]);
}
}
for(i = 0; i < 10; i++){
for(j = 0; j < 10; j++){
for(k = 0; k < 10; k++){
c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
}
}
}
for(i = 0; i < h; i++){
for(j = 0; j < w; j++){
if(a[i][j]>=0 && a[i][j]!=1){
s += c[a[i][j]][1];
}
}
}
printf("%d\n", s);
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_111444/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111444/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%c = alloca [10 x [10 x i32]], align 16
%a = alloca [200 x [200 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 160000, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.4)
%arrayidx5.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 5
%call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.5)
%arrayidx5.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 6
%call6.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.6)
%arrayidx5.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 7
%call6.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.7)
%arrayidx5.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 8
%call6.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.8)
%arrayidx5.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 9
%call6.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10
br i1 %exitcond.not, label %for.cond10.preheader, label %for.cond1.preheader, !llvm.loop !5
for.cond10.preheader: ; preds = %for.cond1.preheader
%0 = load i32, ptr %h, align 4, !tbaa !7
%cmp11131 = icmp sgt i32 %0, 0
%1 = load i32, ptr %w, align 4
%2 = icmp sgt i32 %1, 0
%or.cond = select i1 %cmp11131, i1 %2, i1 false
br i1 %or.cond, label %for.cond13.preheader, label %for.cond27.preheader
for.cond13.preheader: ; preds = %for.cond10.preheader, %for.inc24
%3 = phi i32 [ %7, %for.inc24 ], [ %0, %for.cond10.preheader ]
%4 = phi i32 [ %8, %for.inc24 ], [ %1, %for.cond10.preheader ]
%indvars.iv153 = phi i64 [ %indvars.iv.next154, %for.inc24 ], [ 0, %for.cond10.preheader ]
%cmp14129 = icmp sgt i32 %4, 0
br i1 %cmp14129, label %for.body15, label %for.inc24
for.cond27.preheader: ; preds = %for.inc24, %for.cond10.preheader
%.lcssa = phi i32 [ %0, %for.cond10.preheader ], [ %7, %for.inc24 ]
br label %for.cond30.preheader
for.body15: ; preds = %for.cond13.preheader, %for.body15
%indvars.iv150 = phi i64 [ %indvars.iv.next151, %for.body15 ], [ 0, %for.cond13.preheader ]
%arrayidx19 = getelementptr inbounds [200 x [200 x i32]], ptr %a, i64 0, i64 %indvars.iv153, i64 %indvars.iv150
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx19)
%indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
%5 = load i32, ptr %w, align 4, !tbaa !7
%6 = sext i32 %5 to i64
%cmp14 = icmp slt i64 %indvars.iv.next151, %6
br i1 %cmp14, label %for.body15, label %for.inc24.loopexit, !llvm.loop !11
for.inc24.loopexit: ; preds = %for.body15
%.pre = load i32, ptr %h, align 4, !tbaa !7
br label %for.inc24
for.inc24: ; preds = %for.inc24.loopexit, %for.cond13.preheader
%7 = phi i32 [ %.pre, %for.inc24.loopexit ], [ %3, %for.cond13.preheader ]
%8 = phi i32 [ %5, %for.inc24.loopexit ], [ %4, %for.cond13.preheader ]
%indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
%9 = sext i32 %7 to i64
%cmp11 = icmp slt i64 %indvars.iv.next154, %9
br i1 %cmp11, label %for.cond13.preheader, label %for.cond27.preheader, !llvm.loop !12
for.cond30.preheader: ; preds = %for.cond27.preheader, %for.inc59
%indvars.iv164 = phi i64 [ 0, %for.cond27.preheader ], [ %indvars.iv.next165, %for.inc59 ]
%arrayidx47 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 0
%arrayidx47.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 1
%arrayidx47.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 2
%arrayidx47.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 3
%arrayidx47.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 4
%arrayidx47.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 5
%arrayidx47.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 6
%arrayidx47.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 7
%arrayidx47.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 8
%arrayidx47.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv164, i64 9
br label %for.cond33.preheader
for.cond62.preheader: ; preds = %for.inc59
%cmp63140 = icmp sgt i32 %.lcssa, 0
br i1 %cmp63140, label %for.cond65.preheader.lr.ph, label %for.end91
for.cond65.preheader.lr.ph: ; preds = %for.cond62.preheader
%10 = load i32, ptr %w, align 4, !tbaa !7
%cmp66136 = icmp sgt i32 %10, 0
br i1 %cmp66136, label %for.cond65.preheader.us.preheader, label %for.end91
for.cond65.preheader.us.preheader: ; preds = %for.cond65.preheader.lr.ph
%wide.trip.count175 = zext i32 %.lcssa to i64
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%11 = icmp eq i32 %10, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond65.preheader.us
for.cond65.preheader.us: ; preds = %for.cond65.preheader.us.preheader, %for.cond65.for.inc89_crit_edge.us
%indvars.iv172 = phi i64 [ 0, %for.cond65.preheader.us.preheader ], [ %indvars.iv.next173, %for.cond65.for.inc89_crit_edge.us ]
%s.0142.us = phi i32 [ 0, %for.cond65.preheader.us.preheader ], [ %s.2.us.lcssa, %for.cond65.for.inc89_crit_edge.us ]
br i1 %11, label %for.cond65.for.inc89_crit_edge.us.unr-lcssa, label %for.body67.us
for.body67.us: ; preds = %for.cond65.preheader.us, %for.inc86.us.1
%indvars.iv168 = phi i64 [ %indvars.iv.next169.1, %for.inc86.us.1 ], [ 0, %for.cond65.preheader.us ]
%s.1138.us = phi i32 [ %s.2.us.1, %for.inc86.us.1 ], [ %s.0142.us, %for.cond65.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc86.us.1 ], [ 0, %for.cond65.preheader.us ]
%arrayidx71.us = getelementptr inbounds [200 x [200 x i32]], ptr %a, i64 0, i64 %indvars.iv172, i64 %indvars.iv168
%12 = load i32, ptr %arrayidx71.us, align 8, !tbaa !7
%cmp72.us = icmp slt i32 %12, 0
%cmp77.not.us = icmp eq i32 %12, 1
%or.cond.us = or i1 %cmp72.us, %cmp77.not.us
br i1 %or.cond.us, label %for.inc86.us, label %if.then.us
if.then.us: ; preds = %for.body67.us
%idxprom82.us = zext i32 %12 to i64
%arrayidx84.us = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %idxprom82.us, i64 1
%13 = load i32, ptr %arrayidx84.us, align 4, !tbaa !7
%add85.us = add nsw i32 %13, %s.1138.us
br label %for.inc86.us
for.inc86.us: ; preds = %if.then.us, %for.body67.us
%s.2.us = phi i32 [ %add85.us, %if.then.us ], [ %s.1138.us, %for.body67.us ]
%indvars.iv.next169 = or i64 %indvars.iv168, 1
%arrayidx71.us.1 = getelementptr inbounds [200 x [200 x i32]], ptr %a, i64 0, i64 %indvars.iv172, i64 %indvars.iv.next169
%14 = load i32, ptr %arrayidx71.us.1, align 4, !tbaa !7
%cmp72.us.1 = icmp slt i32 %14, 0
%cmp77.not.us.1 = icmp eq i32 %14, 1
%or.cond.us.1 = or i1 %cmp72.us.1, %cmp77.not.us.1
br i1 %or.cond.us.1, label %for.inc86.us.1, label %if.then.us.1
if.then.us.1: ; preds = %for.inc86.us
%idxprom82.us.1 = zext i32 %14 to i64
%arrayidx84.us.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %idxprom82.us.1, i64 1
%15 = load i32, ptr %arrayidx84.us.1, align 4, !tbaa !7
%add85.us.1 = add nsw i32 %15, %s.2.us
br label %for.inc86.us.1
for.inc86.us.1: ; preds = %if.then.us.1, %for.inc86.us
%s.2.us.1 = phi i32 [ %add85.us.1, %if.then.us.1 ], [ %s.2.us, %for.inc86.us ]
%indvars.iv.next169.1 = add nuw nsw i64 %indvars.iv168, 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.cond65.for.inc89_crit_edge.us.unr-lcssa, label %for.body67.us, !llvm.loop !14
for.cond65.for.inc89_crit_edge.us.unr-lcssa: ; preds = %for.inc86.us.1, %for.cond65.preheader.us
%s.2.us.lcssa.ph = phi i32 [ undef, %for.cond65.preheader.us ], [ %s.2.us.1, %for.inc86.us.1 ]
%indvars.iv168.unr = phi i64 [ 0, %for.cond65.preheader.us ], [ %indvars.iv.next169.1, %for.inc86.us.1 ]
%s.1138.us.unr = phi i32 [ %s.0142.us, %for.cond65.preheader.us ], [ %s.2.us.1, %for.inc86.us.1 ]
br i1 %lcmp.mod.not, label %for.cond65.for.inc89_crit_edge.us, label %for.body67.us.epil
for.body67.us.epil: ; preds = %for.cond65.for.inc89_crit_edge.us.unr-lcssa
%arrayidx71.us.epil = getelementptr inbounds [200 x [200 x i32]], ptr %a, i64 0, i64 %indvars.iv172, i64 %indvars.iv168.unr
%16 = load i32, ptr %arrayidx71.us.epil, align 4, !tbaa !7
%cmp72.us.epil = icmp slt i32 %16, 0
%cmp77.not.us.epil = icmp eq i32 %16, 1
%or.cond.us.epil = or i1 %cmp72.us.epil, %cmp77.not.us.epil
br i1 %or.cond.us.epil, label %for.cond65.for.inc89_crit_edge.us, label %if.then.us.epil
if.then.us.epil: ; preds = %for.body67.us.epil
%idxprom82.us.epil = zext i32 %16 to i64
%arrayidx84.us.epil = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %idxprom82.us.epil, i64 1
%17 = load i32, ptr %arrayidx84.us.epil, align 4, !tbaa !7
%add85.us.epil = add nsw i32 %17, %s.1138.us.unr
br label %for.cond65.for.inc89_crit_edge.us
for.cond65.for.inc89_crit_edge.us: ; preds = %for.body67.us.epil, %if.then.us.epil, %for.cond65.for.inc89_crit_edge.us.unr-lcssa
%s.2.us.lcssa = phi i32 [ %s.2.us.lcssa.ph, %for.cond65.for.inc89_crit_edge.us.unr-lcssa ], [ %add85.us.epil, %if.then.us.epil ], [ %s.1138.us.unr, %for.body67.us.epil ]
%indvars.iv.next173 = add nuw nsw i64 %indvars.iv172, 1
%exitcond176.not = icmp eq i64 %indvars.iv.next173, %wide.trip.count175
br i1 %exitcond176.not, label %for.end91, label %for.cond65.preheader.us, !llvm.loop !15
for.cond33.preheader: ; preds = %for.cond30.preheader, %for.cond33.preheader
%indvars.iv160 = phi i64 [ 0, %for.cond30.preheader ], [ %indvars.iv.next161, %for.cond33.preheader ]
%arrayidx43 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 %indvars.iv164
%arrayidx39 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 0
%18 = load i32, ptr %arrayidx39, align 8, !tbaa !7
%19 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%20 = load i32, ptr %arrayidx47, align 8, !tbaa !7
%add = add nsw i32 %20, %19
%x.y.i = call i32 @llvm.smin.i32(i32 %18, i32 %add)
store i32 %x.y.i, ptr %arrayidx39, align 8, !tbaa !7
%arrayidx39.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 1
%21 = load i32, ptr %arrayidx39.1, align 4, !tbaa !7
%22 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%23 = load i32, ptr %arrayidx47.1, align 4, !tbaa !7
%add.1 = add nsw i32 %23, %22
%x.y.i.1 = call i32 @llvm.smin.i32(i32 %21, i32 %add.1)
store i32 %x.y.i.1, ptr %arrayidx39.1, align 4, !tbaa !7
%arrayidx39.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 2
%24 = load i32, ptr %arrayidx39.2, align 8, !tbaa !7
%25 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%26 = load i32, ptr %arrayidx47.2, align 8, !tbaa !7
%add.2 = add nsw i32 %26, %25
%x.y.i.2 = call i32 @llvm.smin.i32(i32 %24, i32 %add.2)
store i32 %x.y.i.2, ptr %arrayidx39.2, align 8, !tbaa !7
%arrayidx39.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 3
%27 = load i32, ptr %arrayidx39.3, align 4, !tbaa !7
%28 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%29 = load i32, ptr %arrayidx47.3, align 4, !tbaa !7
%add.3 = add nsw i32 %29, %28
%x.y.i.3 = call i32 @llvm.smin.i32(i32 %27, i32 %add.3)
store i32 %x.y.i.3, ptr %arrayidx39.3, align 4, !tbaa !7
%arrayidx39.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 4
%30 = load i32, ptr %arrayidx39.4, align 8, !tbaa !7
%31 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%32 = load i32, ptr %arrayidx47.4, align 8, !tbaa !7
%add.4 = add nsw i32 %32, %31
%x.y.i.4 = call i32 @llvm.smin.i32(i32 %30, i32 %add.4)
store i32 %x.y.i.4, ptr %arrayidx39.4, align 8, !tbaa !7
%arrayidx39.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 5
%33 = load i32, ptr %arrayidx39.5, align 4, !tbaa !7
%34 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%35 = load i32, ptr %arrayidx47.5, align 4, !tbaa !7
%add.5 = add nsw i32 %35, %34
%x.y.i.5 = call i32 @llvm.smin.i32(i32 %33, i32 %add.5)
store i32 %x.y.i.5, ptr %arrayidx39.5, align 4, !tbaa !7
%arrayidx39.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 6
%36 = load i32, ptr %arrayidx39.6, align 8, !tbaa !7
%37 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%38 = load i32, ptr %arrayidx47.6, align 8, !tbaa !7
%add.6 = add nsw i32 %38, %37
%x.y.i.6 = call i32 @llvm.smin.i32(i32 %36, i32 %add.6)
store i32 %x.y.i.6, ptr %arrayidx39.6, align 8, !tbaa !7
%arrayidx39.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 7
%39 = load i32, ptr %arrayidx39.7, align 4, !tbaa !7
%40 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%41 = load i32, ptr %arrayidx47.7, align 4, !tbaa !7
%add.7 = add nsw i32 %41, %40
%x.y.i.7 = call i32 @llvm.smin.i32(i32 %39, i32 %add.7)
store i32 %x.y.i.7, ptr %arrayidx39.7, align 4, !tbaa !7
%arrayidx39.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 8
%42 = load i32, ptr %arrayidx39.8, align 8, !tbaa !7
%43 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%44 = load i32, ptr %arrayidx47.8, align 8, !tbaa !7
%add.8 = add nsw i32 %44, %43
%x.y.i.8 = call i32 @llvm.smin.i32(i32 %42, i32 %add.8)
store i32 %x.y.i.8, ptr %arrayidx39.8, align 8, !tbaa !7
%arrayidx39.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv160, i64 9
%45 = load i32, ptr %arrayidx39.9, align 4, !tbaa !7
%46 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%47 = load i32, ptr %arrayidx47.9, align 4, !tbaa !7
%add.9 = add nsw i32 %47, %46
%x.y.i.9 = call i32 @llvm.smin.i32(i32 %45, i32 %add.9)
store i32 %x.y.i.9, ptr %arrayidx39.9, align 4, !tbaa !7
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next161, 10
br i1 %exitcond163.not, label %for.inc59, label %for.cond33.preheader, !llvm.loop !16
for.inc59: ; preds = %for.cond33.preheader
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next165, 10
br i1 %exitcond167.not, label %for.cond62.preheader, label %for.cond30.preheader, !llvm.loop !17
for.end91: ; preds = %for.cond65.for.inc89_crit_edge.us, %for.cond65.preheader.lr.ph, %for.cond62.preheader
%s.0.lcssa = phi i32 [ 0, %for.cond62.preheader ], [ 0, %for.cond65.preheader.lr.ph ], [ %s.2.us.lcssa, %for.cond65.for.inc89_crit_edge.us ]
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 160000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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:
%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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = 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}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
|
#include <stdio.h>
#include <math.h>
int main(void) {
int l,a,b,c,d;
scanf("%d%d%d%d%d", &l, &a, &b, &c, &d);
if((a + c-1)/c > (b + d-1)/d) printf("%d\n", l-(a + c-1)/c);
else printf("%d\n", l-(b + d-1)/d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111488/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = 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 %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%add = add i32 %0, -1
%sub = add i32 %add, %1
%div = sdiv i32 %sub, %1
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%add1 = add i32 %2, -1
%sub2 = add i32 %add1, %3
%div3 = sdiv i32 %sub2, %3
%4 = load i32, ptr %l, align 4, !tbaa !5
%div.div3 = call i32 @llvm.smax.i32(i32 %div, i32 %div3)
%sub12 = sub nsw i32 %4, %div.div3
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub12)
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 %l) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int l, a, b, c, d, cnt= 1, max;
scanf("%d %d %d %d %d", &l, &a, &b, &c, &d);
while(1){
a = a - c;
b = b - d;
if(a <= 0 && b <= 0)break;
cnt++;
}
max = l - cnt;
printf("%d\n", max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111530/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111530/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = 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 %l) #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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%sub17 = phi i32 [ %b.promoted, %entry ], [ %sub1, %while.cond ]
%sub6 = phi i32 [ %a.promoted, %entry ], [ %sub, %while.cond ]
%cnt.0 = phi i32 [ 1, %entry ], [ %inc, %while.cond ]
%sub = sub nsw i32 %sub6, %0
%sub1 = sub nsw i32 %sub17, %1
%cmp = icmp slt i32 %sub, 1
%cmp2 = icmp slt i32 %sub1, 1
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
%inc = add nuw nsw i32 %cnt.0, 1
br i1 %or.cond, label %while.end, label %while.cond
while.end: ; preds = %while.cond
store i32 %sub, ptr %a, align 4, !tbaa !5
store i32 %sub1, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %l, align 4, !tbaa !5
%sub3 = sub nsw i32 %2, %cnt.0
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int max(int a,int b){
return a>b?a:b;
}
int main(void){
int l,a,b,c,d,j,m,maxd;
scanf("%d %d %d %d %d",&l,&a,&b,&c,&d);
j=a/c+(a%c?1:0);
m=b/d+(b%d?1:0);
maxd=max(j,m);
printf("%d\n",l-maxd);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%l = 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 %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%tobool.not = icmp ne i32 %rem, 0
%cond = zext i1 %tobool.not to i32
%add = add nsw i32 %div, %cond
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%div1 = sdiv i32 %2, %3
%rem2 = srem i32 %2, %3
%tobool3.not = icmp ne i32 %rem2, 0
%cond4 = zext i1 %tobool3.not to i32
%add5 = add nsw i32 %div1, %cond4
%cond.i = call i32 @llvm.smax.i32(i32 %add, i32 %add5)
%4 = load i32, ptr %l, align 4, !tbaa !5
%sub = sub nsw i32 %4, %cond.i
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.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"}
|
#include<stdio.h>
int main(void){
int a,b,c,d,l;
scanf("%d%d%d%d%d",&l,&a,&b,&c,&d);
a=(a-1)/c;
b=(b-1)/d;
a++;
b++;
if(a>b){
l-=a;
}else{
l-=b;
}
printf("%d\n",l);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111624/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111624/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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 %l, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%1 = load i32, ptr %c, align 4, !tbaa !5
%div = sdiv i32 %sub, %1
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub1 = add nsw i32 %2, -1
%3 = load i32, ptr %d, align 4, !tbaa !5
%div2 = sdiv i32 %sub1, %3
%inc = add nsw i32 %div, 1
store i32 %inc, ptr %a, align 4, !tbaa !5
%inc3 = add nsw i32 %div2, 1
store i32 %inc3, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %div, %div2
%4 = load i32, ptr %l, align 4
%storemerge.v = select i1 %cmp, i32 %inc, i32 %inc3
%storemerge = sub nsw i32 %4, %storemerge.v
store i32 %storemerge, ptr %l, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %storemerge)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 1296: Repeated Substitution with Sed
// 2017.10.20 bal4u@uu
#include <stdio.h>
#include <string.h>
typedef struct { char x[11], s, k; } Q;
Q que[10002]; int top, end;
char a[10][11], sa[10];
char b[10][11], sb[10];
char g[11], sg;
int main()
{
int n, i, s, k, w, f, ans;
char *p, *q;
while (scanf("%d", &n) && n > 0) {
for (i = 0; i < n; i++) {
scanf("%s%s", a[i], b[i]);
sa[i] = strlen(a[i]), sb[i] = strlen(b[i]);
}
scanf("%s%s", que[0].x, g), sg = strlen(g);
ans = -1, que[0].k = 0, que[0].s = strlen(que[0].x), top = 0, end = 1;
while (top < end) {
for (i = 0; i < n; i++) {
p = que[top].x, s = que[top].s, k = que[top].k + 1, q = que[end].x, f = 0;
while (*p) {
if ((p-que[top].x) + sa[i] <= s && !memcmp(p, a[i], sa[i])) {
if ((q-que[end].x) - sa[i] + sb[i] > sg) goto next;
memcpy(q, b[i], sb[i]);
p += sa[i], q += sb[i], f = 1;
} else *q++ = *p++;
}
if (!f) continue;
*q = 0; if ((w = q - que[end].x) == sg) {
if (memcmp(que[end].x, g, sg) == 0) { ans = k; goto done; }
} else que[end].s = w, que[end++].k = k;
next: ;
}
top++;
}
done: printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111668/source.c"
target datalayout = "e-m:e-p270: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.Q = type { [11 x i8], i8, i8 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@a = dso_local global [10 x [11 x i8]] zeroinitializer, align 16
@b = dso_local global [10 x [11 x i8]] zeroinitializer, align 16
@sa = dso_local local_unnamed_addr global [10 x i8] zeroinitializer, align 1
@sb = dso_local local_unnamed_addr global [10 x i8] zeroinitializer, align 1
@que = dso_local global [10002 x %struct.Q] zeroinitializer, align 16
@g = dso_local global [11 x i8] zeroinitializer, align 1
@sg = dso_local local_unnamed_addr global i8 0, align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@end = dso_local local_unnamed_addr global i32 0, align 4
@.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) #6
%call189 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool190 = icmp ne i32 %call189, 0
%0 = load i32, ptr %n, align 4
%cmp191 = icmp sgt i32 %0, 0
%1 = select i1 %tobool190, i1 %cmp191, i1 false
br i1 %1, label %for.body, label %while.end145
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10 x [11 x i8]], ptr @a, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [10 x [11 x i8]], ptr @b, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%call9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx) #7
%conv = trunc i64 %call9 to i8
%arrayidx11 = getelementptr inbounds [10 x i8], ptr @sa, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx11, align 1, !tbaa !5
%call15 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx3) #7
%conv16 = trunc i64 %call15 to i8
%arrayidx18 = getelementptr inbounds [10 x i8], ptr @sb, i64 0, i64 %indvars.iv
store i8 %conv16, ptr %arrayidx18, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !8
%3 = sext i32 %2 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body.backedge, label %for.cond28.preheader.lr.ph
for.body.backedge: ; preds = %for.body, %done
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %done ]
br label %for.body, !llvm.loop !10
for.cond28.preheader.lr.ph: ; preds = %for.body
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @que, ptr noundef nonnull @g)
%call20 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @g) #7
%conv21 = trunc i64 %call20 to i8
store i8 %conv21, ptr @sg, align 1, !tbaa !5
store i8 0, ptr getelementptr inbounds ([10002 x %struct.Q], ptr @que, i64 0, i64 0, i32 2), align 4, !tbaa !12
%call22 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @que) #7
%conv23 = trunc i64 %call22 to i8
store i8 %conv23, ptr getelementptr inbounds ([10002 x %struct.Q], ptr @que, i64 0, i64 0, i32 1), align 1, !tbaa !14
store i32 0, ptr @top, align 4, !tbaa !8
store i32 1, ptr @end, align 4, !tbaa !8
%4 = load i32, ptr %n, align 4, !tbaa !8
%5 = icmp sgt i32 %4, 0
br i1 %5, label %for.cond28.preheader, label %for.cond28.preheader.lr.ph.split.us
for.cond28.preheader.lr.ph.split.us: ; preds = %for.cond28.preheader.lr.ph
store i32 1, ptr @top, align 4, !tbaa !8
br label %done
for.cond28.preheader: ; preds = %for.cond28.preheader.lr.ph, %for.end141
%6 = phi i32 [ %29, %for.end141 ], [ 1, %for.cond28.preheader.lr.ph ]
%7 = phi i32 [ %inc142, %for.end141 ], [ 0, %for.cond28.preheader.lr.ph ]
%8 = phi i32 [ %31, %for.end141 ], [ %4, %for.cond28.preheader.lr.ph ]
%cmp29185 = icmp sgt i32 %8, 0
br i1 %cmp29185, label %for.body31, label %for.end141
for.body31: ; preds = %for.cond28.preheader, %for.inc139
%indvars.iv195 = phi i64 [ %indvars.iv.next196, %for.inc139 ], [ 0, %for.cond28.preheader ]
%9 = load i32, ptr @top, align 4, !tbaa !8
%idxprom32 = sext i32 %9 to i64
%arrayidx33 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom32
%k41 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom32, i32 2
%10 = load i8, ptr %k41, align 1, !tbaa !12
%conv42 = sext i8 %10 to i32
%add = add nsw i32 %conv42, 1
%11 = load i8, ptr %arrayidx33, align 1, !tbaa !5
%tobool48.not180 = icmp eq i8 %11, 0
br i1 %tobool48.not180, label %for.inc139, label %while.body49.lr.ph
while.body49.lr.ph: ; preds = %for.body31
%12 = load i32, ptr @end, align 4, !tbaa !8
%idxprom43 = sext i32 %12 to i64
%arrayidx44 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom43
%s37 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom32, i32 1
%13 = load i8, ptr %s37, align 1, !tbaa !14
%arrayidx55 = getelementptr inbounds [10 x i8], ptr @sa, i64 0, i64 %indvars.iv195
%conv58 = sext i8 %13 to i64
%arrayidx62 = getelementptr inbounds [10 x [11 x i8]], ptr @a, i64 0, i64 %indvars.iv195
%arrayidx80 = getelementptr inbounds [10 x i8], ptr @sb, i64 0, i64 %indvars.iv195
%arrayidx88 = getelementptr inbounds [10 x [11 x i8]], ptr @b, i64 0, i64 %indvars.iv195
br label %while.body49
while.body49: ; preds = %while.body49.lr.ph, %if.end102
%14 = phi i8 [ %11, %while.body49.lr.ph ], [ %24, %if.end102 ]
%q.0183 = phi ptr [ %arrayidx44, %while.body49.lr.ph ], [ %q.1, %if.end102 ]
%p.0182 = phi ptr [ %arrayidx33, %while.body49.lr.ph ], [ %p.1, %if.end102 ]
%f.0181 = phi i32 [ 0, %while.body49.lr.ph ], [ %f.1, %if.end102 ]
%15 = load i32, ptr @top, align 4, !tbaa !8
%idxprom50 = sext i32 %15 to i64
%arrayidx51 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom50
%sub.ptr.lhs.cast = ptrtoint ptr %p.0182 to i64
%sub.ptr.rhs.cast = ptrtoint ptr %arrayidx51 to i64
%16 = load i8, ptr %arrayidx55, align 1, !tbaa !5
%conv56 = sext i8 %16 to i64
%sub.ptr.sub = add i64 %conv56, %sub.ptr.lhs.cast
%add57 = sub i64 %sub.ptr.sub, %sub.ptr.rhs.cast
%cmp59.not = icmp sgt i64 %add57, %conv58
br i1 %cmp59.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %while.body49
%bcmp174 = call i32 @bcmp(ptr nonnull %p.0182, ptr nonnull %arrayidx62, i64 %conv56)
%tobool68.not = icmp eq i32 %bcmp174, 0
br i1 %tobool68.not, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
%17 = load i32, ptr @end, align 4, !tbaa !8
%idxprom69 = sext i32 %17 to i64
%arrayidx70 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom69
%sub.ptr.lhs.cast73 = ptrtoint ptr %q.0183 to i64
%sub.ptr.rhs.cast74 = ptrtoint ptr %arrayidx70 to i64
%18 = load i8, ptr %arrayidx80, align 1, !tbaa !5
%conv81 = sext i8 %18 to i64
%19 = add i64 %sub.ptr.lhs.cast73, %conv81
%20 = add i64 %conv56, %sub.ptr.rhs.cast74
%add82 = sub i64 %19, %20
%21 = load i8, ptr @sg, align 1, !tbaa !5
%conv83 = sext i8 %21 to i64
%cmp84 = icmp sgt i64 %add82, %conv83
br i1 %cmp84, label %for.inc139, label %if.end
if.end: ; preds = %if.then
call void @llvm.memcpy.p0.p0.i64(ptr align 1 %q.0183, ptr nonnull align 1 %arrayidx88, i64 %conv81, i1 false)
%22 = load i8, ptr %arrayidx55, align 1, !tbaa !5
%idx.ext = sext i8 %22 to i64
%add.ptr = getelementptr inbounds i8, ptr %p.0182, i64 %idx.ext
%23 = load i8, ptr %arrayidx80, align 1, !tbaa !5
%idx.ext99 = sext i8 %23 to i64
%add.ptr100 = getelementptr inbounds i8, ptr %q.0183, i64 %idx.ext99
br label %if.end102
if.else: ; preds = %land.lhs.true, %while.body49
%incdec.ptr = getelementptr inbounds i8, ptr %p.0182, i64 1
%incdec.ptr101 = getelementptr inbounds i8, ptr %q.0183, i64 1
store i8 %14, ptr %q.0183, align 1, !tbaa !5
br label %if.end102
if.end102: ; preds = %if.else, %if.end
%f.1 = phi i32 [ %f.0181, %if.else ], [ 1, %if.end ]
%p.1 = phi ptr [ %incdec.ptr, %if.else ], [ %add.ptr, %if.end ]
%q.1 = phi ptr [ %incdec.ptr101, %if.else ], [ %add.ptr100, %if.end ]
%24 = load i8, ptr %p.1, align 1, !tbaa !5
%tobool48.not = icmp eq i8 %24, 0
br i1 %tobool48.not, label %while.end, label %while.body49, !llvm.loop !15
while.end: ; preds = %if.end102
%tobool103.not = icmp eq i32 %f.1, 0
br i1 %tobool103.not, label %for.inc139, label %if.end105
if.end105: ; preds = %while.end
store i8 0, ptr %q.1, align 1, !tbaa !5
%25 = load i32, ptr @end, align 4, !tbaa !8
%idxprom106 = sext i32 %25 to i64
%arrayidx107 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom106
%sub.ptr.lhs.cast110 = ptrtoint ptr %q.1 to i64
%sub.ptr.rhs.cast111 = ptrtoint ptr %arrayidx107 to i64
%sub.ptr.sub112 = sub i64 %sub.ptr.lhs.cast110, %sub.ptr.rhs.cast111
%conv113 = trunc i64 %sub.ptr.sub112 to i32
%26 = load i8, ptr @sg, align 1, !tbaa !5
%conv114 = sext i8 %26 to i32
%cmp115 = icmp eq i32 %conv113, %conv114
br i1 %cmp115, label %if.then117, label %if.else128
if.then117: ; preds = %if.end105
%conv122 = sext i8 %26 to i64
%bcmp = call i32 @bcmp(ptr nonnull %arrayidx107, ptr nonnull @g, i64 %conv122)
%cmp124 = icmp eq i32 %bcmp, 0
br i1 %cmp124, label %done, label %for.inc139
if.else128: ; preds = %if.end105
%conv129 = trunc i64 %sub.ptr.sub112 to i8
%s132 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom106, i32 1
store i8 %conv129, ptr %s132, align 1, !tbaa !14
%conv133 = trunc i32 %add to i8
%inc134 = add nsw i32 %25, 1
store i32 %inc134, ptr @end, align 4, !tbaa !8
%k137 = getelementptr inbounds [10002 x %struct.Q], ptr @que, i64 0, i64 %idxprom106, i32 2
store i8 %conv133, ptr %k137, align 1, !tbaa !12
br label %for.inc139
for.inc139: ; preds = %if.then, %for.body31, %if.then117, %if.else128, %while.end
%indvars.iv.next196 = add nuw nsw i64 %indvars.iv195, 1
%27 = load i32, ptr %n, align 4, !tbaa !8
%28 = sext i32 %27 to i64
%cmp29 = icmp slt i64 %indvars.iv.next196, %28
br i1 %cmp29, label %for.body31, label %for.end141.loopexit, !llvm.loop !16
for.end141.loopexit: ; preds = %for.inc139
%.pre = load i32, ptr @top, align 4, !tbaa !8
%.pre198 = load i32, ptr @end, align 4, !tbaa !8
br label %for.end141
for.end141: ; preds = %for.end141.loopexit, %for.cond28.preheader
%29 = phi i32 [ %.pre198, %for.end141.loopexit ], [ %6, %for.cond28.preheader ]
%30 = phi i32 [ %.pre, %for.end141.loopexit ], [ %7, %for.cond28.preheader ]
%31 = phi i32 [ %27, %for.end141.loopexit ], [ %8, %for.cond28.preheader ]
%inc142 = add nsw i32 %30, 1
store i32 %inc142, ptr @top, align 4, !tbaa !8
%cmp25 = icmp slt i32 %inc142, %29
br i1 %cmp25, label %for.cond28.preheader, label %done, !llvm.loop !17
done: ; preds = %for.end141, %if.then117, %for.cond28.preheader.lr.ph.split.us
%ans.0 = phi i32 [ -1, %for.cond28.preheader.lr.ph.split.us ], [ %add, %if.then117 ], [ -1, %for.end141 ]
%call144 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp ne i32 %call, 0
%32 = load i32, ptr %n, align 4
%cmp = icmp sgt i32 %32, 0
%33 = select i1 %tobool, i1 %cmp, i1 false
br i1 %33, label %for.body.backedge, label %while.end145
while.end145: ; preds = %done, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !6, i64 12}
!13 = !{!"", !6, i64 0, !6, i64 11, !6, i64 12}
!14 = !{!13, !6, i64 11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
int main() {
int a, b, c, d, n, k;
while (scanf("%d", &n) != EOF) {
k = 0;
for (a = 0; a < 10; a ++) {
for (b = 0; b < 10; b ++) {
for (c = 0; c < 10; c ++) {
for (d = 0;d < 10; d ++) {
if (a + b + c + d == n) k ++;
}
}
}
}
printf("%d\n", k);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%k.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%k.139 = phi i32 [ %k.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %k.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int n, result;
int i, j, k, l;
while(scanf("%d",&n)!=EOF){
result=0;
for(i=0;i<10;i++)
for(j=0;j<10;j++)
for(k=0;k<10;k++)
for(l=0;l<10;l++){
if(i+j+k+l==n)
result++;
}
printf("%d\n",result);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111804/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%i.041 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
%result.040 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%j.039 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%result.138 = phi i32 [ %result.040, %for.cond2.preheader ], [ %123, %vector.ph ]
%add = add nuw nsw i32 %j.039, %i.041
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %result.138, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.039, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.041, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include "stdio.h"
#define N 50
int solve(int m,int digit){
int i,sum;
sum=0;
if (digit==1){
for (i = 0; i < 10; i++) {
if(i==m)return 1;
}
return 0;
}
for (i = 0; i < 10; i++) {
sum=sum+solve(m-i,digit-1);
}
return sum;
}
int main(int argc, char const *argv[]) {
int n[N],i,j;
i=0;
while(scanf("%d",&n[i])!=EOF)i++;
for (j = 0; j < i; j++) {
printf("%d\n",solve(n[j],4));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @solve(i32 noundef %m, i32 noundef %digit) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %for.cond5.preheader, %entry
%accumulator.tr = phi i32 [ 0, %entry ], [ %add.9, %for.cond5.preheader ]
%m.tr = phi i32 [ %m, %entry ], [ %sub.9, %for.cond5.preheader ]
%digit.tr = phi i32 [ %digit, %entry ], [ %sub8, %for.cond5.preheader ]
%cmp = icmp eq i32 %digit.tr, 1
br i1 %cmp, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %tailrecurse
%switch = icmp ult i32 %m.tr, 10
%spec.select = zext i1 %switch to i32
%accumulator.ret.tr = add nsw i32 %accumulator.tr, %spec.select
ret i32 %accumulator.ret.tr
for.cond5.preheader: ; preds = %tailrecurse
%sub8 = add nsw i32 %digit.tr, -1
%call = tail call i32 @solve(i32 noundef %m.tr, i32 noundef %sub8)
%sub.1 = add nsw i32 %m.tr, -1
%call.1 = tail call i32 @solve(i32 noundef %sub.1, i32 noundef %sub8)
%add.1 = add nsw i32 %call.1, %call
%sub.2 = add nsw i32 %m.tr, -2
%call.2 = tail call i32 @solve(i32 noundef %sub.2, i32 noundef %sub8)
%add.2 = add nsw i32 %call.2, %add.1
%sub.3 = add nsw i32 %m.tr, -3
%call.3 = tail call i32 @solve(i32 noundef %sub.3, i32 noundef %sub8)
%add.3 = add nsw i32 %call.3, %add.2
%sub.4 = add nsw i32 %m.tr, -4
%call.4 = tail call i32 @solve(i32 noundef %sub.4, i32 noundef %sub8)
%add.4 = add nsw i32 %call.4, %add.3
%sub.5 = add nsw i32 %m.tr, -5
%call.5 = tail call i32 @solve(i32 noundef %sub.5, i32 noundef %sub8)
%add.5 = add nsw i32 %call.5, %add.4
%sub.6 = add nsw i32 %m.tr, -6
%call.6 = tail call i32 @solve(i32 noundef %sub.6, i32 noundef %sub8)
%add.6 = add nsw i32 %call.6, %add.5
%sub.7 = add nsw i32 %m.tr, -7
%call.7 = tail call i32 @solve(i32 noundef %sub.7, i32 noundef %sub8)
%add.7 = add nsw i32 %call.7, %add.6
%sub.8 = add nsw i32 %m.tr, -8
%call.8 = tail call i32 @solve(i32 noundef %sub.8, i32 noundef %sub8)
%add.8 = add nsw i32 %call.8, %add.7
%sub.9 = add nsw i32 %m.tr, -9
%add.9 = add nsw i32 %accumulator.tr, %add.8
br label %tailrecurse
}
; 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%n = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %n) #4
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv17 = phi i32 [ %indvars.iv.next18, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %n, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp.not = icmp eq i32 %call, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next18 = add nuw i32 %indvars.iv17, 1
br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !5
for.cond.preheader: ; preds = %while.cond
%0 = and i64 %indvars.iv, 4294967295
%cmp111.not = icmp eq i64 %0, 0
br i1 %cmp111.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %indvars.iv17 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv14 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next15, %for.body ]
%arrayidx3 = getelementptr inbounds [50 x i32], ptr %n, i64 0, i64 %indvars.iv14
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !7
%call4 = call i32 @solve(i32 noundef %1, i32 noundef 4)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call4)
%indvars.iv.next15 = add nuw nsw i64 %indvars.iv14, 1
%exitcond.not = icmp eq i64 %indvars.iv.next15, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
int main()
{
int i,j,k,l,temp,n,sum;
while(scanf("%d",&n)!=EOF){
temp=0;
for(i=0;i<=9;i++){
for(j=0;j<=9;j++){
for(k=0;k<=9;k++){
for(l=0;l<=9;l++){
sum=i+j+k+l;
if(sum==n){
temp++;
}
}
}
}
}
printf("%d\n",temp);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111899/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111899/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%i.041 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
%temp.040 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%temp.139 = phi i32 [ %temp.040, %for.cond2.preheader ], [ %123, %vector.ph ]
%j.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %j.038, %i.041
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %temp.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.041, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main()
{
int i[4],n,c;
while(scanf("%d",&n)!=EOF)
{
c=0;
for(i[0]=0;i[0]<10;i[0]++)
{
for(i[1]=0;i[1]<10;i[1]++)
{
for(i[2]=0;i[2]<10;i[2]++)
{
for(i[3]=0;i[3]<10;i[3]++)
if(i[0]+i[1]+i[2]+i[3]==n)c++;
}}}
printf("%d\n",c);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111963/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not58 = icmp eq i32 %call57, -1
br i1 %cmp.not58, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end38
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert61 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat62 = shufflevector <4 x i32> %broadcast.splatinsert61, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond.preheader, %for.inc35
%c.056 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc35 ]
%i.sroa.0.055 = phi i32 [ 0, %for.cond.preheader ], [ %inc37, %for.inc35 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond4.preheader
%c.154 = phi i32 [ %c.056, %for.cond4.preheader ], [ %123, %vector.ph ]
%i.sroa.7.053 = phi i32 [ 0, %for.cond4.preheader ], [ %inc33, %vector.ph ]
%add = add nuw nsw i32 %i.sroa.7.053, %i.sroa.0.055
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.154, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat62
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat62
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat62
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat62
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat62
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat62
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat62
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat62
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat62
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat62
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat62
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat62
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat62
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat62
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat62
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat62
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat62
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat62
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat62
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat62
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat62
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat62
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat62
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat62
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat62
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat62
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat62
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat62
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat62
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat62
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc33 = add nuw nsw i32 %i.sroa.7.053, 1
%exitcond59.not = icmp eq i32 %inc33, 10
br i1 %exitcond59.not, label %for.inc35, label %vector.ph, !llvm.loop !9
for.inc35: ; preds = %vector.ph
%inc37 = add nuw nsw i32 %i.sroa.0.055, 1
%exitcond60.not = icmp eq i32 %inc37, 10
br i1 %exitcond60.not, label %for.end38, label %for.cond4.preheader, !llvm.loop !11
for.end38: ; preds = %for.inc35
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end38, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void){
int a,b,c,d,n,count;
while(scanf("%d",&n)!=EOF){
count=0;
for(a=0;a<10;a++){
for(b=0;b<10;b++){
for(c=0;c<10;c++){
for(d=0;d<10;d++){
if(n==a+b+c+d){
count++;
}
}
}
}
}
printf("%d\n",count);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112027/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112027/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %broadcast.splat47, %2
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %broadcast.splat47, %6
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %broadcast.splat47, %10
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %broadcast.splat47, %14
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %broadcast.splat47, %18
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %broadcast.splat47, %22
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %broadcast.splat47, %26
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %broadcast.splat47, %30
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %broadcast.splat47, %34
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %broadcast.splat47, %38
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %broadcast.splat47, %42
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %broadcast.splat47, %46
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %broadcast.splat47, %50
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %broadcast.splat47, %54
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %broadcast.splat47, %58
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %broadcast.splat47, %62
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %broadcast.splat47, %66
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %broadcast.splat47, %70
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %broadcast.splat47, %74
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %broadcast.splat47, %78
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %broadcast.splat47, %82
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %broadcast.splat47, %86
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %broadcast.splat47, %90
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %broadcast.splat47, %94
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %broadcast.splat47, %98
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %broadcast.splat47, %102
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %broadcast.splat47, %106
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %broadcast.splat47, %110
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %broadcast.splat47, %114
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %broadcast.splat47, %118
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int n,i,j,k,l,count;
while(scanf("%d",&n)!=EOF){
count=0;
for(i=0;i<10;i++){
for(j=0;j<10;j++){
for(k=0;k<10;k++){
for(l=0;l<10;l++){
if(i+j+k+l==n){
count++;
}
}
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112070/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112070/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%i.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%j.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %j.038, %i.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void)
{
int a,b,c,d,n,k;
while(scanf("%d",&n) != EOF)
{
k = 0;
for(a = 0;a <10;a++)
{
for(b = 0;b < 10;b++)
{
for(c = 0;c < 10;c++)
{
for(d = 0;d < 10;d++)
{
if(a+b+c+d == n)
{
k++;
}
}
}
}
}
printf("%d\n",k);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%k.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%k.139 = phi i32 [ %k.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %k.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int a,b,c,d,n,t;
while(scanf("%d",&n)!=EOF){
t=0;
for(a=0;a<10;a++){
for(b=0;b<10;b++){
for(c=0;c<10;c++){
for(d=0;d<10;d++){
if(a+b+d+c==n){
t++;
}
}
}
}
}
printf("%d\n",t);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%t.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%t.139 = phi i32 [ %t.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %t.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main()
{
int a, b, c, d;
int n;
int count = 0;
while (scanf("%d", &n) != EOF) {
for (a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n) {
count++;
}
}
}
}
}
printf("%d\n", count);
count = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.141 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.239 = phi i32 [ %count.141, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.239, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void)
{
int i, j, k, l;
int count;
int n;
while (scanf("%d", &n) != EOF){
count = 0;
for (i = 0; i < 10; i++){
for (j = 0; j < 10; j++){
for (k = 0; k < 10; k++){
for (l = 0; l < 10; l++){
if ((i + j + k + l) == n){
count++;
}
}
}
}
}
printf("%d\n", count);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112265/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%i.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%j.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %j.038, %i.040
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
typedef struct directedGraph{
int *vertex;
int *next;
int *start;
int v,e;
int pointer;
} graph;
graph* newGraph(const int v,const int e){
graph *g=(graph *)malloc(sizeof(graph));
g->vertex=(int *)calloc(e,sizeof(int));
g->next=(int *)calloc(e,sizeof(int));
g->start=(int *)calloc(v,sizeof(int));
for(int i=0;i<v;i++) g->start[i]=-1;
g->v=v;
g->e=e;
g->pointer=0;
return g;
}
void freeGraph(graph *g){
free(g->vertex);
free(g->next);
free(g->start);
free(g);
return;
}
void addEdge(graph *g,const int from,const int to){
const int p=g->pointer;
g->vertex[p]=to;
g->next[p]=g->start[from];
g->start[from]=p;
g->pointer++;
return;
}
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
int cmp(const void *a,const void *b){
return *(int *)a-*(int *)b;
}
void run(void){
int n;
scanf("%d",&n);
graph *g=newGraph(n,n);
int i;
for(i=1;i<n;i++){
int a;
scanf("%d",&a);
addEdge(g,a-1,i);
}
int *q=(int *)calloc(n,sizeof(int));
int front=0,last=0;
q[last++]=0;
while(last<n){
int v=q[front++];
for(int p=g->start[v];p!=-1;p=g->next[p]){
int u=g->vertex[p];
q[last++]=u;
}
}
int *dp=(int *)calloc(n,sizeof(int));
int *array=(int *)calloc(n,sizeof(int));
for(i=n-1;i>=0;i--){
int v=q[i];
int len=0;
for(int p=g->start[v];p!=-1;p=g->next[p]){
int u=g->vertex[p];
array[len++]=dp[u];
}
qsort(array,len,sizeof(int),cmp);
int d=0;
for(int j=0;j<len;j++){
d=MAX(d,array[len-1-j]+1+j);
}
dp[v]=d;
}
printf("%d\n",dp[0]);
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112308/source.c"
target datalayout = "e-m:e-p270: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.directedGraph = type { ptr, ptr, ptr, i32, i32, i32 }
@.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 nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @newGraph(i32 noundef %v, i32 noundef %e) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #13
%conv = sext i32 %e to i64
%call1 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #14
store ptr %call1, ptr %call, align 8, !tbaa !5
%call3 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #14
%next = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 1
store ptr %call3, ptr %next, align 8, !tbaa !11
%conv4 = sext i32 %v to i64
%call5 = tail call noalias ptr @calloc(i64 noundef %conv4, i64 noundef 4) #14
%start = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 2
store ptr %call5, ptr %start, align 8, !tbaa !12
%cmp23 = icmp sgt i32 %v, 0
br i1 %cmp23, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %v to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %call5, i8 -1, i64 %1, i1 false), !tbaa !13
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
%v8 = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 3
store i32 %v, ptr %v8, align 8, !tbaa !14
%e9 = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 4
store i32 %e, ptr %e9, align 4, !tbaa !15
%pointer = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 5
store i32 0, ptr %pointer, align 8, !tbaa !16
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local void @freeGraph(ptr nocapture noundef %g) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !5
tail call void @free(ptr noundef %0) #15
%next = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 1
%1 = load ptr, ptr %next, align 8, !tbaa !11
tail call void @free(ptr noundef %1) #15
%start = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 2
%2 = load ptr, ptr %start, align 8, !tbaa !12
tail call void @free(ptr noundef %2) #15
tail call void @free(ptr noundef %g) #15
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @addEdge(ptr nocapture noundef %g, i32 noundef %from, i32 noundef %to) local_unnamed_addr #6 {
entry:
%pointer = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 5
%0 = load i32, ptr %pointer, align 8, !tbaa !16
%1 = load ptr, ptr %g, align 8, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom
store i32 %to, ptr %arrayidx, align 4, !tbaa !13
%start = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 2
%2 = load ptr, ptr %start, align 8, !tbaa !12
%idxprom1 = sext i32 %from to i64
%arrayidx2 = getelementptr inbounds i32, ptr %2, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !13
%next = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 1
%4 = load ptr, ptr %next, align 8, !tbaa !11
%arrayidx4 = getelementptr inbounds i32, ptr %4, i64 %idxprom
store i32 %3, ptr %arrayidx4, align 4, !tbaa !13
store i32 %0, ptr %arrayidx2, align 4, !tbaa !13
%5 = load i32, ptr %pointer, align 8, !tbaa !16
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %pointer, align 8, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #7 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !13
%1 = load i32, ptr %b, align 4, !tbaa !13
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #8 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%conv.i = sext i32 %0 to i64
%call1.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #14
%call3.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #14
%call5.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #14
%cmp23.i = icmp sgt i32 %0, 0
br i1 %cmp23.i, label %newGraph.exit, label %for.end.thread
newGraph.exit: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr align 4 %call5.i, i8 -1, i64 %2, i1 false), !tbaa !13
%cmp129.not = icmp eq i32 %0, 1
br i1 %cmp129.not, label %for.end.thread, label %for.body
for.body: ; preds = %newGraph.exit, %for.body
%3 = phi i32 [ %inc.i, %for.body ], [ 0, %newGraph.exit ]
%i.0130 = phi i32 [ %inc, %for.body ], [ 1, %newGraph.exit ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #15
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !13
%sub = add nsw i32 %4, -1
%idxprom.i = zext i32 %3 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i
store i32 %i.0130, ptr %arrayidx.i, align 4, !tbaa !13
%idxprom1.i = sext i32 %sub to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %call5.i, i64 %idxprom1.i
%5 = load i32, ptr %arrayidx2.i, align 4, !tbaa !13
%arrayidx4.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom.i
store i32 %5, ptr %arrayidx4.i, align 4, !tbaa !13
store i32 %3, ptr %arrayidx2.i, align 4, !tbaa !13
%inc.i = add nuw nsw i32 %3, 1
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #15
%inc = add nuw nsw i32 %i.0130, 1
%6 = load i32, ptr %n, align 4, !tbaa !13
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end.thread: ; preds = %newGraph.exit, %entry
%call3170 = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #14
br label %while.end
for.end: ; preds = %for.body
%.pre166 = sext i32 %6 to i64
%call3 = call noalias ptr @calloc(i64 noundef %.pre166, i64 noundef 4) #14
%cmp5136 = icmp sgt i32 %6, 1
br i1 %cmp5136, label %while.body, label %while.end
while.cond.loopexit.loopexit: ; preds = %for.body15
%7 = trunc i64 %indvars.iv.next to i32
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %while.cond.loopexit.loopexit, %while.body
%last.1.lcssa = phi i32 [ %last.0137, %while.body ], [ %7, %while.cond.loopexit.loopexit ]
%cmp5 = icmp slt i32 %last.1.lcssa, %6
br i1 %cmp5, label %while.body, label %while.end, !llvm.loop !19
while.body: ; preds = %for.end, %while.cond.loopexit
%indvars.iv153 = phi i64 [ %indvars.iv.next154, %while.cond.loopexit ], [ 0, %for.end ]
%last.0137 = phi i32 [ %last.1.lcssa, %while.cond.loopexit ], [ 1, %for.end ]
%indvars.iv.next154 = add nuw i64 %indvars.iv153, 1
%arrayidx9 = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv153
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !13
%idxprom10 = sext i32 %8 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %call5.i, i64 %idxprom10
%p.0131 = load i32, ptr %arrayidx11, align 4, !tbaa !13
%cmp13.not132 = icmp eq i32 %p.0131, -1
br i1 %cmp13.not132, label %while.cond.loopexit, label %for.body15.preheader
for.body15.preheader: ; preds = %while.body
%9 = sext i32 %last.0137 to i64
br label %for.body15
for.body15: ; preds = %for.body15.preheader, %for.body15
%indvars.iv = phi i64 [ %9, %for.body15.preheader ], [ %indvars.iv.next, %for.body15 ]
%p.0134 = phi i32 [ %p.0131, %for.body15.preheader ], [ %p.0, %for.body15 ]
%idxprom16 = sext i32 %p.0134 to i64
%arrayidx17 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom16
%10 = load i32, ptr %arrayidx17, align 4, !tbaa !13
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx20 = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv
store i32 %10, ptr %arrayidx20, align 4, !tbaa !13
%arrayidx23 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom16
%p.0 = load i32, ptr %arrayidx23, align 4, !tbaa !13
%cmp13.not = icmp eq i32 %p.0, -1
br i1 %cmp13.not, label %while.cond.loopexit.loopexit, label %for.body15, !llvm.loop !20
while.end: ; preds = %while.cond.loopexit, %for.end.thread, %for.end
%call3174 = phi ptr [ %call3170, %for.end.thread ], [ %call3, %for.end ], [ %call3, %while.cond.loopexit ]
%.lcssa173 = phi i32 [ %0, %for.end.thread ], [ %6, %for.end ], [ %6, %while.cond.loopexit ]
%conv.pre-phi172 = phi i64 [ %conv.i, %for.end.thread ], [ %.pre166, %for.end ], [ %.pre166, %while.cond.loopexit ]
%call26 = call noalias ptr @calloc(i64 noundef %conv.pre-phi172, i64 noundef 4) #14
%call28 = call noalias ptr @calloc(i64 noundef %conv.pre-phi172, i64 noundef 4) #14
%cmp31149 = icmp sgt i32 %.lcssa173, 0
br i1 %cmp31149, label %for.body33.preheader, label %for.end85
for.body33.preheader: ; preds = %while.end
%11 = zext i32 %.lcssa173 to i64
br label %for.body33
for.body33: ; preds = %for.body33.preheader, %for.cond.cleanup64
%indvars.iv163 = phi i64 [ %11, %for.body33.preheader ], [ %indvars.iv.next164, %for.cond.cleanup64 ]
%indvars.iv.next164 = add nsw i64 %indvars.iv163, -1
%idxprom35 = and i64 %indvars.iv.next164, 4294967295
%arrayidx36 = getelementptr inbounds i32, ptr %call3174, i64 %idxprom35
%12 = load i32, ptr %arrayidx36, align 4, !tbaa !13
%idxprom39 = sext i32 %12 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %call5.i, i64 %idxprom39
%p37.0139 = load i32, ptr %arrayidx40, align 4, !tbaa !13
%cmp42.not140 = icmp eq i32 %p37.0139, -1
br i1 %cmp42.not140, label %for.cond.cleanup44.thread, label %for.body45
for.cond.cleanup44.thread: ; preds = %for.body33
call void @qsort(ptr noundef %call28, i64 noundef 0, i64 noundef 4, ptr noundef nonnull @cmp) #15
br label %for.cond.cleanup64
for.cond.cleanup44: ; preds = %for.body45
%conv60 = and i64 %indvars.iv.next157, 4294967295
call void @qsort(ptr noundef nonnull %call28, i64 noundef %conv60, i64 noundef 4, ptr noundef nonnull @cmp) #15
%13 = and i64 %indvars.iv.next157, 4294967295
%cmp62144.not = icmp eq i64 %13, 0
br i1 %cmp62144.not, label %for.cond.cleanup64, label %for.body65.preheader
for.body65.preheader: ; preds = %for.cond.cleanup44
%sext = shl i64 %indvars.iv.next157, 32
%14 = ashr exact i64 %sext, 32
%15 = getelementptr i32, ptr %call28, i64 %14
%min.iters.check = icmp ult i64 %conv60, 8
br i1 %min.iters.check, label %for.body65.preheader182, label %vector.ph
vector.ph: ; preds = %for.body65.preheader
%n.mod.vf = and i64 %indvars.iv.next157, 7
%n.vec = sub nsw i64 %conv60, %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.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
%vec.phi179 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
%16 = xor i64 %index, -1
%17 = getelementptr i32, ptr %15, i64 %16
%18 = getelementptr i32, ptr %17, i64 -3
%wide.load = load <4 x i32>, ptr %18, align 4, !tbaa !13
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%19 = getelementptr i32, ptr %17, i64 -7
%wide.load180 = load <4 x i32>, ptr %19, align 4, !tbaa !13
%reverse181 = shufflevector <4 x i32> %wide.load180, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%20 = trunc <4 x i64> %vec.ind to <4 x i32>
%21 = add <4 x i32> %20, <i32 1, i32 1, i32 1, i32 1>
%22 = trunc <4 x i64> %vec.ind to <4 x i32>
%23 = add <4 x i32> %22, <i32 5, i32 5, i32 5, i32 5>
%24 = add <4 x i32> %reverse, %21
%25 = add <4 x i32> %reverse181, %23
%26 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %24)
%27 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi179, <4 x i32> %25)
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%28 = icmp eq i64 %index.next, %n.vec
br i1 %28, label %middle.block, label %vector.body, !llvm.loop !21
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %26, <4 x i32> %27)
%29 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup64, label %for.body65.preheader182
for.body65.preheader182: ; preds = %for.body65.preheader, %middle.block
%indvars.iv159.ph = phi i64 [ 0, %for.body65.preheader ], [ %n.vec, %middle.block ]
%d.0145.ph = phi i32 [ 0, %for.body65.preheader ], [ %29, %middle.block ]
br label %for.body65
for.body45: ; preds = %for.body33, %for.body45
%indvars.iv156 = phi i64 [ %indvars.iv.next157, %for.body45 ], [ 0, %for.body33 ]
%p37.0142 = phi i32 [ %p37.0, %for.body45 ], [ %p37.0139, %for.body33 ]
%idxprom48 = sext i32 %p37.0142 to i64
%arrayidx49 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom48
%30 = load i32, ptr %arrayidx49, align 4, !tbaa !13
%idxprom50 = sext i32 %30 to i64
%arrayidx51 = getelementptr inbounds i32, ptr %call26, i64 %idxprom50
%31 = load i32, ptr %arrayidx51, align 4, !tbaa !13
%indvars.iv.next157 = add nuw i64 %indvars.iv156, 1
%arrayidx54 = getelementptr inbounds i32, ptr %call28, i64 %indvars.iv156
store i32 %31, ptr %arrayidx54, align 4, !tbaa !13
%arrayidx58 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom48
%p37.0 = load i32, ptr %arrayidx58, align 4, !tbaa !13
%cmp42.not = icmp eq i32 %p37.0, -1
br i1 %cmp42.not, label %for.cond.cleanup44, label %for.body45, !llvm.loop !24
for.cond.cleanup64: ; preds = %for.body65, %middle.block, %for.cond.cleanup44.thread, %for.cond.cleanup44
%d.0.lcssa = phi i32 [ 0, %for.cond.cleanup44 ], [ 0, %for.cond.cleanup44.thread ], [ %29, %middle.block ], [ %d.0.add70, %for.body65 ]
%arrayidx83 = getelementptr inbounds i32, ptr %call26, i64 %idxprom39
store i32 %d.0.lcssa, ptr %arrayidx83, align 4, !tbaa !13
%cmp31 = icmp sgt i64 %indvars.iv163, 1
br i1 %cmp31, label %for.body33, label %for.end85.loopexit, !llvm.loop !25
for.body65: ; preds = %for.body65.preheader182, %for.body65
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.body65 ], [ %indvars.iv159.ph, %for.body65.preheader182 ]
%d.0145 = phi i32 [ %d.0.add70, %for.body65 ], [ %d.0145.ph, %for.body65.preheader182 ]
%32 = xor i64 %indvars.iv159, -1
%arrayidx69 = getelementptr i32, ptr %15, i64 %32
%33 = load i32, ptr %arrayidx69, align 4, !tbaa !13
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%34 = trunc i64 %indvars.iv.next160 to i32
%add70 = add i32 %33, %34
%d.0.add70 = call i32 @llvm.smax.i32(i32 %d.0145, i32 %add70)
%exitcond.not = icmp eq i64 %indvars.iv.next160, %conv60
br i1 %exitcond.not, label %for.cond.cleanup64, label %for.body65, !llvm.loop !26
for.end85.loopexit: ; preds = %for.cond.cleanup64
%.pre = load i32, ptr %call26, align 4, !tbaa !13
br label %for.end85
for.end85: ; preds = %for.end85.loopexit, %while.end
%35 = phi i32 [ %.pre, %for.end85.loopexit ], [ 0, %while.end ]
%call87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #15
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #12
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind "no-trapping-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 "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { nounwind allocsize(0,1) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"directedGraph", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 16}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 28}
!16 = !{!6, !10, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18, !22, !23}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18, !23, !22}
|
#include<stdio.h>
int main(void){
int n;
scanf("%d",&n);
if (n % 2 == 0)
{
printf("%d",n/2);
}else if (n % 2 == 1)
{
printf("%d",n/2 + 1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112351/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%rem = srem i32 %0, 2
%div5 = sdiv i32 %0, 2
switch i32 %rem, label %if.end7 [
i32 0, label %if.then
i32 1, label %if.then4
]
if.then: ; preds = %entry
%div = sdiv i32 %0, 2
br label %if.end7.sink.split
if.then4: ; preds = %entry
%add = add nsw i32 %div5, 1
br label %if.end7.sink.split
if.end7.sink.split: ; preds = %if.then, %if.then4
%add.sink = phi i32 [ %add, %if.then4 ], [ %div, %if.then ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add.sink)
br label %if.end7
if.end7: ; preds = %if.end7.sink.split, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int n;
scanf("%d",&n);
if(n%2==0){
printf("%d\n",n/2);
}
else{
printf("%d\n",n/2+1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%add.sink = add nsw i32 %div, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;
int main()
{
int n;
scanf("%d",&n);
if(n%2==0)
{
n=n/2;
}
else
{
n=n+1;
n=n/2;
}
printf("%d\n",n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%storemerge.in = add i32 %1, %0
%storemerge = sdiv i32 %storemerge.in, 2
store i32 %storemerge, ptr %n, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %storemerge)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
i=n/2;
j=n%2;
printf("%d",i+j);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %0, 2
%rem = srem i32 %0, 2
%add = add nsw i32 %div, %rem
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int n; scanf("%d",&n);
printf("%d\n",(n+1)/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int N,a;
a=scanf("%d",&N);
if(a!=1){
printf("正しく入力されていません\n");
}
if(N%2==0){
printf("%d\n",N/2);
}
else{
printf("%d\n",N/2+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [37 x i8] c"\E6\AD\A3\E3\81\97\E3\81\8F\E5\85\A5\E5\8A\9B\E3\81\95\E3\82\8C\E3\81\A6\E3\81\84\E3\81\BE\E3\81\9B\E3\82\93\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%cmp.not = icmp eq i32 %call, 1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.then, %entry
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%add.sink = add nsw i32 %div, %1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 N;
scanf("%d",&N);
printf("%d",N/2+N%2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112618/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%div = sdiv i32 %0, 2
%rem = srem i32 %0, 2
%add = add nsw i32 %div, %rem
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
printf("%d",(n+1)/2);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112661/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int N;
scanf( "%d" , &N );
if( N%2 ) printf( "%d" , N/2 + 1 );
else printf( "%d" , N/2 );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%div2 = sdiv i32 %0, 2
%div2.sink = add nsw i32 %div2, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int i;
scanf("%d",&i);
if(i%2==0){
printf("%d",i/2);
}else{
printf("%d",(i+1)/2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112748/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
%1 = and i32 %0, 1
%add.sink = add i32 %0, %1
%div2 = sdiv i32 %add.sink, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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){
// Your code here!
int n;
scanf("%d",&n);
printf("%d\n",(n+1)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i, a;
char x[1001];
int sum = 0;
while(1){
scanf("%s", x);
if(x[0] == '0'){
break;
}else{
for(i = 0; i < 1001; i++){
if(x[i] == 0){
break;
}else{
sum += x[i] - '0';
}
}
printf("%d\n", sum);
sum = 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112834/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112834/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %x) #3
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i8, ptr %x, align 16, !tbaa !5
%cmp22 = icmp eq i8 %0, 48
br i1 %cmp22, label %while.end, label %for.body
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%sum.120 = phi i32 [ %sum.120.be, %for.body.backedge ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds [1001 x i8], ptr %x, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp6 = icmp eq i8 %1, 0
br i1 %cmp6, label %for.end, label %if.else9
if.else9: ; preds = %for.body
%conv5 = sext i8 %1 to i32
%sub = add i32 %sum.120, -48
%add = add i32 %sub, %conv5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1001
br i1 %exitcond.not, label %for.end, label %for.body.backedge
for.body.backedge: ; preds = %if.else9, %for.end
%indvars.iv.be = phi i64 [ %indvars.iv.next, %if.else9 ], [ 0, %for.end ]
%sum.120.be = phi i32 [ %add, %if.else9 ], [ 0, %for.end ]
br label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %if.else9
%sum.1.lcssa = phi i32 [ %sum.120, %for.body ], [ %add, %if.else9 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i8, ptr %x, align 16, !tbaa !5
%cmp = icmp eq i8 %2, 48
br i1 %cmp, label %while.end, label %for.body.backedge
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int sum;
char data;
sum = 0;
while(1){
scanf("%c",&data);
if(sum == 0 && data == '0'){
break;
}
if(data == '\n'){
printf("%d\n",sum);
sum = 0;
continue;
}else{
if(data == '1'){
sum += 1;
}else if(data == '2'){
sum += 2;
}else if(data == '3'){
sum += 3;
}else if(data == '4'){
sum += 4;
}else if(data == '5'){
sum += 5;
}else if(data == '6'){
sum += 6;
}else if(data == '7'){
sum += 7;
}else if(data == '8'){
sum += 8;
}else if(data == '9'){
sum += 9;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112892/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112892/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %data) #3
%call80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%0 = load i8, ptr %data, align 1
%cmp181 = icmp eq i8 %0, 48
br i1 %cmp181, label %while.end, label %if.end
if.end: ; preds = %entry, %while.cond.backedge
%1 = phi i8 [ %2, %while.cond.backedge ], [ %0, %entry ]
%sum.082 = phi i32 [ %sum.0.be, %while.cond.backedge ], [ 0, %entry ]
switch i8 %1, label %while.cond.backedge [
i8 10, label %if.then6
i8 49, label %if.then11
i8 50, label %if.then16
i8 51, label %if.then22
i8 52, label %if.then28
i8 53, label %if.then34
i8 54, label %if.then40
i8 55, label %if.then46
i8 56, label %if.then52
i8 57, label %if.then58
]
if.then6: ; preds = %if.end
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.082)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then16, %if.then28, %if.then40, %if.then52, %if.then58, %if.then46, %if.then34, %if.then22, %if.then11, %if.end, %if.then6
%sum.0.be = phi i32 [ 0, %if.then6 ], [ %add, %if.then11 ], [ %add17, %if.then16 ], [ %add23, %if.then22 ], [ %add29, %if.then28 ], [ %add35, %if.then34 ], [ %add41, %if.then40 ], [ %add47, %if.then46 ], [ %add53, %if.then52 ], [ %add59, %if.then58 ], [ %sum.082, %if.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%cmp = icmp eq i32 %sum.0.be, 0
%2 = load i8, ptr %data, align 1
%cmp1 = icmp eq i8 %2, 48
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
if.then11: ; preds = %if.end
%add = add nsw i32 %sum.082, 1
br label %while.cond.backedge
if.then16: ; preds = %if.end
%add17 = add nsw i32 %sum.082, 2
br label %while.cond.backedge
if.then22: ; preds = %if.end
%add23 = add nsw i32 %sum.082, 3
br label %while.cond.backedge
if.then28: ; preds = %if.end
%add29 = add nsw i32 %sum.082, 4
br label %while.cond.backedge
if.then34: ; preds = %if.end
%add35 = add nsw i32 %sum.082, 5
br label %while.cond.backedge
if.then40: ; preds = %if.end
%add41 = add nsw i32 %sum.082, 6
br label %while.cond.backedge
if.then46: ; preds = %if.end
%add47 = add nsw i32 %sum.082, 7
br label %while.cond.backedge
if.then52: ; preds = %if.end
%add53 = add nsw i32 %sum.082, 8
br label %while.cond.backedge
if.then58: ; preds = %if.end
%add59 = add nsw i32 %sum.082, 9
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %data) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include "stdio.h"
#include "string.h"
int main(void){
char input_number[1001];
int i,j=0,k,num,temp=0,flag=0,submit[1000];
while(flag!=1){
scanf("%s",input_number);
num=strlen(input_number);
temp=0;
for(i=0;i<num;i++){
temp+=input_number[i]-'0';
if(temp==0){
flag=1;
}
}
submit[j]=temp;
j++;
}
for(k=0;k<j-1;k++){
printf("%d\n",submit[k]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112935/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112935/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%input_number = alloca [1001 x i8], align 16
%submit = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %input_number) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %submit) #4
br label %while.body
for.cond11.preheader: ; preds = %for.end
%0 = and i64 %indvars.iv39, 4294967295
%cmp1336.not = icmp eq i64 %0, 0
br i1 %cmp1336.not, label %for.end21, label %for.body15.preheader
for.body15.preheader: ; preds = %for.cond11.preheader
%wide.trip.count47 = zext i32 %indvars.iv45 to i64
br label %for.body15
while.body: ; preds = %entry, %for.end
%indvars.iv45 = phi i32 [ 0, %entry ], [ %indvars.iv.next46, %for.end ]
%indvars.iv39 = phi i64 [ 0, %entry ], [ %indvars.iv.next40, %for.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input_number)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %input_number) #5
%conv = trunc i64 %call2 to i32
%cmp330 = icmp sgt i32 %conv, 0
br i1 %cmp330, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %while.body
%wide.trip.count = and i64 %call2, 4294967295
%1 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %call2, 3
%2 = icmp ult i64 %1, 3
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%flag.133 = phi i32 [ 0, %for.body.preheader.new ], [ %spec.select.3, %for.body ]
%temp.032 = phi i32 [ 0, %for.body.preheader.new ], [ %add.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [1001 x i8], ptr %input_number, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 4, !tbaa !5
%conv5 = sext i8 %3 to i32
%sub = add i32 %temp.032, -48
%add = add i32 %sub, %conv5
%cmp6 = icmp eq i32 %add, 0
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1001 x i8], ptr %input_number, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%conv5.1 = sext i8 %4 to i32
%sub.1 = add i32 %add, -48
%add.1 = add i32 %sub.1, %conv5.1
%cmp6.1 = icmp eq i32 %add.1, 0
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1001 x i8], ptr %input_number, i64 0, i64 %indvars.iv.next.1
%5 = load i8, ptr %arrayidx.2, align 2, !tbaa !5
%conv5.2 = sext i8 %5 to i32
%sub.2 = add i32 %add.1, -48
%add.2 = add i32 %sub.2, %conv5.2
%cmp6.2 = icmp eq i32 %add.2, 0
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1001 x i8], ptr %input_number, i64 0, i64 %indvars.iv.next.2
%6 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%conv5.3 = sext i8 %6 to i32
%sub.3 = add i32 %add.2, -48
%add.3 = add i32 %sub.3, %conv5.3
%cmp6.3 = icmp eq i32 %add.3, 0
%7 = select i1 %cmp6.3, i1 true, i1 %cmp6.2
%8 = select i1 %7, i1 true, i1 %cmp6.1
%9 = select i1 %8, i1 true, i1 %cmp6
%spec.select.3 = select i1 %9, i32 1, i32 %flag.133
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.3, %for.body ]
%spec.select.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %spec.select.3, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%flag.133.unr = phi i32 [ 0, %for.body.preheader ], [ %spec.select.3, %for.body ]
%temp.032.unr = phi i32 [ 0, %for.body.preheader ], [ %add.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%flag.133.epil = phi i32 [ %spec.select.epil, %for.body.epil ], [ %flag.133.unr, %for.end.loopexit.unr-lcssa ]
%temp.032.epil = phi i32 [ %add.epil, %for.body.epil ], [ %temp.032.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [1001 x i8], ptr %input_number, i64 0, i64 %indvars.iv.epil
%10 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%conv5.epil = sext i8 %10 to i32
%sub.epil = add i32 %temp.032.epil, -48
%add.epil = add i32 %sub.epil, %conv5.epil
%cmp6.epil = icmp eq i32 %add.epil, 0
%spec.select.epil = select i1 %cmp6.epil, i32 1, i32 %flag.133.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !10
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %while.body
%temp.0.lcssa = phi i32 [ 0, %while.body ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ]
%flag.1.lcssa = phi i32 [ 0, %while.body ], [ %spec.select.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%arrayidx9 = getelementptr inbounds [1000 x i32], ptr %submit, i64 0, i64 %indvars.iv39
store i32 %temp.0.lcssa, ptr %arrayidx9, align 4, !tbaa !12
%indvars.iv.next40 = add nuw i64 %indvars.iv39, 1
%cmp.not = icmp eq i32 %flag.1.lcssa, 1
%indvars.iv.next46 = add nuw i32 %indvars.iv45, 1
br i1 %cmp.not, label %for.cond11.preheader, label %while.body, !llvm.loop !14
for.body15: ; preds = %for.body15.preheader, %for.body15
%indvars.iv42 = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next43, %for.body15 ]
%arrayidx17 = getelementptr inbounds [1000 x i32], ptr %submit, i64 0, i64 %indvars.iv42
%11 = load i32, ptr %arrayidx17, align 4, !tbaa !12
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count47
br i1 %exitcond48.not, label %for.end21, label %for.body15, !llvm.loop !15
for.end21: ; preds = %for.body15, %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %submit) #4
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %input_number) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.unroll.disable"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int i,p,n,w;
char num[1001];
scanf("%s",num);
while(num[0] != '0'){
p = 0;
n = strlen(num);
for(i = 0;i < n;i++){
w = num[i]-'0';
p = p+w;
}
printf("%d\n",p);
scanf("%s",num);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112979/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112979/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%num = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i8, ptr %num, align 16, !tbaa !5
%cmp.not18 = icmp eq i8 %0, 48
br i1 %cmp.not18, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num) #6
%conv4 = trunc i64 %call3 to i32
%cmp515 = icmp sgt i32 %conv4, 0
br i1 %cmp515, label %for.body.preheader, label %for.end
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.preheader22, 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 ], [ %7, %vector.body ]
%vec.phi20 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [1001 x i8], ptr %num, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load21 = load <4 x i8>, ptr %2, align 4, !tbaa !5
%3 = sext <4 x i8> %wide.load to <4 x i32>
%4 = sext <4 x i8> %wide.load21 to <4 x i32>
%5 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %vec.phi20, <i32 -48, i32 -48, i32 -48, i32 -48>
%7 = add <4 x i32> %5, %3
%8 = add <4 x i32> %6, %4
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader22
for.body.preheader22: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%p.016.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader22, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader22 ]
%p.016 = phi i32 [ %add, %for.body ], [ %p.016.ph, %for.body.preheader22 ]
%arrayidx7 = getelementptr inbounds [1001 x i8], ptr %num, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%conv8 = sext i8 %11 to i32
%sub = add i32 %p.016, -48
%add = add i32 %sub, %conv8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %while.body
%p.0.lcssa = phi i32 [ 0, %while.body ], [ %10, %middle.block ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %p.0.lcssa)
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%12 = load i8, ptr %num, align 16, !tbaa !5
%cmp.not = icmp eq i8 %12, 48
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9}
|
#include<stdio.h>
int main(){
char S[200000];
int N=0;
long ans=0;
while (scanf("%c",&S[N])!=EOF){N++;}
N--;
int L=0,R=N;
while (1)
{
if (R>L)
{
while (S[L]!='B'&&L<N){L++;}
while (S[R]!='W'&&R>0){R--;}
if(R>L){
ans += R-L;
L++;
R--;
}
}else{
break;
}
}
printf("%ld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113042/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [200000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %S) #3
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i8], ptr %S, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp.not = icmp eq i32 %call, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !5
while.end: ; preds = %while.cond
%0 = trunc i64 %indvars.iv to i32
%cmp353 = icmp ugt i32 %0, 1
br i1 %cmp353, label %while.cond4.preheader.preheader, label %while.end34
while.cond4.preheader.preheader: ; preds = %while.end
%dec = add nsw i32 %0, -1
%1 = sext i32 %dec to i64
br label %while.cond4.preheader
while.cond4.preheader: ; preds = %while.cond4.preheader.preheader, %if.end33
%R.056 = phi i32 [ %R.2, %if.end33 ], [ %dec, %while.cond4.preheader.preheader ]
%L.055 = phi i32 [ %L.2, %if.end33 ], [ 0, %while.cond4.preheader.preheader ]
%ans.054 = phi i64 [ %ans.1, %if.end33 ], [ 0, %while.cond4.preheader.preheader ]
%2 = sext i32 %L.055 to i64
br label %while.cond4
while.cond4: ; preds = %while.cond4, %while.cond4.preheader
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %while.cond4 ], [ %2, %while.cond4.preheader ]
%arrayidx6 = getelementptr inbounds [200000 x i8], ptr %S, i64 0, i64 %indvars.iv58
%3 = load i8, ptr %arrayidx6, align 1, !tbaa !7
%cmp7 = icmp ne i8 %3, 66
%cmp9 = icmp slt i64 %indvars.iv58, %1
%4 = select i1 %cmp7, i1 %cmp9, i1 false
%indvars.iv.next59 = add nsw i64 %indvars.iv58, 1
br i1 %4, label %while.cond4, label %while.cond14.preheader, !llvm.loop !10
while.cond14.preheader: ; preds = %while.cond4
%5 = sext i32 %R.056 to i64
br label %while.cond14
while.cond14: ; preds = %while.cond14, %while.cond14.preheader
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %while.cond14 ], [ %5, %while.cond14.preheader ]
%arrayidx16 = getelementptr inbounds [200000 x i8], ptr %S, i64 0, i64 %indvars.iv61
%6 = load i8, ptr %arrayidx16, align 1, !tbaa !7
%cmp18 = icmp ne i8 %6, 87
%cmp21 = icmp sgt i64 %indvars.iv61, 0
%7 = and i1 %cmp21, %cmp18
%indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
br i1 %7, label %while.cond14, label %while.end26, !llvm.loop !11
while.end26: ; preds = %while.cond14
%8 = trunc i64 %indvars.iv58 to i32
%9 = trunc i64 %indvars.iv61 to i32
%cmp27 = icmp sgt i32 %9, %8
br i1 %cmp27, label %if.then29, label %if.end33
if.then29: ; preds = %while.end26
%sub = sub i64 %indvars.iv61, %indvars.iv58
%sext = shl i64 %sub, 32
%conv30 = ashr exact i64 %sext, 32
%add = add nsw i64 %ans.054, %conv30
%inc31 = add nsw i32 %8, 1
%dec32 = add nsw i32 %9, -1
br label %if.end33
if.end33: ; preds = %while.end26, %if.then29
%ans.1 = phi i64 [ %add, %if.then29 ], [ %ans.054, %while.end26 ]
%L.2 = phi i32 [ %inc31, %if.then29 ], [ %8, %while.end26 ]
%R.2 = phi i32 [ %dec32, %if.then29 ], [ %9, %while.end26 ]
%cmp3 = icmp sgt i32 %R.2, %L.2
br i1 %cmp3, label %while.cond4.preheader, label %while.end34
while.end34: ; preds = %if.end33, %while.end
%ans.0.lcssa = phi i64 [ 0, %while.end ], [ %ans.1, %if.end33 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !6}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
#include<string.h>
#define MAX 200001
void run(){
char S[MAX];
scanf(" %s", S);
signed long long int len = strlen(S);
char *a = S;
long long int n = -1, cnt = 0, ans = 0;
while(n!=len-1){
while(a[++n] == 'B' && n != len-1) cnt++;
if(a[n] == 'W') ans += cnt;
}
printf("%lld\n", ans);
}
int main(){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113086/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%S = alloca [200001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200001, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #5
%sub = add nsw i64 %call2, -1
%cmp.not25 = icmp eq i64 %call2, 0
br i1 %cmp.not25, label %while.end16, label %while.cond4.preheader
while.cond4.preheader: ; preds = %entry, %while.end
%ans.028 = phi i64 [ %spec.select, %while.end ], [ 0, %entry ]
%cnt.027 = phi i64 [ %cnt.1, %while.end ], [ 0, %entry ]
%n.026 = phi i64 [ %inc, %while.end ], [ -1, %entry ]
br label %while.cond4
while.cond4: ; preds = %while.cond4, %while.cond4.preheader
%n.1 = phi i64 [ %inc, %while.cond4 ], [ %n.026, %while.cond4.preheader ]
%cnt.1 = phi i64 [ %inc11, %while.cond4 ], [ %cnt.027, %while.cond4.preheader ]
%inc = add nsw i64 %n.1, 1
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %inc
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5 = icmp eq i8 %0, 66
%cmp8 = icmp ne i64 %inc, %sub
%1 = and i1 %cmp8, %cmp5
%inc11 = add nsw i64 %cnt.1, 1
br i1 %1, label %while.cond4, label %while.end, !llvm.loop !8
while.end: ; preds = %while.cond4
%cmp14 = icmp eq i8 %0, 87
%add = select i1 %cmp14, i64 %cnt.1, i64 0
%spec.select = add nsw i64 %add, %ans.028
%cmp.not = icmp eq i64 %inc, %sub
br i1 %cmp.not, label %while.end16, label %while.cond4.preheader, !llvm.loop !10
while.end16: ; preds = %while.end, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %spec.select, %while.end ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200001, ptr nonnull %S) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S.i = alloca [200001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200001, ptr nonnull %S.i) #4
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S.i)
%call2.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S.i) #5
%sub.i = add nsw i64 %call2.i, -1
%cmp.not25.i = icmp eq i64 %call2.i, 0
br i1 %cmp.not25.i, label %run.exit, label %while.cond4.preheader.i
while.cond4.preheader.i: ; preds = %entry, %while.end.i
%ans.028.i = phi i64 [ %spec.select.i, %while.end.i ], [ 0, %entry ]
%cnt.027.i = phi i64 [ %cnt.1.i, %while.end.i ], [ 0, %entry ]
%n.026.i = phi i64 [ %inc.i, %while.end.i ], [ -1, %entry ]
br label %while.cond4.i
while.cond4.i: ; preds = %while.cond4.i, %while.cond4.preheader.i
%n.1.i = phi i64 [ %inc.i, %while.cond4.i ], [ %n.026.i, %while.cond4.preheader.i ]
%cnt.1.i = phi i64 [ %inc11.i, %while.cond4.i ], [ %cnt.027.i, %while.cond4.preheader.i ]
%inc.i = add nsw i64 %n.1.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %S.i, i64 %inc.i
%0 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp5.i = icmp eq i8 %0, 66
%cmp8.i = icmp ne i64 %inc.i, %sub.i
%1 = and i1 %cmp8.i, %cmp5.i
%inc11.i = add nsw i64 %cnt.1.i, 1
br i1 %1, label %while.cond4.i, label %while.end.i, !llvm.loop !8
while.end.i: ; preds = %while.cond4.i
%cmp14.i = icmp eq i8 %0, 87
%add.i = select i1 %cmp14.i, i64 %cnt.1.i, i64 0
%spec.select.i = add nsw i64 %add.i, %ans.028.i
%cmp.not.i = icmp eq i64 %inc.i, %sub.i
br i1 %cmp.not.i, label %run.exit, label %while.cond4.preheader.i, !llvm.loop !10
run.exit: ; preds = %while.end.i, %entry
%ans.0.lcssa.i = phi i64 [ 0, %entry ], [ %spec.select.i, %while.end.i ]
%call17.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 200001, ptr nonnull %S.i) #4
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include<stdio.h>
#include<string.h>
#define N 36
int main(){
int i,j,n,min,flag=0;
int swap,N1[N],N2[N];
char tmp,data1[N][2],data2[N][2];
scanf("%d",&n);
for(i=0;i<n;i++){
N1[i]=i;
scanf("%s",&data1[i]);
}
for(i=0;i<n;i++){
N2[i]=i;
strcpy(data2[i],data1[i]);
}
/*Bubble sort*/
for(i=0;i<n;i++){
for(j=n-1;j>=i+1;j--){
if(data1[j][1]-'0'<data1[j-1][1]-'0'){
tmp=data1[j][1];
data1[j][1]=data1[j-1][1];
data1[j-1][1]=tmp;
tmp=data1[j][0];
data1[j][0]=data1[j-1][0];
data1[j-1][0]=tmp;
swap=N1[j];
N1[j]=N1[j-1];
N1[j-1]=swap;
}
}
}
for(i=0;i<n;i++){
if(i==n-1){
printf("%c%c\n",data1[i][0],data1[i][1]);
}
else{
printf("%c%c ",data1[i][0],data1[i][1]);
}
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(data1[i][1]==data1[j][1] && N1[i]>N1[j]){
flag=1;
break;
}
}
if(flag==1) break;
}
if(flag==1) printf("Not stable\n");
else printf("Stable\n");
flag=0;
/*Selection sort*/
for(i=0;i<n;i++){
min=i;
for(j=i;j<n;j++){
if(data2[j][1]-'0'<data2[min][1]-'0'){
min=j;
}
}
tmp=data2[i][1];
data2[i][1]=data2[min][1];
data2[min][1]=tmp;
tmp=data2[i][0];
data2[i][0]=data2[min][0];
data2[min][0]=tmp;
swap=N2[i];
N2[i]=N2[min];
N2[min]=swap;
}
for(i=0;i<n;i++){
if(i==n-1){
printf("%c%c\n",data2[i][0],data2[i][1]);
}
else{
printf("%c%c ",data2[i][0],data2[i][1]);
}
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(data2[i][1]==data2[j][1] && N2[i]>N2[j]){
flag=1;
break;
}
}
if(flag==1) break;
}
if(flag==1) printf("Not stable\n");
else printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113129/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113129/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%c\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%c \00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%N1 = alloca [36 x i32], align 16
%N2 = alloca [36 x i32], align 16
%data1 = alloca [36 x [2 x i8]], align 16
%data2 = alloca [36 x [2 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %N1) #5
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %N2) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %data1) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %data2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp385 = icmp sgt i32 %0, 0
br i1 %cmp385, label %for.body, label %if.end153
for.cond4.preheader: ; preds = %for.body
%cmp5387 = icmp sgt i32 %2, 0
br i1 %cmp5387, label %for.body6.preheader, label %if.end153
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x i32], ptr %N1, i64 0, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond18.preheader: ; preds = %for.body6
br i1 %cmp5387, label %for.cond21.preheader.lr.ph, label %for.cond109.preheader
for.cond21.preheader.lr.ph: ; preds = %for.cond18.preheader
%4 = zext i32 %2 to i64
%wide.trip.count428 = zext i32 %2 to i64
br label %for.cond21.preheader
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv418 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next419, %for.body6 ]
%arrayidx8 = getelementptr inbounds [36 x i32], ptr %N2, i64 0, i64 %indvars.iv418
%5 = trunc i64 %indvars.iv418 to i32
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%arrayidx10 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv418
%arrayidx12 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv418
%call14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx10, ptr noundef nonnull dereferenceable(1) %arrayidx12) #5
%indvars.iv.next419 = add nuw nsw i64 %indvars.iv418, 1
%exitcond.not = icmp eq i64 %indvars.iv.next419, %wide.trip.count
br i1 %exitcond.not, label %for.cond18.preheader, label %for.body6, !llvm.loop !11
for.cond18.loopexit: ; preds = %for.inc74, %for.cond21.preheader
%exitcond429.not = icmp eq i64 %indvars.iv.next426, %wide.trip.count428
br i1 %exitcond429.not, label %for.cond79.preheader, label %for.cond21.preheader, !llvm.loop !12
for.cond21.preheader: ; preds = %for.cond21.preheader.lr.ph, %for.cond18.loopexit
%indvars.iv425 = phi i64 [ 0, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next426, %for.cond18.loopexit ]
%indvars.iv.next426 = add nuw nsw i64 %indvars.iv425, 1
%cmp22.not.not390 = icmp ult i64 %indvars.iv.next426, %4
br i1 %cmp22.not.not390, label %for.body23, label %for.cond18.loopexit
for.cond79.preheader: ; preds = %for.cond18.loopexit
br i1 %cmp5387, label %for.body82, label %for.cond109.preheader
for.body23: ; preds = %for.cond21.preheader, %for.inc74
%indvars.iv421 = phi i64 [ %indvars.iv.next422, %for.inc74 ], [ %4, %for.cond21.preheader ]
%indvars.iv.next422 = add nsw i64 %indvars.iv421, -1
%arrayidx26 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv.next422, i64 1
%6 = load i8, ptr %arrayidx26, align 1, !tbaa !13
%7 = add nsw i64 %indvars.iv421, -2
%arrayidx31 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %7, i64 1
%8 = load i8, ptr %arrayidx31, align 1, !tbaa !13
%cmp34 = icmp slt i8 %6, %8
br i1 %cmp34, label %if.then, label %for.inc74
if.then: ; preds = %for.body23
%arrayidx30 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %7
%arrayidx25 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv.next422
store i8 %8, ptr %arrayidx26, align 1, !tbaa !13
store i8 %6, ptr %arrayidx31, align 1, !tbaa !13
%9 = load i8, ptr %arrayidx25, align 2, !tbaa !13
%10 = load i8, ptr %arrayidx30, align 2, !tbaa !13
store i8 %10, ptr %arrayidx25, align 2, !tbaa !13
store i8 %9, ptr %arrayidx30, align 2, !tbaa !13
%arrayidx68 = getelementptr inbounds [36 x i32], ptr %N1, i64 0, i64 %7
%11 = load <2 x i32>, ptr %arrayidx68, align 4, !tbaa !5
%12 = shufflevector <2 x i32> %11, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %12, ptr %arrayidx68, align 4, !tbaa !5
br label %for.inc74
for.inc74: ; preds = %for.body23, %if.then
%cmp22.not.not = icmp sgt i64 %indvars.iv.next422, %indvars.iv.next426
br i1 %cmp22.not.not, label %for.body23, label %for.cond18.loopexit, !llvm.loop !14
for.cond109.preheader: ; preds = %for.body82, %for.cond18.preheader, %for.cond79.preheader
%.lcssa383 = phi i32 [ %2, %for.cond79.preheader ], [ %2, %for.cond18.preheader ], [ %18, %for.body82 ]
%cmp111401 = icmp sgt i32 %.lcssa383, 1
br i1 %cmp111401, label %for.body113.preheader, label %if.end153
for.body113.preheader: ; preds = %for.cond109.preheader
%sub110 = add nsw i32 %.lcssa383, -1
%13 = zext i32 %.lcssa383 to i64
%wide.trip.count443 = zext i32 %sub110 to i64
%wide.trip.count438 = zext i32 %.lcssa383 to i64
br label %for.body113
for.body82: ; preds = %for.cond79.preheader, %for.body82
%indvars.iv430 = phi i64 [ %indvars.iv.next431, %for.body82 ], [ 0, %for.cond79.preheader ]
%14 = phi i32 [ %18, %for.body82 ], [ %2, %for.cond79.preheader ]
%sub83 = add nsw i32 %14, -1
%15 = zext i32 %sub83 to i64
%cmp84 = icmp eq i64 %indvars.iv430, %15
%arrayidx88 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv430
%16 = load i8, ptr %arrayidx88, align 2, !tbaa !13
%conv90 = sext i8 %16 to i32
%arrayidx93 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv430, i64 1
%17 = load i8, ptr %arrayidx93, align 1, !tbaa !13
%conv94 = sext i8 %17 to i32
%.str.2..str.3 = select i1 %cmp84, ptr @.str.2, ptr @.str.3
%call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv90, i32 noundef %conv94)
%indvars.iv.next431 = add nuw nsw i64 %indvars.iv430, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp80 = icmp slt i64 %indvars.iv.next431, %19
br i1 %cmp80, label %for.body82, label %for.cond109.preheader, !llvm.loop !15
for.cond109.loopexit: ; preds = %for.inc137, %for.body113
%indvars.iv.next434 = add nuw nsw i64 %indvars.iv433, 1
%exitcond444.not = icmp eq i64 %indvars.iv.next441, %wide.trip.count443
br i1 %exitcond444.not, label %if.end153, label %for.body113, !llvm.loop !16
for.body113: ; preds = %for.body113.preheader, %for.cond109.loopexit
%indvars.iv440 = phi i64 [ 0, %for.body113.preheader ], [ %indvars.iv.next441, %for.cond109.loopexit ]
%indvars.iv433 = phi i64 [ 1, %for.body113.preheader ], [ %indvars.iv.next434, %for.cond109.loopexit ]
%indvars.iv.next441 = add nuw nsw i64 %indvars.iv440, 1
%cmp116399 = icmp ult i64 %indvars.iv.next441, %13
br i1 %cmp116399, label %for.body118.lr.ph, label %for.cond109.loopexit
for.body118.lr.ph: ; preds = %for.body113
%arrayidx121 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv440, i64 1
%20 = load i8, ptr %arrayidx121, align 1, !tbaa !13
%arrayidx130 = getelementptr inbounds [36 x i32], ptr %N1, i64 0, i64 %indvars.iv440
br label %for.body118
for.body118: ; preds = %for.body118.lr.ph, %for.inc137
%indvars.iv435 = phi i64 [ %indvars.iv433, %for.body118.lr.ph ], [ %indvars.iv.next436, %for.inc137 ]
%arrayidx125 = getelementptr inbounds [36 x [2 x i8]], ptr %data1, i64 0, i64 %indvars.iv435, i64 1
%21 = load i8, ptr %arrayidx125, align 1, !tbaa !13
%cmp127 = icmp eq i8 %20, %21
br i1 %cmp127, label %land.lhs.true, label %for.inc137
land.lhs.true: ; preds = %for.body118
%22 = load i32, ptr %arrayidx130, align 4, !tbaa !5
%arrayidx132 = getelementptr inbounds [36 x i32], ptr %N1, i64 0, i64 %indvars.iv435
%23 = load i32, ptr %arrayidx132, align 4, !tbaa !5
%cmp133 = icmp sgt i32 %22, %23
br i1 %cmp133, label %if.end153, label %for.inc137
for.inc137: ; preds = %for.body118, %land.lhs.true
%indvars.iv.next436 = add nuw nsw i64 %indvars.iv435, 1
%exitcond439.not = icmp eq i64 %indvars.iv.next436, %wide.trip.count438
br i1 %exitcond439.not, label %for.cond109.loopexit, label %for.body118, !llvm.loop !17
if.end153: ; preds = %for.cond109.loopexit, %land.lhs.true, %for.cond109.preheader, %for.cond4.preheader, %entry
%str.sink = phi ptr [ @str.7, %entry ], [ @str.7, %for.cond4.preheader ], [ @str.7, %for.cond109.preheader ], [ @str.8, %land.lhs.true ], [ @str.7, %for.cond109.loopexit ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%24 = load i32, ptr %n, align 4, !tbaa !5
%cmp155405 = icmp sgt i32 %24, 0
br i1 %cmp155405, label %for.cond158.preheader.preheader, label %if.end290
for.cond158.preheader.preheader: ; preds = %if.end153
%25 = zext i32 %24 to i64
%wide.trip.count451 = zext i32 %24 to i64
br label %for.cond158.preheader
for.cond158.preheader: ; preds = %for.cond158.preheader.preheader, %for.end178
%indvars.iv445 = phi i64 [ 0, %for.cond158.preheader.preheader ], [ %indvars.iv.next446, %for.end178 ]
%26 = trunc i64 %indvars.iv445 to i32
br label %for.body161
for.cond214.preheader: ; preds = %for.end178
br i1 %cmp155405, label %for.body217, label %if.end290
for.body161: ; preds = %for.cond158.preheader, %for.body161
%indvars.iv447 = phi i64 [ %indvars.iv445, %for.cond158.preheader ], [ %indvars.iv.next448, %for.body161 ]
%min.0404 = phi i32 [ %26, %for.cond158.preheader ], [ %spec.select, %for.body161 ]
%arrayidx164 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv447, i64 1
%27 = load i8, ptr %arrayidx164, align 1, !tbaa !13
%idxprom167 = sext i32 %min.0404 to i64
%arrayidx169 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %idxprom167, i64 1
%28 = load i8, ptr %arrayidx169, align 1, !tbaa !13
%cmp172 = icmp slt i8 %27, %28
%29 = trunc i64 %indvars.iv447 to i32
%spec.select = select i1 %cmp172, i32 %29, i32 %min.0404
%indvars.iv.next448 = add nuw nsw i64 %indvars.iv447, 1
%cmp159 = icmp ult i64 %indvars.iv.next448, %25
br i1 %cmp159, label %for.body161, label %for.end178, !llvm.loop !18
for.end178: ; preds = %for.body161
%arrayidx180 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv445
%arrayidx181 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv445, i64 1
%30 = load i8, ptr %arrayidx181, align 1, !tbaa !13
%idxprom182 = sext i32 %spec.select to i64
%arrayidx183 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %idxprom182
%arrayidx184 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %idxprom182, i64 1
%31 = load i8, ptr %arrayidx184, align 1, !tbaa !13
store i8 %31, ptr %arrayidx181, align 1, !tbaa !13
store i8 %30, ptr %arrayidx184, align 1, !tbaa !13
%32 = load i8, ptr %arrayidx180, align 2, !tbaa !13
%33 = load i8, ptr %arrayidx183, align 2, !tbaa !13
store i8 %33, ptr %arrayidx180, align 2, !tbaa !13
store i8 %32, ptr %arrayidx183, align 2, !tbaa !13
%arrayidx204 = getelementptr inbounds [36 x i32], ptr %N2, i64 0, i64 %indvars.iv445
%34 = load i32, ptr %arrayidx204, align 4, !tbaa !5
%arrayidx206 = getelementptr inbounds [36 x i32], ptr %N2, i64 0, i64 %idxprom182
%35 = load i32, ptr %arrayidx206, align 4, !tbaa !5
store i32 %35, ptr %arrayidx204, align 4, !tbaa !5
store i32 %34, ptr %arrayidx206, align 4, !tbaa !5
%indvars.iv.next446 = add nuw nsw i64 %indvars.iv445, 1
%exitcond452.not = icmp eq i64 %indvars.iv.next446, %wide.trip.count451
br i1 %exitcond452.not, label %for.cond214.preheader, label %for.cond158.preheader, !llvm.loop !19
for.cond245.preheader: ; preds = %for.body217
%cmp247412 = icmp sgt i32 %41, 1
br i1 %cmp247412, label %for.body249.preheader, label %if.end290
for.body249.preheader: ; preds = %for.cond245.preheader
%sub246 = add nsw i32 %41, -1
%36 = zext i32 %41 to i64
%wide.trip.count466 = zext i32 %sub246 to i64
%wide.trip.count461 = zext i32 %41 to i64
br label %for.body249
for.body217: ; preds = %for.cond214.preheader, %for.body217
%indvars.iv453 = phi i64 [ %indvars.iv.next454, %for.body217 ], [ 0, %for.cond214.preheader ]
%37 = phi i32 [ %41, %for.body217 ], [ %24, %for.cond214.preheader ]
%sub218 = add nsw i32 %37, -1
%38 = zext i32 %sub218 to i64
%cmp219 = icmp eq i64 %indvars.iv453, %38
%arrayidx223 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv453
%39 = load i8, ptr %arrayidx223, align 2, !tbaa !13
%conv225 = sext i8 %39 to i32
%arrayidx228 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv453, i64 1
%40 = load i8, ptr %arrayidx228, align 1, !tbaa !13
%conv229 = sext i8 %40 to i32
%.str.2..str.3481 = select i1 %cmp219, ptr @.str.2, ptr @.str.3
%call230 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3481, i32 noundef %conv225, i32 noundef %conv229)
%indvars.iv.next454 = add nuw nsw i64 %indvars.iv453, 1
%41 = load i32, ptr %n, align 4, !tbaa !5
%42 = sext i32 %41 to i64
%cmp215 = icmp slt i64 %indvars.iv.next454, %42
br i1 %cmp215, label %for.body217, label %for.cond245.preheader, !llvm.loop !20
for.cond245.loopexit: ; preds = %for.inc274, %for.body249
%indvars.iv.next457 = add nuw nsw i64 %indvars.iv456, 1
%exitcond467.not = icmp eq i64 %indvars.iv.next464, %wide.trip.count466
br i1 %exitcond467.not, label %if.end290, label %for.body249, !llvm.loop !21
for.body249: ; preds = %for.body249.preheader, %for.cond245.loopexit
%indvars.iv463 = phi i64 [ 0, %for.body249.preheader ], [ %indvars.iv.next464, %for.cond245.loopexit ]
%indvars.iv456 = phi i64 [ 1, %for.body249.preheader ], [ %indvars.iv.next457, %for.cond245.loopexit ]
%indvars.iv.next464 = add nuw nsw i64 %indvars.iv463, 1
%cmp252410 = icmp ult i64 %indvars.iv.next464, %36
br i1 %cmp252410, label %for.body254.lr.ph, label %for.cond245.loopexit
for.body254.lr.ph: ; preds = %for.body249
%arrayidx257 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv463, i64 1
%43 = load i8, ptr %arrayidx257, align 1, !tbaa !13
%arrayidx267 = getelementptr inbounds [36 x i32], ptr %N2, i64 0, i64 %indvars.iv463
br label %for.body254
for.body254: ; preds = %for.body254.lr.ph, %for.inc274
%indvars.iv458 = phi i64 [ %indvars.iv456, %for.body254.lr.ph ], [ %indvars.iv.next459, %for.inc274 ]
%arrayidx261 = getelementptr inbounds [36 x [2 x i8]], ptr %data2, i64 0, i64 %indvars.iv458, i64 1
%44 = load i8, ptr %arrayidx261, align 1, !tbaa !13
%cmp263 = icmp eq i8 %43, %44
br i1 %cmp263, label %land.lhs.true265, label %for.inc274
land.lhs.true265: ; preds = %for.body254
%45 = load i32, ptr %arrayidx267, align 4, !tbaa !5
%arrayidx269 = getelementptr inbounds [36 x i32], ptr %N2, i64 0, i64 %indvars.iv458
%46 = load i32, ptr %arrayidx269, align 4, !tbaa !5
%cmp270 = icmp sgt i32 %45, %46
br i1 %cmp270, label %if.end290, label %for.inc274
for.inc274: ; preds = %for.body254, %land.lhs.true265
%indvars.iv.next459 = add nuw nsw i64 %indvars.iv458, 1
%exitcond462.not = icmp eq i64 %indvars.iv.next459, %wide.trip.count461
br i1 %exitcond462.not, label %for.cond245.loopexit, label %for.body254, !llvm.loop !22
if.end290: ; preds = %for.cond245.loopexit, %land.lhs.true265, %for.cond245.preheader, %for.cond214.preheader, %if.end153
%str.7.sink = phi ptr [ @str.7, %if.end153 ], [ @str.7, %for.cond214.preheader ], [ @str.7, %for.cond245.preheader ], [ @str.8, %land.lhs.true265 ], [ @str.7, %for.cond245.loopexit ]
%puts381 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %data2) #5
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %data1) #5
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %N2) #5
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %N1) #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: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
typedef struct {
char mark;
int number;
}card;
void BubbleSort(card C[], int N);
void SelectionSort(card C[], int N);
int main(){
int N,i;
card C[36];
card D[36];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf(" %c",&C[i].mark);
scanf("%d",&C[i].number);
D[i] = C[i];
}
BubbleSort(C,N);
SelectionSort(D,N);
for(i=0;i<N-1;i++){
printf("%c%d ",C[i].mark,C[i].number);
}
printf("%c%d\n",C[N-1].mark,C[N-1].number);
printf("Stable\n");
for(i=0;i<N-1;i++){
printf("%c%d ",D[i].mark,D[i].number);
}
printf("%c%d\n",D[N-1].mark,D[N-1].number);
for(i=0;i<N;i++){
if(i == N-1){
printf("Stable\n");
}
if((C[i].number != D[i].number) || (C[i].mark != D[i].mark)){
printf("Not stable\n");
break;
}
}
return 0;
}
void BubbleSort(card C[], int N){
int i,j;
card tmp;
for(i=0;i<N-1;i++){
for(j=N-1;j>i;j--){
if(C[j].number < C[j-1].number){
tmp = C[j];
C[j] = C[j-1];
C[j-1] = tmp;
}
}
}
}
void SelectionSort(card C[],int N){
card tmp;
int minj,i,j;
for(i=0;i<N;i++){
minj = i;
for(j=i;j<N;j++){
if(C[j].number < C[minj].number){
minj = j;
}
}
tmp = C[i];
C[i] = C[minj];
C[minj] = tmp;
}
return;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113172/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113172/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%C = alloca [36 x %struct.card], align 16
%D = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %D) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp120 = icmp sgt i32 %0, 0
br i1 %cmp120, label %for.body, label %SelectionSort.exit.for.end22_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%number = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%arrayidx6 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr %arrayidx6, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp38.i = icmp sgt i32 %2, 1
br i1 %cmp38.i, label %for.cond2.preheader.preheader.i, label %BubbleSort.exit
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %2, -1
%4 = zext i32 %2 to i64
%5 = add nsw i64 %4, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc20.i, %for.cond2.preheader.preheader.i
%indvars.iv41.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next42.i, %for.inc20.i ]
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.i = phi i64 [ %5, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%number.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.i, i32 1
%6 = load i32, ptr %number.i, align 4, !tbaa !11
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%number8.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next.i, i32 1
%7 = load i32, ptr %number8.i, align 4, !tbaa !11
%cmp9.i = icmp slt i32 %6, %7
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next.i
%8 = load <2 x i64>, ptr %arrayidx7.i, align 8
%9 = shufflevector <2 x i64> %8, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %9, ptr %arrayidx7.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv41.i
br i1 %cmp3.i, label %for.body4.i, label %for.inc20.i, !llvm.loop !13
for.inc20.i: ; preds = %for.inc.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next42.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond2.preheader.i, !llvm.loop !14
BubbleSort.exit: ; preds = %for.inc20.i, %for.end
%cmp38.i147 = phi i1 [ false, %for.end ], [ %cmp38.i, %for.inc20.i ]
%cmp37.i = icmp sgt i32 %2, 0
br i1 %cmp37.i, label %for.cond1.preheader.preheader.i, label %SelectionSort.exit
for.cond1.preheader.preheader.i: ; preds = %BubbleSort.exit
%10 = zext i32 %2 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i116 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i118, %for.end.i ]
%11 = trunc i64 %indvars.iv.i116 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv39.i = phi i64 [ %indvars.iv.i116, %for.cond1.preheader.i ], [ %indvars.iv.next40.i, %for.body3.i ]
%minj.035.i = phi i32 [ %11, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%number.i117 = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv39.i, i32 1
%12 = load i32, ptr %number.i117, align 4, !tbaa !11
%idxprom4.i = sext i32 %minj.035.i to i64
%number6.i = getelementptr inbounds %struct.card, ptr %D, i64 %idxprom4.i, i32 1
%13 = load i32, ptr %number6.i, align 4, !tbaa !11
%cmp7.i = icmp slt i32 %12, %13
%14 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %14, i32 %minj.035.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next40.i, %10
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !15
for.end.i: ; preds = %for.body3.i
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv.i116
%15 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %spec.select.i to i64
%arrayidx13.i = getelementptr inbounds %struct.card, ptr %D, i64 %idxprom12.i
%16 = load i64, ptr %arrayidx13.i, align 8
store i64 %16, ptr %arrayidx9.i, align 8
store i64 %15, ptr %arrayidx13.i, align 8
%indvars.iv.next.i118 = add nuw nsw i64 %indvars.iv.i116, 1
%exitcond.not.i119 = icmp eq i64 %indvars.iv.next.i118, %10
br i1 %exitcond.not.i119, label %SelectionSort.exit, label %for.cond1.preheader.i, !llvm.loop !16
SelectionSort.exit: ; preds = %for.end.i, %BubbleSort.exit
br i1 %cmp38.i147, label %for.body12, label %SelectionSort.exit.for.end22_crit_edge
SelectionSort.exit.for.end22_crit_edge: ; preds = %entry, %SelectionSort.exit
%17 = phi i32 [ %2, %SelectionSort.exit ], [ %0, %entry ]
%sub122 = add nsw i32 %17, -1
%.pre = sext i32 %sub122 to i64
br label %for.end22
for.body12: ; preds = %SelectionSort.exit, %for.body12
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.body12 ], [ 0, %SelectionSort.exit ]
%arrayidx14 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv136
%18 = load i8, ptr %arrayidx14, align 8, !tbaa !17
%conv = sext i8 %18 to i32
%number18 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv136, i32 1
%19 = load i32, ptr %number18, align 4, !tbaa !11
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%20 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %20, -1
%21 = sext i32 %sub to i64
%cmp11 = icmp slt i64 %indvars.iv.next137, %21
br i1 %cmp11, label %for.body12, label %for.end22, !llvm.loop !18
for.end22: ; preds = %for.body12, %SelectionSort.exit.for.end22_crit_edge
%idxprom24.pre-phi = phi i64 [ %.pre, %SelectionSort.exit.for.end22_crit_edge ], [ %21, %for.body12 ]
%arrayidx25 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %idxprom24.pre-phi
%22 = load i8, ptr %arrayidx25, align 8, !tbaa !17
%conv27 = sext i8 %22 to i32
%number31 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %idxprom24.pre-phi, i32 1
%23 = load i32, ptr %number31, align 4, !tbaa !11
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv27, i32 noundef %23)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%24 = load i32, ptr %N, align 4, !tbaa !5
%cmp36127 = icmp sgt i32 %24, 1
br i1 %cmp36127, label %for.body38, label %for.end22.for.end49_crit_edge
for.end22.for.end49_crit_edge: ; preds = %for.end22
%sub35126 = add nsw i32 %24, -1
%.pre145 = sext i32 %sub35126 to i64
br label %for.end49
for.body38: ; preds = %for.end22, %for.body38
%indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.body38 ], [ 0, %for.end22 ]
%arrayidx40 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv139
%25 = load i8, ptr %arrayidx40, align 8, !tbaa !17
%conv42 = sext i8 %25 to i32
%number45 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv139, i32 1
%26 = load i32, ptr %number45, align 4, !tbaa !11
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv42, i32 noundef %26)
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%27 = load i32, ptr %N, align 4, !tbaa !5
%sub35 = add nsw i32 %27, -1
%28 = sext i32 %sub35 to i64
%cmp36 = icmp slt i64 %indvars.iv.next140, %28
br i1 %cmp36, label %for.body38, label %for.end49, !llvm.loop !19
for.end49: ; preds = %for.body38, %for.end22.for.end49_crit_edge
%idxprom51.pre-phi = phi i64 [ %.pre145, %for.end22.for.end49_crit_edge ], [ %28, %for.body38 ]
%arrayidx52 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %idxprom51.pre-phi
%29 = load i8, ptr %arrayidx52, align 8, !tbaa !17
%conv54 = sext i8 %29 to i32
%number58 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %idxprom51.pre-phi, i32 1
%30 = load i32, ptr %number58, align 4, !tbaa !11
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv54, i32 noundef %30)
%31 = load i32, ptr %N, align 4, !tbaa !5
%cmp61130 = icmp sgt i32 %31, 0
br i1 %cmp61130, label %for.body63, label %for.end91
for.cond60: ; preds = %lor.lhs.false
%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
%cmp61 = icmp slt i64 %indvars.iv.next143, %33
br i1 %cmp61, label %for.body63, label %for.end91, !llvm.loop !20
for.body63: ; preds = %for.end49, %for.cond60
%indvars.iv142 = phi i64 [ %indvars.iv.next143, %for.cond60 ], [ 0, %for.end49 ]
%34 = phi i32 [ %32, %for.cond60 ], [ %31, %for.end49 ]
%sub64 = add nsw i32 %34, -1
%35 = zext i32 %sub64 to i64
%cmp65 = icmp eq i64 %indvars.iv142, %35
br i1 %cmp65, label %if.then, label %if.end
if.then: ; preds = %for.body63
%puts113 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %if.end
if.end: ; preds = %if.then, %for.body63
%number70 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv142, i32 1
%36 = load i32, ptr %number70, align 4, !tbaa !11
%number73 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv142, i32 1
%37 = load i32, ptr %number73, align 4, !tbaa !11
%cmp74.not = icmp eq i32 %36, %37
br i1 %cmp74.not, label %lor.lhs.false, label %if.then86
lor.lhs.false: ; preds = %if.end
%arrayidx72 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv142
%arrayidx69 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv142
%38 = load i8, ptr %arrayidx69, align 8, !tbaa !17
%39 = load i8, ptr %arrayidx72, align 8, !tbaa !17
%cmp84.not = icmp eq i8 %38, %39
br i1 %cmp84.not, label %for.cond60, label %if.then86
if.then86: ; preds = %lor.lhs.false, %if.end
%puts114 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.end91
for.end91: ; preds = %for.cond60, %for.end49, %if.then86
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp38 = icmp sgt i32 %N, 1
br i1 %cmp38, label %for.cond2.preheader.preheader, label %for.end21
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
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc20
%indvars.iv41 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next42, %for.inc20 ]
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%number = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv, i32 1
%2 = load i32, ptr %number, align 4, !tbaa !11
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%number8 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next, i32 1
%3 = load i32, ptr %number8, align 4, !tbaa !11
%cmp9 = icmp slt i32 %2, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next
%4 = load <2 x i64>, ptr %arrayidx7, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx7, align 4
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv41
br i1 %cmp3, label %for.body4, label %for.inc20, !llvm.loop !13
for.inc20: ; preds = %for.inc
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.cond2.preheader, !llvm.loop !14
for.end21: ; preds = %for.inc20, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%minj.035 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%number = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv39, i32 1
%2 = load i32, ptr %number, align 4, !tbaa !11
%idxprom4 = sext i32 %minj.035 to i64
%number6 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4, i32 1
%3 = load i32, ptr %number6, align 4, !tbaa !11
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.035
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
%5 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %spec.select to i64
%arrayidx13 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom12
%6 = load i64, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx9, align 4
store i64 %5, ptr %arrayidx13, align 4
%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.end18, label %for.cond1.preheader, !llvm.loop !16
for.end18: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!12, !6, i64 4}
!12 = !{!"", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
struct Card{char suit;int value; };
int main()
{
struct Card a[101],b[101];
int n,i,j,k,mini,m,sum=0;
char ch;
scanf("%d%c",&n,&ch);
for(i=0;i<n;i++){
scanf("%c%d%c",&a[i].suit,&a[i].value,&ch);
}
for(i=0;i<n+1;i++){
b[i]=a[i];
}
for(i=0;i<n-1;i++){
for(j=n-1;j>i;j--){
if(a[j].value<a[j-1].value){
m=a[j].value;
a[j].value=a[j-1].value;
a[j-1].value=m;
ch=a[j].suit;
a[j].suit=a[j-1].suit;
a[j-1].suit=ch;
}
}
}
for(i=0;i<n-1;i++){
mini=i;
m=b[i].value;
for(j=i;j<n;j++){
if(b[j].value<m){
m=b[j].value;
mini=j;
}
}
if(m!=b[i].value){
k=b[i].value;
b[i].value=b[mini].value;
b[mini].value=k;
ch=b[i].suit;
b[i].suit=b[mini].suit;
b[mini].suit=ch;
}
}
for(i=0;i<n;i++){
if(a[i].suit==b[i].suit && a[i].value==b[i].value){
sum++;
}
}
for(i=0;i<n-1;i++){
printf("%c%d ",a[i].suit,a[i].value);
}
printf("%c%d",a[i].suit,a[i].value);
printf("\nStable\n");
for(i=0;i<n-1;i++){
printf("%c%d ",b[i].suit,b[i].value);
}
printf("%c%d",b[i].suit,b[i].value);
if(sum==n)printf("\nStable\n");
else printf("\nNot stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113215/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113215/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%d%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.6 = private unnamed_addr constant [12 x i8] c"\0ANot stable\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [101 x %struct.Card], align 16
%b = alloca [101 x %struct.Card], align 16
%n = alloca i32, align 4
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 808, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 808, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %ch)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp265 = icmp sgt i32 %0, 0
br i1 %cmp265, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %2, %for.body ]
%cmp5.not267 = icmp slt i32 %1, 0
br i1 %cmp5.not267, label %for.end158, label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value, ptr noundef nonnull %ch)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader: ; preds = %for.cond4.preheader
%4 = add nuw i32 %1, 1
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 3
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %b, ptr noundef nonnull align 16 dereferenceable(1) %a, i64 %6, i1 false)
%sub = add nsw i32 %1, -1
%cmp15270 = icmp ugt i32 %1, 1
br i1 %cmp15270, label %for.cond18.preheader.preheader, label %for.cond117.preheader
for.cond18.preheader.preheader: ; preds = %for.cond14.preheader
%7 = zext i32 %1 to i64
%8 = add nsw i64 %7, -1
%wide.trip.count = zext i32 %sub to i64
%value23.phi.trans.insert = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %8, i32 1
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.preheader, %for.inc59
%indvars.iv301 = phi i64 [ 0, %for.cond18.preheader.preheader ], [ %indvars.iv.next302, %for.inc59 ]
%.pre = load i32, ptr %value23.phi.trans.insert, align 4, !tbaa !11
br label %for.body20
for.cond62.preheader: ; preds = %for.inc59
br i1 %cmp15270, label %for.body65.preheader, label %for.cond117.preheader
for.body65.preheader: ; preds = %for.cond62.preheader
%9 = sext i32 %1 to i64
%wide.trip.count312 = zext i32 %sub to i64
%wide.trip.count309 = zext i32 %1 to i64
br label %for.body65
for.body20: ; preds = %for.cond18.preheader, %for.inc57
%10 = phi i32 [ %.pre, %for.cond18.preheader ], [ %14, %for.inc57 ]
%indvars.iv298 = phi i64 [ %8, %for.cond18.preheader ], [ %indvars.iv.next299, %for.inc57 ]
%indvars.iv.next299 = add nsw i64 %indvars.iv298, -1
%value27 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next299, i32 1
%11 = load i32, ptr %value27, align 4, !tbaa !11
%cmp28 = icmp slt i32 %10, %11
br i1 %cmp28, label %if.then, label %for.inc57
if.then: ; preds = %for.body20
%value23 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv298, i32 1
%arrayidx26 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next299
%arrayidx22 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv298
store i32 %11, ptr %value23, align 4, !tbaa !11
store i32 %10, ptr %value27, align 4, !tbaa !11
%12 = load i8, ptr %arrayidx22, align 8, !tbaa !13
store i8 %12, ptr %ch, align 1, !tbaa !14
%13 = load i8, ptr %arrayidx26, align 8, !tbaa !13
store i8 %13, ptr %arrayidx22, align 8, !tbaa !13
store i8 %12, ptr %arrayidx26, align 8, !tbaa !13
br label %for.inc57
for.inc57: ; preds = %for.body20, %if.then
%14 = phi i32 [ %11, %for.body20 ], [ %10, %if.then ]
%cmp19 = icmp sgt i64 %indvars.iv.next299, %indvars.iv301
br i1 %cmp19, label %for.body20, label %for.inc59, !llvm.loop !15
for.inc59: ; preds = %for.inc57
%indvars.iv.next302 = add nuw nsw i64 %indvars.iv301, 1
%exitcond.not = icmp eq i64 %indvars.iv.next302, %wide.trip.count
br i1 %exitcond.not, label %for.cond62.preheader, label %for.cond18.preheader, !llvm.loop !16
for.cond117.preheader: ; preds = %for.inc114, %for.cond14.preheader, %for.cond62.preheader
%cmp15270328331 = phi i1 [ false, %for.cond62.preheader ], [ false, %for.cond14.preheader ], [ %cmp15270, %for.inc114 ]
%cmp118281 = icmp sgt i32 %1, 0
br i1 %cmp118281, label %for.body119.preheader, label %for.cond143.preheader
for.body119.preheader: ; preds = %for.cond117.preheader
%wide.trip.count317 = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count317, 1
%15 = icmp eq i32 %1, 1
br i1 %15, label %for.cond143.preheader.loopexit.unr-lcssa, label %for.body119.preheader.new
for.body119.preheader.new: ; preds = %for.body119.preheader
%unroll_iter = and i64 %wide.trip.count317, 4294967294
br label %for.body119
for.body65: ; preds = %for.body65.preheader, %for.inc114
%indvars.iv304 = phi i64 [ 0, %for.body65.preheader ], [ %indvars.iv.next305, %for.inc114 ]
%arrayidx67 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv304
%value68 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv304, i32 1
%16 = load i32, ptr %value68, align 4, !tbaa !11
%cmp70273 = icmp slt i64 %indvars.iv304, %9
br i1 %cmp70273, label %for.body71.preheader, label %for.inc114
for.body71.preheader: ; preds = %for.body65
%17 = trunc i64 %indvars.iv304 to i32
br label %for.body71
for.body71: ; preds = %for.body71.preheader, %for.body71
%indvars.iv306 = phi i64 [ %indvars.iv.next307, %for.body71 ], [ %indvars.iv304, %for.body71.preheader ]
%m.0276 = phi i32 [ %spec.select263, %for.body71 ], [ %16, %for.body71.preheader ]
%mini.0275 = phi i32 [ %spec.select, %for.body71 ], [ %17, %for.body71.preheader ]
%value74 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv306, i32 1
%18 = load i32, ptr %value74, align 4, !tbaa !11
%cmp75 = icmp slt i32 %18, %m.0276
%19 = trunc i64 %indvars.iv306 to i32
%spec.select = select i1 %cmp75, i32 %19, i32 %mini.0275
%spec.select263 = call i32 @llvm.smin.i32(i32 %18, i32 %m.0276)
%indvars.iv.next307 = add nuw nsw i64 %indvars.iv306, 1
%exitcond310.not = icmp eq i64 %indvars.iv.next307, %wide.trip.count309
br i1 %exitcond310.not, label %for.end83, label %for.body71, !llvm.loop !17
for.end83: ; preds = %for.body71
%cmp87.not = icmp eq i32 %spec.select263, %16
br i1 %cmp87.not, label %for.inc114, label %if.then88
if.then88: ; preds = %for.end83
%idxprom92 = sext i32 %spec.select to i64
%arrayidx93 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %idxprom92
%value94 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %idxprom92, i32 1
%20 = load i32, ptr %value94, align 4, !tbaa !11
store i32 %20, ptr %value68, align 4, !tbaa !11
store i32 %16, ptr %value94, align 4, !tbaa !11
%21 = load i8, ptr %arrayidx67, align 8, !tbaa !13
store i8 %21, ptr %ch, align 1, !tbaa !14
%22 = load i8, ptr %arrayidx93, align 8, !tbaa !13
store i8 %22, ptr %arrayidx67, align 8, !tbaa !13
store i8 %21, ptr %arrayidx93, align 8, !tbaa !13
br label %for.inc114
for.inc114: ; preds = %for.body65, %for.end83, %if.then88
%indvars.iv.next305 = add nuw nsw i64 %indvars.iv304, 1
%exitcond313.not = icmp eq i64 %indvars.iv.next305, %wide.trip.count312
br i1 %exitcond313.not, label %for.cond117.preheader, label %for.body65, !llvm.loop !18
for.cond143.preheader.loopexit.unr-lcssa: ; preds = %for.inc140.1, %for.body119.preheader
%sum.1.lcssa.ph = phi i32 [ undef, %for.body119.preheader ], [ %sum.1.1, %for.inc140.1 ]
%indvars.iv314.unr = phi i64 [ 0, %for.body119.preheader ], [ %indvars.iv.next315.1, %for.inc140.1 ]
%sum.0283.unr = phi i32 [ 0, %for.body119.preheader ], [ %sum.1.1, %for.inc140.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond143.preheader, label %for.body119.epil
for.body119.epil: ; preds = %for.cond143.preheader.loopexit.unr-lcssa
%arrayidx121.epil = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv314.unr
%23 = load i8, ptr %arrayidx121.epil, align 8, !tbaa !13
%arrayidx124.epil = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv314.unr
%24 = load i8, ptr %arrayidx124.epil, align 8, !tbaa !13
%cmp127.epil = icmp eq i8 %23, %24
br i1 %cmp127.epil, label %land.lhs.true.epil, label %for.cond143.preheader
land.lhs.true.epil: ; preds = %for.body119.epil
%value131.epil = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv314.unr, i32 1
%25 = load i32, ptr %value131.epil, align 4, !tbaa !11
%value134.epil = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv314.unr, i32 1
%26 = load i32, ptr %value134.epil, align 4, !tbaa !11
%cmp135.epil = icmp eq i32 %25, %26
%inc138.epil = zext i1 %cmp135.epil to i32
%spec.select264.epil = add nsw i32 %sum.0283.unr, %inc138.epil
br label %for.cond143.preheader
for.cond143.preheader: ; preds = %for.cond143.preheader.loopexit.unr-lcssa, %land.lhs.true.epil, %for.body119.epil, %for.cond117.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond117.preheader ], [ %sum.1.lcssa.ph, %for.cond143.preheader.loopexit.unr-lcssa ], [ %sum.0283.unr, %for.body119.epil ], [ %spec.select264.epil, %land.lhs.true.epil ]
br i1 %cmp15270328331, label %for.body147, label %for.end158
for.body119: ; preds = %for.inc140.1, %for.body119.preheader.new
%indvars.iv314 = phi i64 [ 0, %for.body119.preheader.new ], [ %indvars.iv.next315.1, %for.inc140.1 ]
%sum.0283 = phi i32 [ 0, %for.body119.preheader.new ], [ %sum.1.1, %for.inc140.1 ]
%niter = phi i64 [ 0, %for.body119.preheader.new ], [ %niter.next.1, %for.inc140.1 ]
%arrayidx121 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv314
%27 = load i8, ptr %arrayidx121, align 16, !tbaa !13
%arrayidx124 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv314
%28 = load i8, ptr %arrayidx124, align 16, !tbaa !13
%cmp127 = icmp eq i8 %27, %28
br i1 %cmp127, label %land.lhs.true, label %for.inc140
land.lhs.true: ; preds = %for.body119
%value131 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv314, i32 1
%29 = load i32, ptr %value131, align 4, !tbaa !11
%value134 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv314, i32 1
%30 = load i32, ptr %value134, align 4, !tbaa !11
%cmp135 = icmp eq i32 %29, %30
%inc138 = zext i1 %cmp135 to i32
%spec.select264 = add nsw i32 %sum.0283, %inc138
br label %for.inc140
for.inc140: ; preds = %land.lhs.true, %for.body119
%sum.1 = phi i32 [ %sum.0283, %for.body119 ], [ %spec.select264, %land.lhs.true ]
%indvars.iv.next315 = or i64 %indvars.iv314, 1
%arrayidx121.1 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next315
%31 = load i8, ptr %arrayidx121.1, align 8, !tbaa !13
%arrayidx124.1 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv.next315
%32 = load i8, ptr %arrayidx124.1, align 8, !tbaa !13
%cmp127.1 = icmp eq i8 %31, %32
br i1 %cmp127.1, label %land.lhs.true.1, label %for.inc140.1
land.lhs.true.1: ; preds = %for.inc140
%value131.1 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next315, i32 1
%33 = load i32, ptr %value131.1, align 4, !tbaa !11
%value134.1 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv.next315, i32 1
%34 = load i32, ptr %value134.1, align 4, !tbaa !11
%cmp135.1 = icmp eq i32 %33, %34
%inc138.1 = zext i1 %cmp135.1 to i32
%spec.select264.1 = add nsw i32 %sum.1, %inc138.1
br label %for.inc140.1
for.inc140.1: ; preds = %land.lhs.true.1, %for.inc140
%sum.1.1 = phi i32 [ %sum.1, %for.inc140 ], [ %spec.select264.1, %land.lhs.true.1 ]
%indvars.iv.next315.1 = add nuw nsw i64 %indvars.iv314, 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.cond143.preheader.loopexit.unr-lcssa, label %for.body119, !llvm.loop !19
for.body147: ; preds = %for.cond143.preheader, %for.body147
%indvars.iv319 = phi i64 [ %indvars.iv.next320, %for.body147 ], [ 0, %for.cond143.preheader ]
%arrayidx149 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv319
%35 = load i8, ptr %arrayidx149, align 8, !tbaa !13
%conv151 = sext i8 %35 to i32
%value154 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv319, i32 1
%36 = load i32, ptr %value154, align 4, !tbaa !11
%call155 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv151, i32 noundef %36)
%indvars.iv.next320 = add nuw nsw i64 %indvars.iv319, 1
%37 = load i32, ptr %n, align 4, !tbaa !5
%sub144 = add nsw i32 %37, -1
%38 = sext i32 %sub144 to i64
%cmp145 = icmp slt i64 %indvars.iv.next320, %38
br i1 %cmp145, label %for.body147, label %for.end158.loopexit, !llvm.loop !20
for.end158.loopexit: ; preds = %for.body147
%39 = and i64 %indvars.iv.next320, 4294967295
br label %for.end158
for.end158: ; preds = %for.cond4.preheader, %for.end158.loopexit, %for.cond143.preheader
%sum.0.lcssa340 = phi i32 [ %sum.0.lcssa, %for.cond143.preheader ], [ %sum.0.lcssa, %for.end158.loopexit ], [ 0, %for.cond4.preheader ]
%i.5.lcssa = phi i64 [ 0, %for.cond143.preheader ], [ %39, %for.end158.loopexit ], [ 0, %for.cond4.preheader ]
%arrayidx160 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %i.5.lcssa
%40 = load i8, ptr %arrayidx160, align 8, !tbaa !13
%conv162 = sext i8 %40 to i32
%value165 = getelementptr inbounds [101 x %struct.Card], ptr %a, i64 0, i64 %i.5.lcssa, i32 1
%41 = load i32, ptr %value165, align 4, !tbaa !11
%call166 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv162, i32 noundef %41)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%42 = load i32, ptr %n, align 4, !tbaa !5
%cmp170290 = icmp sgt i32 %42, 1
br i1 %cmp170290, label %for.body172, label %for.end183
for.body172: ; preds = %for.end158, %for.body172
%indvars.iv322 = phi i64 [ %indvars.iv.next323, %for.body172 ], [ 0, %for.end158 ]
%arrayidx174 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv322
%43 = load i8, ptr %arrayidx174, align 8, !tbaa !13
%conv176 = sext i8 %43 to i32
%value179 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv322, i32 1
%44 = load i32, ptr %value179, align 4, !tbaa !11
%call180 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv176, i32 noundef %44)
%indvars.iv.next323 = add nuw nsw i64 %indvars.iv322, 1
%45 = load i32, ptr %n, align 4, !tbaa !5
%sub169 = add nsw i32 %45, -1
%46 = sext i32 %sub169 to i64
%cmp170 = icmp slt i64 %indvars.iv.next323, %46
br i1 %cmp170, label %for.body172, label %for.end183.loopexit, !llvm.loop !21
for.end183.loopexit: ; preds = %for.body172
%47 = and i64 %indvars.iv.next323, 4294967295
br label %for.end183
for.end183: ; preds = %for.end183.loopexit, %for.end158
%i.6.lcssa = phi i64 [ 0, %for.end158 ], [ %47, %for.end183.loopexit ]
%arrayidx185 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %i.6.lcssa
%48 = load i8, ptr %arrayidx185, align 8, !tbaa !13
%conv187 = sext i8 %48 to i32
%value190 = getelementptr inbounds [101 x %struct.Card], ptr %b, i64 0, i64 %i.6.lcssa, i32 1
%49 = load i32, ptr %value190, align 4, !tbaa !11
%call191 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv187, i32 noundef %49)
%50 = load i32, ptr %n, align 4, !tbaa !5
%cmp192 = icmp eq i32 %sum.0.lcssa340, %50
%str.7.str.6 = select i1 %cmp192, ptr @str.7, ptr @str.6
%puts261 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.str.6)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 808, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 808, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"Card", !7, i64 0, !6, i64 4}
!13 = !{!12, !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
typedef struct tag_card {
char suit_;
int num_;
} card_t;
void DisplayArray(card_t C[], int N)
{
int i;
for (i = 0; i < N; i++) {
if (i) printf(" ");
printf("%c%d", C[i].suit_, C[i].num_);
}
printf("\n");
}
void BubbleSort(card_t C[], int N)
{
int i, j;
card_t tmp;
for (i = 0; i < N - 1; i++) {
for (j = N - 1; j >= i; j--) {
if (C[j].num_ < C[j - 1].num_) {
tmp = C[j];
C[j] = C[j - 1];
C[j - 1] = tmp;
}
}
}
}
void SelectionSort(card_t C[], int N)
{
int i, j, minj;
card_t tmp;
for (i = 0; i < N; i++) {
minj = i;
for (j = i; j < N; j++) {
if (C[j].num_ < C[minj].num_) {
minj = j;
}
}
tmp = C[i];
C[i] = C[minj];
C[minj] = tmp;
}
}
int IsStable(card_t cBubble[], card_t cSelection[], int N)
{
int i;
for (i = 0; i < N; i++) {
if (cBubble[i].suit_ != cSelection[i].suit_) return FALSE;
}
return TRUE;
}
int main(void)
{
int N, i;
scanf("%d%*c", &N);
card_t* C1 = (card_t*)malloc(sizeof(card_t) * N);
card_t* C2 = (card_t*)malloc(sizeof(card_t) * N);
for (i = 0; i < N; i++) {
scanf("%c%d%*c", &C1[i].suit_, &C1[i].num_);
C2[i].suit_ = C1[i].suit_;
C2[i].num_ = C1[i].num_;
}
BubbleSort(C1, N);
SelectionSort(C2, N);
DisplayArray(C1, N);
printf("Stable\n");
DisplayArray(C2, N);
if (IsStable(C1, C2, N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113273/source.c"
target datalayout = "e-m:e-p270: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.tag_card = type { i8, i32 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%d%*c\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"%c%d%*c\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @DisplayArray(ptr nocapture noundef readonly %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp11 = icmp sgt i32 %N, 0
br i1 %cmp11, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%num_.peel.phi.trans.insert = getelementptr inbounds %struct.tag_card, ptr %C, i64 0, i32 1
%.pre15 = load i32, ptr %num_.peel.phi.trans.insert, align 4, !tbaa !5
%.pre = load i8, ptr %C, align 4, !tbaa !10
%conv.peel = sext i8 %.pre to i32
%call3.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %.pre15)
%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 ]
%putchar10 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !10
%conv = sext i8 %0 to i32
%num_ = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv, i32 1
%1 = load i32, ptr %num_, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %1)
%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 !11
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: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp38 = icmp sgt i32 %N, 1
br i1 %cmp38, label %for.cond2.preheader.preheader, label %for.end21
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
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc20
%indvars.iv41 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next42, %for.inc20 ]
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%num_ = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv, i32 1
%2 = load i32, ptr %num_, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%num_8 = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv.next, i32 1
%3 = load i32, ptr %num_8, align 4, !tbaa !5
%cmp9 = icmp slt i32 %2, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv.next
%4 = load <2 x i64>, ptr %arrayidx7, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx7, align 4
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3.not.not = icmp sgt i64 %indvars.iv, %indvars.iv41
br i1 %cmp3.not.not, label %for.body4, label %for.inc20, !llvm.loop !14
for.inc20: ; preds = %for.inc
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.cond2.preheader, !llvm.loop !15
for.end21: ; preds = %for.inc20, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%minj.036 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%num_ = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv39, i32 1
%2 = load i32, ptr %num_, align 4, !tbaa !5
%idxprom4 = sext i32 %minj.036 to i64
%num_6 = getelementptr inbounds %struct.tag_card, ptr %C, i64 %idxprom4, i32 1
%3 = load i32, ptr %num_6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.036
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.tag_card, ptr %C, i64 %indvars.iv
%5 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %spec.select to i64
%arrayidx13 = getelementptr inbounds %struct.tag_card, ptr %C, i64 %idxprom12
%6 = load i64, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx9, align 4
store i64 %5, ptr %arrayidx13, align 4
%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.end18, label %for.cond1.preheader, !llvm.loop !17
for.end18: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @IsStable(ptr nocapture noundef readonly %cBubble, ptr nocapture noundef readonly %cSelection, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !18
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.tag_card, ptr %cBubble, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !10
%arrayidx2 = getelementptr inbounds %struct.tag_card, ptr %cSelection, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 4, !tbaa !10
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; 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.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%call4 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp84 = icmp sgt i32 %0, 0
br i1 %cmp84, label %for.body, label %DisplayArray.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv
%num_ = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv, i32 1
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %arrayidx, ptr noundef nonnull %num_)
%1 = load i8, ptr %arrayidx, align 4, !tbaa !10
%arrayidx13 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv
store i8 %1, ptr %arrayidx13, align 4, !tbaa !10
%2 = load i32, ptr %num_, align 4, !tbaa !5
%num_20 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv, i32 1
store i32 %2, ptr %num_20, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %N, align 4, !tbaa !19
%3 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.body
%cmp38.i = icmp sgt i32 %.pr, 1
br i1 %cmp38.i, label %for.cond2.preheader.preheader.i, label %BubbleSort.exit
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %.pr, -1
%4 = zext i32 %.pr to i64
%5 = add nsw i64 %4, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc20.i, %for.cond2.preheader.preheader.i
%indvars.iv41.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next42.i, %for.inc20.i ]
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.i = phi i64 [ %5, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%num_.i = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.i, i32 1
%6 = load i32, ptr %num_.i, align 4, !tbaa !5
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%num_8.i = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.next.i, i32 1
%7 = load i32, ptr %num_8.i, align 4, !tbaa !5
%cmp9.i = icmp slt i32 %6, %7
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.next.i
%8 = load <2 x i64>, ptr %arrayidx7.i, align 4
%9 = shufflevector <2 x i64> %8, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %9, ptr %arrayidx7.i, align 4
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp3.not.not.i = icmp sgt i64 %indvars.iv.i, %indvars.iv41.i
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.inc20.i, !llvm.loop !14
for.inc20.i: ; preds = %for.inc.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next42.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond2.preheader.i, !llvm.loop !15
BubbleSort.exit: ; preds = %for.inc20.i, %for.end
%cmp37.i = icmp sgt i32 %.pr, 0
br i1 %cmp37.i, label %for.cond1.preheader.preheader.i, label %DisplayArray.exit
for.cond1.preheader.preheader.i: ; preds = %BubbleSort.exit
%10 = zext i32 %.pr to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i45 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i47, %for.end.i ]
%11 = trunc i64 %indvars.iv.i45 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv39.i = phi i64 [ %indvars.iv.i45, %for.cond1.preheader.i ], [ %indvars.iv.next40.i, %for.body3.i ]
%minj.036.i = phi i32 [ %11, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%num_.i46 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv39.i, i32 1
%12 = load i32, ptr %num_.i46, align 4, !tbaa !5
%idxprom4.i = sext i32 %minj.036.i to i64
%num_6.i = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %idxprom4.i, i32 1
%13 = load i32, ptr %num_6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %12, %13
%14 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %14, i32 %minj.036.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next40.i, %10
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !16
for.end.i: ; preds = %for.body3.i
%arrayidx9.i = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv.i45
%15 = load i64, ptr %arrayidx9.i, align 4
%idxprom12.i = sext i32 %spec.select.i to i64
%arrayidx13.i = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %idxprom12.i
%16 = load i64, ptr %arrayidx13.i, align 4
store i64 %16, ptr %arrayidx9.i, align 4
store i64 %15, ptr %arrayidx13.i, align 4
%indvars.iv.next.i47 = add nuw nsw i64 %indvars.iv.i45, 1
%exitcond.not.i48 = icmp eq i64 %indvars.iv.next.i47, %10
br i1 %exitcond.not.i48, label %if.end.peel.i, label %for.cond1.preheader.i, !llvm.loop !17
if.end.peel.i: ; preds = %for.end.i
%num_.peel.phi.trans.insert.i = getelementptr inbounds %struct.tag_card, ptr %call1, i64 0, i32 1
%.pre15.i = load i32, ptr %num_.peel.phi.trans.insert.i, align 4, !tbaa !5
%.pre.i = load i8, ptr %call1, align 4, !tbaa !10
%conv.peel.i = sext i8 %.pre.i to i32
%call3.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %.pre15.i)
%exitcond.peel.not.i = icmp eq i32 %.pr, 1
br i1 %exitcond.peel.not.i, label %DisplayArray.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i51 = phi i64 [ %indvars.iv.next.i54, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar10.i = call i32 @putchar(i32 32)
%arrayidx.i52 = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.i51
%17 = load i8, ptr %arrayidx.i52, align 4, !tbaa !10
%conv.i = sext i8 %17 to i32
%num_.i53 = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.i51, i32 1
%18 = load i32, ptr %num_.i53, align 4, !tbaa !5
%call3.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %18)
%indvars.iv.next.i54 = add nuw nsw i64 %indvars.iv.i51, 1
%exitcond.not.i55 = icmp eq i64 %indvars.iv.next.i54, %10
br i1 %exitcond.not.i55, label %DisplayArray.exit, label %if.end.i, !llvm.loop !11
DisplayArray.exit: ; preds = %if.end.i, %entry, %BubbleSort.exit, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%19 = load i32, ptr %N, align 4, !tbaa !19
%cmp11.i56 = icmp sgt i32 %19, 0
br i1 %cmp11.i56, label %if.end.peel.i59, label %DisplayArray.exit76
if.end.peel.i59: ; preds = %DisplayArray.exit
%wide.trip.count.i60 = zext i32 %19 to i64
%num_.peel.phi.trans.insert.i61 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 0, i32 1
%.pre15.i62 = load i32, ptr %num_.peel.phi.trans.insert.i61, align 4, !tbaa !5
%.pre.i63 = load i8, ptr %call4, align 4, !tbaa !10
%conv.peel.i64 = sext i8 %.pre.i63 to i32
%call3.peel.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i64, i32 noundef %.pre15.i62)
%exitcond.peel.not.i66 = icmp eq i32 %19, 1
br i1 %exitcond.peel.not.i66, label %DisplayArray.exit76, label %if.end.i67
if.end.i67: ; preds = %if.end.peel.i59, %if.end.i67
%indvars.iv.i68 = phi i64 [ %indvars.iv.next.i74, %if.end.i67 ], [ 1, %if.end.peel.i59 ]
%putchar10.i69 = call i32 @putchar(i32 32)
%arrayidx.i70 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv.i68
%20 = load i8, ptr %arrayidx.i70, align 4, !tbaa !10
%conv.i71 = sext i8 %20 to i32
%num_.i72 = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv.i68, i32 1
%21 = load i32, ptr %num_.i72, align 4, !tbaa !5
%call3.i73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i71, i32 noundef %21)
%indvars.iv.next.i74 = add nuw nsw i64 %indvars.iv.i68, 1
%exitcond.not.i75 = icmp eq i64 %indvars.iv.next.i74, %wide.trip.count.i60
br i1 %exitcond.not.i75, label %DisplayArray.exit76, label %if.end.i67, !llvm.loop !11
DisplayArray.exit76: ; preds = %if.end.i67, %DisplayArray.exit, %if.end.peel.i59
%putchar.i58 = call i32 @putchar(i32 10)
%22 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %22, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %DisplayArray.exit76
%wide.trip.count.i77 = zext i32 %22 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i80 = add nuw nsw i64 %indvars.iv.i78, 1
%exitcond.not.i81 = icmp eq i64 %indvars.iv.next.i80, %wide.trip.count.i77
br i1 %exitcond.not.i81, label %if.end, label %for.body.i, !llvm.loop !18
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i78 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i80, %for.cond.i ]
%arrayidx.i79 = getelementptr inbounds %struct.tag_card, ptr %call1, i64 %indvars.iv.i78
%23 = load i8, ptr %arrayidx.i79, align 4, !tbaa !10
%arrayidx2.i = getelementptr inbounds %struct.tag_card, ptr %call4, i64 %indvars.iv.i78
%24 = load i8, ptr %arrayidx2.i, align 4, !tbaa !10
%cmp5.not.i = icmp eq i8 %23, %24
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %DisplayArray.exit76
%str.7.sink = phi ptr [ @str.8, %DisplayArray.exit76 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts42 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
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 #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 #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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 = { 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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !9, i64 4}
!6 = !{!"tag_card", !7, i64 0, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = !{!9, !9, i64 0}
!20 = distinct !{!20, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 36
typedef struct{
char key[2];
int value;
} SHCD;
int main(){
SHCD A[N],temp,B[N];
int i,j,n,minj,flag;
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%s",A[i].key);
A[i].value = atoi(&A[i].key[1]);
B[i] = A[i];
}
i = 0;
flag = 1;
while(flag==1){
flag = 0;
for(j = n-1 ; j >= i ; j--){
if(A[j].value < A[j-1].value){
temp = A[j];
A[j] = A[j-1];
A[j-1] = temp;
}
flag = 1;
}
i+=1;
}
for(i = 0 ; i < n ; i++){
minj = i;
for(j = i ; j < n ; j++){
if(B[j].value < B[minj].value){
minj = j;
}
}
if( i != minj) {
temp = B[minj];
B[minj] = B[i];
B[i] = temp;
}
}
for(i = 0 ; i < n-1 ; i++){
printf("%c%d ",A[i].key[0],A[i].value);
}
printf("%c%d\n",A[i].key[0],A[i].value);
printf("Stable\n");
for(i = 0 ; i < n-1 ; i++){
printf("%c%d ",B[i].key[0],B[i].value);
}
printf("%c%d\n",B[i].key[0],B[i].value);
flag = 0;
for( i = 0 ; i < n ; i++ )
{
if( strcmp(A[i].key,B[i].key) != 0 ){
flag = 1;
break;
}
}
if( flag == 0 ) printf("Stable\n");
else printf("Not stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113316/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113316/source.c"
target datalayout = "e-m:e-p270: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.SHCD = type { [2 x i8], i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [36 x %struct.SHCD], align 16
%B = alloca [36 x %struct.SHCD], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %A) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp194 = icmp sgt i32 %0, 0
br i1 %cmp194, label %for.body, label %entry.while.cond.preheader_crit_edge
entry.while.cond.preheader_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry.while.cond.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre, %entry.while.cond.preheader_crit_edge ], [ %5, %for.body ]
%1 = phi i32 [ %0, %entry.while.cond.preheader_crit_edge ], [ %4, %for.body ]
%smax = call i32 @llvm.smax.i32(i32 %1, i32 0)
%2 = add nuw i32 %smax, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx5 = getelementptr inbounds [2 x i8], ptr %arrayidx, i64 0, i64 1
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %arrayidx5, ptr noundef null, i32 noundef 10) #7
%conv.i = trunc i64 %call.i to i32
%value = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv, i32 1
store i32 %conv.i, ptr %value, align 4, !tbaa !9
%arrayidx10 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv
%3 = load i64, ptr %arrayidx, align 8
store i64 %3, ptr %arrayidx10, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %while.cond.preheader, %for.end36
%indvars.iv222 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next223, %for.end36 ]
%cmp15.not.not197 = icmp sgt i64 %.pre-phi, %indvars.iv222
br i1 %cmp15.not.not197, label %for.body16, label %for.end36
for.cond37.preheader: ; preds = %for.end36
%cmp38204 = icmp sgt i32 %1, 0
br i1 %cmp38204, label %for.cond40.preheader.preheader, label %for.end83
for.cond40.preheader.preheader: ; preds = %for.cond37.preheader
%wide.trip.count231 = zext i32 %1 to i64
br label %for.cond40.preheader
for.body16: ; preds = %for.cond14.preheader, %if.end
%indvars.iv218 = phi i64 [ %indvars.iv.next219, %if.end ], [ %.pre-phi, %for.cond14.preheader ]
%indvars.iv.next219 = add nsw i64 %indvars.iv218, -1
%value19 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv.next219, i32 1
%6 = load i32, ptr %value19, align 4, !tbaa !9
%7 = add nsw i64 %indvars.iv218, -2
%value23 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %7, i32 1
%8 = load i32, ptr %value23, align 4, !tbaa !9
%cmp24 = icmp slt i32 %6, %8
br i1 %cmp24, label %if.then, label %if.end
if.then: ; preds = %for.body16
%arrayidx22 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %7
%9 = load <2 x i64>, ptr %arrayidx22, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx22, align 8
br label %if.end
if.end: ; preds = %if.then, %for.body16
%cmp15.not.not = icmp sgt i64 %indvars.iv.next219, %indvars.iv222
br i1 %cmp15.not.not, label %for.body16, label %for.end36, !llvm.loop !13
for.end36: ; preds = %if.end, %for.cond14.preheader
%indvars.iv.next223 = add nuw nsw i64 %indvars.iv222, 1
%exitcond.not = icmp eq i64 %indvars.iv.next223, %wide.trip.count
br i1 %exitcond.not, label %for.cond37.preheader, label %for.cond14.preheader, !llvm.loop !14
for.cond40.preheader: ; preds = %for.cond40.preheader.preheader, %for.inc66
%indvars.iv225 = phi i64 [ 0, %for.cond40.preheader.preheader ], [ %indvars.iv.next226, %for.inc66 ]
%11 = trunc i64 %indvars.iv225 to i32
br label %for.body42
for.cond69.preheader: ; preds = %for.inc66
%cmp71207 = icmp sgt i32 %1, 1
br i1 %cmp71207, label %for.body72, label %for.end83
for.body42: ; preds = %for.cond40.preheader, %for.body42
%indvars.iv227 = phi i64 [ %indvars.iv225, %for.cond40.preheader ], [ %indvars.iv.next228, %for.body42 ]
%minj.0203 = phi i32 [ %11, %for.cond40.preheader ], [ %spec.select, %for.body42 ]
%value45 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv227, i32 1
%12 = load i32, ptr %value45, align 4, !tbaa !9
%idxprom46 = sext i32 %minj.0203 to i64
%value48 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %idxprom46, i32 1
%13 = load i32, ptr %value48, align 4, !tbaa !9
%cmp49 = icmp slt i32 %12, %13
%14 = trunc i64 %indvars.iv227 to i32
%spec.select = select i1 %cmp49, i32 %14, i32 %minj.0203
%indvars.iv.next228 = add nuw nsw i64 %indvars.iv227, 1
%cmp41 = icmp slt i64 %indvars.iv.next228, %.pre-phi
br i1 %cmp41, label %for.body42, label %for.end54, !llvm.loop !15
for.end54: ; preds = %for.body42
%15 = zext i32 %spec.select to i64
%cmp55.not = icmp eq i64 %indvars.iv225, %15
br i1 %cmp55.not, label %for.inc66, label %if.then56
if.then56: ; preds = %for.end54
%idxprom57 = sext i32 %spec.select to i64
%arrayidx58 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %idxprom57
%16 = load i64, ptr %arrayidx58, align 8
%arrayidx62 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv225
%17 = load i64, ptr %arrayidx62, align 8
store i64 %17, ptr %arrayidx58, align 8
store i64 %16, ptr %arrayidx62, align 8
br label %for.inc66
for.inc66: ; preds = %for.end54, %if.then56
%indvars.iv.next226 = add nuw nsw i64 %indvars.iv225, 1
%exitcond232.not = icmp eq i64 %indvars.iv.next226, %wide.trip.count231
br i1 %exitcond232.not, label %for.cond69.preheader, label %for.cond40.preheader, !llvm.loop !16
for.body72: ; preds = %for.cond69.preheader, %for.body72
%indvars.iv233 = phi i64 [ %indvars.iv.next234, %for.body72 ], [ 0, %for.cond69.preheader ]
%arrayidx74 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv233
%18 = load i8, ptr %arrayidx74, align 8, !tbaa !17
%conv = sext i8 %18 to i32
%value79 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv233, i32 1
%19 = load i32, ptr %value79, align 4, !tbaa !9
%call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%sub70 = add nsw i32 %20, -1
%21 = sext i32 %sub70 to i64
%cmp71 = icmp slt i64 %indvars.iv.next234, %21
br i1 %cmp71, label %for.body72, label %for.end83.loopexit, !llvm.loop !18
for.end83.loopexit: ; preds = %for.body72
%22 = and i64 %indvars.iv.next234, 4294967295
br label %for.end83
for.end83: ; preds = %for.cond37.preheader, %for.end83.loopexit, %for.cond69.preheader
%i.3.lcssa = phi i64 [ 0, %for.cond69.preheader ], [ %22, %for.end83.loopexit ], [ 0, %for.cond37.preheader ]
%arrayidx85 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %i.3.lcssa
%23 = load i8, ptr %arrayidx85, align 8, !tbaa !17
%conv88 = sext i8 %23 to i32
%value91 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %i.3.lcssa, i32 1
%24 = load i32, ptr %value91, align 4, !tbaa !9
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv88, i32 noundef %24)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp96211 = icmp sgt i32 %25, 1
br i1 %cmp96211, label %for.body98, label %for.end110
for.body98: ; preds = %for.end83, %for.body98
%indvars.iv236 = phi i64 [ %indvars.iv.next237, %for.body98 ], [ 0, %for.end83 ]
%arrayidx100 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv236
%26 = load i8, ptr %arrayidx100, align 8, !tbaa !17
%conv103 = sext i8 %26 to i32
%value106 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv236, i32 1
%27 = load i32, ptr %value106, align 4, !tbaa !9
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv103, i32 noundef %27)
%indvars.iv.next237 = add nuw nsw i64 %indvars.iv236, 1
%28 = load i32, ptr %n, align 4, !tbaa !5
%sub95 = add nsw i32 %28, -1
%29 = sext i32 %sub95 to i64
%cmp96 = icmp slt i64 %indvars.iv.next237, %29
br i1 %cmp96, label %for.body98, label %for.end110.loopexit, !llvm.loop !19
for.end110.loopexit: ; preds = %for.body98
%30 = and i64 %indvars.iv.next237, 4294967295
br label %for.end110
for.end110: ; preds = %for.end110.loopexit, %for.end83
%i.4.lcssa = phi i64 [ 0, %for.end83 ], [ %30, %for.end110.loopexit ]
%arrayidx112 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %i.4.lcssa
%31 = load i8, ptr %arrayidx112, align 8, !tbaa !17
%conv115 = sext i8 %31 to i32
%value118 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %i.4.lcssa, i32 1
%32 = load i32, ptr %value118, align 4, !tbaa !9
%call119 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv115, i32 noundef %32)
%33 = load i32, ptr %n, align 4, !tbaa !5
%cmp121.not214 = icmp sgt i32 %33, 0
br i1 %cmp121.not214, label %for.body123.preheader, label %if.end145
for.body123.preheader: ; preds = %for.end110
%wide.trip.count242 = zext i32 %33 to i64
br label %for.body123
for.cond120: ; preds = %for.body123
%indvars.iv.next240 = add nuw nsw i64 %indvars.iv239, 1
%exitcond243.not = icmp eq i64 %indvars.iv.next240, %wide.trip.count242
br i1 %exitcond243.not, label %if.end145, label %for.body123, !llvm.loop !20
for.body123: ; preds = %for.body123.preheader, %for.cond120
%indvars.iv239 = phi i64 [ 0, %for.body123.preheader ], [ %indvars.iv.next240, %for.cond120 ]
%arrayidx125 = getelementptr inbounds [36 x %struct.SHCD], ptr %A, i64 0, i64 %indvars.iv239
%arrayidx129 = getelementptr inbounds [36 x %struct.SHCD], ptr %B, i64 0, i64 %indvars.iv239
%call132 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx125, ptr noundef nonnull dereferenceable(1) %arrayidx129) #8
%cmp133.not = icmp eq i32 %call132, 0
br i1 %cmp133.not, label %for.cond120, label %if.end145
if.end145: ; preds = %for.body123, %for.cond120, %for.end110
%str.6.sink = phi ptr [ @str.7, %for.end110 ], [ @str.7, %for.cond120 ], [ @str.6, %for.body123 ]
%puts192 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #7
call void @llvm.lifetime.end.p0(i64 288, 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: nofree nounwind
declare noundef i32 @printf(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 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
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 = !{!10, !6, i64 4}
!10 = !{!"", !7, i64 0, !6, i64 4}
!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 = !{!7, !7, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
|
#include <stdio.h>
int main(){
int t;
scanf("%i",&t);
while(t--){
unsigned long long n,r,s=0ULL;
scanf("%llu%llu",&n,&r);
if(r<n)
s = r*(r+1)/2ULL;
else
s = n*(n-1)/2 +1 ;
printf("%llu\n",s);
}
return 0-0-0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%i\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i64, align 8
%r = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%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 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %r)
%1 = load i64, ptr %r, align 8, !tbaa !9
%2 = load i64, ptr %n, align 8, !tbaa !9
%cmp = icmp ult i64 %1, %2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%add = add nuw i64 %1, 1
%mul = mul i64 %add, %1
%div8 = lshr i64 %mul, 1
br label %if.end
if.else: ; preds = %while.body
%sub = add i64 %2, -1
%mul2 = mul i64 %sub, %2
%div37 = lshr i64 %mul2, 1
%add4 = add nuw i64 %div37, 1
br label %if.end
if.end: ; preds = %if.else, %if.then
%s.0 = phi i64 [ %div8, %if.then ], [ %add4, %if.else ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
void BubbleSort(char**, int);
void SelectionSort(char**, int);
char C[36],D[36];
int main(){
int i, N, flag;
char **A, *B;
scanf("%d",&N);
A = (char **)malloc(sizeof(char*) * N);
for(i=0; i<N; i++)
A[i] = (char *)malloc(sizeof(char) * 2);
for(i=0; i<N; i++)
scanf("%s",A[i]);
BubbleSort(A, N);
SelectionSort(A, N);
for(i=0,flag=1; i<N; i++)
if(D[i] != C[i]){
flag = 0;
break;
}
flag ? printf("Stable\n"):printf("Not stable\n");
free(A);
return 0;
}
void BubbleSort(char* A[], int N){
int n, i, j;
char B[N][2];
char x[2];
n = N;
for(i=0;i<N;i++)
B[i][0]=A[i][0],B[i][1]=A[i][1];
for(i=0; i<N-1; i++){
for(j=N-1; j>i; j--)
if(B[j][1] < B[j-1][1]){
x[0] = B[j-1][0];
x[1] = B[j-1][1];
B[j-1][0] = B[j][0];
B[j-1][1] = B[j][1];
B[j][0] = x[0];
B[j][1] = x[1];
}
}
for(i=0; i<N; i++){
printf("%c%c",B[i][0],B[i][1]);
i < N-1 ? printf(" "):printf("\n");
C[i] = B[i][0];
}
printf("Stable\n");
}
void SelectionSort(char* A[], int N){
int i, j, min;
char x[2];
for(i=0; i<N-1; i++){
min = i;
for(j=i; j<N; j++){
if(A[j][1] < A[min][1])
min = j;
}
x[0] = A[i][0];
x[1] = A[i][1];
A[i][0] = A[min][0];
A[i][1] = A[min][1];
A[min][0] = x[0];
A[min][1] = x[1];
}
for(i=0; i<N; i++){
printf("%c%c",A[i][0],A[i][1]);
i < N-1 ? printf(" "):printf("\n");
D[i] = A[i][0];
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113402/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113402/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@D = dso_local local_unnamed_addr global [36 x i8] zeroinitializer, align 16
@C = dso_local local_unnamed_addr global [36 x i8] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body.preheader, label %for.end13
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond4.preheader: ; preds = %for.body
br i1 %cmp45, label %for.body7, label %for.end13
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call3 = call noalias dereferenceable_or_null(2) ptr @malloc(i64 noundef 2) #8
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call3, ptr %arrayidx, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond4.preheader, label %for.body, !llvm.loop !11
for.body7: ; preds = %for.cond4.preheader, %for.body7
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body7 ], [ 0, %for.cond4.preheader ]
%arrayidx9 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv53
%1 = load ptr, ptr %arrayidx9, align 8, !tbaa !9
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %1)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp5 = icmp slt i64 %indvars.iv.next54, %3
br i1 %cmp5, label %for.body7, label %for.end13, !llvm.loop !13
for.end13: ; preds = %for.body7, %entry, %for.cond4.preheader
%.lcssa = phi i32 [ %0, %for.cond4.preheader ], [ %0, %entry ], [ %2, %for.body7 ]
call void @BubbleSort(ptr noundef %call1, i32 noundef %.lcssa)
%4 = load i32, ptr %N, align 4, !tbaa !5
call void @SelectionSort(ptr noundef %call1, i32 noundef %4)
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp1549 = icmp sgt i32 %5, 0
br i1 %cmp1549, label %for.body17.preheader, label %cond.end
for.body17.preheader: ; preds = %for.end13
%wide.trip.count59 = zext i32 %5 to i64
br label %for.body17
for.cond14: ; preds = %for.body17
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count59
br i1 %exitcond60.not, label %cond.end, label %for.body17, !llvm.loop !14
for.body17: ; preds = %for.body17.preheader, %for.cond14
%indvars.iv56 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next57, %for.cond14 ]
%arrayidx19 = getelementptr inbounds [36 x i8], ptr @D, i64 0, i64 %indvars.iv56
%6 = load i8, ptr %arrayidx19, align 1, !tbaa !15
%arrayidx22 = getelementptr inbounds [36 x i8], ptr @C, i64 0, i64 %indvars.iv56
%7 = load i8, ptr %arrayidx22, align 1, !tbaa !15
%cmp24.not = icmp eq i8 %6, %7
br i1 %cmp24.not, label %for.cond14, label %cond.end
cond.end: ; preds = %for.body17, %for.cond14, %for.end13
%str.sink = phi ptr [ @str.8, %for.end13 ], [ @str.8, %for.cond14 ], [ @str, %for.body17 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @free(ptr noundef %call1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @BubbleSort(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%0 = zext i32 %N to i64
%vla = alloca [2 x i8], i64 %0, align 16
%cmp125 = icmp sgt i32 %N, 0
br i1 %cmp125, label %for.body.preheader, label %for.end89
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %0, 1
%1 = icmp eq i32 %N, 1
br i1 %1, label %for.cond11.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, 4294967294
br label %for.body
for.cond11.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond11.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond11.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv.unr
%2 = load ptr, ptr %arrayidx.epil, align 8, !tbaa !9
%3 = load i8, ptr %2, align 1, !tbaa !15
%arrayidx3.epil = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.unr
store i8 %3, ptr %arrayidx3.epil, align 2, !tbaa !15
%arrayidx7.epil = getelementptr inbounds i8, ptr %2, i64 1
%4 = load i8, ptr %arrayidx7.epil, align 1, !tbaa !15
%arrayidx10.epil = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.unr, i64 1
store i8 %4, ptr %arrayidx10.epil, align 1, !tbaa !15
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.unr-lcssa, %for.body.epil
%sub = add i32 %N, -1
%cmp12128 = icmp sgt i32 %N, 1
br i1 %cmp12128, label %for.cond15.preheader.preheader, label %for.cond65.preheader
for.cond15.preheader.preheader: ; preds = %for.cond11.preheader
%5 = zext i32 %N to i64
%6 = add nsw i64 %5, -1
%wide.trip.count139 = zext i32 %sub to i64
%arrayidx20.phi.trans.insert = getelementptr inbounds [2 x i8], ptr %vla, i64 %6, i64 1
br label %for.cond15.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv
%7 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%8 = load i8, ptr %7, align 1, !tbaa !15
%arrayidx3 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv
store i8 %8, ptr %arrayidx3, align 4, !tbaa !15
%arrayidx7 = getelementptr inbounds i8, ptr %7, i64 1
%9 = load i8, ptr %arrayidx7, align 1, !tbaa !15
%arrayidx10 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv, i64 1
store i8 %9, ptr %arrayidx10, align 1, !tbaa !15
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv.next
%10 = load ptr, ptr %arrayidx.1, align 8, !tbaa !9
%11 = load i8, ptr %10, align 1, !tbaa !15
%arrayidx3.1 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.next
store i8 %11, ptr %arrayidx3.1, align 2, !tbaa !15
%arrayidx7.1 = getelementptr inbounds i8, ptr %10, i64 1
%12 = load i8, ptr %arrayidx7.1, align 1, !tbaa !15
%arrayidx10.1 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.next, i64 1
store i8 %12, ptr %arrayidx10.1, align 1, !tbaa !15
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add nuw i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond11.preheader.unr-lcssa, label %for.body, !llvm.loop !16
for.cond15.preheader: ; preds = %for.cond15.preheader.preheader, %for.inc62
%indvars.iv136 = phi i64 [ 0, %for.cond15.preheader.preheader ], [ %indvars.iv.next137, %for.inc62 ]
%.pre = load i8, ptr %arrayidx20.phi.trans.insert, align 1, !tbaa !15
br label %for.body17
for.cond65.preheader: ; preds = %for.inc62, %for.cond11.preheader
br i1 %cmp125, label %for.body68.preheader, label %for.end89
for.body68.preheader: ; preds = %for.cond65.preheader
%13 = zext i32 %sub to i64
br label %for.body68
for.body17: ; preds = %for.cond15.preheader, %for.inc60
%14 = phi i8 [ %.pre, %for.cond15.preheader ], [ %18, %for.inc60 ]
%indvars.iv133 = phi i64 [ %6, %for.cond15.preheader ], [ %indvars.iv.next134, %for.inc60 ]
%indvars.iv.next134 = add nsw i64 %indvars.iv133, -1
%arrayidx24 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.next134, i64 1
%15 = load i8, ptr %arrayidx24, align 1, !tbaa !15
%cmp26 = icmp slt i8 %14, %15
br i1 %cmp26, label %if.then, label %for.inc60
if.then: ; preds = %for.body17
%arrayidx20 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv133, i64 1
%arrayidx23 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv.next134
%arrayidx19 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv133
%16 = load i8, ptr %arrayidx23, align 2, !tbaa !15
%17 = load i8, ptr %arrayidx19, align 2, !tbaa !15
store i8 %17, ptr %arrayidx23, align 2, !tbaa !15
store i8 %14, ptr %arrayidx24, align 1, !tbaa !15
store i8 %16, ptr %arrayidx19, align 2, !tbaa !15
store i8 %15, ptr %arrayidx20, align 1, !tbaa !15
br label %for.inc60
for.inc60: ; preds = %for.body17, %if.then
%18 = phi i8 [ %15, %for.body17 ], [ %14, %if.then ]
%cmp16 = icmp sgt i64 %indvars.iv.next134, %indvars.iv136
br i1 %cmp16, label %for.body17, label %for.inc62, !llvm.loop !17
for.inc62: ; preds = %for.inc60
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%exitcond140.not = icmp eq i64 %indvars.iv.next137, %wide.trip.count139
br i1 %exitcond140.not, label %for.cond65.preheader, label %for.cond15.preheader, !llvm.loop !18
for.body68: ; preds = %for.body68.preheader, %for.body68
%indvars.iv141 = phi i64 [ 0, %for.body68.preheader ], [ %indvars.iv.next142, %for.body68 ]
%arrayidx70 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv141
%19 = load i8, ptr %arrayidx70, align 2, !tbaa !15
%conv72 = sext i8 %19 to i32
%arrayidx75 = getelementptr inbounds [2 x i8], ptr %vla, i64 %indvars.iv141, i64 1
%20 = load i8, ptr %arrayidx75, align 1, !tbaa !15
%conv76 = sext i8 %20 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %conv72, i32 noundef %conv76)
%cmp78 = icmp ult i64 %indvars.iv141, %13
%. = select i1 %cmp78, i32 32, i32 10
%putchar = tail call i32 @putchar(i32 %.)
%arrayidx86 = getelementptr inbounds [36 x i8], ptr @C, i64 0, i64 %indvars.iv141
store i8 %19, ptr %arrayidx86, align 1, !tbaa !15
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%exitcond145.not = icmp eq i64 %indvars.iv.next142, %0
br i1 %exitcond145.not, label %for.end89, label %for.body68, !llvm.loop !19
for.end89: ; preds = %for.body68, %entry, %for.cond65.preheader
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @SelectionSort(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%sub = add i32 %N, -1
%cmp107 = icmp sgt i32 %N, 1
br i1 %cmp107, label %for.cond1.preheader.preheader, label %for.cond42.preheader
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count116 = zext i32 %sub to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%cmp2104 = icmp ult i64 %indvars.iv, %0
%1 = trunc i64 %indvars.iv to i32
br i1 %cmp2104, label %for.body3, label %for.end
for.cond42.preheader: ; preds = %for.end, %entry
%cmp43110 = icmp sgt i32 %N, 0
br i1 %cmp43110, label %for.body45.preheader, label %for.end66
for.body45.preheader: ; preds = %for.cond42.preheader
%2 = zext i32 %sub to i64
%wide.trip.count121 = zext i32 %N to i64
br label %for.body45
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.body3 ], [ %indvars.iv, %for.cond1.preheader ]
%min.0105 = phi i32 [ %spec.select, %for.body3 ], [ %1, %for.cond1.preheader ]
%arrayidx = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv112
%3 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%arrayidx4 = getelementptr inbounds i8, ptr %3, i64 1
%4 = load i8, ptr %arrayidx4, align 1, !tbaa !15
%idxprom5 = sext i32 %min.0105 to i64
%arrayidx6 = getelementptr inbounds ptr, ptr %A, i64 %idxprom5
%5 = load ptr, ptr %arrayidx6, align 8, !tbaa !9
%arrayidx7 = getelementptr inbounds i8, ptr %5, i64 1
%6 = load i8, ptr %arrayidx7, align 1, !tbaa !15
%cmp9 = icmp slt i8 %4, %6
%7 = trunc i64 %indvars.iv112 to i32
%spec.select = select i1 %cmp9, i32 %7, i32 %min.0105
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%exitcond.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !20
for.end: ; preds = %for.body3, %for.cond1.preheader
%min.0.lcssa = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%arrayidx12 = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv
%8 = load ptr, ptr %arrayidx12, align 8, !tbaa !9
%9 = load i8, ptr %8, align 1, !tbaa !15
%arrayidx17 = getelementptr inbounds i8, ptr %8, i64 1
%10 = load i8, ptr %arrayidx17, align 1, !tbaa !15
%idxprom19 = sext i32 %min.0.lcssa to i64
%arrayidx20 = getelementptr inbounds ptr, ptr %A, i64 %idxprom19
%11 = load ptr, ptr %arrayidx20, align 8, !tbaa !9
%12 = load i8, ptr %11, align 1, !tbaa !15
store i8 %12, ptr %8, align 1, !tbaa !15
%13 = load ptr, ptr %arrayidx20, align 8, !tbaa !9
%arrayidx27 = getelementptr inbounds i8, ptr %13, i64 1
%14 = load i8, ptr %arrayidx27, align 1, !tbaa !15
%15 = load ptr, ptr %arrayidx12, align 8, !tbaa !9
%arrayidx30 = getelementptr inbounds i8, ptr %15, i64 1
store i8 %14, ptr %arrayidx30, align 1, !tbaa !15
%16 = load ptr, ptr %arrayidx20, align 8, !tbaa !9
store i8 %9, ptr %16, align 1, !tbaa !15
%17 = load ptr, ptr %arrayidx20, align 8, !tbaa !9
%arrayidx38 = getelementptr inbounds i8, ptr %17, i64 1
store i8 %10, ptr %arrayidx38, align 1, !tbaa !15
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond117.not = icmp eq i64 %indvars.iv.next, %wide.trip.count116
br i1 %exitcond117.not, label %for.cond42.preheader, label %for.cond1.preheader, !llvm.loop !21
for.body45: ; preds = %for.body45.preheader, %for.body45
%indvars.iv118 = phi i64 [ 0, %for.body45.preheader ], [ %indvars.iv.next119, %for.body45 ]
%arrayidx47 = getelementptr inbounds ptr, ptr %A, i64 %indvars.iv118
%18 = load ptr, ptr %arrayidx47, align 8, !tbaa !9
%19 = load i8, ptr %18, align 1, !tbaa !15
%conv49 = sext i8 %19 to i32
%arrayidx52 = getelementptr inbounds i8, ptr %18, i64 1
%20 = load i8, ptr %arrayidx52, align 1, !tbaa !15
%conv53 = sext i8 %20 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %conv49, i32 noundef %conv53)
%cmp55 = icmp ult i64 %indvars.iv118, %2
%. = select i1 %cmp55, i32 32, i32 10
%putchar = tail call i32 @putchar(i32 %.)
%21 = load ptr, ptr %arrayidx47, align 8, !tbaa !9
%22 = load i8, ptr %21, align 1, !tbaa !15
%arrayidx63 = getelementptr inbounds [36 x i8], ptr @D, i64 0, i64 %indvars.iv118
store i8 %22, ptr %arrayidx63, align 1, !tbaa !15
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
br i1 %exitcond122.not, label %for.end66, label %for.body45, !llvm.loop !22
for.end66: ; preds = %for.body45, %for.cond42.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
char suit,value;
}Card;
void Bubble(Card A[],int n)
{
int i,j;
Card f;
for(i=0;i<=n-1;i++)
{
for(j = n-1;j>=i+1;j--)
{
if(A[j].value<A[j-1].value)
{
f = A[j];
A[j]=A[j-1];
A[j-1]=f;
}
}
}
}
void Selection(Card A[], int n)
{
int i,j,minj,a,b;
Card t;
for(i=0;i<=n-1;i++)
{
minj=i;
for(j = i;j<=n-1;j++)
{
if(A[j].value<A[minj].value)
{
minj=j;
}
}
t =A[i];A[i] = A[minj];A[minj]=t;
}
}
int isStable(Card C1[],Card C2[],int n)
{
int i;
for(i=0;i<n;i++)
{
if(C1[i].suit != C2[i].suit)return 0;
}
return 1;
}
int main()
{
int i,j,n;
Card C1[100],C2[100];
char as,s[3];
scanf("%d",&n);
for(i = 0;i<n;i++)
{
scanf("%s",s);
C1[i].suit=s[0];
C1[i].value=s[1];
}
for(i=0;i<n;i++)C2[i]=C1[i];
Bubble(C1,n);
Selection(C2,n);
for(i=0;i<n-1;i++)
{
s[0] = C1[i].suit;
s[1]=C1[i].value;
printf("%s ",s);
}
s[0] = C1[i].suit;
s[1]=C1[i].value;
printf("%s\n",s);
printf("Stable\n");
for(i=0;i<n-1;i++)
{
s[0] = C2[i].suit;
s[1]=C2[i].value;
printf("%s ",s);
}
s[0] = C2[i].suit;
s[1]=C2[i].value;
printf("%s\n",s);
if(isStable(C1,C2,n))
{
printf("Stable\n");
}
else{
printf("Not stable\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113446/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113446/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @Bubble(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not.not43 = icmp sgt i32 %n, 0
br i1 %cmp.not.not43, label %for.cond2.preheader.lr.ph, label %for.end23
for.cond2.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond2.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond2.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
br i1 %exitcond.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !5
for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.cond.loopexit
%indvars.iv47 = phi i64 [ 0, %for.cond2.preheader.lr.ph ], [ %indvars.iv.next48, %for.cond.loopexit ]
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%cmp3.not.not40 = icmp ult i64 %indvars.iv.next48, %0
br i1 %cmp3.not.not40, label %for.body4, label %for.cond.loopexit
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond2.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !7
%2 = add nsw i64 %indvars.iv, -2
%value8 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value8, align 1, !tbaa !7
%cmp10 = icmp slt i8 %1, %3
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx7, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx7, align 1
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next48
br i1 %cmp3.not.not, label %for.body4, label %for.cond.loopexit, !llvm.loop !11
for.end23: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @Selection(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not.not40 = icmp sgt i32 %n, 0
br i1 %cmp.not.not40, label %for.cond1.preheader.preheader, label %for.end21
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body4
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv42 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next43, %for.body4 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv42, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !7
%idxprom5 = sext i32 %minj.038 to i64
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom5, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !7
%cmp9 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv42 to i32
%spec.select = select i1 %cmp9, i32 %4, i32 %minj.038
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%cmp3.not.not = icmp ult i64 %indvars.iv.next43, %0
br i1 %cmp3.not.not, label %for.body4, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body4
%arrayidx12 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx12, align 1
%idxprom15 = sext i32 %spec.select to i64
%arrayidx16 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom15
%6 = load i16, ptr %arrayidx16, align 1
store i16 %6, ptr %arrayidx12, align 1
store i16 %5, ptr %arrayidx16, align 1
%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.end21, label %for.cond1.preheader, !llvm.loop !13
for.end21: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp10 = icmp sgt i32 %n, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !14
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !15
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !15
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #7
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !16
%cmp115 = icmp sgt i32 %0, 0
br i1 %cmp115, label %for.body.lr.ph, label %for.end33
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
br label %for.body
for.cond6.preheader: ; preds = %for.body
%cmp7117 = icmp sgt i32 %3, 0
br i1 %cmp7117, label %for.cond2.preheader.lr.ph.i, label %for.end33
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%1 = load i8, ptr %s, align 1, !tbaa !18
%arrayidx2 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx2, align 2, !tbaa !15
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !18
%value = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %2, ptr %value, align 1, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !16
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !19
for.cond2.preheader.lr.ph.i: ; preds = %for.cond6.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond2.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next48.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i, label %for.cond2.preheader.i, !llvm.loop !5
for.cond2.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond2.preheader.lr.ph.i
%indvars.iv47.i = phi i64 [ 0, %for.cond2.preheader.lr.ph.i ], [ %indvars.iv.next48.i, %for.cond.loopexit.i ]
%indvars.iv.next48.i = add nuw nsw i64 %indvars.iv47.i, 1
%cmp3.not.not40.i = icmp ult i64 %indvars.iv.next48.i, %7
br i1 %cmp3.not.not40.i, label %for.body4.i, label %for.cond.loopexit.i
for.body4.i: ; preds = %for.cond2.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %7, %for.cond2.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i, align 1, !tbaa !7
%9 = add nsw i64 %indvars.iv.i, -2
%value8.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value8.i, align 1, !tbaa !7
%cmp10.i = icmp slt i8 %8, %10
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx7.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx7.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp3.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next48.i
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.cond.loopexit.i, !llvm.loop !11
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.end.i
%indvars.iv.i101 = phi i64 [ %indvars.iv.next.i105, %for.end.i ], [ 0, %for.cond.loopexit.i ]
%13 = trunc i64 %indvars.iv.i101 to i32
br label %for.body4.i102
for.body4.i102: ; preds = %for.body4.i102, %for.cond1.preheader.i
%indvars.iv42.i = phi i64 [ %indvars.iv.i101, %for.cond1.preheader.i ], [ %indvars.iv.next43.i, %for.body4.i102 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i ], [ %spec.select.i, %for.body4.i102 ]
%value.i103 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv42.i, i32 1
%14 = load i8, ptr %value.i103, align 1, !tbaa !7
%idxprom5.i = sext i32 %minj.038.i to i64
%value7.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom5.i, i32 1
%15 = load i8, ptr %value7.i, align 1, !tbaa !7
%cmp9.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv42.i to i32
%spec.select.i = select i1 %cmp9.i, i32 %16, i32 %minj.038.i
%indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, 1
%cmp3.not.not.i104 = icmp ult i64 %indvars.iv.next43.i, %7
br i1 %cmp3.not.not.i104, label %for.body4.i102, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body4.i102
%arrayidx12.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i101
%17 = load i16, ptr %arrayidx12.i, align 2
%idxprom15.i = sext i32 %spec.select.i to i64
%arrayidx16.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom15.i
%18 = load i16, ptr %arrayidx16.i, align 2
store i16 %18, ptr %arrayidx12.i, align 2
store i16 %17, ptr %arrayidx16.i, align 2
%indvars.iv.next.i105 = add nuw nsw i64 %indvars.iv.i101, 1
%exitcond.not.i106 = icmp eq i64 %indvars.iv.next.i105, %7
br i1 %exitcond.not.i106, label %Selection.exit, label %for.cond1.preheader.i, !llvm.loop !13
Selection.exit: ; preds = %for.end.i
%cmp19120 = icmp sgt i32 %3, 1
br i1 %cmp19120, label %for.body20.lr.ph, label %for.end33
for.body20.lr.ph: ; preds = %Selection.exit
%arrayidx28 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
br label %for.body20
for.body20: ; preds = %for.body20.lr.ph, %for.body20
%indvars.iv132 = phi i64 [ 0, %for.body20.lr.ph ], [ %indvars.iv.next133, %for.body20 ]
%arrayidx22 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv132
%19 = load i8, ptr %arrayidx22, align 2, !tbaa !15
store i8 %19, ptr %s, align 1, !tbaa !18
%value27 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv132, i32 1
%20 = load i8, ptr %value27, align 1, !tbaa !7
store i8 %20, ptr %arrayidx28, align 1, !tbaa !18
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %s)
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%21 = load i32, ptr %n, align 4, !tbaa !16
%sub = add nsw i32 %21, -1
%22 = sext i32 %sub to i64
%cmp19 = icmp slt i64 %indvars.iv.next133, %22
br i1 %cmp19, label %for.body20, label %for.end33.loopexit, !llvm.loop !20
for.end33.loopexit: ; preds = %for.body20
%23 = and i64 %indvars.iv.next133, 4294967295
br label %for.end33
for.end33: ; preds = %for.cond6.preheader, %entry, %for.end33.loopexit, %Selection.exit
%i.2.lcssa = phi i64 [ 0, %Selection.exit ], [ %23, %for.end33.loopexit ], [ 0, %entry ], [ 0, %for.cond6.preheader ]
%arrayidx35 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %i.2.lcssa
%24 = load i8, ptr %arrayidx35, align 2, !tbaa !15
store i8 %24, ptr %s, align 1, !tbaa !18
%value40 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %i.2.lcssa, i32 1
%25 = load i8, ptr %value40, align 1, !tbaa !7
%arrayidx41 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
store i8 %25, ptr %arrayidx41, align 1, !tbaa !18
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%puts96 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%26 = load i32, ptr %n, align 4, !tbaa !16
%cmp47124 = icmp sgt i32 %26, 1
br i1 %cmp47124, label %for.body48, label %for.end61
for.body48: ; preds = %for.end33, %for.body48
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.body48 ], [ 0, %for.end33 ]
%arrayidx50 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv135
%27 = load i8, ptr %arrayidx50, align 2, !tbaa !15
store i8 %27, ptr %s, align 1, !tbaa !18
%value55 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv135, i32 1
%28 = load i8, ptr %value55, align 1, !tbaa !7
store i8 %28, ptr %arrayidx41, align 1, !tbaa !18
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %s)
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%29 = load i32, ptr %n, align 4, !tbaa !16
%sub46 = add nsw i32 %29, -1
%30 = sext i32 %sub46 to i64
%cmp47 = icmp slt i64 %indvars.iv.next136, %30
br i1 %cmp47, label %for.body48, label %for.end61.loopexit, !llvm.loop !21
for.end61.loopexit: ; preds = %for.body48
%31 = and i64 %indvars.iv.next136, 4294967295
br label %for.end61
for.end61: ; preds = %for.end61.loopexit, %for.end33
%i.3.lcssa = phi i64 [ 0, %for.end33 ], [ %31, %for.end61.loopexit ]
%arrayidx63 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %i.3.lcssa
%32 = load i8, ptr %arrayidx63, align 2, !tbaa !15
store i8 %32, ptr %s, align 1, !tbaa !18
%value68 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %i.3.lcssa, i32 1
%33 = load i8, ptr %value68, align 1, !tbaa !7
store i8 %33, ptr %arrayidx41, align 1, !tbaa !18
%puts97 = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%34 = load i32, ptr %n, align 4, !tbaa !16
%cmp10.i107 = icmp sgt i32 %34, 0
br i1 %cmp10.i107, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %for.end61
%wide.trip.count.i108 = zext i32 %34 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i111 = add nuw nsw i64 %indvars.iv.i109, 1
%exitcond.not.i112 = icmp eq i64 %indvars.iv.next.i111, %wide.trip.count.i108
br i1 %exitcond.not.i112, label %if.end, label %for.body.i, !llvm.loop !14
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i109 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i111, %for.cond.i ]
%arrayidx.i110 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i109
%35 = load i8, ptr %arrayidx.i110, align 2, !tbaa !15
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i109
%36 = load i8, ptr %arrayidx2.i, align 2, !tbaa !15
%cmp5.not.i = icmp eq i8 %35, %36
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %for.end61
%str.6.sink = phi ptr [ @str.7, %for.end61 ], [ @str.7, %for.cond.i ], [ @str.6, %for.body.i ]
%puts98 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 1}
!8 = !{!"", !9, i64 0, !9, i64 1}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = !{!8, !9, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !9, i64 0}
!18 = !{!9, !9, i64 0}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
|
#include<stdio.h>
int main()
{
int t,n;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
int x=n/2 + n%2;
printf("%d\n",x);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11349/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11349/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%rem = srem i32 %1, 2
%add = add nsw i32 %div, %rem
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%2 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 N 36
struct Card{
char value;
char suit;
};
int main(){
int i,j,n,min,flag=0;
char a;
struct Card C1[N],C2[N],tmp;
scanf("%d%c",&n,&a);
for(i=0 ; i<n ; i++){
scanf("%c%c%c",&C1[i].suit,&C1[i].value,&a);
}
for(i=0 ; i<n ; i++){
C2[i]=C1[i];
}
//BubbleSort
for(i=0 ; i<n ; i++){
for(j=n-1 ; j>i ; j--){
if(C2[j].value < C2[j-1].value){
tmp=C2[j];
C2[j]=C2[j-1];
C2[j-1]=tmp;
}
}
}
for(i=0 ; i<n ; i++){
if(i>0)printf(" ");
printf("%c%c",C2[i].suit,C2[i].value);
}
printf("\n");
printf("Stable\n");
//SelectionSort
for(i=0 ; i<n ; i++){
min=i;
for(j=i ; j<n ; j++){
if(C1[j].value<C1[min].value) min=j;
}
tmp=C1[i];
C1[i]=C1[min];
C1[min]=tmp;
}
for(i=0 ; i<n ; i++){
if(i>0)printf(" ");
printf("%c%c",C1[i].suit,C1[i].value);
if(C1[i].suit!=C2[i].suit || C1[i].value!=C2[i].value) flag=1;
}
printf("\n");
if(flag==1)printf("Not stable\n");
else printf("Stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113547/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113547/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%c%c\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\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 i8, align 1
%C1 = alloca [36 x %struct.Card], align 16
%C2 = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %C1) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %C2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp200 = icmp sgt i32 %0, 0
br i1 %cmp200, label %for.body, label %for.end65
for.cond4.preheader: ; preds = %for.body
%cmp5202 = icmp sgt i32 %1, 0
br i1 %cmp5202, label %for.cond17.preheader.lr.ph, label %for.end65
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%suit = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %suit, ptr noundef nonnull %arrayidx, ptr noundef nonnull %a)
%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.cond4.preheader, !llvm.loop !9
for.cond17.preheader.lr.ph: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %4, i1 false)
%j.0204 = add nsw i32 %1, -1
%5 = zext i32 %1 to i64
%6 = add nsw i64 %5, -1
%7 = zext i32 %j.0204 to i64
%wide.trip.count = zext i32 %1 to i64
br label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc42
%indvars.iv233 = phi i64 [ 0, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next234, %for.inc42 ]
%cmp18205 = icmp ult i64 %indvars.iv233, %7
br i1 %cmp18205, label %for.body19, label %for.inc42
for.cond45.preheader: ; preds = %for.inc42
br i1 %cmp5202, label %if.end53.peel, label %for.end65
if.end53.peel: ; preds = %for.cond45.preheader
%suit56.peel = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 0, i32 1
%8 = load i8, ptr %suit56.peel, align 1, !tbaa !11
%conv57.peel = sext i8 %8 to i32
%9 = load i8, ptr %C2, align 16, !tbaa !13
%conv61.peel = sext i8 %9 to i32
%call62.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv57.peel, i32 noundef %conv61.peel)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp46.peel = icmp sgt i32 %10, 1
br i1 %cmp46.peel, label %if.end53, label %for.end65
for.body19: ; preds = %for.cond17.preheader, %for.inc40
%indvars.iv227 = phi i64 [ %indvars.iv.next228, %for.inc40 ], [ %5, %for.cond17.preheader ]
%indvars.iv225 = phi i64 [ %indvars.iv.next226, %for.inc40 ], [ %6, %for.cond17.preheader ]
%indvars.iv.next228 = add nsw i64 %indvars.iv227, -1
%arrayidx21 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv225
%11 = load i8, ptr %arrayidx21, align 2, !tbaa !13
%12 = add nsw i64 %indvars.iv227, -2
%arrayidx25 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %12
%13 = load i8, ptr %arrayidx25, align 2, !tbaa !13
%cmp28 = icmp slt i8 %11, %13
br i1 %cmp28, label %if.then, label %for.inc40
if.then: ; preds = %for.body19
%14 = load i16, ptr %arrayidx21, align 2
%15 = load i16, ptr %arrayidx25, align 2
store i16 %15, ptr %arrayidx21, align 2
store i16 %14, ptr %arrayidx25, align 2
br label %for.inc40
for.inc40: ; preds = %for.body19, %if.then
%indvars.iv.next226 = add nsw i64 %indvars.iv225, -1
%cmp18 = icmp sgt i64 %indvars.iv.next226, %indvars.iv233
br i1 %cmp18, label %for.body19, label %for.inc42, !llvm.loop !14
for.inc42: ; preds = %for.inc40, %for.cond17.preheader
%indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1
%exitcond.not = icmp eq i64 %indvars.iv.next234, %wide.trip.count
br i1 %exitcond.not, label %for.cond45.preheader, label %for.cond17.preheader, !llvm.loop !15
if.end53: ; preds = %if.end53.peel, %if.end53
%indvars.iv236 = phi i64 [ %indvars.iv.next237, %if.end53 ], [ 1, %if.end53.peel ]
%putchar199 = call i32 @putchar(i32 32)
%arrayidx55 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv236
%suit56 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv236, i32 1
%16 = load i8, ptr %suit56, align 1, !tbaa !11
%conv57 = sext i8 %16 to i32
%17 = load i8, ptr %arrayidx55, align 2, !tbaa !13
%conv61 = sext i8 %17 to i32
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv57, i32 noundef %conv61)
%indvars.iv.next237 = add nuw nsw i64 %indvars.iv236, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp46 = icmp slt i64 %indvars.iv.next237, %19
br i1 %cmp46, label %if.end53, label %for.end65, !llvm.loop !16
for.end65: ; preds = %if.end53, %for.cond4.preheader, %entry, %if.end53.peel, %for.cond45.preheader
%putchar = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%20 = load i32, ptr %n, align 4, !tbaa !5
%cmp69214 = icmp sgt i32 %20, 0
br i1 %cmp69214, label %for.cond72.preheader.preheader, label %for.end144.thread
for.cond72.preheader.preheader: ; preds = %for.end65
%21 = zext i32 %20 to i64
%wide.trip.count246 = zext i32 %20 to i64
br label %for.cond72.preheader
for.cond72.preheader: ; preds = %for.cond72.preheader.preheader, %for.end90
%indvars.iv240 = phi i64 [ 0, %for.cond72.preheader.preheader ], [ %indvars.iv.next241, %for.end90 ]
%22 = trunc i64 %indvars.iv240 to i32
br label %for.body75
for.cond102.preheader: ; preds = %for.end90
br i1 %cmp69214, label %if.end110.peel, label %for.end144.thread
if.end110.peel: ; preds = %for.cond102.preheader
%.pre252 = load i8, ptr %C1, align 16, !tbaa !13
%suit113.peel.phi.trans.insert = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 0, i32 1
%.pre = load i8, ptr %suit113.peel.phi.trans.insert, align 1, !tbaa !11
%suit113.peel = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 0, i32 1
%conv114.peel = sext i8 %.pre to i32
%conv118.peel = sext i8 %.pre252 to i32
%call119.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv114.peel, i32 noundef %conv118.peel)
%23 = load i8, ptr %suit113.peel, align 1, !tbaa !11
%suit126.peel = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 0, i32 1
%24 = load i8, ptr %suit126.peel, align 1, !tbaa !11
%cmp128.not.peel = icmp eq i8 %23, %24
br i1 %cmp128.not.peel, label %lor.lhs.false.peel, label %if.then140.peel
lor.lhs.false.peel: ; preds = %if.end110.peel
%25 = load i8, ptr %C1, align 16, !tbaa !13
%26 = load i8, ptr %C2, align 16, !tbaa !13
%cmp138.not.peel = icmp eq i8 %25, %26
br i1 %cmp138.not.peel, label %for.inc142.peel, label %if.then140.peel
if.then140.peel: ; preds = %lor.lhs.false.peel, %if.end110.peel
br label %for.inc142.peel
for.inc142.peel: ; preds = %if.then140.peel, %lor.lhs.false.peel
%flag.1.peel = phi i32 [ 1, %if.then140.peel ], [ 0, %lor.lhs.false.peel ]
%27 = load i32, ptr %n, align 4, !tbaa !5
%cmp103.peel = icmp sgt i32 %27, 1
br i1 %cmp103.peel, label %if.end110, label %for.end144
for.body75: ; preds = %for.cond72.preheader, %for.body75
%indvars.iv242 = phi i64 [ %indvars.iv240, %for.cond72.preheader ], [ %indvars.iv.next243, %for.body75 ]
%min.0213 = phi i32 [ %22, %for.cond72.preheader ], [ %spec.select, %for.body75 ]
%arrayidx77 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv242
%28 = load i8, ptr %arrayidx77, align 2, !tbaa !13
%idxprom80 = sext i32 %min.0213 to i64
%arrayidx81 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %idxprom80
%29 = load i8, ptr %arrayidx81, align 2, !tbaa !13
%cmp84 = icmp slt i8 %28, %29
%30 = trunc i64 %indvars.iv242 to i32
%spec.select = select i1 %cmp84, i32 %30, i32 %min.0213
%indvars.iv.next243 = add nuw nsw i64 %indvars.iv242, 1
%cmp73 = icmp ult i64 %indvars.iv.next243, %21
br i1 %cmp73, label %for.body75, label %for.end90, !llvm.loop !18
for.end90: ; preds = %for.body75
%arrayidx92 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv240
%31 = load i16, ptr %arrayidx92, align 2
%idxprom95 = sext i32 %spec.select to i64
%arrayidx96 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %idxprom95
%32 = load i16, ptr %arrayidx96, align 2
store i16 %32, ptr %arrayidx92, align 2
store i16 %31, ptr %arrayidx96, align 2
%indvars.iv.next241 = add nuw nsw i64 %indvars.iv240, 1
%exitcond247.not = icmp eq i64 %indvars.iv.next241, %wide.trip.count246
br i1 %exitcond247.not, label %for.cond102.preheader, label %for.cond72.preheader, !llvm.loop !19
if.end110: ; preds = %for.inc142.peel, %for.inc142
%indvars.iv248 = phi i64 [ %indvars.iv.next249, %for.inc142 ], [ 1, %for.inc142.peel ]
%flag.0218 = phi i32 [ %flag.1, %for.inc142 ], [ %flag.1.peel, %for.inc142.peel ]
%putchar198 = call i32 @putchar(i32 32)
%arrayidx112 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv248
%suit113 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv248, i32 1
%33 = load i8, ptr %suit113, align 1, !tbaa !11
%conv114 = sext i8 %33 to i32
%34 = load i8, ptr %arrayidx112, align 2, !tbaa !13
%conv118 = sext i8 %34 to i32
%call119 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv114, i32 noundef %conv118)
%35 = load i8, ptr %suit113, align 1, !tbaa !11
%suit126 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv248, i32 1
%36 = load i8, ptr %suit126, align 1, !tbaa !11
%cmp128.not = icmp eq i8 %35, %36
br i1 %cmp128.not, label %lor.lhs.false, label %if.then140
lor.lhs.false: ; preds = %if.end110
%arrayidx125 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv248
%37 = load i8, ptr %arrayidx112, align 2, !tbaa !13
%38 = load i8, ptr %arrayidx125, align 2, !tbaa !13
%cmp138.not = icmp eq i8 %37, %38
br i1 %cmp138.not, label %for.inc142, label %if.then140
if.then140: ; preds = %lor.lhs.false, %if.end110
br label %for.inc142
for.inc142: ; preds = %lor.lhs.false, %if.then140
%flag.1 = phi i32 [ 1, %if.then140 ], [ %flag.0218, %lor.lhs.false ]
%indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1
%39 = load i32, ptr %n, align 4, !tbaa !5
%40 = sext i32 %39 to i64
%cmp103 = icmp slt i64 %indvars.iv.next249, %40
br i1 %cmp103, label %if.end110, label %for.end144, !llvm.loop !20
for.end144.thread: ; preds = %for.cond102.preheader, %for.end65
%putchar195259 = call i32 @putchar(i32 10)
br label %if.else
for.end144: ; preds = %for.inc142, %for.inc142.peel
%flag.1.lcssa = phi i32 [ %flag.1.peel, %for.inc142.peel ], [ %flag.1, %for.inc142 ]
%41 = icmp eq i32 %flag.1.lcssa, 1
%putchar195 = call i32 @putchar(i32 10)
br i1 %41, label %if.end151, label %if.else
if.else: ; preds = %for.end144.thread, %for.end144
br label %if.end151
if.end151: ; preds = %for.end144, %if.else
%str.7.sink = phi ptr [ @str.7, %if.else ], [ @str.8, %for.end144 ]
%puts196 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %C2) #5
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %C1) #5
call void @llvm.lifetime.end.p0(i64 1, 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 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) #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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!12, !7, i64 1}
!12 = !{!"Card", !7, i64 0, !7, i64 1}
!13 = !{!12, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !17}
|
#include<stdio.h>
struct tranp{
char gara;
int atai;
};
void bbsort(struct tranp C[], int);
void selsort(struct tranp C[], int);
void pr(struct tranp C[], int);
int main(){
int i=0,j=0;
struct tranp C[100];
struct tranp CC[100];
int N=0;
int count=0;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf(" %c%d",&C[i].gara,&C[i].atai);
}
for(i=0;i<N;i++){
CC[i]=C[i];
}
bbsort(C,N);
selsort(CC,N);
pr(C,N);
printf("Stable\n");
pr(CC,N);
for(i=0;i<N;i++){
if(C[i].gara!=CC[i].gara){
printf("Not stable\n");
break;
}
}
if(i==N)printf("Stable\n");
return 0;
}
void bbsort(struct tranp A[],int N){
int i=0,j=0;
struct tranp temp;
for(i=0;i<N-1;i++){
for(j=N-1;j>i;j--){
if(A[j].atai<A[j-1].atai){
temp=A[j];
A[j]=A[j-1];
A[j-1]=temp;
}
}
}
}
void selsort(struct tranp A[], int N){
int i=0,j=0;
struct tranp temp;
int min=0;
for(i=0;i<=N-1;i++){
min=i;
for(j=i;j<=N-1;j++){
if(A[j].atai<A[min].atai){
min=j;
}
}
temp=A[i];
A[i]=A[min];
A[min]=temp;
}
}
void pr(struct tranp A[],int N){
int i=0;
/*if(N>1){
for(i=0;i<N;i++){
if(i<N-1){
printf("%c%d ",A[i].gara,A[i].atai);
}
if(i==N-1){
printf("%c%d",A[i].gara,A[i].atai);
}
}
printf("\n");
}
else {
for(i=0;i<N;i++){
printf("%c%d",A[i].gara,A[i].atai);
}
printf("\n");
}
*/
for(i=0;i<N;i++){
if(i>0)printf(" ");
printf("%c%d",A[i].gara,A[i].atai);
}
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113590/source.c"
target datalayout = "e-m:e-p270: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.tranp = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%C = alloca [100 x %struct.tranp], align 16
%CC = alloca [100 x %struct.tranp], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %C) #6
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %CC) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp89 = icmp sgt i32 %0, 0
br i1 %cmp89, label %for.body, label %pr.exit
for.cond4.preheader: ; preds = %for.body
%cmp591 = icmp sgt i32 %1, 0
br i1 %cmp591, label %for.end13, label %pr.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x %struct.tranp], ptr %C, i64 0, i64 %indvars.iv
%atai = getelementptr inbounds [100 x %struct.tranp], ptr %C, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %atai)
%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.cond4.preheader, !llvm.loop !9
for.end13: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %CC, ptr nonnull align 16 %C, i64 %4, i1 false)
%cmp38.i.not = icmp eq i32 %1, 1
br i1 %cmp38.i.not, label %for.cond1.preheader.preheader.i, label %for.cond2.preheader.preheader.i
for.cond2.preheader.preheader.i: ; preds = %for.end13
%sub.i = add nsw i32 %1, -1
%5 = zext i32 %1 to i64
%6 = add nsw i64 %5, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc20.i, %for.cond2.preheader.preheader.i
%indvars.iv41.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next42.i, %for.inc20.i ]
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.i = phi i64 [ %6, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%atai.i = getelementptr inbounds %struct.tranp, ptr %C, i64 %indvars.iv.i, i32 1
%7 = load i32, ptr %atai.i, align 4, !tbaa !11
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%atai8.i = getelementptr inbounds %struct.tranp, ptr %C, i64 %indvars.iv.next.i, i32 1
%8 = load i32, ptr %atai8.i, align 4, !tbaa !11
%cmp9.i = icmp slt i32 %7, %8
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.tranp, ptr %C, i64 %indvars.iv.next.i
%9 = load <2 x i64>, ptr %arrayidx7.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx7.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv41.i
br i1 %cmp3.i, label %for.body4.i, label %for.inc20.i, !llvm.loop !13
for.inc20.i: ; preds = %for.inc.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next42.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %bbsort.exit, label %for.cond2.preheader.i, !llvm.loop !14
bbsort.exit: ; preds = %for.inc20.i
br i1 %cmp591, label %for.cond1.preheader.preheader.i, label %pr.exit
for.cond1.preheader.preheader.i: ; preds = %for.end13, %bbsort.exit
%.lcssa107113116 = phi i32 [ %1, %bbsort.exit ], [ 1, %for.end13 ]
%11 = zext i32 %.lcssa107113116 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i54 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i57, %for.end.i ]
%12 = trunc i64 %indvars.iv.i54 to i32
br label %for.body4.i55
for.body4.i55: ; preds = %for.body4.i55, %for.cond1.preheader.i
%indvars.iv40.i = phi i64 [ %indvars.iv.i54, %for.cond1.preheader.i ], [ %indvars.iv.next41.i, %for.body4.i55 ]
%min.037.i = phi i32 [ %12, %for.cond1.preheader.i ], [ %spec.select.i, %for.body4.i55 ]
%atai.i56 = getelementptr inbounds %struct.tranp, ptr %CC, i64 %indvars.iv40.i, i32 1
%13 = load i32, ptr %atai.i56, align 4, !tbaa !11
%idxprom5.i = sext i32 %min.037.i to i64
%atai7.i = getelementptr inbounds %struct.tranp, ptr %CC, i64 %idxprom5.i, i32 1
%14 = load i32, ptr %atai7.i, align 4, !tbaa !11
%cmp8.i = icmp slt i32 %13, %14
%15 = trunc i64 %indvars.iv40.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %15, i32 %min.037.i
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%cmp3.not.not.i = icmp ult i64 %indvars.iv.next41.i, %11
br i1 %cmp3.not.not.i, label %for.body4.i55, label %for.end.i, !llvm.loop !15
for.end.i: ; preds = %for.body4.i55
%arrayidx10.i = getelementptr inbounds %struct.tranp, ptr %CC, i64 %indvars.iv.i54
%16 = load i64, ptr %arrayidx10.i, align 8
%idxprom13.i = sext i32 %spec.select.i to i64
%arrayidx14.i = getelementptr inbounds %struct.tranp, ptr %CC, i64 %idxprom13.i
%17 = load i64, ptr %arrayidx14.i, align 8
store i64 %17, ptr %arrayidx10.i, align 8
store i64 %16, ptr %arrayidx14.i, align 8
%indvars.iv.next.i57 = add nuw nsw i64 %indvars.iv.i54, 1
%exitcond.not.i58 = icmp eq i64 %indvars.iv.next.i57, %11
br i1 %exitcond.not.i58, label %if.end.peel.i, label %for.cond1.preheader.i, !llvm.loop !16
if.end.peel.i: ; preds = %for.end.i
%atai.peel.phi.trans.insert.i = getelementptr inbounds %struct.tranp, ptr %C, i64 0, i32 1
%.pre16.i = load i32, ptr %atai.peel.phi.trans.insert.i, align 4, !tbaa !11
%.pre.i = load i8, ptr %C, align 16, !tbaa !17
%conv.peel.i = sext i8 %.pre.i to i32
%call4.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel.i, i32 noundef %.pre16.i)
%exitcond.peel.not.i = icmp eq i32 %.lcssa107113116, 1
br i1 %exitcond.peel.not.i, label %pr.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i61 = phi i64 [ %indvars.iv.next.i64, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar11.i = call i32 @putchar(i32 32)
%arrayidx.i62 = getelementptr inbounds %struct.tranp, ptr %C, i64 %indvars.iv.i61
%18 = load i8, ptr %arrayidx.i62, align 8, !tbaa !17
%conv.i = sext i8 %18 to i32
%atai.i63 = getelementptr inbounds %struct.tranp, ptr %C, i64 %indvars.iv.i61, i32 1
%19 = load i32, ptr %atai.i63, align 4, !tbaa !11
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.i, i32 noundef %19)
%indvars.iv.next.i64 = add nuw nsw i64 %indvars.iv.i61, 1
%exitcond.not.i65 = icmp eq i64 %indvars.iv.next.i64, %11
br i1 %exitcond.not.i65, label %pr.exit, label %if.end.i, !llvm.loop !18
pr.exit: ; preds = %if.end.i, %for.cond4.preheader, %entry, %bbsort.exit, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%20 = load i32, ptr %N, align 4, !tbaa !5
%cmp12.i66 = icmp sgt i32 %20, 0
br i1 %cmp12.i66, label %if.end.peel.i69, label %pr.exit86
if.end.peel.i69: ; preds = %pr.exit
%wide.trip.count.i70 = zext i32 %20 to i64
%atai.peel.phi.trans.insert.i71 = getelementptr inbounds %struct.tranp, ptr %CC, i64 0, i32 1
%.pre16.i72 = load i32, ptr %atai.peel.phi.trans.insert.i71, align 4, !tbaa !11
%.pre.i73 = load i8, ptr %CC, align 16, !tbaa !17
%conv.peel.i74 = sext i8 %.pre.i73 to i32
%call4.peel.i75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel.i74, i32 noundef %.pre16.i72)
%exitcond.peel.not.i76 = icmp eq i32 %20, 1
br i1 %exitcond.peel.not.i76, label %pr.exit86, label %if.end.i77
if.end.i77: ; preds = %if.end.peel.i69, %if.end.i77
%indvars.iv.i78 = phi i64 [ %indvars.iv.next.i84, %if.end.i77 ], [ 1, %if.end.peel.i69 ]
%putchar11.i79 = call i32 @putchar(i32 32)
%arrayidx.i80 = getelementptr inbounds %struct.tranp, ptr %CC, i64 %indvars.iv.i78
%21 = load i8, ptr %arrayidx.i80, align 8, !tbaa !17
%conv.i81 = sext i8 %21 to i32
%atai.i82 = getelementptr inbounds %struct.tranp, ptr %CC, i64 %indvars.iv.i78, i32 1
%22 = load i32, ptr %atai.i82, align 4, !tbaa !11
%call4.i83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.i81, i32 noundef %22)
%indvars.iv.next.i84 = add nuw nsw i64 %indvars.iv.i78, 1
%exitcond.not.i85 = icmp eq i64 %indvars.iv.next.i84, %wide.trip.count.i70
br i1 %exitcond.not.i85, label %pr.exit86, label %if.end.i77, !llvm.loop !18
pr.exit86: ; preds = %if.end.i77, %pr.exit, %if.end.peel.i69
%putchar.i68 = call i32 @putchar(i32 10)
%23 = load i32, ptr %N, align 4, !tbaa !5
%cmp1993 = icmp sgt i32 %23, 0
br i1 %cmp1993, label %for.body20.preheader, label %for.end33
for.body20.preheader: ; preds = %pr.exit86
%wide.trip.count = zext i32 %23 to i64
br label %for.body20
for.body20: ; preds = %for.body20.preheader, %for.inc31
%indvars.iv102 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next103, %for.inc31 ]
%arrayidx22 = getelementptr inbounds [100 x %struct.tranp], ptr %C, i64 0, i64 %indvars.iv102
%24 = load i8, ptr %arrayidx22, align 8, !tbaa !17
%arrayidx25 = getelementptr inbounds [100 x %struct.tranp], ptr %CC, i64 0, i64 %indvars.iv102
%25 = load i8, ptr %arrayidx25, align 8, !tbaa !17
%cmp28.not = icmp eq i8 %24, %25
br i1 %cmp28.not, label %for.inc31, label %if.then
if.then: ; preds = %for.body20
%26 = trunc i64 %indvars.iv102 to i32
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.end33
for.inc31: ; preds = %for.body20
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count
br i1 %exitcond.not, label %if.then36, label %for.body20, !llvm.loop !20
for.end33: ; preds = %pr.exit86, %if.then
%27 = phi i32 [ %.pre, %if.then ], [ %23, %pr.exit86 ]
%i.288 = phi i32 [ %26, %if.then ], [ 0, %pr.exit86 ]
%cmp34 = icmp eq i32 %i.288, %27
br i1 %cmp34, label %if.then36, label %if.end38
if.then36: ; preds = %for.inc31, %for.end33
%puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %if.end38
if.end38: ; preds = %if.then36, %for.end33
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %CC) #6
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %C) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bbsort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp38 = icmp sgt i32 %N, 1
br i1 %cmp38, label %for.cond2.preheader.preheader, label %for.end21
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
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc20
%indvars.iv41 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next42, %for.inc20 ]
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%atai = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv, i32 1
%2 = load i32, ptr %atai, align 4, !tbaa !11
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%atai8 = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv.next, i32 1
%3 = load i32, ptr %atai8, align 4, !tbaa !11
%cmp9 = icmp slt i32 %2, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv.next
%4 = load <2 x i64>, ptr %arrayidx7, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx7, align 4
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv41
br i1 %cmp3, label %for.body4, label %for.inc20, !llvm.loop !13
for.inc20: ; preds = %for.inc
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.cond2.preheader, !llvm.loop !14
for.end21: ; preds = %for.inc20, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selsort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp.not.not38 = icmp sgt i32 %N, 0
br i1 %cmp.not.not38, label %for.cond1.preheader.preheader, label %for.end19
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body4
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv40 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next41, %for.body4 ]
%min.037 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%atai = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv40, i32 1
%2 = load i32, ptr %atai, align 4, !tbaa !11
%idxprom5 = sext i32 %min.037 to i64
%atai7 = getelementptr inbounds %struct.tranp, ptr %A, i64 %idxprom5, i32 1
%3 = load i32, ptr %atai7, align 4, !tbaa !11
%cmp8 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv40 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %min.037
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%cmp3.not.not = icmp ult i64 %indvars.iv.next41, %0
br i1 %cmp3.not.not, label %for.body4, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv
%5 = load i64, ptr %arrayidx10, align 4
%idxprom13 = sext i32 %spec.select to i64
%arrayidx14 = getelementptr inbounds %struct.tranp, ptr %A, i64 %idxprom13
%6 = load i64, ptr %arrayidx14, align 4
store i64 %6, ptr %arrayidx10, align 4
store i64 %5, ptr %arrayidx14, align 4
%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.end19, label %for.cond1.preheader, !llvm.loop !16
for.end19: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @pr(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp12 = icmp sgt i32 %N, 0
br i1 %cmp12, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%atai.peel.phi.trans.insert = getelementptr inbounds %struct.tranp, ptr %A, i64 0, i32 1
%.pre16 = load i32, ptr %atai.peel.phi.trans.insert, align 4, !tbaa !11
%.pre = load i8, ptr %A, align 4, !tbaa !17
%conv.peel = sext i8 %.pre to i32
%call4.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel, i32 noundef %.pre16)
%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 ]
%putchar11 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !17
%conv = sext i8 %0 to i32
%atai = getelementptr inbounds %struct.tranp, ptr %A, i64 %indvars.iv, i32 1
%1 = load i32, ptr %atai, align 4, !tbaa !11
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv, i32 noundef %1)
%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 !18
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"tranp", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 0}
!18 = distinct !{!18, !10, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
int main(){
int i,j,n,mini,si,a1[37],a2[37],a3[37],count=1,f=0;
char sc,c1[37],c2[37],c3[37];
//load N
scanf("%d",&n);
//load number
for(i=1;i<=n;i++){
scanf(" %c%d",&c1[i],&a1[i]);
a2[i]=a1[i];
c2[i]=c1[i];
a3[i]=a1[i];
c3[i]=c1[i];
}
//normal Sort
for(i=1;i<=13;i++){
for(j=1;j<=n;j++){
if(a1[j]==i){
a3[count]=a1[j];
c3[count]=c1[j];
count++;
}
}
}
//BubbleSort
for(i=1;i<=n;i++){
for(j=n;j>=i+1;j--){
//swap
if(a1[j]<a1[j-1]){
si=a1[j];
a1[j]=a1[j-1];
a1[j-1]=si;
sc=c1[j];
c1[j]=c1[j-1];
c1[j-1]=sc;
}
}
}
//print
for(i=1;i<=n;i++){
printf("%c%d",c1[i],a1[i]);
if(i!=n){
printf(" ");
}
}
printf("\n");
//stability
for(i=1;i<=n;i++){
if(c1[i]!=c3[i]){
printf("Not stable\n");
f=1;
break;
}
}
if(f==0)printf("Stable\n");
//SelectionSort
for(i=1;i<=n;i++){
mini=i;
for(j=i;j<=n;j++){
if(a2[j]<a2[mini]){
mini=j;
}
}
//swap
si=a2[i];
a2[i]=a2[mini];
a2[mini]=si;
sc=c2[i];
c2[i]=c2[mini];
c2[mini]=sc;
}
//print
for(i=1;i<=n;i++){
printf("%c%d",c2[i],a2[i]);
if(i!=n){
printf(" ");
}
}
printf("\n");
//stability
f=0;
for(i=1;i<=n;i++){
if(c2[i]!=c3[i]){
printf("Not stable\n");
f=1;
break;
}
}
if(f==0)printf("Stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113640/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.9 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a1 = alloca [37 x i32], align 16
%a2 = alloca [37 x i32], align 16
%c1 = alloca [37 x i8], align 16
%c2 = alloca [37 x i8], align 16
%c3 = alloca [37 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %a1) #4
call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %a2) #4
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %c1) #4
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %c2) #4
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %c3) #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.not283 = icmp slt i32 %0, 1
br i1 %cmp.not283, label %for.end97, label %for.body
for.cond20.preheader: ; preds = %for.body
%cmp24.not285 = icmp slt i32 %7, 1
br i1 %cmp24.not285, label %for.end97, label %for.cond23.preheader.preheader
for.cond23.preheader.preheader: ; preds = %for.cond20.preheader
%1 = add i32 %7, 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, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %for.body25.1.preheader.unr-lcssa, label %for.cond23.preheader.preheader.new
for.cond23.preheader.preheader.new: ; preds = %for.cond23.preheader.preheader
%unroll_iter = and i64 %2, -2
br label %for.body25
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%5 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%arrayidx7 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %indvars.iv
store i32 %5, ptr %arrayidx7, align 4, !tbaa !5
%6 = load i8, ptr %arrayidx, align 1, !tbaa !9
%arrayidx11 = getelementptr inbounds [37 x i8], ptr %c2, i64 0, i64 %indvars.iv
store i8 %6, ptr %arrayidx11, align 1, !tbaa !9
%arrayidx19 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %indvars.iv
store i8 %6, ptr %arrayidx19, align 1, !tbaa !9
%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.not.not = icmp slt i64 %indvars.iv, %8
br i1 %cmp.not.not, label %for.body, label %for.cond20.preheader, !llvm.loop !10
for.cond44.preheader.unr-lcssa: ; preds = %for.inc38.12.1, %for.body25.12.preheader
%indvars.iv310.12.unr = phi i64 [ 1, %for.body25.12.preheader ], [ %indvars.iv.next311.12.1, %for.inc38.12.1 ]
%count.1287.12.unr = phi i32 [ %count.2.11.lcssa, %for.body25.12.preheader ], [ %count.2.12.1, %for.inc38.12.1 ]
%lcmp.mod424.not = icmp eq i64 %xtraiter423, 0
br i1 %lcmp.mod424.not, label %for.cond44.preheader, label %for.body25.12.epil
for.body25.12.epil: ; preds = %for.cond44.preheader.unr-lcssa
%arrayidx27.12.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.12.unr
%9 = load i32, ptr %arrayidx27.12.epil, align 4, !tbaa !5
%cmp28.12.epil = icmp eq i32 %9, 13
br i1 %cmp28.12.epil, label %if.then.12.epil, label %for.cond44.preheader
if.then.12.epil: ; preds = %for.body25.12.epil
%idxprom31.12.epil = sext i32 %count.1287.12.unr to i64
%arrayidx34.12.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.12.unr
%10 = load i8, ptr %arrayidx34.12.epil, align 1, !tbaa !9
%arrayidx36.12.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.12.epil
store i8 %10, ptr %arrayidx36.12.epil, align 1, !tbaa !9
br label %for.cond44.preheader
for.cond44.preheader: ; preds = %for.body25.12.epil, %if.then.12.epil, %for.cond44.preheader.unr-lcssa
br i1 %cmp24.not285, label %for.end97, label %for.cond47.preheader.preheader
for.cond47.preheader.preheader: ; preds = %for.cond44.preheader
%11 = zext i32 %7 to i64
%12 = add nuw i32 %7, 1
%wide.trip.count320 = zext i32 %12 to i64
%arrayidx51.phi.trans.insert = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %11
br label %for.cond47.preheader
for.body25: ; preds = %for.inc38.1367, %for.cond23.preheader.preheader.new
%indvars.iv310 = phi i64 [ 1, %for.cond23.preheader.preheader.new ], [ %indvars.iv.next311.1366, %for.inc38.1367 ]
%count.1287 = phi i32 [ 1, %for.cond23.preheader.preheader.new ], [ %count.2.1365, %for.inc38.1367 ]
%niter = phi i64 [ 0, %for.cond23.preheader.preheader.new ], [ %niter.next.1, %for.inc38.1367 ]
%arrayidx27 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310
%13 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp eq i32 %13, 1
br i1 %cmp28, label %if.then, label %for.inc38
if.then: ; preds = %for.body25
%idxprom31 = sext i32 %count.1287 to i64
%arrayidx34 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310
%14 = load i8, ptr %arrayidx34, align 1, !tbaa !9
%arrayidx36 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31
store i8 %14, ptr %arrayidx36, align 1, !tbaa !9
%inc37 = add nsw i32 %count.1287, 1
br label %for.inc38
for.inc38: ; preds = %for.body25, %if.then
%count.2 = phi i32 [ %inc37, %if.then ], [ %count.1287, %for.body25 ]
%indvars.iv.next311 = add nuw nsw i64 %indvars.iv310, 1
%arrayidx27.1357 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311
%15 = load i32, ptr %arrayidx27.1357, align 4, !tbaa !5
%cmp28.1358 = icmp eq i32 %15, 1
br i1 %cmp28.1358, label %if.then.1364, label %for.inc38.1367
if.then.1364: ; preds = %for.inc38
%idxprom31.1360 = sext i32 %count.2 to i64
%arrayidx34.1361 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311
%16 = load i8, ptr %arrayidx34.1361, align 1, !tbaa !9
%arrayidx36.1362 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.1360
store i8 %16, ptr %arrayidx36.1362, align 1, !tbaa !9
%inc37.1363 = add nsw i32 %count.2, 1
br label %for.inc38.1367
for.inc38.1367: ; preds = %if.then.1364, %for.inc38
%count.2.1365 = phi i32 [ %inc37.1363, %if.then.1364 ], [ %count.2, %for.inc38 ]
%indvars.iv.next311.1366 = add nuw nsw i64 %indvars.iv310, 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.body25.1.preheader.unr-lcssa, label %for.body25, !llvm.loop !12
for.body25.1.preheader.unr-lcssa: ; preds = %for.inc38.1367, %for.cond23.preheader.preheader
%count.2.lcssa.ph = phi i32 [ undef, %for.cond23.preheader.preheader ], [ %count.2.1365, %for.inc38.1367 ]
%indvars.iv310.unr = phi i64 [ 1, %for.cond23.preheader.preheader ], [ %indvars.iv.next311.1366, %for.inc38.1367 ]
%count.1287.unr = phi i32 [ 1, %for.cond23.preheader.preheader ], [ %count.2.1365, %for.inc38.1367 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body25.1.preheader, label %for.body25.epil
for.body25.epil: ; preds = %for.body25.1.preheader.unr-lcssa
%arrayidx27.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.unr
%17 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !5
%cmp28.epil = icmp eq i32 %17, 1
br i1 %cmp28.epil, label %if.then.epil, label %for.body25.1.preheader
if.then.epil: ; preds = %for.body25.epil
%idxprom31.epil = sext i32 %count.1287.unr to i64
%arrayidx34.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.unr
%18 = load i8, ptr %arrayidx34.epil, align 1, !tbaa !9
%arrayidx36.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.epil
store i8 %18, ptr %arrayidx36.epil, align 1, !tbaa !9
%inc37.epil = add nsw i32 %count.1287.unr, 1
br label %for.body25.1.preheader
for.body25.1.preheader: ; preds = %for.body25.epil, %if.then.epil, %for.body25.1.preheader.unr-lcssa
%count.2.lcssa = phi i32 [ %count.2.lcssa.ph, %for.body25.1.preheader.unr-lcssa ], [ %inc37.epil, %if.then.epil ], [ %count.1287.unr, %for.body25.epil ]
%xtraiter368 = and i64 %2, 1
%19 = icmp eq i64 %3, 0
br i1 %19, label %for.body25.2.preheader.unr-lcssa, label %for.body25.1.preheader.new
for.body25.1.preheader.new: ; preds = %for.body25.1.preheader
%unroll_iter371 = and i64 %2, -2
br label %for.body25.1
for.body25.1: ; preds = %for.inc38.1.1, %for.body25.1.preheader.new
%indvars.iv310.1 = phi i64 [ 1, %for.body25.1.preheader.new ], [ %indvars.iv.next311.1.1, %for.inc38.1.1 ]
%count.1287.1 = phi i32 [ %count.2.lcssa, %for.body25.1.preheader.new ], [ %count.2.1.1, %for.inc38.1.1 ]
%niter372 = phi i64 [ 0, %for.body25.1.preheader.new ], [ %niter372.next.1, %for.inc38.1.1 ]
%arrayidx27.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.1
%20 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%cmp28.1 = icmp eq i32 %20, 2
br i1 %cmp28.1, label %if.then.1, label %for.inc38.1
if.then.1: ; preds = %for.body25.1
%idxprom31.1 = sext i32 %count.1287.1 to i64
%arrayidx34.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.1
%21 = load i8, ptr %arrayidx34.1, align 1, !tbaa !9
%arrayidx36.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.1
store i8 %21, ptr %arrayidx36.1, align 1, !tbaa !9
%inc37.1 = add nsw i32 %count.1287.1, 1
br label %for.inc38.1
for.inc38.1: ; preds = %if.then.1, %for.body25.1
%count.2.1 = phi i32 [ %inc37.1, %if.then.1 ], [ %count.1287.1, %for.body25.1 ]
%indvars.iv.next311.1 = add nuw nsw i64 %indvars.iv310.1, 1
%arrayidx27.1.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.1
%22 = load i32, ptr %arrayidx27.1.1, align 4, !tbaa !5
%cmp28.1.1 = icmp eq i32 %22, 2
br i1 %cmp28.1.1, label %if.then.1.1, label %for.inc38.1.1
if.then.1.1: ; preds = %for.inc38.1
%idxprom31.1.1 = sext i32 %count.2.1 to i64
%arrayidx34.1.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.1
%23 = load i8, ptr %arrayidx34.1.1, align 1, !tbaa !9
%arrayidx36.1.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.1.1
store i8 %23, ptr %arrayidx36.1.1, align 1, !tbaa !9
%inc37.1.1 = add nsw i32 %count.2.1, 1
br label %for.inc38.1.1
for.inc38.1.1: ; preds = %if.then.1.1, %for.inc38.1
%count.2.1.1 = phi i32 [ %inc37.1.1, %if.then.1.1 ], [ %count.2.1, %for.inc38.1 ]
%indvars.iv.next311.1.1 = add nuw nsw i64 %indvars.iv310.1, 2
%niter372.next.1 = add i64 %niter372, 2
%niter372.ncmp.1 = icmp eq i64 %niter372.next.1, %unroll_iter371
br i1 %niter372.ncmp.1, label %for.body25.2.preheader.unr-lcssa, label %for.body25.1, !llvm.loop !12
for.body25.2.preheader.unr-lcssa: ; preds = %for.inc38.1.1, %for.body25.1.preheader
%count.2.1.lcssa.ph = phi i32 [ undef, %for.body25.1.preheader ], [ %count.2.1.1, %for.inc38.1.1 ]
%indvars.iv310.1.unr = phi i64 [ 1, %for.body25.1.preheader ], [ %indvars.iv.next311.1.1, %for.inc38.1.1 ]
%count.1287.1.unr = phi i32 [ %count.2.lcssa, %for.body25.1.preheader ], [ %count.2.1.1, %for.inc38.1.1 ]
%lcmp.mod369.not = icmp eq i64 %xtraiter368, 0
br i1 %lcmp.mod369.not, label %for.body25.2.preheader, label %for.body25.1.epil
for.body25.1.epil: ; preds = %for.body25.2.preheader.unr-lcssa
%arrayidx27.1.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.1.unr
%24 = load i32, ptr %arrayidx27.1.epil, align 4, !tbaa !5
%cmp28.1.epil = icmp eq i32 %24, 2
br i1 %cmp28.1.epil, label %if.then.1.epil, label %for.body25.2.preheader
if.then.1.epil: ; preds = %for.body25.1.epil
%idxprom31.1.epil = sext i32 %count.1287.1.unr to i64
%arrayidx34.1.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.1.unr
%25 = load i8, ptr %arrayidx34.1.epil, align 1, !tbaa !9
%arrayidx36.1.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.1.epil
store i8 %25, ptr %arrayidx36.1.epil, align 1, !tbaa !9
%inc37.1.epil = add nsw i32 %count.1287.1.unr, 1
br label %for.body25.2.preheader
for.body25.2.preheader: ; preds = %for.body25.1.epil, %if.then.1.epil, %for.body25.2.preheader.unr-lcssa
%count.2.1.lcssa = phi i32 [ %count.2.1.lcssa.ph, %for.body25.2.preheader.unr-lcssa ], [ %inc37.1.epil, %if.then.1.epil ], [ %count.1287.1.unr, %for.body25.1.epil ]
%xtraiter373 = and i64 %2, 1
%26 = icmp eq i64 %3, 0
br i1 %26, label %for.body25.3.preheader.unr-lcssa, label %for.body25.2.preheader.new
for.body25.2.preheader.new: ; preds = %for.body25.2.preheader
%unroll_iter376 = and i64 %2, -2
br label %for.body25.2
for.body25.2: ; preds = %for.inc38.2.1, %for.body25.2.preheader.new
%indvars.iv310.2 = phi i64 [ 1, %for.body25.2.preheader.new ], [ %indvars.iv.next311.2.1, %for.inc38.2.1 ]
%count.1287.2 = phi i32 [ %count.2.1.lcssa, %for.body25.2.preheader.new ], [ %count.2.2.1, %for.inc38.2.1 ]
%niter377 = phi i64 [ 0, %for.body25.2.preheader.new ], [ %niter377.next.1, %for.inc38.2.1 ]
%arrayidx27.2 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.2
%27 = load i32, ptr %arrayidx27.2, align 4, !tbaa !5
%cmp28.2 = icmp eq i32 %27, 3
br i1 %cmp28.2, label %if.then.2, label %for.inc38.2
if.then.2: ; preds = %for.body25.2
%idxprom31.2 = sext i32 %count.1287.2 to i64
%arrayidx34.2 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.2
%28 = load i8, ptr %arrayidx34.2, align 1, !tbaa !9
%arrayidx36.2 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.2
store i8 %28, ptr %arrayidx36.2, align 1, !tbaa !9
%inc37.2 = add nsw i32 %count.1287.2, 1
br label %for.inc38.2
for.inc38.2: ; preds = %if.then.2, %for.body25.2
%count.2.2 = phi i32 [ %inc37.2, %if.then.2 ], [ %count.1287.2, %for.body25.2 ]
%indvars.iv.next311.2 = add nuw nsw i64 %indvars.iv310.2, 1
%arrayidx27.2.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.2
%29 = load i32, ptr %arrayidx27.2.1, align 4, !tbaa !5
%cmp28.2.1 = icmp eq i32 %29, 3
br i1 %cmp28.2.1, label %if.then.2.1, label %for.inc38.2.1
if.then.2.1: ; preds = %for.inc38.2
%idxprom31.2.1 = sext i32 %count.2.2 to i64
%arrayidx34.2.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.2
%30 = load i8, ptr %arrayidx34.2.1, align 1, !tbaa !9
%arrayidx36.2.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.2.1
store i8 %30, ptr %arrayidx36.2.1, align 1, !tbaa !9
%inc37.2.1 = add nsw i32 %count.2.2, 1
br label %for.inc38.2.1
for.inc38.2.1: ; preds = %if.then.2.1, %for.inc38.2
%count.2.2.1 = phi i32 [ %inc37.2.1, %if.then.2.1 ], [ %count.2.2, %for.inc38.2 ]
%indvars.iv.next311.2.1 = add nuw nsw i64 %indvars.iv310.2, 2
%niter377.next.1 = add i64 %niter377, 2
%niter377.ncmp.1 = icmp eq i64 %niter377.next.1, %unroll_iter376
br i1 %niter377.ncmp.1, label %for.body25.3.preheader.unr-lcssa, label %for.body25.2, !llvm.loop !12
for.body25.3.preheader.unr-lcssa: ; preds = %for.inc38.2.1, %for.body25.2.preheader
%count.2.2.lcssa.ph = phi i32 [ undef, %for.body25.2.preheader ], [ %count.2.2.1, %for.inc38.2.1 ]
%indvars.iv310.2.unr = phi i64 [ 1, %for.body25.2.preheader ], [ %indvars.iv.next311.2.1, %for.inc38.2.1 ]
%count.1287.2.unr = phi i32 [ %count.2.1.lcssa, %for.body25.2.preheader ], [ %count.2.2.1, %for.inc38.2.1 ]
%lcmp.mod374.not = icmp eq i64 %xtraiter373, 0
br i1 %lcmp.mod374.not, label %for.body25.3.preheader, label %for.body25.2.epil
for.body25.2.epil: ; preds = %for.body25.3.preheader.unr-lcssa
%arrayidx27.2.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.2.unr
%31 = load i32, ptr %arrayidx27.2.epil, align 4, !tbaa !5
%cmp28.2.epil = icmp eq i32 %31, 3
br i1 %cmp28.2.epil, label %if.then.2.epil, label %for.body25.3.preheader
if.then.2.epil: ; preds = %for.body25.2.epil
%idxprom31.2.epil = sext i32 %count.1287.2.unr to i64
%arrayidx34.2.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.2.unr
%32 = load i8, ptr %arrayidx34.2.epil, align 1, !tbaa !9
%arrayidx36.2.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.2.epil
store i8 %32, ptr %arrayidx36.2.epil, align 1, !tbaa !9
%inc37.2.epil = add nsw i32 %count.1287.2.unr, 1
br label %for.body25.3.preheader
for.body25.3.preheader: ; preds = %for.body25.2.epil, %if.then.2.epil, %for.body25.3.preheader.unr-lcssa
%count.2.2.lcssa = phi i32 [ %count.2.2.lcssa.ph, %for.body25.3.preheader.unr-lcssa ], [ %inc37.2.epil, %if.then.2.epil ], [ %count.1287.2.unr, %for.body25.2.epil ]
%xtraiter378 = and i64 %2, 1
%33 = icmp eq i64 %3, 0
br i1 %33, label %for.body25.4.preheader.unr-lcssa, label %for.body25.3.preheader.new
for.body25.3.preheader.new: ; preds = %for.body25.3.preheader
%unroll_iter381 = and i64 %2, -2
br label %for.body25.3
for.body25.3: ; preds = %for.inc38.3.1, %for.body25.3.preheader.new
%indvars.iv310.3 = phi i64 [ 1, %for.body25.3.preheader.new ], [ %indvars.iv.next311.3.1, %for.inc38.3.1 ]
%count.1287.3 = phi i32 [ %count.2.2.lcssa, %for.body25.3.preheader.new ], [ %count.2.3.1, %for.inc38.3.1 ]
%niter382 = phi i64 [ 0, %for.body25.3.preheader.new ], [ %niter382.next.1, %for.inc38.3.1 ]
%arrayidx27.3 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.3
%34 = load i32, ptr %arrayidx27.3, align 4, !tbaa !5
%cmp28.3 = icmp eq i32 %34, 4
br i1 %cmp28.3, label %if.then.3, label %for.inc38.3
if.then.3: ; preds = %for.body25.3
%idxprom31.3 = sext i32 %count.1287.3 to i64
%arrayidx34.3 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.3
%35 = load i8, ptr %arrayidx34.3, align 1, !tbaa !9
%arrayidx36.3 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.3
store i8 %35, ptr %arrayidx36.3, align 1, !tbaa !9
%inc37.3 = add nsw i32 %count.1287.3, 1
br label %for.inc38.3
for.inc38.3: ; preds = %if.then.3, %for.body25.3
%count.2.3 = phi i32 [ %inc37.3, %if.then.3 ], [ %count.1287.3, %for.body25.3 ]
%indvars.iv.next311.3 = add nuw nsw i64 %indvars.iv310.3, 1
%arrayidx27.3.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.3
%36 = load i32, ptr %arrayidx27.3.1, align 4, !tbaa !5
%cmp28.3.1 = icmp eq i32 %36, 4
br i1 %cmp28.3.1, label %if.then.3.1, label %for.inc38.3.1
if.then.3.1: ; preds = %for.inc38.3
%idxprom31.3.1 = sext i32 %count.2.3 to i64
%arrayidx34.3.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.3
%37 = load i8, ptr %arrayidx34.3.1, align 1, !tbaa !9
%arrayidx36.3.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.3.1
store i8 %37, ptr %arrayidx36.3.1, align 1, !tbaa !9
%inc37.3.1 = add nsw i32 %count.2.3, 1
br label %for.inc38.3.1
for.inc38.3.1: ; preds = %if.then.3.1, %for.inc38.3
%count.2.3.1 = phi i32 [ %inc37.3.1, %if.then.3.1 ], [ %count.2.3, %for.inc38.3 ]
%indvars.iv.next311.3.1 = add nuw nsw i64 %indvars.iv310.3, 2
%niter382.next.1 = add i64 %niter382, 2
%niter382.ncmp.1 = icmp eq i64 %niter382.next.1, %unroll_iter381
br i1 %niter382.ncmp.1, label %for.body25.4.preheader.unr-lcssa, label %for.body25.3, !llvm.loop !12
for.body25.4.preheader.unr-lcssa: ; preds = %for.inc38.3.1, %for.body25.3.preheader
%count.2.3.lcssa.ph = phi i32 [ undef, %for.body25.3.preheader ], [ %count.2.3.1, %for.inc38.3.1 ]
%indvars.iv310.3.unr = phi i64 [ 1, %for.body25.3.preheader ], [ %indvars.iv.next311.3.1, %for.inc38.3.1 ]
%count.1287.3.unr = phi i32 [ %count.2.2.lcssa, %for.body25.3.preheader ], [ %count.2.3.1, %for.inc38.3.1 ]
%lcmp.mod379.not = icmp eq i64 %xtraiter378, 0
br i1 %lcmp.mod379.not, label %for.body25.4.preheader, label %for.body25.3.epil
for.body25.3.epil: ; preds = %for.body25.4.preheader.unr-lcssa
%arrayidx27.3.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.3.unr
%38 = load i32, ptr %arrayidx27.3.epil, align 4, !tbaa !5
%cmp28.3.epil = icmp eq i32 %38, 4
br i1 %cmp28.3.epil, label %if.then.3.epil, label %for.body25.4.preheader
if.then.3.epil: ; preds = %for.body25.3.epil
%idxprom31.3.epil = sext i32 %count.1287.3.unr to i64
%arrayidx34.3.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.3.unr
%39 = load i8, ptr %arrayidx34.3.epil, align 1, !tbaa !9
%arrayidx36.3.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.3.epil
store i8 %39, ptr %arrayidx36.3.epil, align 1, !tbaa !9
%inc37.3.epil = add nsw i32 %count.1287.3.unr, 1
br label %for.body25.4.preheader
for.body25.4.preheader: ; preds = %for.body25.3.epil, %if.then.3.epil, %for.body25.4.preheader.unr-lcssa
%count.2.3.lcssa = phi i32 [ %count.2.3.lcssa.ph, %for.body25.4.preheader.unr-lcssa ], [ %inc37.3.epil, %if.then.3.epil ], [ %count.1287.3.unr, %for.body25.3.epil ]
%xtraiter383 = and i64 %2, 1
%40 = icmp eq i64 %3, 0
br i1 %40, label %for.body25.5.preheader.unr-lcssa, label %for.body25.4.preheader.new
for.body25.4.preheader.new: ; preds = %for.body25.4.preheader
%unroll_iter386 = and i64 %2, -2
br label %for.body25.4
for.body25.4: ; preds = %for.inc38.4.1, %for.body25.4.preheader.new
%indvars.iv310.4 = phi i64 [ 1, %for.body25.4.preheader.new ], [ %indvars.iv.next311.4.1, %for.inc38.4.1 ]
%count.1287.4 = phi i32 [ %count.2.3.lcssa, %for.body25.4.preheader.new ], [ %count.2.4.1, %for.inc38.4.1 ]
%niter387 = phi i64 [ 0, %for.body25.4.preheader.new ], [ %niter387.next.1, %for.inc38.4.1 ]
%arrayidx27.4 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.4
%41 = load i32, ptr %arrayidx27.4, align 4, !tbaa !5
%cmp28.4 = icmp eq i32 %41, 5
br i1 %cmp28.4, label %if.then.4, label %for.inc38.4
if.then.4: ; preds = %for.body25.4
%idxprom31.4 = sext i32 %count.1287.4 to i64
%arrayidx34.4 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.4
%42 = load i8, ptr %arrayidx34.4, align 1, !tbaa !9
%arrayidx36.4 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.4
store i8 %42, ptr %arrayidx36.4, align 1, !tbaa !9
%inc37.4 = add nsw i32 %count.1287.4, 1
br label %for.inc38.4
for.inc38.4: ; preds = %if.then.4, %for.body25.4
%count.2.4 = phi i32 [ %inc37.4, %if.then.4 ], [ %count.1287.4, %for.body25.4 ]
%indvars.iv.next311.4 = add nuw nsw i64 %indvars.iv310.4, 1
%arrayidx27.4.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.4
%43 = load i32, ptr %arrayidx27.4.1, align 4, !tbaa !5
%cmp28.4.1 = icmp eq i32 %43, 5
br i1 %cmp28.4.1, label %if.then.4.1, label %for.inc38.4.1
if.then.4.1: ; preds = %for.inc38.4
%idxprom31.4.1 = sext i32 %count.2.4 to i64
%arrayidx34.4.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.4
%44 = load i8, ptr %arrayidx34.4.1, align 1, !tbaa !9
%arrayidx36.4.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.4.1
store i8 %44, ptr %arrayidx36.4.1, align 1, !tbaa !9
%inc37.4.1 = add nsw i32 %count.2.4, 1
br label %for.inc38.4.1
for.inc38.4.1: ; preds = %if.then.4.1, %for.inc38.4
%count.2.4.1 = phi i32 [ %inc37.4.1, %if.then.4.1 ], [ %count.2.4, %for.inc38.4 ]
%indvars.iv.next311.4.1 = add nuw nsw i64 %indvars.iv310.4, 2
%niter387.next.1 = add i64 %niter387, 2
%niter387.ncmp.1 = icmp eq i64 %niter387.next.1, %unroll_iter386
br i1 %niter387.ncmp.1, label %for.body25.5.preheader.unr-lcssa, label %for.body25.4, !llvm.loop !12
for.body25.5.preheader.unr-lcssa: ; preds = %for.inc38.4.1, %for.body25.4.preheader
%count.2.4.lcssa.ph = phi i32 [ undef, %for.body25.4.preheader ], [ %count.2.4.1, %for.inc38.4.1 ]
%indvars.iv310.4.unr = phi i64 [ 1, %for.body25.4.preheader ], [ %indvars.iv.next311.4.1, %for.inc38.4.1 ]
%count.1287.4.unr = phi i32 [ %count.2.3.lcssa, %for.body25.4.preheader ], [ %count.2.4.1, %for.inc38.4.1 ]
%lcmp.mod384.not = icmp eq i64 %xtraiter383, 0
br i1 %lcmp.mod384.not, label %for.body25.5.preheader, label %for.body25.4.epil
for.body25.4.epil: ; preds = %for.body25.5.preheader.unr-lcssa
%arrayidx27.4.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.4.unr
%45 = load i32, ptr %arrayidx27.4.epil, align 4, !tbaa !5
%cmp28.4.epil = icmp eq i32 %45, 5
br i1 %cmp28.4.epil, label %if.then.4.epil, label %for.body25.5.preheader
if.then.4.epil: ; preds = %for.body25.4.epil
%idxprom31.4.epil = sext i32 %count.1287.4.unr to i64
%arrayidx34.4.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.4.unr
%46 = load i8, ptr %arrayidx34.4.epil, align 1, !tbaa !9
%arrayidx36.4.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.4.epil
store i8 %46, ptr %arrayidx36.4.epil, align 1, !tbaa !9
%inc37.4.epil = add nsw i32 %count.1287.4.unr, 1
br label %for.body25.5.preheader
for.body25.5.preheader: ; preds = %for.body25.4.epil, %if.then.4.epil, %for.body25.5.preheader.unr-lcssa
%count.2.4.lcssa = phi i32 [ %count.2.4.lcssa.ph, %for.body25.5.preheader.unr-lcssa ], [ %inc37.4.epil, %if.then.4.epil ], [ %count.1287.4.unr, %for.body25.4.epil ]
%xtraiter388 = and i64 %2, 1
%47 = icmp eq i64 %3, 0
br i1 %47, label %for.body25.6.preheader.unr-lcssa, label %for.body25.5.preheader.new
for.body25.5.preheader.new: ; preds = %for.body25.5.preheader
%unroll_iter391 = and i64 %2, -2
br label %for.body25.5
for.body25.5: ; preds = %for.inc38.5.1, %for.body25.5.preheader.new
%indvars.iv310.5 = phi i64 [ 1, %for.body25.5.preheader.new ], [ %indvars.iv.next311.5.1, %for.inc38.5.1 ]
%count.1287.5 = phi i32 [ %count.2.4.lcssa, %for.body25.5.preheader.new ], [ %count.2.5.1, %for.inc38.5.1 ]
%niter392 = phi i64 [ 0, %for.body25.5.preheader.new ], [ %niter392.next.1, %for.inc38.5.1 ]
%arrayidx27.5 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.5
%48 = load i32, ptr %arrayidx27.5, align 4, !tbaa !5
%cmp28.5 = icmp eq i32 %48, 6
br i1 %cmp28.5, label %if.then.5, label %for.inc38.5
if.then.5: ; preds = %for.body25.5
%idxprom31.5 = sext i32 %count.1287.5 to i64
%arrayidx34.5 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.5
%49 = load i8, ptr %arrayidx34.5, align 1, !tbaa !9
%arrayidx36.5 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.5
store i8 %49, ptr %arrayidx36.5, align 1, !tbaa !9
%inc37.5 = add nsw i32 %count.1287.5, 1
br label %for.inc38.5
for.inc38.5: ; preds = %if.then.5, %for.body25.5
%count.2.5 = phi i32 [ %inc37.5, %if.then.5 ], [ %count.1287.5, %for.body25.5 ]
%indvars.iv.next311.5 = add nuw nsw i64 %indvars.iv310.5, 1
%arrayidx27.5.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.5
%50 = load i32, ptr %arrayidx27.5.1, align 4, !tbaa !5
%cmp28.5.1 = icmp eq i32 %50, 6
br i1 %cmp28.5.1, label %if.then.5.1, label %for.inc38.5.1
if.then.5.1: ; preds = %for.inc38.5
%idxprom31.5.1 = sext i32 %count.2.5 to i64
%arrayidx34.5.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.5
%51 = load i8, ptr %arrayidx34.5.1, align 1, !tbaa !9
%arrayidx36.5.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.5.1
store i8 %51, ptr %arrayidx36.5.1, align 1, !tbaa !9
%inc37.5.1 = add nsw i32 %count.2.5, 1
br label %for.inc38.5.1
for.inc38.5.1: ; preds = %if.then.5.1, %for.inc38.5
%count.2.5.1 = phi i32 [ %inc37.5.1, %if.then.5.1 ], [ %count.2.5, %for.inc38.5 ]
%indvars.iv.next311.5.1 = add nuw nsw i64 %indvars.iv310.5, 2
%niter392.next.1 = add i64 %niter392, 2
%niter392.ncmp.1 = icmp eq i64 %niter392.next.1, %unroll_iter391
br i1 %niter392.ncmp.1, label %for.body25.6.preheader.unr-lcssa, label %for.body25.5, !llvm.loop !12
for.body25.6.preheader.unr-lcssa: ; preds = %for.inc38.5.1, %for.body25.5.preheader
%count.2.5.lcssa.ph = phi i32 [ undef, %for.body25.5.preheader ], [ %count.2.5.1, %for.inc38.5.1 ]
%indvars.iv310.5.unr = phi i64 [ 1, %for.body25.5.preheader ], [ %indvars.iv.next311.5.1, %for.inc38.5.1 ]
%count.1287.5.unr = phi i32 [ %count.2.4.lcssa, %for.body25.5.preheader ], [ %count.2.5.1, %for.inc38.5.1 ]
%lcmp.mod389.not = icmp eq i64 %xtraiter388, 0
br i1 %lcmp.mod389.not, label %for.body25.6.preheader, label %for.body25.5.epil
for.body25.5.epil: ; preds = %for.body25.6.preheader.unr-lcssa
%arrayidx27.5.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.5.unr
%52 = load i32, ptr %arrayidx27.5.epil, align 4, !tbaa !5
%cmp28.5.epil = icmp eq i32 %52, 6
br i1 %cmp28.5.epil, label %if.then.5.epil, label %for.body25.6.preheader
if.then.5.epil: ; preds = %for.body25.5.epil
%idxprom31.5.epil = sext i32 %count.1287.5.unr to i64
%arrayidx34.5.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.5.unr
%53 = load i8, ptr %arrayidx34.5.epil, align 1, !tbaa !9
%arrayidx36.5.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.5.epil
store i8 %53, ptr %arrayidx36.5.epil, align 1, !tbaa !9
%inc37.5.epil = add nsw i32 %count.1287.5.unr, 1
br label %for.body25.6.preheader
for.body25.6.preheader: ; preds = %for.body25.5.epil, %if.then.5.epil, %for.body25.6.preheader.unr-lcssa
%count.2.5.lcssa = phi i32 [ %count.2.5.lcssa.ph, %for.body25.6.preheader.unr-lcssa ], [ %inc37.5.epil, %if.then.5.epil ], [ %count.1287.5.unr, %for.body25.5.epil ]
%xtraiter393 = and i64 %2, 1
%54 = icmp eq i64 %3, 0
br i1 %54, label %for.body25.7.preheader.unr-lcssa, label %for.body25.6.preheader.new
for.body25.6.preheader.new: ; preds = %for.body25.6.preheader
%unroll_iter396 = and i64 %2, -2
br label %for.body25.6
for.body25.6: ; preds = %for.inc38.6.1, %for.body25.6.preheader.new
%indvars.iv310.6 = phi i64 [ 1, %for.body25.6.preheader.new ], [ %indvars.iv.next311.6.1, %for.inc38.6.1 ]
%count.1287.6 = phi i32 [ %count.2.5.lcssa, %for.body25.6.preheader.new ], [ %count.2.6.1, %for.inc38.6.1 ]
%niter397 = phi i64 [ 0, %for.body25.6.preheader.new ], [ %niter397.next.1, %for.inc38.6.1 ]
%arrayidx27.6 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.6
%55 = load i32, ptr %arrayidx27.6, align 4, !tbaa !5
%cmp28.6 = icmp eq i32 %55, 7
br i1 %cmp28.6, label %if.then.6, label %for.inc38.6
if.then.6: ; preds = %for.body25.6
%idxprom31.6 = sext i32 %count.1287.6 to i64
%arrayidx34.6 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.6
%56 = load i8, ptr %arrayidx34.6, align 1, !tbaa !9
%arrayidx36.6 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.6
store i8 %56, ptr %arrayidx36.6, align 1, !tbaa !9
%inc37.6 = add nsw i32 %count.1287.6, 1
br label %for.inc38.6
for.inc38.6: ; preds = %if.then.6, %for.body25.6
%count.2.6 = phi i32 [ %inc37.6, %if.then.6 ], [ %count.1287.6, %for.body25.6 ]
%indvars.iv.next311.6 = add nuw nsw i64 %indvars.iv310.6, 1
%arrayidx27.6.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.6
%57 = load i32, ptr %arrayidx27.6.1, align 4, !tbaa !5
%cmp28.6.1 = icmp eq i32 %57, 7
br i1 %cmp28.6.1, label %if.then.6.1, label %for.inc38.6.1
if.then.6.1: ; preds = %for.inc38.6
%idxprom31.6.1 = sext i32 %count.2.6 to i64
%arrayidx34.6.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.6
%58 = load i8, ptr %arrayidx34.6.1, align 1, !tbaa !9
%arrayidx36.6.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.6.1
store i8 %58, ptr %arrayidx36.6.1, align 1, !tbaa !9
%inc37.6.1 = add nsw i32 %count.2.6, 1
br label %for.inc38.6.1
for.inc38.6.1: ; preds = %if.then.6.1, %for.inc38.6
%count.2.6.1 = phi i32 [ %inc37.6.1, %if.then.6.1 ], [ %count.2.6, %for.inc38.6 ]
%indvars.iv.next311.6.1 = add nuw nsw i64 %indvars.iv310.6, 2
%niter397.next.1 = add i64 %niter397, 2
%niter397.ncmp.1 = icmp eq i64 %niter397.next.1, %unroll_iter396
br i1 %niter397.ncmp.1, label %for.body25.7.preheader.unr-lcssa, label %for.body25.6, !llvm.loop !12
for.body25.7.preheader.unr-lcssa: ; preds = %for.inc38.6.1, %for.body25.6.preheader
%count.2.6.lcssa.ph = phi i32 [ undef, %for.body25.6.preheader ], [ %count.2.6.1, %for.inc38.6.1 ]
%indvars.iv310.6.unr = phi i64 [ 1, %for.body25.6.preheader ], [ %indvars.iv.next311.6.1, %for.inc38.6.1 ]
%count.1287.6.unr = phi i32 [ %count.2.5.lcssa, %for.body25.6.preheader ], [ %count.2.6.1, %for.inc38.6.1 ]
%lcmp.mod394.not = icmp eq i64 %xtraiter393, 0
br i1 %lcmp.mod394.not, label %for.body25.7.preheader, label %for.body25.6.epil
for.body25.6.epil: ; preds = %for.body25.7.preheader.unr-lcssa
%arrayidx27.6.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.6.unr
%59 = load i32, ptr %arrayidx27.6.epil, align 4, !tbaa !5
%cmp28.6.epil = icmp eq i32 %59, 7
br i1 %cmp28.6.epil, label %if.then.6.epil, label %for.body25.7.preheader
if.then.6.epil: ; preds = %for.body25.6.epil
%idxprom31.6.epil = sext i32 %count.1287.6.unr to i64
%arrayidx34.6.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.6.unr
%60 = load i8, ptr %arrayidx34.6.epil, align 1, !tbaa !9
%arrayidx36.6.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.6.epil
store i8 %60, ptr %arrayidx36.6.epil, align 1, !tbaa !9
%inc37.6.epil = add nsw i32 %count.1287.6.unr, 1
br label %for.body25.7.preheader
for.body25.7.preheader: ; preds = %for.body25.6.epil, %if.then.6.epil, %for.body25.7.preheader.unr-lcssa
%count.2.6.lcssa = phi i32 [ %count.2.6.lcssa.ph, %for.body25.7.preheader.unr-lcssa ], [ %inc37.6.epil, %if.then.6.epil ], [ %count.1287.6.unr, %for.body25.6.epil ]
%xtraiter398 = and i64 %2, 1
%61 = icmp eq i64 %3, 0
br i1 %61, label %for.body25.8.preheader.unr-lcssa, label %for.body25.7.preheader.new
for.body25.7.preheader.new: ; preds = %for.body25.7.preheader
%unroll_iter401 = and i64 %2, -2
br label %for.body25.7
for.body25.7: ; preds = %for.inc38.7.1, %for.body25.7.preheader.new
%indvars.iv310.7 = phi i64 [ 1, %for.body25.7.preheader.new ], [ %indvars.iv.next311.7.1, %for.inc38.7.1 ]
%count.1287.7 = phi i32 [ %count.2.6.lcssa, %for.body25.7.preheader.new ], [ %count.2.7.1, %for.inc38.7.1 ]
%niter402 = phi i64 [ 0, %for.body25.7.preheader.new ], [ %niter402.next.1, %for.inc38.7.1 ]
%arrayidx27.7 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.7
%62 = load i32, ptr %arrayidx27.7, align 4, !tbaa !5
%cmp28.7 = icmp eq i32 %62, 8
br i1 %cmp28.7, label %if.then.7, label %for.inc38.7
if.then.7: ; preds = %for.body25.7
%idxprom31.7 = sext i32 %count.1287.7 to i64
%arrayidx34.7 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.7
%63 = load i8, ptr %arrayidx34.7, align 1, !tbaa !9
%arrayidx36.7 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.7
store i8 %63, ptr %arrayidx36.7, align 1, !tbaa !9
%inc37.7 = add nsw i32 %count.1287.7, 1
br label %for.inc38.7
for.inc38.7: ; preds = %if.then.7, %for.body25.7
%count.2.7 = phi i32 [ %inc37.7, %if.then.7 ], [ %count.1287.7, %for.body25.7 ]
%indvars.iv.next311.7 = add nuw nsw i64 %indvars.iv310.7, 1
%arrayidx27.7.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.7
%64 = load i32, ptr %arrayidx27.7.1, align 4, !tbaa !5
%cmp28.7.1 = icmp eq i32 %64, 8
br i1 %cmp28.7.1, label %if.then.7.1, label %for.inc38.7.1
if.then.7.1: ; preds = %for.inc38.7
%idxprom31.7.1 = sext i32 %count.2.7 to i64
%arrayidx34.7.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.7
%65 = load i8, ptr %arrayidx34.7.1, align 1, !tbaa !9
%arrayidx36.7.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.7.1
store i8 %65, ptr %arrayidx36.7.1, align 1, !tbaa !9
%inc37.7.1 = add nsw i32 %count.2.7, 1
br label %for.inc38.7.1
for.inc38.7.1: ; preds = %if.then.7.1, %for.inc38.7
%count.2.7.1 = phi i32 [ %inc37.7.1, %if.then.7.1 ], [ %count.2.7, %for.inc38.7 ]
%indvars.iv.next311.7.1 = add nuw nsw i64 %indvars.iv310.7, 2
%niter402.next.1 = add i64 %niter402, 2
%niter402.ncmp.1 = icmp eq i64 %niter402.next.1, %unroll_iter401
br i1 %niter402.ncmp.1, label %for.body25.8.preheader.unr-lcssa, label %for.body25.7, !llvm.loop !12
for.body25.8.preheader.unr-lcssa: ; preds = %for.inc38.7.1, %for.body25.7.preheader
%count.2.7.lcssa.ph = phi i32 [ undef, %for.body25.7.preheader ], [ %count.2.7.1, %for.inc38.7.1 ]
%indvars.iv310.7.unr = phi i64 [ 1, %for.body25.7.preheader ], [ %indvars.iv.next311.7.1, %for.inc38.7.1 ]
%count.1287.7.unr = phi i32 [ %count.2.6.lcssa, %for.body25.7.preheader ], [ %count.2.7.1, %for.inc38.7.1 ]
%lcmp.mod399.not = icmp eq i64 %xtraiter398, 0
br i1 %lcmp.mod399.not, label %for.body25.8.preheader, label %for.body25.7.epil
for.body25.7.epil: ; preds = %for.body25.8.preheader.unr-lcssa
%arrayidx27.7.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.7.unr
%66 = load i32, ptr %arrayidx27.7.epil, align 4, !tbaa !5
%cmp28.7.epil = icmp eq i32 %66, 8
br i1 %cmp28.7.epil, label %if.then.7.epil, label %for.body25.8.preheader
if.then.7.epil: ; preds = %for.body25.7.epil
%idxprom31.7.epil = sext i32 %count.1287.7.unr to i64
%arrayidx34.7.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.7.unr
%67 = load i8, ptr %arrayidx34.7.epil, align 1, !tbaa !9
%arrayidx36.7.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.7.epil
store i8 %67, ptr %arrayidx36.7.epil, align 1, !tbaa !9
%inc37.7.epil = add nsw i32 %count.1287.7.unr, 1
br label %for.body25.8.preheader
for.body25.8.preheader: ; preds = %for.body25.7.epil, %if.then.7.epil, %for.body25.8.preheader.unr-lcssa
%count.2.7.lcssa = phi i32 [ %count.2.7.lcssa.ph, %for.body25.8.preheader.unr-lcssa ], [ %inc37.7.epil, %if.then.7.epil ], [ %count.1287.7.unr, %for.body25.7.epil ]
%xtraiter403 = and i64 %2, 1
%68 = icmp eq i64 %3, 0
br i1 %68, label %for.body25.9.preheader.unr-lcssa, label %for.body25.8.preheader.new
for.body25.8.preheader.new: ; preds = %for.body25.8.preheader
%unroll_iter406 = and i64 %2, -2
br label %for.body25.8
for.body25.8: ; preds = %for.inc38.8.1, %for.body25.8.preheader.new
%indvars.iv310.8 = phi i64 [ 1, %for.body25.8.preheader.new ], [ %indvars.iv.next311.8.1, %for.inc38.8.1 ]
%count.1287.8 = phi i32 [ %count.2.7.lcssa, %for.body25.8.preheader.new ], [ %count.2.8.1, %for.inc38.8.1 ]
%niter407 = phi i64 [ 0, %for.body25.8.preheader.new ], [ %niter407.next.1, %for.inc38.8.1 ]
%arrayidx27.8 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.8
%69 = load i32, ptr %arrayidx27.8, align 4, !tbaa !5
%cmp28.8 = icmp eq i32 %69, 9
br i1 %cmp28.8, label %if.then.8, label %for.inc38.8
if.then.8: ; preds = %for.body25.8
%idxprom31.8 = sext i32 %count.1287.8 to i64
%arrayidx34.8 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.8
%70 = load i8, ptr %arrayidx34.8, align 1, !tbaa !9
%arrayidx36.8 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.8
store i8 %70, ptr %arrayidx36.8, align 1, !tbaa !9
%inc37.8 = add nsw i32 %count.1287.8, 1
br label %for.inc38.8
for.inc38.8: ; preds = %if.then.8, %for.body25.8
%count.2.8 = phi i32 [ %inc37.8, %if.then.8 ], [ %count.1287.8, %for.body25.8 ]
%indvars.iv.next311.8 = add nuw nsw i64 %indvars.iv310.8, 1
%arrayidx27.8.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.8
%71 = load i32, ptr %arrayidx27.8.1, align 4, !tbaa !5
%cmp28.8.1 = icmp eq i32 %71, 9
br i1 %cmp28.8.1, label %if.then.8.1, label %for.inc38.8.1
if.then.8.1: ; preds = %for.inc38.8
%idxprom31.8.1 = sext i32 %count.2.8 to i64
%arrayidx34.8.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.8
%72 = load i8, ptr %arrayidx34.8.1, align 1, !tbaa !9
%arrayidx36.8.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.8.1
store i8 %72, ptr %arrayidx36.8.1, align 1, !tbaa !9
%inc37.8.1 = add nsw i32 %count.2.8, 1
br label %for.inc38.8.1
for.inc38.8.1: ; preds = %if.then.8.1, %for.inc38.8
%count.2.8.1 = phi i32 [ %inc37.8.1, %if.then.8.1 ], [ %count.2.8, %for.inc38.8 ]
%indvars.iv.next311.8.1 = add nuw nsw i64 %indvars.iv310.8, 2
%niter407.next.1 = add i64 %niter407, 2
%niter407.ncmp.1 = icmp eq i64 %niter407.next.1, %unroll_iter406
br i1 %niter407.ncmp.1, label %for.body25.9.preheader.unr-lcssa, label %for.body25.8, !llvm.loop !12
for.body25.9.preheader.unr-lcssa: ; preds = %for.inc38.8.1, %for.body25.8.preheader
%count.2.8.lcssa.ph = phi i32 [ undef, %for.body25.8.preheader ], [ %count.2.8.1, %for.inc38.8.1 ]
%indvars.iv310.8.unr = phi i64 [ 1, %for.body25.8.preheader ], [ %indvars.iv.next311.8.1, %for.inc38.8.1 ]
%count.1287.8.unr = phi i32 [ %count.2.7.lcssa, %for.body25.8.preheader ], [ %count.2.8.1, %for.inc38.8.1 ]
%lcmp.mod404.not = icmp eq i64 %xtraiter403, 0
br i1 %lcmp.mod404.not, label %for.body25.9.preheader, label %for.body25.8.epil
for.body25.8.epil: ; preds = %for.body25.9.preheader.unr-lcssa
%arrayidx27.8.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.8.unr
%73 = load i32, ptr %arrayidx27.8.epil, align 4, !tbaa !5
%cmp28.8.epil = icmp eq i32 %73, 9
br i1 %cmp28.8.epil, label %if.then.8.epil, label %for.body25.9.preheader
if.then.8.epil: ; preds = %for.body25.8.epil
%idxprom31.8.epil = sext i32 %count.1287.8.unr to i64
%arrayidx34.8.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.8.unr
%74 = load i8, ptr %arrayidx34.8.epil, align 1, !tbaa !9
%arrayidx36.8.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.8.epil
store i8 %74, ptr %arrayidx36.8.epil, align 1, !tbaa !9
%inc37.8.epil = add nsw i32 %count.1287.8.unr, 1
br label %for.body25.9.preheader
for.body25.9.preheader: ; preds = %for.body25.8.epil, %if.then.8.epil, %for.body25.9.preheader.unr-lcssa
%count.2.8.lcssa = phi i32 [ %count.2.8.lcssa.ph, %for.body25.9.preheader.unr-lcssa ], [ %inc37.8.epil, %if.then.8.epil ], [ %count.1287.8.unr, %for.body25.8.epil ]
%xtraiter408 = and i64 %2, 1
%75 = icmp eq i64 %3, 0
br i1 %75, label %for.body25.10.preheader.unr-lcssa, label %for.body25.9.preheader.new
for.body25.9.preheader.new: ; preds = %for.body25.9.preheader
%unroll_iter411 = and i64 %2, -2
br label %for.body25.9
for.body25.9: ; preds = %for.inc38.9.1, %for.body25.9.preheader.new
%indvars.iv310.9 = phi i64 [ 1, %for.body25.9.preheader.new ], [ %indvars.iv.next311.9.1, %for.inc38.9.1 ]
%count.1287.9 = phi i32 [ %count.2.8.lcssa, %for.body25.9.preheader.new ], [ %count.2.9.1, %for.inc38.9.1 ]
%niter412 = phi i64 [ 0, %for.body25.9.preheader.new ], [ %niter412.next.1, %for.inc38.9.1 ]
%arrayidx27.9 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.9
%76 = load i32, ptr %arrayidx27.9, align 4, !tbaa !5
%cmp28.9 = icmp eq i32 %76, 10
br i1 %cmp28.9, label %if.then.9, label %for.inc38.9
if.then.9: ; preds = %for.body25.9
%idxprom31.9 = sext i32 %count.1287.9 to i64
%arrayidx34.9 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.9
%77 = load i8, ptr %arrayidx34.9, align 1, !tbaa !9
%arrayidx36.9 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.9
store i8 %77, ptr %arrayidx36.9, align 1, !tbaa !9
%inc37.9 = add nsw i32 %count.1287.9, 1
br label %for.inc38.9
for.inc38.9: ; preds = %if.then.9, %for.body25.9
%count.2.9 = phi i32 [ %inc37.9, %if.then.9 ], [ %count.1287.9, %for.body25.9 ]
%indvars.iv.next311.9 = add nuw nsw i64 %indvars.iv310.9, 1
%arrayidx27.9.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.9
%78 = load i32, ptr %arrayidx27.9.1, align 4, !tbaa !5
%cmp28.9.1 = icmp eq i32 %78, 10
br i1 %cmp28.9.1, label %if.then.9.1, label %for.inc38.9.1
if.then.9.1: ; preds = %for.inc38.9
%idxprom31.9.1 = sext i32 %count.2.9 to i64
%arrayidx34.9.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.9
%79 = load i8, ptr %arrayidx34.9.1, align 1, !tbaa !9
%arrayidx36.9.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.9.1
store i8 %79, ptr %arrayidx36.9.1, align 1, !tbaa !9
%inc37.9.1 = add nsw i32 %count.2.9, 1
br label %for.inc38.9.1
for.inc38.9.1: ; preds = %if.then.9.1, %for.inc38.9
%count.2.9.1 = phi i32 [ %inc37.9.1, %if.then.9.1 ], [ %count.2.9, %for.inc38.9 ]
%indvars.iv.next311.9.1 = add nuw nsw i64 %indvars.iv310.9, 2
%niter412.next.1 = add i64 %niter412, 2
%niter412.ncmp.1 = icmp eq i64 %niter412.next.1, %unroll_iter411
br i1 %niter412.ncmp.1, label %for.body25.10.preheader.unr-lcssa, label %for.body25.9, !llvm.loop !12
for.body25.10.preheader.unr-lcssa: ; preds = %for.inc38.9.1, %for.body25.9.preheader
%count.2.9.lcssa.ph = phi i32 [ undef, %for.body25.9.preheader ], [ %count.2.9.1, %for.inc38.9.1 ]
%indvars.iv310.9.unr = phi i64 [ 1, %for.body25.9.preheader ], [ %indvars.iv.next311.9.1, %for.inc38.9.1 ]
%count.1287.9.unr = phi i32 [ %count.2.8.lcssa, %for.body25.9.preheader ], [ %count.2.9.1, %for.inc38.9.1 ]
%lcmp.mod409.not = icmp eq i64 %xtraiter408, 0
br i1 %lcmp.mod409.not, label %for.body25.10.preheader, label %for.body25.9.epil
for.body25.9.epil: ; preds = %for.body25.10.preheader.unr-lcssa
%arrayidx27.9.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.9.unr
%80 = load i32, ptr %arrayidx27.9.epil, align 4, !tbaa !5
%cmp28.9.epil = icmp eq i32 %80, 10
br i1 %cmp28.9.epil, label %if.then.9.epil, label %for.body25.10.preheader
if.then.9.epil: ; preds = %for.body25.9.epil
%idxprom31.9.epil = sext i32 %count.1287.9.unr to i64
%arrayidx34.9.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.9.unr
%81 = load i8, ptr %arrayidx34.9.epil, align 1, !tbaa !9
%arrayidx36.9.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.9.epil
store i8 %81, ptr %arrayidx36.9.epil, align 1, !tbaa !9
%inc37.9.epil = add nsw i32 %count.1287.9.unr, 1
br label %for.body25.10.preheader
for.body25.10.preheader: ; preds = %for.body25.9.epil, %if.then.9.epil, %for.body25.10.preheader.unr-lcssa
%count.2.9.lcssa = phi i32 [ %count.2.9.lcssa.ph, %for.body25.10.preheader.unr-lcssa ], [ %inc37.9.epil, %if.then.9.epil ], [ %count.1287.9.unr, %for.body25.9.epil ]
%xtraiter413 = and i64 %2, 1
%82 = icmp eq i64 %3, 0
br i1 %82, label %for.body25.11.preheader.unr-lcssa, label %for.body25.10.preheader.new
for.body25.10.preheader.new: ; preds = %for.body25.10.preheader
%unroll_iter416 = and i64 %2, -2
br label %for.body25.10
for.body25.10: ; preds = %for.inc38.10.1, %for.body25.10.preheader.new
%indvars.iv310.10 = phi i64 [ 1, %for.body25.10.preheader.new ], [ %indvars.iv.next311.10.1, %for.inc38.10.1 ]
%count.1287.10 = phi i32 [ %count.2.9.lcssa, %for.body25.10.preheader.new ], [ %count.2.10.1, %for.inc38.10.1 ]
%niter417 = phi i64 [ 0, %for.body25.10.preheader.new ], [ %niter417.next.1, %for.inc38.10.1 ]
%arrayidx27.10 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.10
%83 = load i32, ptr %arrayidx27.10, align 4, !tbaa !5
%cmp28.10 = icmp eq i32 %83, 11
br i1 %cmp28.10, label %if.then.10, label %for.inc38.10
if.then.10: ; preds = %for.body25.10
%idxprom31.10 = sext i32 %count.1287.10 to i64
%arrayidx34.10 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.10
%84 = load i8, ptr %arrayidx34.10, align 1, !tbaa !9
%arrayidx36.10 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.10
store i8 %84, ptr %arrayidx36.10, align 1, !tbaa !9
%inc37.10 = add nsw i32 %count.1287.10, 1
br label %for.inc38.10
for.inc38.10: ; preds = %if.then.10, %for.body25.10
%count.2.10 = phi i32 [ %inc37.10, %if.then.10 ], [ %count.1287.10, %for.body25.10 ]
%indvars.iv.next311.10 = add nuw nsw i64 %indvars.iv310.10, 1
%arrayidx27.10.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.10
%85 = load i32, ptr %arrayidx27.10.1, align 4, !tbaa !5
%cmp28.10.1 = icmp eq i32 %85, 11
br i1 %cmp28.10.1, label %if.then.10.1, label %for.inc38.10.1
if.then.10.1: ; preds = %for.inc38.10
%idxprom31.10.1 = sext i32 %count.2.10 to i64
%arrayidx34.10.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.10
%86 = load i8, ptr %arrayidx34.10.1, align 1, !tbaa !9
%arrayidx36.10.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.10.1
store i8 %86, ptr %arrayidx36.10.1, align 1, !tbaa !9
%inc37.10.1 = add nsw i32 %count.2.10, 1
br label %for.inc38.10.1
for.inc38.10.1: ; preds = %if.then.10.1, %for.inc38.10
%count.2.10.1 = phi i32 [ %inc37.10.1, %if.then.10.1 ], [ %count.2.10, %for.inc38.10 ]
%indvars.iv.next311.10.1 = add nuw nsw i64 %indvars.iv310.10, 2
%niter417.next.1 = add i64 %niter417, 2
%niter417.ncmp.1 = icmp eq i64 %niter417.next.1, %unroll_iter416
br i1 %niter417.ncmp.1, label %for.body25.11.preheader.unr-lcssa, label %for.body25.10, !llvm.loop !12
for.body25.11.preheader.unr-lcssa: ; preds = %for.inc38.10.1, %for.body25.10.preheader
%count.2.10.lcssa.ph = phi i32 [ undef, %for.body25.10.preheader ], [ %count.2.10.1, %for.inc38.10.1 ]
%indvars.iv310.10.unr = phi i64 [ 1, %for.body25.10.preheader ], [ %indvars.iv.next311.10.1, %for.inc38.10.1 ]
%count.1287.10.unr = phi i32 [ %count.2.9.lcssa, %for.body25.10.preheader ], [ %count.2.10.1, %for.inc38.10.1 ]
%lcmp.mod414.not = icmp eq i64 %xtraiter413, 0
br i1 %lcmp.mod414.not, label %for.body25.11.preheader, label %for.body25.10.epil
for.body25.10.epil: ; preds = %for.body25.11.preheader.unr-lcssa
%arrayidx27.10.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.10.unr
%87 = load i32, ptr %arrayidx27.10.epil, align 4, !tbaa !5
%cmp28.10.epil = icmp eq i32 %87, 11
br i1 %cmp28.10.epil, label %if.then.10.epil, label %for.body25.11.preheader
if.then.10.epil: ; preds = %for.body25.10.epil
%idxprom31.10.epil = sext i32 %count.1287.10.unr to i64
%arrayidx34.10.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.10.unr
%88 = load i8, ptr %arrayidx34.10.epil, align 1, !tbaa !9
%arrayidx36.10.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.10.epil
store i8 %88, ptr %arrayidx36.10.epil, align 1, !tbaa !9
%inc37.10.epil = add nsw i32 %count.1287.10.unr, 1
br label %for.body25.11.preheader
for.body25.11.preheader: ; preds = %for.body25.10.epil, %if.then.10.epil, %for.body25.11.preheader.unr-lcssa
%count.2.10.lcssa = phi i32 [ %count.2.10.lcssa.ph, %for.body25.11.preheader.unr-lcssa ], [ %inc37.10.epil, %if.then.10.epil ], [ %count.1287.10.unr, %for.body25.10.epil ]
%xtraiter418 = and i64 %2, 1
%89 = icmp eq i64 %3, 0
br i1 %89, label %for.body25.12.preheader.unr-lcssa, label %for.body25.11.preheader.new
for.body25.11.preheader.new: ; preds = %for.body25.11.preheader
%unroll_iter421 = and i64 %2, -2
br label %for.body25.11
for.body25.11: ; preds = %for.inc38.11.1, %for.body25.11.preheader.new
%indvars.iv310.11 = phi i64 [ 1, %for.body25.11.preheader.new ], [ %indvars.iv.next311.11.1, %for.inc38.11.1 ]
%count.1287.11 = phi i32 [ %count.2.10.lcssa, %for.body25.11.preheader.new ], [ %count.2.11.1, %for.inc38.11.1 ]
%niter422 = phi i64 [ 0, %for.body25.11.preheader.new ], [ %niter422.next.1, %for.inc38.11.1 ]
%arrayidx27.11 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.11
%90 = load i32, ptr %arrayidx27.11, align 4, !tbaa !5
%cmp28.11 = icmp eq i32 %90, 12
br i1 %cmp28.11, label %if.then.11, label %for.inc38.11
if.then.11: ; preds = %for.body25.11
%idxprom31.11 = sext i32 %count.1287.11 to i64
%arrayidx34.11 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.11
%91 = load i8, ptr %arrayidx34.11, align 1, !tbaa !9
%arrayidx36.11 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.11
store i8 %91, ptr %arrayidx36.11, align 1, !tbaa !9
%inc37.11 = add nsw i32 %count.1287.11, 1
br label %for.inc38.11
for.inc38.11: ; preds = %if.then.11, %for.body25.11
%count.2.11 = phi i32 [ %inc37.11, %if.then.11 ], [ %count.1287.11, %for.body25.11 ]
%indvars.iv.next311.11 = add nuw nsw i64 %indvars.iv310.11, 1
%arrayidx27.11.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.11
%92 = load i32, ptr %arrayidx27.11.1, align 4, !tbaa !5
%cmp28.11.1 = icmp eq i32 %92, 12
br i1 %cmp28.11.1, label %if.then.11.1, label %for.inc38.11.1
if.then.11.1: ; preds = %for.inc38.11
%idxprom31.11.1 = sext i32 %count.2.11 to i64
%arrayidx34.11.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.11
%93 = load i8, ptr %arrayidx34.11.1, align 1, !tbaa !9
%arrayidx36.11.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.11.1
store i8 %93, ptr %arrayidx36.11.1, align 1, !tbaa !9
%inc37.11.1 = add nsw i32 %count.2.11, 1
br label %for.inc38.11.1
for.inc38.11.1: ; preds = %if.then.11.1, %for.inc38.11
%count.2.11.1 = phi i32 [ %inc37.11.1, %if.then.11.1 ], [ %count.2.11, %for.inc38.11 ]
%indvars.iv.next311.11.1 = add nuw nsw i64 %indvars.iv310.11, 2
%niter422.next.1 = add i64 %niter422, 2
%niter422.ncmp.1 = icmp eq i64 %niter422.next.1, %unroll_iter421
br i1 %niter422.ncmp.1, label %for.body25.12.preheader.unr-lcssa, label %for.body25.11, !llvm.loop !12
for.body25.12.preheader.unr-lcssa: ; preds = %for.inc38.11.1, %for.body25.11.preheader
%count.2.11.lcssa.ph = phi i32 [ undef, %for.body25.11.preheader ], [ %count.2.11.1, %for.inc38.11.1 ]
%indvars.iv310.11.unr = phi i64 [ 1, %for.body25.11.preheader ], [ %indvars.iv.next311.11.1, %for.inc38.11.1 ]
%count.1287.11.unr = phi i32 [ %count.2.10.lcssa, %for.body25.11.preheader ], [ %count.2.11.1, %for.inc38.11.1 ]
%lcmp.mod419.not = icmp eq i64 %xtraiter418, 0
br i1 %lcmp.mod419.not, label %for.body25.12.preheader, label %for.body25.11.epil
for.body25.11.epil: ; preds = %for.body25.12.preheader.unr-lcssa
%arrayidx27.11.epil = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.11.unr
%94 = load i32, ptr %arrayidx27.11.epil, align 4, !tbaa !5
%cmp28.11.epil = icmp eq i32 %94, 12
br i1 %cmp28.11.epil, label %if.then.11.epil, label %for.body25.12.preheader
if.then.11.epil: ; preds = %for.body25.11.epil
%idxprom31.11.epil = sext i32 %count.1287.11.unr to i64
%arrayidx34.11.epil = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.11.unr
%95 = load i8, ptr %arrayidx34.11.epil, align 1, !tbaa !9
%arrayidx36.11.epil = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.11.epil
store i8 %95, ptr %arrayidx36.11.epil, align 1, !tbaa !9
%inc37.11.epil = add nsw i32 %count.1287.11.unr, 1
br label %for.body25.12.preheader
for.body25.12.preheader: ; preds = %for.body25.11.epil, %if.then.11.epil, %for.body25.12.preheader.unr-lcssa
%count.2.11.lcssa = phi i32 [ %count.2.11.lcssa.ph, %for.body25.12.preheader.unr-lcssa ], [ %inc37.11.epil, %if.then.11.epil ], [ %count.1287.11.unr, %for.body25.11.epil ]
%xtraiter423 = and i64 %2, 1
%96 = icmp eq i64 %3, 0
br i1 %96, label %for.cond44.preheader.unr-lcssa, label %for.body25.12.preheader.new
for.body25.12.preheader.new: ; preds = %for.body25.12.preheader
%unroll_iter425 = and i64 %2, -2
br label %for.body25.12
for.body25.12: ; preds = %for.inc38.12.1, %for.body25.12.preheader.new
%indvars.iv310.12 = phi i64 [ 1, %for.body25.12.preheader.new ], [ %indvars.iv.next311.12.1, %for.inc38.12.1 ]
%count.1287.12 = phi i32 [ %count.2.11.lcssa, %for.body25.12.preheader.new ], [ %count.2.12.1, %for.inc38.12.1 ]
%niter426 = phi i64 [ 0, %for.body25.12.preheader.new ], [ %niter426.next.1, %for.inc38.12.1 ]
%arrayidx27.12 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv310.12
%97 = load i32, ptr %arrayidx27.12, align 4, !tbaa !5
%cmp28.12 = icmp eq i32 %97, 13
br i1 %cmp28.12, label %if.then.12, label %for.inc38.12
if.then.12: ; preds = %for.body25.12
%idxprom31.12 = sext i32 %count.1287.12 to i64
%arrayidx34.12 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv310.12
%98 = load i8, ptr %arrayidx34.12, align 1, !tbaa !9
%arrayidx36.12 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.12
store i8 %98, ptr %arrayidx36.12, align 1, !tbaa !9
%inc37.12 = add nsw i32 %count.1287.12, 1
br label %for.inc38.12
for.inc38.12: ; preds = %if.then.12, %for.body25.12
%count.2.12 = phi i32 [ %inc37.12, %if.then.12 ], [ %count.1287.12, %for.body25.12 ]
%indvars.iv.next311.12 = add nuw nsw i64 %indvars.iv310.12, 1
%arrayidx27.12.1 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next311.12
%99 = load i32, ptr %arrayidx27.12.1, align 4, !tbaa !5
%cmp28.12.1 = icmp eq i32 %99, 13
br i1 %cmp28.12.1, label %if.then.12.1, label %for.inc38.12.1
if.then.12.1: ; preds = %for.inc38.12
%idxprom31.12.1 = sext i32 %count.2.12 to i64
%arrayidx34.12.1 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next311.12
%100 = load i8, ptr %arrayidx34.12.1, align 1, !tbaa !9
%arrayidx36.12.1 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %idxprom31.12.1
store i8 %100, ptr %arrayidx36.12.1, align 1, !tbaa !9
%inc37.12.1 = add nsw i32 %count.2.12, 1
br label %for.inc38.12.1
for.inc38.12.1: ; preds = %if.then.12.1, %for.inc38.12
%count.2.12.1 = phi i32 [ %inc37.12.1, %if.then.12.1 ], [ %count.2.12, %for.inc38.12 ]
%indvars.iv.next311.12.1 = add nuw nsw i64 %indvars.iv310.12, 2
%niter426.next.1 = add i64 %niter426, 2
%niter426.ncmp.1 = icmp eq i64 %niter426.next.1, %unroll_iter425
br i1 %niter426.ncmp.1, label %for.cond44.preheader.unr-lcssa, label %for.body25.12, !llvm.loop !12
for.cond47.preheader: ; preds = %for.cond47.preheader.preheader, %for.inc79
%indvars.iv317 = phi i64 [ 1, %for.cond47.preheader.preheader ], [ %indvars.iv.next318, %for.inc79 ]
%cmp48.not.not291 = icmp ult i64 %indvars.iv317, %11
br i1 %cmp48.not.not291, label %for.body49.preheader, label %for.inc79
for.body49.preheader: ; preds = %for.cond47.preheader
%.pre = load i32, ptr %arrayidx51.phi.trans.insert, align 4, !tbaa !5
br label %for.body49
for.cond82.preheader: ; preds = %for.inc79
br i1 %cmp24.not285, label %for.end97, label %for.body84
for.body49: ; preds = %for.body49.preheader, %for.inc77
%101 = phi i32 [ %.pre, %for.body49.preheader ], [ %105, %for.inc77 ]
%indvars.iv314 = phi i64 [ %11, %for.body49.preheader ], [ %indvars.iv.next315, %for.inc77 ]
%indvars.iv.next315 = add nsw i64 %indvars.iv314, -1
%arrayidx53 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv.next315
%102 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%cmp54 = icmp slt i32 %101, %102
br i1 %cmp54, label %if.then55, label %for.inc77
if.then55: ; preds = %for.body49
%arrayidx51 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv314
store i32 %102, ptr %arrayidx51, align 4, !tbaa !5
store i32 %101, ptr %arrayidx53, align 4, !tbaa !5
%arrayidx67 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv314
%103 = load i8, ptr %arrayidx67, align 1, !tbaa !9
%arrayidx70 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv.next315
%104 = load i8, ptr %arrayidx70, align 1, !tbaa !9
store i8 %104, ptr %arrayidx67, align 1, !tbaa !9
store i8 %103, ptr %arrayidx70, align 1, !tbaa !9
br label %for.inc77
for.inc77: ; preds = %for.body49, %if.then55
%105 = phi i32 [ %102, %for.body49 ], [ %101, %if.then55 ]
%cmp48.not.not = icmp sgt i64 %indvars.iv.next315, %indvars.iv317
br i1 %cmp48.not.not, label %for.body49, label %for.inc79, !llvm.loop !13
for.inc79: ; preds = %for.inc77, %for.cond47.preheader
%indvars.iv.next318 = add nuw nsw i64 %indvars.iv317, 1
%exitcond321.not = icmp eq i64 %indvars.iv.next318, %wide.trip.count320
br i1 %exitcond321.not, label %for.cond82.preheader, label %for.cond47.preheader, !llvm.loop !14
for.body84: ; preds = %for.cond82.preheader, %for.inc95
%indvars.iv322 = phi i64 [ %indvars.iv.next323, %for.inc95 ], [ 1, %for.cond82.preheader ]
%arrayidx86 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv322
%106 = load i8, ptr %arrayidx86, align 1, !tbaa !9
%conv = sext i8 %106 to i32
%arrayidx88 = getelementptr inbounds [37 x i32], ptr %a1, i64 0, i64 %indvars.iv322
%107 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %107)
%108 = load i32, ptr %n, align 4, !tbaa !5
%109 = zext i32 %108 to i64
%cmp90.not = icmp eq i64 %indvars.iv322, %109
br i1 %cmp90.not, label %for.inc95, label %if.then92
if.then92: ; preds = %for.body84
%putchar282 = call i32 @putchar(i32 32)
%.pre346 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc95
for.inc95: ; preds = %for.body84, %if.then92
%110 = phi i32 [ %108, %for.body84 ], [ %.pre346, %if.then92 ]
%indvars.iv.next323 = add nuw nsw i64 %indvars.iv322, 1
%111 = sext i32 %110 to i64
%cmp83.not.not = icmp slt i64 %indvars.iv322, %111
br i1 %cmp83.not.not, label %for.body84, label %for.end97, !llvm.loop !15
for.end97: ; preds = %for.inc95, %entry, %for.cond20.preheader, %for.cond44.preheader, %for.cond82.preheader
%putchar = call i32 @putchar(i32 10)
%112 = load i32, ptr %n, align 4, !tbaa !5
%cmp100.not297 = icmp slt i32 %112, 1
br i1 %cmp100.not297, label %if.end121, label %for.body102.preheader
for.body102.preheader: ; preds = %for.end97
%113 = add nuw i32 %112, 1
%wide.trip.count328 = zext i32 %113 to i64
br label %for.body102
for.cond99: ; preds = %for.body102
%indvars.iv.next326 = add nuw nsw i64 %indvars.iv325, 1
%exitcond329.not = icmp eq i64 %indvars.iv.next326, %wide.trip.count328
br i1 %exitcond329.not, label %if.end121, label %for.body102, !llvm.loop !16
for.body102: ; preds = %for.body102.preheader, %for.cond99
%indvars.iv325 = phi i64 [ 1, %for.body102.preheader ], [ %indvars.iv.next326, %for.cond99 ]
%arrayidx104 = getelementptr inbounds [37 x i8], ptr %c1, i64 0, i64 %indvars.iv325
%114 = load i8, ptr %arrayidx104, align 1, !tbaa !9
%arrayidx107 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %indvars.iv325
%115 = load i8, ptr %arrayidx107, align 1, !tbaa !9
%cmp109.not = icmp eq i8 %114, %115
br i1 %cmp109.not, label %for.cond99, label %if.end121
if.end121: ; preds = %for.cond99, %for.body102, %for.end97
%str.sink = phi ptr [ @str.9, %for.end97 ], [ @str.8, %for.body102 ], [ @str.9, %for.cond99 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%116 = load i32, ptr %n, align 4, !tbaa !5
%cmp123.not301 = icmp slt i32 %116, 1
br i1 %cmp123.not301, label %for.end177, label %for.cond126.preheader.preheader
for.cond126.preheader.preheader: ; preds = %if.end121
%117 = zext i32 %116 to i64
%118 = add nuw i32 %116, 1
%wide.trip.count336 = zext i32 %118 to i64
br label %for.cond126.preheader
for.cond126.preheader: ; preds = %for.cond126.preheader.preheader, %for.end140
%indvars.iv330 = phi i64 [ 1, %for.cond126.preheader.preheader ], [ %indvars.iv.next331, %for.end140 ]
%119 = trunc i64 %indvars.iv330 to i32
br label %for.body129
for.cond160.preheader: ; preds = %for.end140
br i1 %cmp123.not301, label %for.end177, label %for.body163
for.body129: ; preds = %for.cond126.preheader, %for.body129
%indvars.iv332 = phi i64 [ %indvars.iv330, %for.cond126.preheader ], [ %indvars.iv.next333, %for.body129 ]
%mini.0300 = phi i32 [ %119, %for.cond126.preheader ], [ %spec.select, %for.body129 ]
%arrayidx131 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %indvars.iv332
%120 = load i32, ptr %arrayidx131, align 4, !tbaa !5
%idxprom132 = sext i32 %mini.0300 to i64
%arrayidx133 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %idxprom132
%121 = load i32, ptr %arrayidx133, align 4, !tbaa !5
%cmp134 = icmp slt i32 %120, %121
%122 = trunc i64 %indvars.iv332 to i32
%spec.select = select i1 %cmp134, i32 %122, i32 %mini.0300
%indvars.iv.next333 = add nuw nsw i64 %indvars.iv332, 1
%cmp127.not.not = icmp ult i64 %indvars.iv332, %117
br i1 %cmp127.not.not, label %for.body129, label %for.end140, !llvm.loop !17
for.end140: ; preds = %for.body129
%arrayidx142 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %indvars.iv330
%123 = load i32, ptr %arrayidx142, align 4, !tbaa !5
%idxprom143 = sext i32 %spec.select to i64
%arrayidx144 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %idxprom143
%124 = load i32, ptr %arrayidx144, align 4, !tbaa !5
store i32 %124, ptr %arrayidx142, align 4, !tbaa !5
store i32 %123, ptr %arrayidx144, align 4, !tbaa !5
%arrayidx150 = getelementptr inbounds [37 x i8], ptr %c2, i64 0, i64 %indvars.iv330
%125 = load i8, ptr %arrayidx150, align 1, !tbaa !9
%arrayidx152 = getelementptr inbounds [37 x i8], ptr %c2, i64 0, i64 %idxprom143
%126 = load i8, ptr %arrayidx152, align 1, !tbaa !9
store i8 %126, ptr %arrayidx150, align 1, !tbaa !9
store i8 %125, ptr %arrayidx152, align 1, !tbaa !9
%indvars.iv.next331 = add nuw nsw i64 %indvars.iv330, 1
%exitcond337.not = icmp eq i64 %indvars.iv.next331, %wide.trip.count336
br i1 %exitcond337.not, label %for.cond160.preheader, label %for.cond126.preheader, !llvm.loop !18
for.body163: ; preds = %for.cond160.preheader, %for.inc175
%indvars.iv338 = phi i64 [ %indvars.iv.next339, %for.inc175 ], [ 1, %for.cond160.preheader ]
%arrayidx165 = getelementptr inbounds [37 x i8], ptr %c2, i64 0, i64 %indvars.iv338
%127 = load i8, ptr %arrayidx165, align 1, !tbaa !9
%conv166 = sext i8 %127 to i32
%arrayidx168 = getelementptr inbounds [37 x i32], ptr %a2, i64 0, i64 %indvars.iv338
%128 = load i32, ptr %arrayidx168, align 4, !tbaa !5
%call169 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv166, i32 noundef %128)
%129 = load i32, ptr %n, align 4, !tbaa !5
%130 = zext i32 %129 to i64
%cmp170.not = icmp eq i64 %indvars.iv338, %130
br i1 %cmp170.not, label %for.inc175, label %if.then172
if.then172: ; preds = %for.body163
%putchar281 = call i32 @putchar(i32 32)
%.pre347 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc175
for.inc175: ; preds = %for.body163, %if.then172
%131 = phi i32 [ %129, %for.body163 ], [ %.pre347, %if.then172 ]
%indvars.iv.next339 = add nuw nsw i64 %indvars.iv338, 1
%132 = sext i32 %131 to i64
%cmp161.not.not = icmp slt i64 %indvars.iv338, %132
br i1 %cmp161.not.not, label %for.body163, label %for.end177, !llvm.loop !19
for.end177: ; preds = %for.inc175, %if.end121, %for.cond160.preheader
%putchar278 = call i32 @putchar(i32 10)
%133 = load i32, ptr %n, align 4, !tbaa !5
%cmp180.not305 = icmp slt i32 %133, 1
br i1 %cmp180.not305, label %if.end201, label %for.body182.preheader
for.body182.preheader: ; preds = %for.end177
%134 = add nuw i32 %133, 1
%wide.trip.count344 = zext i32 %134 to i64
br label %for.body182
for.cond179: ; preds = %for.body182
%indvars.iv.next342 = add nuw nsw i64 %indvars.iv341, 1
%exitcond345.not = icmp eq i64 %indvars.iv.next342, %wide.trip.count344
br i1 %exitcond345.not, label %if.end201, label %for.body182, !llvm.loop !20
for.body182: ; preds = %for.body182.preheader, %for.cond179
%indvars.iv341 = phi i64 [ 1, %for.body182.preheader ], [ %indvars.iv.next342, %for.cond179 ]
%arrayidx184 = getelementptr inbounds [37 x i8], ptr %c2, i64 0, i64 %indvars.iv341
%135 = load i8, ptr %arrayidx184, align 1, !tbaa !9
%arrayidx187 = getelementptr inbounds [37 x i8], ptr %c3, i64 0, i64 %indvars.iv341
%136 = load i8, ptr %arrayidx187, align 1, !tbaa !9
%cmp189.not = icmp eq i8 %135, %136
br i1 %cmp189.not, label %for.cond179, label %if.end201
if.end201: ; preds = %for.cond179, %for.body182, %for.end177
%str.8.sink = phi ptr [ @str.9, %for.end177 ], [ @str.8, %for.body182 ], [ @str.9, %for.cond179 ]
%puts279 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %c3) #4
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %c2) #4
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %c1) #4
call void @llvm.lifetime.end.p0(i64 148, ptr nonnull %a2) #4
call void @llvm.lifetime.end.p0(i64 148, ptr nonnull %a1) #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
; 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include <stdio.h>
int main(void)
{
int n,i,j,temp1,x1[100],x2[100],x3[100],mini,count=0,temp3;
char c1[100],c2[100],temp2;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf(" %c%d",&c1[i],&x1[i]);
}
for(i=0;i<n;i++){
c2[i]=c1[i];
x2[i]=x1[i];
x3[i]=i;
}
for (i=0;i<n;i++){
for (j=n-1;j>=i+1;j--){
if (x1[j-1]>x1[j]){
temp1=c1[j];
c1[j]=c1[j-1];
c1[j-1]=temp1;
temp1=x1[j];
x1[j]=x1[j-1];
x1[j-1]=temp1;
}
}
}
for(i=0;i<n;i++){
if(i==n-1)
printf("%c%d\n",c1[i],x1[i]);
else
printf("%c%d ",c1[i],x1[i]);
}
printf("Stable\n");
for (i=0;i<n;i++){
mini=i;
for (j=i;j<n;j++){
if (x2[j]<x2[mini]){
mini=j;
}
}
temp2 = c2[i];
c2[i] = c2[mini];
c2[mini]= temp2;
temp1 = x2[i];
x2[i] = x2[mini];
x2[mini]= temp1;
temp3=x3[i];
x3[i]=x3[mini];
x3[mini]=temp3;
}
for(i=0;i<n;i++){
if(i>0 && x2[i-1]==x2[i] && x3[i-1]>x3[i])
count++;
if(i==n-1)
printf("%c%d\n",c2[i],x2[i]);
else
printf("%c%d ",c2[i],x2[i]);
}
if(count>0)
printf("Not stable\n");
else
printf("Stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113699/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113699/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x1 = alloca [100 x i32], align 16
%x2 = alloca [100 x i32], align 16
%x3 = alloca [100 x i32], align 16
%c1 = alloca [100 x i8], align 16
%c2 = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x3) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c1) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp252 = icmp sgt i32 %0, 0
br i1 %cmp252, label %for.body, label %for.end81
for.cond4.preheader: ; preds = %for.body
%cmp5254 = icmp sgt i32 %6, 0
br i1 %cmp5254, label %for.body6.preheader, label %for.end81
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = zext i32 %6 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %c2, ptr nonnull align 16 %c1, i64 %1, i1 false), !tbaa !9
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %x2, ptr nonnull align 16 %x1, i64 %2, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %6, 8
br i1 %min.iters.check, label %for.body6.preheader315, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %1, 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>
%3 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> %step.add, ptr %4, 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>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.cond20.preheader, label %for.body6.preheader315
for.body6.preheader315: ; preds = %for.body6.preheader, %middle.block
%indvars.iv275.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i8], ptr %c1, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100 x i32], ptr %x1, 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 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !14
for.cond20.preheader: ; preds = %for.body6, %middle.block
br i1 %cmp5254, label %for.cond23.preheader.lr.ph, label %for.end81
for.cond23.preheader.lr.ph: ; preds = %for.cond20.preheader
%8 = zext i32 %6 to i64
%wide.trip.count285 = zext i32 %6 to i64
br label %for.cond23.preheader
for.body6: ; preds = %for.body6.preheader315, %for.body6
%indvars.iv275 = phi i64 [ %indvars.iv.next276, %for.body6 ], [ %indvars.iv275.ph, %for.body6.preheader315 ]
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %indvars.iv275
%9 = trunc i64 %indvars.iv275 to i32
store i32 %9, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next276 = add nuw nsw i64 %indvars.iv275, 1
%exitcond.not = icmp eq i64 %indvars.iv.next276, %1
br i1 %exitcond.not, label %for.cond20.preheader, label %for.body6, !llvm.loop !15
for.cond20.loopexit: ; preds = %for.inc53, %for.cond23.preheader
%exitcond286.not = icmp eq i64 %indvars.iv.next283, %wide.trip.count285
br i1 %exitcond286.not, label %for.cond58.preheader, label %for.cond23.preheader, !llvm.loop !16
for.cond23.preheader: ; preds = %for.cond23.preheader.lr.ph, %for.cond20.loopexit
%indvars.iv282 = phi i64 [ 0, %for.cond23.preheader.lr.ph ], [ %indvars.iv.next283, %for.cond20.loopexit ]
%indvars.iv.next283 = add nuw nsw i64 %indvars.iv282, 1
%cmp24.not.not257 = icmp ult i64 %indvars.iv.next283, %8
br i1 %cmp24.not.not257, label %for.body25, label %for.cond20.loopexit
for.cond58.preheader: ; preds = %for.cond20.loopexit
br i1 %cmp5254, label %for.body61, label %for.end81
for.body25: ; preds = %for.cond23.preheader, %for.inc53
%indvars.iv278 = phi i64 [ %indvars.iv.next279, %for.inc53 ], [ %8, %for.cond23.preheader ]
%indvars.iv.next279 = add nsw i64 %indvars.iv278, -1
%10 = add nsw i64 %indvars.iv278, -2
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %x1, i64 0, i64 %10
%11 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%arrayidx30 = getelementptr inbounds [100 x i32], ptr %x1, i64 0, i64 %indvars.iv.next279
%12 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %11, %12
br i1 %cmp31, label %if.then, label %for.inc53
if.then: ; preds = %for.body25
%arrayidx33 = getelementptr inbounds [100 x i8], ptr %c1, i64 0, i64 %indvars.iv.next279
%13 = load i8, ptr %arrayidx33, align 1, !tbaa !9
%arrayidx36 = getelementptr inbounds [100 x i8], ptr %c1, i64 0, i64 %10
%14 = load i8, ptr %arrayidx36, align 1, !tbaa !9
store i8 %14, ptr %arrayidx33, align 1, !tbaa !9
store i8 %13, ptr %arrayidx36, align 1, !tbaa !9
store i32 %11, ptr %arrayidx30, align 4, !tbaa !5
store i32 %12, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc53
for.inc53: ; preds = %for.body25, %if.then
%cmp24.not.not = icmp sgt i64 %indvars.iv.next279, %indvars.iv.next283
br i1 %cmp24.not.not, label %for.body25, label %for.cond20.loopexit, !llvm.loop !17
for.body61: ; preds = %for.cond58.preheader, %for.body61
%indvars.iv287 = phi i64 [ %indvars.iv.next288, %for.body61 ], [ 0, %for.cond58.preheader ]
%15 = phi i32 [ %19, %for.body61 ], [ %6, %for.cond58.preheader ]
%sub62 = add nsw i32 %15, -1
%16 = zext i32 %sub62 to i64
%cmp63 = icmp eq i64 %indvars.iv287, %16
%arrayidx67 = getelementptr inbounds [100 x i8], ptr %c1, i64 0, i64 %indvars.iv287
%17 = load i8, ptr %arrayidx67, align 1, !tbaa !9
%conv68 = sext i8 %17 to i32
%arrayidx70 = getelementptr inbounds [100 x i32], ptr %x1, i64 0, i64 %indvars.iv287
%18 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%.str.2..str.3 = select i1 %cmp63, ptr @.str.2, ptr @.str.3
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv68, i32 noundef %18)
%indvars.iv.next288 = add nuw nsw i64 %indvars.iv287, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp59 = icmp slt i64 %indvars.iv.next288, %20
br i1 %cmp59, label %for.body61, label %for.end81, !llvm.loop !18
for.end81: ; preds = %for.body61, %entry, %for.cond4.preheader, %for.cond20.preheader, %for.cond58.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp84267 = icmp sgt i32 %21, 0
br i1 %cmp84267, label %for.cond87.preheader.preheader, label %if.else178
for.cond87.preheader.preheader: ; preds = %for.end81
%22 = zext i32 %21 to i64
%wide.trip.count296 = zext i32 %21 to i64
br label %for.cond87.preheader
for.cond87.preheader: ; preds = %for.cond87.preheader.preheader, %for.end101
%indvars.iv290 = phi i64 [ 0, %for.cond87.preheader.preheader ], [ %indvars.iv.next291, %for.end101 ]
%23 = trunc i64 %indvars.iv290 to i32
br label %for.body90
for.cond129.preheader: ; preds = %for.end101
br i1 %cmp84267, label %if.end152.peel, label %if.else178
if.end152.peel: ; preds = %for.cond129.preheader
%cmp154.peel = icmp eq i32 %21, 1
%24 = load i8, ptr %c2, align 16, !tbaa !9
%conv159.peel = sext i8 %24 to i32
%25 = load i32, ptr %x2, align 16, !tbaa !5
%.str.2..str.3312 = select i1 %cmp154.peel, ptr @.str.2, ptr @.str.3
%call162.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3312, i32 noundef %conv159.peel, i32 noundef %25)
%26 = load i32, ptr %n, align 4, !tbaa !5
%cmp130.peel = icmp sgt i32 %26, 1
br i1 %cmp130.peel, label %land.lhs.true, label %if.else178
for.body90: ; preds = %for.cond87.preheader, %for.body90
%indvars.iv292 = phi i64 [ %indvars.iv290, %for.cond87.preheader ], [ %indvars.iv.next293, %for.body90 ]
%mini.0265 = phi i32 [ %23, %for.cond87.preheader ], [ %spec.select, %for.body90 ]
%arrayidx92 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %indvars.iv292
%27 = load i32, ptr %arrayidx92, align 4, !tbaa !5
%idxprom93 = sext i32 %mini.0265 to i64
%arrayidx94 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %idxprom93
%28 = load i32, ptr %arrayidx94, align 4, !tbaa !5
%cmp95 = icmp slt i32 %27, %28
%29 = trunc i64 %indvars.iv292 to i32
%spec.select = select i1 %cmp95, i32 %29, i32 %mini.0265
%indvars.iv.next293 = add nuw nsw i64 %indvars.iv292, 1
%cmp88 = icmp ult i64 %indvars.iv.next293, %22
br i1 %cmp88, label %for.body90, label %for.end101, !llvm.loop !19
for.end101: ; preds = %for.body90
%arrayidx103 = getelementptr inbounds [100 x i8], ptr %c2, i64 0, i64 %indvars.iv290
%30 = load i8, ptr %arrayidx103, align 1, !tbaa !9
%idxprom104 = sext i32 %spec.select to i64
%arrayidx105 = getelementptr inbounds [100 x i8], ptr %c2, i64 0, i64 %idxprom104
%31 = load i8, ptr %arrayidx105, align 1, !tbaa !9
store i8 %31, ptr %arrayidx103, align 1, !tbaa !9
store i8 %30, ptr %arrayidx105, align 1, !tbaa !9
%arrayidx111 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %indvars.iv290
%32 = load i32, ptr %arrayidx111, align 4, !tbaa !5
%arrayidx113 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %idxprom104
%33 = load i32, ptr %arrayidx113, align 4, !tbaa !5
store i32 %33, ptr %arrayidx111, align 4, !tbaa !5
store i32 %32, ptr %arrayidx113, align 4, !tbaa !5
%arrayidx119 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %indvars.iv290
%34 = load i32, ptr %arrayidx119, align 4, !tbaa !5
%arrayidx121 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %idxprom104
%35 = load i32, ptr %arrayidx121, align 4, !tbaa !5
store i32 %35, ptr %arrayidx119, align 4, !tbaa !5
store i32 %34, ptr %arrayidx121, align 4, !tbaa !5
%indvars.iv.next291 = add nuw nsw i64 %indvars.iv290, 1
%exitcond297.not = icmp eq i64 %indvars.iv.next291, %wide.trip.count296
br i1 %exitcond297.not, label %for.cond129.preheader, label %for.cond87.preheader, !llvm.loop !20
land.lhs.true: ; preds = %if.end152.peel, %if.end152
%indvars.iv298 = phi i64 [ %indvars.iv.next299, %if.end152 ], [ 1, %if.end152.peel ]
%36 = phi i32 [ %45, %if.end152 ], [ %26, %if.end152.peel ]
%count.0270 = phi i32 [ %count.1, %if.end152 ], [ 0, %if.end152.peel ]
%37 = add nuw i64 %indvars.iv298, 4294967295
%idxprom136 = and i64 %37, 4294967295
%arrayidx137 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %idxprom136
%38 = load i32, ptr %arrayidx137, align 4, !tbaa !5
%arrayidx139 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %indvars.iv298
%39 = load i32, ptr %arrayidx139, align 4, !tbaa !5
%cmp140 = icmp eq i32 %38, %39
br i1 %cmp140, label %land.lhs.true142, label %if.end152
land.lhs.true142: ; preds = %land.lhs.true
%arrayidx145 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %idxprom136
%40 = load i32, ptr %arrayidx145, align 4, !tbaa !5
%arrayidx147 = getelementptr inbounds [100 x i32], ptr %x3, i64 0, i64 %indvars.iv298
%41 = load i32, ptr %arrayidx147, align 4, !tbaa !5
%cmp148 = icmp sgt i32 %40, %41
%inc151 = zext i1 %cmp148 to i32
%spec.select251 = add nsw i32 %count.0270, %inc151
br label %if.end152
if.end152: ; preds = %land.lhs.true142, %land.lhs.true
%count.1 = phi i32 [ %count.0270, %land.lhs.true ], [ %spec.select251, %land.lhs.true142 ]
%sub153 = add nsw i32 %36, -1
%42 = zext i32 %sub153 to i64
%cmp154 = icmp eq i64 %indvars.iv298, %42
%arrayidx158 = getelementptr inbounds [100 x i8], ptr %c2, i64 0, i64 %indvars.iv298
%43 = load i8, ptr %arrayidx158, align 1, !tbaa !9
%conv159 = sext i8 %43 to i32
%arrayidx161 = getelementptr inbounds [100 x i32], ptr %x2, i64 0, i64 %indvars.iv298
%44 = load i32, ptr %arrayidx161, align 4, !tbaa !5
%.str.2..str.3313 = select i1 %cmp154, ptr @.str.2, ptr @.str.3
%call162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3313, i32 noundef %conv159, i32 noundef %44)
%indvars.iv.next299 = add nuw nsw i64 %indvars.iv298, 1
%45 = load i32, ptr %n, align 4, !tbaa !5
%46 = sext i32 %45 to i64
%cmp130 = icmp slt i64 %indvars.iv.next299, %46
br i1 %cmp130, label %land.lhs.true, label %for.end173, !llvm.loop !21
for.end173: ; preds = %if.end152
%47 = icmp sgt i32 %count.1, 0
br i1 %47, label %if.end180, label %if.else178
if.else178: ; preds = %for.end81, %if.end152.peel, %for.cond129.preheader, %for.end173
br label %if.end180
if.end180: ; preds = %for.end173, %if.else178
%str.6.sink = phi ptr [ @str.6, %if.else178 ], [ @str.7, %for.end173 ]
%puts249 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c2) #5
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c1) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x3) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x1) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 = { nofree nounwind }
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 = !{!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}
!15 = distinct !{!15, !11, !13, !12}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11, !22}
!22 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
int i,j;
Card t;
for(i = 0; i<N; i++) {
for(j = N-1; j >= i; j--) {
if(A[j].value < A[j-1].value) {
t = A[j]; A[j] = A[j-1]; A[j-1] = t;
}
}
}
}
void selection(Card A[], int N) {
int i,j,minj;
Card t;
for(i=0;i<N;i++) {
minj = i;
for(j=i; j<N; j++) {
if(A[j].value < A[minj].value) minj = j;
}
t = A[i]; A[i] = A[minj]; A[minj] = t;
}
}
void print(Card A[], int N) {
int i;
for(i=0; i<N; i++) {
if(i>0) printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
int i;
for(i=0; i<N; i++) {
if(C1[i].suit != C2[i].suit) return 0;
}
return 1;
}
void str2Card(Card *t,char str[]) {
t->suit = str[0];
t->value = str[1] - '0';
}
int main(void) {
Card C1[100], C2[100];
int N,i;
char str[3];
scanf("%d",&N);
for(i=0;i<N; i++) {
scanf("%s",str);
str2Card(&C1[i],str);
}
for(i=0; i<N; i++) C2[i] = C1[i];
bubble(C1,N);
selection(C2,N);
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113741/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113741/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %N, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %N, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%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 ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 !15
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 #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @str2Card(ptr nocapture noundef writeonly %t, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !18
store i8 %0, ptr %t, align 1, !tbaa !14
%arrayidx1 = getelementptr inbounds i8, ptr %str, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !18
%sub = add i8 %1, -48
%value = getelementptr inbounds %struct.Card, ptr %t, i64 0, i32 1
store i8 %sub, ptr %value, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%N = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx1.i = getelementptr inbounds i8, ptr %str, i64 1
br label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp478 = icmp sgt i32 %3, 0
br i1 %cmp478, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %str, align 1, !tbaa !18
store i8 %1, ptr %arrayidx, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx1.i, align 1, !tbaa !18
%sub.i = add i8 %2, -48
%value.i = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %sub.i, ptr %value.i, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !19
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond3.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i31 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i31, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx6.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i33, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i33: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i34 = phi i64 [ %indvars.iv.next.i37, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i34 to i32
br label %for.body3.i35
for.body3.i35: ; preds = %for.body3.i35, %for.cond1.preheader.i33
%indvars.iv41.i = phi i64 [ %indvars.iv.i34, %for.cond1.preheader.i33 ], [ %indvars.iv.next42.i, %for.body3.i35 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i33 ], [ %spec.select.i, %for.body3.i35 ]
%value.i36 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i36, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i35, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i35
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i34
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i34, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %7
br i1 %exitcond.not.i38, label %if.end.peel.i, label %for.cond1.preheader.i33, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %C1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i41 = phi i64 [ %indvars.iv.next.i44, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41
%19 = load i8, ptr %arrayidx.i42, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41, i32 1
%20 = load i8, ptr %value.i43, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i41, 1
%exitcond.not.i45 = icmp eq i64 %indvars.iv.next.i44, %7
br i1 %exitcond.not.i45, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond3.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %N, align 4, !tbaa !19
%cmp13.i46 = icmp sgt i32 %21, 0
br i1 %cmp13.i46, label %if.end.peel.i49, label %print.exit68
if.end.peel.i49: ; preds = %print.exit
%wide.trip.count.i50 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i51 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre17.i52 = load i8, ptr %value.peel.phi.trans.insert.i51, align 1, !tbaa !5
%.pre.i53 = load i8, ptr %C2, align 16, !tbaa !14
%conv.peel.i54 = sext i8 %.pre.i53 to i32
%conv4.peel.i55 = sext i8 %.pre17.i52 to i32
%call5.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i54, i32 noundef %conv4.peel.i55)
%exitcond.peel.not.i57 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i57, label %print.exit68, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i49, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i66, %if.end.i58 ], [ 1, %if.end.peel.i49 ]
%putchar12.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%22 = load i8, ptr %arrayidx.i61, align 2, !tbaa !14
%conv.i62 = sext i8 %22 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%23 = load i8, ptr %value.i63, align 1, !tbaa !5
%conv4.i64 = sext i8 %23 to i32
%call5.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %conv4.i64)
%indvars.iv.next.i66 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i67 = icmp eq i64 %indvars.iv.next.i66, %wide.trip.count.i50
br i1 %exitcond.not.i67, label %print.exit68, label %if.end.i58, !llvm.loop !15
print.exit68: ; preds = %if.end.i58, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit68
%wide.trip.count.i69 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i69
br i1 %exitcond.not.i73, label %if.end, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i70 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i72, %for.cond.i ]
%arrayidx.i71 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i70
%25 = load i8, ptr %arrayidx.i71, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i70
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit68
%str.7.sink = phi ptr [ @str.8, %print.exit68 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress 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 #7 = { nofree nounwind }
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, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!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 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
#include <stdlib.h>
#define false 0
#define true 1
void BubbleSort(int);
void SelectionSort(int);
int isStable(int);
struct tranp{
char picture;
int value;
};
struct tranp card[36],bub[36],sel[36];
int main(){
int N,i;
scanf("%d",&N);
for(i=0;i<N;i++){
//while(1){
scanf(" %c",&card[i].picture);
// if((card[i].picture<'A')&&('Z'<card[i].picture))
// continue;
// else
// break;
//}
scanf("%d",&card[i].value);
bub[i]=sel[i]=card[i];
}
/* for(i=0;i<N;i++){
bub[i].picture=sel[i].picture=card[i].picture;
bub[i].value=sel[i].value=card[i].value;
}*/
BubbleSort(N);
SelectionSort(N);
for(i=0;i<N-1;i++)
printf("%c%d ",bub[i].picture,bub[i].value);
printf("%c%d\n",bub[i].picture,bub[i].value);
printf("Stable\n");
for(i=0;i<N-1;i++)
printf("%c%d ",sel[i].picture,sel[i].value);
printf("%c%d\n",sel[i].picture,sel[i].value);
if(isStable(N)==true)
printf("Stable\n");
else
printf("Not stable\n");
return 0;
}
void BubbleSort(int N){
int i,j;
struct tranp x;
for(i=0;i<N;i++){
for(j=N-1;j>0;j--){
if(bub[j].value<bub[j-1].value){
x=bub[j];
bub[j]=bub[j-1];
bub[j-1]=x;
}
}
}
}
void SelectionSort(int N){
int i,j,minj;
struct tranp x;
for(i=0;i<N;i++){
minj=i;
for(j=i;j<N;j++){
if(sel[j].value<sel[minj].value)
minj=j;
}
if(minj!=i){
x=sel[i];
sel[i]=sel[minj];
sel[minj]=x;
}
}
}
int isStable(int N){
int i;
for(i=0;i<N;i++){
if((bub[i].picture!=sel[i].picture)||(bub[i].value!=sel[i].value))
return false;
}
return true;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113785/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113785/source.c"
target datalayout = "e-m:e-p270: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.tranp = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@card = dso_local global [36 x %struct.tranp] zeroinitializer, align 16
@bub = dso_local local_unnamed_addr global [36 x %struct.tranp] zeroinitializer, align 16
@sel = dso_local local_unnamed_addr global [36 x %struct.tranp] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\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
%cmp92 = icmp sgt i32 %0, 0
br i1 %cmp92, label %for.body, label %for.end23
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.tranp], ptr @card, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%value = getelementptr inbounds [36 x %struct.tranp], ptr @card, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %value)
%arrayidx6 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv
%arrayidx8 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr %arrayidx8, align 8
store i64 %1, ptr %arrayidx6, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%or.cond.i = icmp slt i32 %2, 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
%4 = zext i32 %2 to i64
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.cond1.for.inc19_crit_edge.us.i, %for.cond1.preheader.us.preheader.i
%i.035.us.i = phi i32 [ %inc.us.i, %for.cond1.for.inc19_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 [ %4, %for.cond1.preheader.us.i ], [ %indvars.iv.next.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
%value.us.i = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom.us.i, i32 1
%5 = load i32, ptr %value.us.i, align 4, !tbaa !11
%sub4.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294
%idxprom5.us.i = and i64 %sub4.us.i, 4294967295
%value7.us.i = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom5.us.i, i32 1
%6 = load i32, ptr %value7.us.i, align 4, !tbaa !11
%cmp8.us.i = icmp slt i32 %5, %6
br i1 %cmp8.us.i, label %if.then.us.i, label %for.inc.us.i
if.then.us.i: ; preds = %for.body3.us.i
%arrayidx6.us.i = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom5.us.i
%arrayidx.us.i = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom.us.i
%7 = load i64, ptr %arrayidx.us.i, align 8
%8 = load i64, ptr %arrayidx6.us.i, align 8
store i64 %8, ptr %arrayidx.us.i, align 8
store i64 %7, ptr %arrayidx6.us.i, align 8
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.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.inc19_crit_edge.us.i, !llvm.loop !13
for.cond1.for.inc19_crit_edge.us.i: ; preds = %for.inc.us.i
%inc.us.i = add nuw nsw i32 %i.035.us.i, 1
%exitcond.not.i = icmp eq i32 %inc.us.i, %2
br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond1.preheader.us.i, !llvm.loop !14
BubbleSort.exit: ; preds = %for.cond1.for.inc19_crit_edge.us.i, %for.end
%cmp37.i = icmp sgt i32 %2, 0
br i1 %cmp37.i, label %for.cond1.preheader.preheader.i, label %for.end23
for.cond1.preheader.preheader.i: ; preds = %BubbleSort.exit
%9 = zext i32 %2 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc19.i, %for.cond1.preheader.preheader.i
%indvars.iv.i82 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i83, %for.inc19.i ]
%10 = trunc i64 %indvars.iv.i82 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv39.i = phi i64 [ %indvars.iv.i82, %for.cond1.preheader.i ], [ %indvars.iv.next40.i, %for.body3.i ]
%minj.036.i = phi i32 [ %10, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%value.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv39.i, i32 1
%11 = load i32, ptr %value.i, align 4, !tbaa !11
%idxprom4.i = sext i32 %minj.036.i to i64
%value6.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %idxprom4.i, i32 1
%12 = load i32, ptr %value6.i, align 4, !tbaa !11
%cmp7.i = icmp slt i32 %11, %12
%13 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %13, i32 %minj.036.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next40.i, %9
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !15
for.end.i: ; preds = %for.body3.i
%14 = zext i32 %spec.select.i to i64
%cmp8.not.i = icmp eq i64 %indvars.iv.i82, %14
br i1 %cmp8.not.i, label %for.inc19.i, label %if.then9.i
if.then9.i: ; preds = %for.end.i
%arrayidx11.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv.i82
%15 = load i64, ptr %arrayidx11.i, align 8
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %idxprom14.i
%16 = load i64, ptr %arrayidx15.i, align 8
store i64 %16, ptr %arrayidx11.i, align 8
store i64 %15, ptr %arrayidx15.i, align 8
br label %for.inc19.i
for.inc19.i: ; preds = %if.then9.i, %for.end.i
%indvars.iv.next.i83 = add nuw nsw i64 %indvars.iv.i82, 1
%exitcond.not.i84 = icmp eq i64 %indvars.iv.next.i83, %9
br i1 %exitcond.not.i84, label %SelectionSort.exit, label %for.cond1.preheader.i, !llvm.loop !16
SelectionSort.exit: ; preds = %for.inc19.i
%cmp1295 = icmp sgt i32 %2, 1
br i1 %cmp1295, label %for.body13, label %for.end23
for.body13: ; preds = %SelectionSort.exit, %for.body13
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body13 ], [ 0, %SelectionSort.exit ]
%arrayidx15 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv104
%17 = load i8, ptr %arrayidx15, align 8, !tbaa !17
%conv = sext i8 %17 to i32
%value19 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv104, i32 1
%18 = load i32, ptr %value19, align 4, !tbaa !11
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %18)
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %19, -1
%20 = sext i32 %sub to i64
%cmp12 = icmp slt i64 %indvars.iv.next105, %20
br i1 %cmp12, label %for.body13, label %for.end23.loopexit, !llvm.loop !18
for.end23.loopexit: ; preds = %for.body13
%21 = and i64 %indvars.iv.next105, 4294967295
br label %for.end23
for.end23: ; preds = %entry, %BubbleSort.exit, %for.end23.loopexit, %SelectionSort.exit
%i.1.lcssa = phi i64 [ 0, %SelectionSort.exit ], [ %21, %for.end23.loopexit ], [ 0, %BubbleSort.exit ], [ 0, %entry ]
%arrayidx25 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %i.1.lcssa
%22 = load i8, ptr %arrayidx25, align 8, !tbaa !17
%conv27 = sext i8 %22 to i32
%value30 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %i.1.lcssa, i32 1
%23 = load i32, ptr %value30, align 4, !tbaa !11
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv27, i32 noundef %23)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%24 = load i32, ptr %N, align 4, !tbaa !5
%cmp3599 = icmp sgt i32 %24, 1
br i1 %cmp3599, label %for.body37, label %for.end48
for.body37: ; preds = %for.end23, %for.body37
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.body37 ], [ 0, %for.end23 ]
%arrayidx39 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv107
%25 = load i8, ptr %arrayidx39, align 8, !tbaa !17
%conv41 = sext i8 %25 to i32
%value44 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv107, i32 1
%26 = load i32, ptr %value44, align 4, !tbaa !11
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv41, i32 noundef %26)
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%27 = load i32, ptr %N, align 4, !tbaa !5
%sub34 = add nsw i32 %27, -1
%28 = sext i32 %sub34 to i64
%cmp35 = icmp slt i64 %indvars.iv.next108, %28
br i1 %cmp35, label %for.body37, label %for.end48.loopexit, !llvm.loop !19
for.end48.loopexit: ; preds = %for.body37
%29 = and i64 %indvars.iv.next108, 4294967295
br label %for.end48
for.end48: ; preds = %for.end48.loopexit, %for.end23
%i.2.lcssa = phi i64 [ 0, %for.end23 ], [ %29, %for.end48.loopexit ]
%arrayidx50 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %i.2.lcssa
%30 = load i8, ptr %arrayidx50, align 8, !tbaa !17
%conv52 = sext i8 %30 to i32
%value55 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %i.2.lcssa, i32 1
%31 = load i32, ptr %value55, align 4, !tbaa !11
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv52, i32 noundef %31)
%32 = load i32, ptr %N, align 4, !tbaa !5
%cmp19.i = icmp sgt i32 %32, 0
br i1 %cmp19.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %for.end48
%wide.trip.count.i85 = zext i32 %32 to i64
br label %for.body.i
for.cond.i: ; preds = %lor.lhs.false.i
%indvars.iv.next.i88 = add nuw nsw i64 %indvars.iv.i86, 1
%exitcond.not.i89 = icmp eq i64 %indvars.iv.next.i88, %wide.trip.count.i85
br i1 %exitcond.not.i89, label %if.end, label %for.body.i, !llvm.loop !20
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i86 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i88, %for.cond.i ]
%arrayidx.i = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv.i86
%33 = load i8, ptr %arrayidx.i, align 8, !tbaa !17
%arrayidx2.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv.i86
%34 = load i8, ptr %arrayidx2.i, align 8, !tbaa !17
%cmp5.not.i = icmp eq i8 %33, %34
br i1 %cmp5.not.i, label %lor.lhs.false.i, label %if.end
lor.lhs.false.i: ; preds = %for.body.i
%value.i87 = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv.i86, i32 1
%35 = load i32, ptr %value.i87, align 4, !tbaa !11
%value11.i = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv.i86, i32 1
%36 = load i32, ptr %value11.i, align 4, !tbaa !11
%cmp12.not.i = icmp eq i32 %35, %36
br i1 %cmp12.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %lor.lhs.false.i, %for.body.i, %for.cond.i, %for.end48
%str.6.sink = phi ptr [ @str.7, %for.end48 ], [ @str.7, %for.cond.i ], [ @str.6, %for.body.i ], [ @str.6, %lor.lhs.false.i ]
%puts80 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @BubbleSort(i32 noundef %N) local_unnamed_addr #3 {
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.inc19_crit_edge.us
%i.035.us = phi i32 [ %inc.us, %for.cond1.for.inc19_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 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%value.us = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom.us, i32 1
%1 = load i32, ptr %value.us, align 4, !tbaa !11
%sub4.us = add i64 %indvars.iv, 4294967294
%idxprom5.us = and i64 %sub4.us, 4294967295
%value7.us = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom5.us, i32 1
%2 = load i32, ptr %value7.us, align 4, !tbaa !11
%cmp8.us = icmp slt i32 %1, %2
br i1 %cmp8.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body3.us
%arrayidx6.us = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom5.us
%arrayidx.us = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %idxprom.us
%3 = load i64, ptr %arrayidx.us, align 8
%4 = load i64, ptr %arrayidx6.us, align 8
store i64 %4, ptr %arrayidx.us, align 8
store i64 %3, ptr %arrayidx6.us, align 8
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body3.us
%cmp2.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp2.us, label %for.body3.us, label %for.cond1.for.inc19_crit_edge.us, !llvm.loop !13
for.cond1.for.inc19_crit_edge.us: ; preds = %for.inc.us
%inc.us = add nuw nsw i32 %i.035.us, 1
%exitcond.not = icmp eq i32 %inc.us, %N
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader.us, !llvm.loop !14
for.end20: ; preds = %for.cond1.for.inc19_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @SelectionSort(i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.preheader, label %for.end21
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc19
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.inc19 ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%minj.036 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv39, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !11
%idxprom4 = sext i32 %minj.036 to i64
%value6 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %idxprom4, i32 1
%3 = load i32, ptr %value6, align 4, !tbaa !11
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.036
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body3
%5 = zext i32 %spec.select to i64
%cmp8.not = icmp eq i64 %indvars.iv, %5
br i1 %cmp8.not, label %for.inc19, label %if.then9
if.then9: ; preds = %for.end
%arrayidx11 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv
%6 = load i64, ptr %arrayidx11, align 8
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %idxprom14
%7 = load i64, ptr %arrayidx15, align 8
store i64 %7, ptr %arrayidx11, align 8
store i64 %6, ptr %arrayidx15, align 8
br label %for.inc19
for.inc19: ; preds = %for.end, %if.then9
%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.end21, label %for.cond1.preheader, !llvm.loop !16
for.end21: ; preds = %for.inc19, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isStable(i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp19 = icmp sgt i32 %N, 0
br i1 %cmp19, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %lor.lhs.false
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !20
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 8, !tbaa !17
%arrayidx2 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 8, !tbaa !17
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %lor.lhs.false, label %cleanup
lor.lhs.false: ; preds = %for.body
%value = getelementptr inbounds [36 x %struct.tranp], ptr @bub, i64 0, i64 %indvars.iv, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !11
%value11 = getelementptr inbounds [36 x %struct.tranp], ptr @sel, i64 0, i64 %indvars.iv, i32 1
%3 = load i32, ptr %value11, align 4, !tbaa !11
%cmp12.not = icmp eq i32 %2, %3
br i1 %cmp12.not, label %for.cond, label %cleanup
cleanup: ; preds = %lor.lhs.false, %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ], [ 0, %lor.lhs.false ]
ret i32 %retval.0
}
; 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 #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, 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 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!12, !6, i64 4}
!12 = !{!"tranp", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
typedef struct{
char s;
int n;
} card;
void bubble(card c[], int N)
{
int i, j;
card x;
for (i = 0; i < N; i++)
for (j = N-1; j > i; j--)
if (c[j].n < c[j-1].n){
x = c[j];
c[j] = c[j-1];
c[j-1] = x;
}
}
void selection(card c[], int N)
{
int i, j, min;
card x;
for (i = 0; i < N; i++){
min = i;
for (j = i; j < N; j++)
if (c[j].n < c[min].n)
min = j;
x = c[i];
c[i] = c[min];
c[min] = x;
}
}
int stable(card c1[], card c2[], int N)
{
int i;
for (i = 0; i < N; i++)
if (c1[i].s != c2[i].s)
return 0;
return 1;
}
int main()
{
int i, N;
card c1[36], c2[36];
scanf("%d",&N);
for (i = 0; i < N; i++){
scanf(" %c%d",&c1[i].s,&c1[i].n);
c2[i] = c1[i];
}
bubble(c1,N);
selection(c2,N);
for (i = 0; i < N; i++){
printf("%c%d",c1[i].s,c1[i].n);
if (i < N-1)
printf(" ");
else
printf("\n");
}
printf("Stable\n");
for (i = 0; i < N; i++){
printf("%c%d",c2[i].s,c2[i].n);
if (i < N-1)
printf(" ");
else
printf("\n");
}
if (stable(c1,c2,N) == 0)
printf("Not stable\n");
else
printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113828/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %c, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp40 = icmp sgt i32 %N, 0
br i1 %cmp40, label %for.cond1.preheader.lr.ph, label %for.end20
for.cond1.preheader.lr.ph: ; preds = %entry
%j.036 = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.036 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc19
%indvars.iv48 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next49, %for.inc19 ]
%cmp237 = icmp ult i64 %indvars.iv48, %2
br i1 %cmp237, label %for.body3, label %for.inc19
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next43 = add nsw i64 %indvars.iv42, -1
%n = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv, i32 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = add nsw i64 %indvars.iv42, -2
%n7 = getelementptr inbounds %struct.card, ptr %c, i64 %4, i32 1
%5 = load i32, ptr %n7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %3, %5
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %c, i64 %4
%arrayidx = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv
%6 = load i64, ptr %arrayidx, align 4
%7 = load i64, ptr %arrayidx6, align 4
store i64 %7, ptr %arrayidx, align 4
store i64 %6, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv48
br i1 %cmp2, label %for.body3, label %for.inc19, !llvm.loop !10
for.inc19: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !12
for.end20: ; preds = %for.inc19, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %c, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%min.036 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%n = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv39, i32 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%idxprom4 = sext i32 %min.036 to i64
%n6 = getelementptr inbounds %struct.card, ptr %c, i64 %idxprom4, i32 1
%3 = load i32, ptr %n6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %min.036
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv
%5 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %spec.select to i64
%arrayidx13 = getelementptr inbounds %struct.card, ptr %c, i64 %idxprom12
%6 = load i64, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx9, align 4
store i64 %5, ptr %arrayidx13, align 4
%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.end18, label %for.cond1.preheader, !llvm.loop !14
for.end18: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @stable(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2, i32 noundef %N) local_unnamed_addr #2 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !15
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 4, !tbaa !16
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%c1 = alloca [36 x %struct.card], align 16
%c2 = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %c1) #6
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %c2) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !17
%cmp97 = icmp sgt i32 %0, 0
br i1 %cmp97, label %for.body, label %for.end25
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv
%n = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %n)
%arrayidx5 = getelementptr inbounds [36 x %struct.card], ptr %c2, i64 0, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr %arrayidx5, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !17
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.body
%cmp40.i = icmp sgt i32 %2, 0
br i1 %cmp40.i, label %for.cond1.preheader.lr.ph.i, label %for.end25
for.cond1.preheader.lr.ph.i: ; preds = %for.end
%j.036.i = add nsw i32 %2, -1
%4 = zext i32 %2 to i64
%5 = add nsw i64 %4, -1
%6 = zext i32 %j.036.i to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc19.i, %for.cond1.preheader.lr.ph.i
%indvars.iv48.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next49.i, %for.inc19.i ]
%cmp237.i = icmp ult i64 %indvars.iv48.i, %6
br i1 %cmp237.i, label %for.body3.i, label %for.inc19.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv42.i = phi i64 [ %indvars.iv.next43.i, %for.inc.i ], [ %4, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.next43.i = add nsw i64 %indvars.iv42.i, -1
%n.i = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i, i32 1
%7 = load i32, ptr %n.i, align 4, !tbaa !5
%8 = add nsw i64 %indvars.iv42.i, -2
%n7.i = getelementptr inbounds %struct.card, ptr %c1, i64 %8, i32 1
%9 = load i32, ptr %n7.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %7, %9
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %c1, i64 %8
%arrayidx.i = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i
%10 = load i64, ptr %arrayidx.i, align 8
%11 = load i64, ptr %arrayidx6.i, align 8
store i64 %11, ptr %arrayidx.i, align 8
store i64 %10, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.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.iv48.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc19.i, !llvm.loop !10
for.inc19.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.next49.i = add nuw nsw i64 %indvars.iv48.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next49.i, %4
br i1 %exitcond.not.i, label %for.cond1.preheader.i82, label %for.cond1.preheader.i, !llvm.loop !12
for.cond1.preheader.i82: ; preds = %for.inc19.i, %for.end.i
%indvars.iv.i83 = phi i64 [ %indvars.iv.next.i87, %for.end.i ], [ 0, %for.inc19.i ]
%12 = trunc i64 %indvars.iv.i83 to i32
br label %for.body3.i84
for.body3.i84: ; preds = %for.body3.i84, %for.cond1.preheader.i82
%indvars.iv39.i = phi i64 [ %indvars.iv.i83, %for.cond1.preheader.i82 ], [ %indvars.iv.next40.i, %for.body3.i84 ]
%min.036.i = phi i32 [ %12, %for.cond1.preheader.i82 ], [ %spec.select.i, %for.body3.i84 ]
%n.i85 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv39.i, i32 1
%13 = load i32, ptr %n.i85, align 4, !tbaa !5
%idxprom4.i = sext i32 %min.036.i to i64
%n6.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom4.i, i32 1
%14 = load i32, ptr %n6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %13, %14
%15 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %15, i32 %min.036.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i86 = icmp ult i64 %indvars.iv.next40.i, %4
br i1 %cmp2.i86, label %for.body3.i84, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body3.i84
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i83
%16 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %spec.select.i to i64
%arrayidx13.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom12.i
%17 = load i64, ptr %arrayidx13.i, align 8
store i64 %17, ptr %arrayidx9.i, align 8
store i64 %16, ptr %arrayidx13.i, align 8
%indvars.iv.next.i87 = add nuw nsw i64 %indvars.iv.i83, 1
%exitcond.not.i88 = icmp eq i64 %indvars.iv.next.i87, %4
br i1 %exitcond.not.i88, label %selection.exit, label %for.cond1.preheader.i82, !llvm.loop !14
selection.exit: ; preds = %for.end.i
br i1 %cmp40.i, label %for.body11, label %for.end25
for.body11: ; preds = %selection.exit, %for.body11
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.body11 ], [ 0, %selection.exit ]
%arrayidx13 = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv107
%18 = load i8, ptr %arrayidx13, align 8, !tbaa !16
%conv = sext i8 %18 to i32
%n17 = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv107, i32 1
%19 = load i32, ptr %n17, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%20 = load i32, ptr %N, align 4, !tbaa !17
%sub = add nsw i32 %20, -1
%21 = sext i32 %sub to i64
%cmp19 = icmp slt i64 %indvars.iv107, %21
%. = select i1 %cmp19, i32 32, i32 10
%putchar80 = call i32 @putchar(i32 %.)
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%22 = load i32, ptr %N, align 4, !tbaa !17
%23 = sext i32 %22 to i64
%cmp10 = icmp slt i64 %indvars.iv.next108, %23
br i1 %cmp10, label %for.body11, label %for.end25, !llvm.loop !19
for.end25: ; preds = %for.body11, %entry, %for.end, %selection.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%24 = load i32, ptr %N, align 4, !tbaa !17
%cmp28101 = icmp sgt i32 %24, 0
br i1 %cmp28101, label %for.body30, label %if.end59
for.body30: ; preds = %for.end25, %for.body30
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.body30 ], [ 0, %for.end25 ]
%arrayidx32 = getelementptr inbounds [36 x %struct.card], ptr %c2, i64 0, i64 %indvars.iv110
%25 = load i8, ptr %arrayidx32, align 8, !tbaa !16
%conv34 = sext i8 %25 to i32
%n37 = getelementptr inbounds [36 x %struct.card], ptr %c2, i64 0, i64 %indvars.iv110, i32 1
%26 = load i32, ptr %n37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv34, i32 noundef %26)
%27 = load i32, ptr %N, align 4, !tbaa !17
%sub39 = add nsw i32 %27, -1
%28 = sext i32 %sub39 to i64
%cmp40 = icmp slt i64 %indvars.iv110, %28
%.120 = select i1 %cmp40, i32 32, i32 10
%putchar78 = call i32 @putchar(i32 %.120)
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%29 = load i32, ptr %N, align 4, !tbaa !17
%30 = sext i32 %29 to i64
%cmp28 = icmp slt i64 %indvars.iv.next111, %30
br i1 %cmp28, label %for.body30, label %for.end49, !llvm.loop !20
for.end49: ; preds = %for.body30
%cmp10.i = icmp sgt i32 %29, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end59
for.body.preheader.i: ; preds = %for.end49
%wide.trip.count.i89 = zext i32 %29 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i92 = add nuw nsw i64 %indvars.iv.i90, 1
%exitcond.not.i93 = icmp eq i64 %indvars.iv.next.i92, %wide.trip.count.i89
br i1 %exitcond.not.i93, label %if.end59, label %for.body.i, !llvm.loop !15
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i90 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i92, %for.cond.i ]
%arrayidx.i91 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i90
%31 = load i8, ptr %arrayidx.i91, align 8, !tbaa !16
%arrayidx2.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i90
%32 = load i8, ptr %arrayidx2.i, align 8, !tbaa !16
%cmp5.not.i = icmp eq i8 %31, %32
br i1 %cmp5.not.i, label %for.cond.i, label %if.end59
if.end59: ; preds = %for.cond.i, %for.body.i, %for.end49, %for.end25
%str.7.sink = phi ptr [ @str.7, %for.end25 ], [ @str.7, %for.end49 ], [ @str.8, %for.body.i ], [ @str.7, %for.cond.i ]
%puts76 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %c2) #6
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %c1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #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, !9, i64 4}
!6 = !{!"", !7, i64 0, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = !{!6, !7, i64 0}
!17 = !{!9, !9, i64 0}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
char suit,value;
}Card;
void Bubble(Card A[],int N){
int i,j;
Card f;
for(i=0;i<=N-1;i++){
for(j=N-1;j>i;j--){
if(A[j].value<A[j-1].value){
f = A[j];
A[j]=A[j-1];
A[j-1]=f;
}
}
}
}
void Selection(Card A[], int N){
int i,j,minj,a,b;
Card t;
for(i=0;i<N;i++){
minj=i;
for(j=i;j<N;j++){
if(A[j].value<A[minj].value){
minj=j;
}
}
t =A[i];A[i] = A[minj];A[minj]=t;
}
}
int isStable(Card C1[],Card C2[],int N){
int i;
for(i=0;i<N;i++){
if(C1[i].suit!=C2[i].suit)return 0;
}
return 1;
}
int main(){
int i,j,N;
Card C1[100],C2[100];
char as,s[3];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%s",s);
C1[i].suit=s[0];
C1[i].value=s[1];
}
for(i=0;i<N;i++)C2[i]=C1[i];
Bubble(C1,N);
Selection(C2,N);
for(i=0;i<N-1;i++){
s[0]=C1[i].suit;
s[1]=C1[i].value;
printf("%s ",s);
}
s[0]=C1[i].suit;
s[1]=C1[i].value;
printf("%s\n",s);
printf("Stable\n");
for(i=0;i<N-1;i++){
s[0]=C2[i].suit;
s[1]=C2[i].value;
printf("%s ",s);
}
s[0]=C2[i].suit;
s[1]=C2[i].value;
printf("%s\n",s);
if(isStable(C1,C2,N)){
printf("Stable\n");
}
else{
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113871/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @Bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not.not43 = icmp sgt i32 %N, 0
br i1 %cmp.not.not43, label %for.cond2.preheader.lr.ph, label %for.end23
for.cond2.preheader.lr.ph: ; preds = %entry
%j.039 = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.039 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.inc22
%indvars.iv51 = phi i64 [ 0, %for.cond2.preheader.lr.ph ], [ %indvars.iv.next52, %for.inc22 ]
%cmp340 = icmp ult i64 %indvars.iv51, %2
br i1 %cmp340, label %for.body4, label %for.inc22
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc ], [ %0, %for.cond2.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond2.preheader ]
%indvars.iv.next46 = add nsw i64 %indvars.iv45, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%3 = load i8, ptr %value, align 1, !tbaa !5
%4 = add nsw i64 %indvars.iv45, -2
%value8 = getelementptr inbounds %struct.Card, ptr %A, i64 %4, i32 1
%5 = load i8, ptr %value8, align 1, !tbaa !5
%cmp10 = icmp slt i8 %3, %5
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.Card, ptr %A, i64 %4
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%6 = load i16, ptr %arrayidx, align 1
%7 = load i16, ptr %arrayidx7, align 1
store i16 %7, ptr %arrayidx, align 1
store i16 %6, ptr %arrayidx7, align 1
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv51
br i1 %cmp3, label %for.body4, label %for.inc22, !llvm.loop !9
for.inc22: ; preds = %for.inc, %for.cond2.preheader
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
br i1 %exitcond.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc22, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @Selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.037 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.037 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.037
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !14
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !15
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !15
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%N = alloca i32, align 4
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #7
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !16
%cmp113 = icmp sgt i32 %0, 0
br i1 %cmp113, label %for.body.lr.ph, label %for.end33
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
br label %for.body
for.cond6.preheader: ; preds = %for.body
%cmp7115 = icmp sgt i32 %3, 0
br i1 %cmp7115, label %for.cond2.preheader.lr.ph.i, label %for.end33
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%1 = load i8, ptr %s, align 1, !tbaa !18
%arrayidx2 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx2, align 2, !tbaa !15
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !18
%value = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %2, ptr %value, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !16
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !19
for.cond2.preheader.lr.ph.i: ; preds = %for.cond6.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%j.039.i = add nsw i32 %3, -1
%7 = zext i32 %3 to i64
%8 = add nsw i64 %7, -1
%9 = zext i32 %j.039.i to i64
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc22.i, %for.cond2.preheader.lr.ph.i
%indvars.iv51.i = phi i64 [ 0, %for.cond2.preheader.lr.ph.i ], [ %indvars.iv.next52.i, %for.inc22.i ]
%cmp340.i = icmp ult i64 %indvars.iv51.i, %9
br i1 %cmp340.i, label %for.body4.i, label %for.inc22.i
for.body4.i: ; preds = %for.cond2.preheader.i, %for.inc.i
%indvars.iv45.i = phi i64 [ %indvars.iv.next46.i, %for.inc.i ], [ %7, %for.cond2.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %8, %for.cond2.preheader.i ]
%indvars.iv.next46.i = add nsw i64 %indvars.iv45.i, -1
%value.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i, i32 1
%10 = load i8, ptr %value.i, align 1, !tbaa !5
%11 = add nsw i64 %indvars.iv45.i, -2
%value8.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %11, i32 1
%12 = load i8, ptr %value8.i, align 1, !tbaa !5
%cmp10.i = icmp slt i8 %10, %12
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %11
%arrayidx.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i
%13 = load i16, ptr %arrayidx.i, align 2
%14 = load i16, ptr %arrayidx7.i, align 2
store i16 %14, ptr %arrayidx.i, align 2
store i16 %13, ptr %arrayidx7.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv51.i
br i1 %cmp3.i, label %for.body4.i, label %for.inc22.i, !llvm.loop !9
for.inc22.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.next52.i = add nuw nsw i64 %indvars.iv51.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next52.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i, label %for.cond2.preheader.i, !llvm.loop !11
for.cond1.preheader.i: ; preds = %for.inc22.i, %for.end.i
%indvars.iv.i101 = phi i64 [ %indvars.iv.next.i103, %for.end.i ], [ 0, %for.inc22.i ]
%15 = trunc i64 %indvars.iv.i101 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv41.i = phi i64 [ %indvars.iv.i101, %for.cond1.preheader.i ], [ %indvars.iv.next42.i, %for.body3.i ]
%minj.037.i = phi i32 [ %15, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%value.i102 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%16 = load i8, ptr %value.i102, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.037.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%17 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %16, %17
%18 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %18, i32 %minj.037.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i101
%19 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%20 = load i16, ptr %arrayidx15.i, align 2
store i16 %20, ptr %arrayidx11.i, align 2
store i16 %19, ptr %arrayidx15.i, align 2
%indvars.iv.next.i103 = add nuw nsw i64 %indvars.iv.i101, 1
%exitcond.not.i104 = icmp eq i64 %indvars.iv.next.i103, %7
br i1 %exitcond.not.i104, label %Selection.exit, label %for.cond1.preheader.i, !llvm.loop !13
Selection.exit: ; preds = %for.end.i
%cmp19118 = icmp sgt i32 %3, 1
br i1 %cmp19118, label %for.body20.lr.ph, label %for.end33
for.body20.lr.ph: ; preds = %Selection.exit
%arrayidx28 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
br label %for.body20
for.body20: ; preds = %for.body20.lr.ph, %for.body20
%indvars.iv130 = phi i64 [ 0, %for.body20.lr.ph ], [ %indvars.iv.next131, %for.body20 ]
%arrayidx22 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv130
%21 = load i8, ptr %arrayidx22, align 2, !tbaa !15
store i8 %21, ptr %s, align 1, !tbaa !18
%value27 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv130, i32 1
%22 = load i8, ptr %value27, align 1, !tbaa !5
store i8 %22, ptr %arrayidx28, align 1, !tbaa !18
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %s)
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%23 = load i32, ptr %N, align 4, !tbaa !16
%sub = add nsw i32 %23, -1
%24 = sext i32 %sub to i64
%cmp19 = icmp slt i64 %indvars.iv.next131, %24
br i1 %cmp19, label %for.body20, label %for.end33.loopexit, !llvm.loop !20
for.end33.loopexit: ; preds = %for.body20
%25 = and i64 %indvars.iv.next131, 4294967295
br label %for.end33
for.end33: ; preds = %for.cond6.preheader, %entry, %for.end33.loopexit, %Selection.exit
%i.2.lcssa = phi i64 [ 0, %Selection.exit ], [ %25, %for.end33.loopexit ], [ 0, %entry ], [ 0, %for.cond6.preheader ]
%arrayidx35 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %i.2.lcssa
%26 = load i8, ptr %arrayidx35, align 2, !tbaa !15
store i8 %26, ptr %s, align 1, !tbaa !18
%value40 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %i.2.lcssa, i32 1
%27 = load i8, ptr %value40, align 1, !tbaa !5
%arrayidx41 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
store i8 %27, ptr %arrayidx41, align 1, !tbaa !18
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%puts96 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%28 = load i32, ptr %N, align 4, !tbaa !16
%cmp47122 = icmp sgt i32 %28, 1
br i1 %cmp47122, label %for.body48, label %for.end61
for.body48: ; preds = %for.end33, %for.body48
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.body48 ], [ 0, %for.end33 ]
%arrayidx50 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv133
%29 = load i8, ptr %arrayidx50, align 2, !tbaa !15
store i8 %29, ptr %s, align 1, !tbaa !18
%value55 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv133, i32 1
%30 = load i8, ptr %value55, align 1, !tbaa !5
store i8 %30, ptr %arrayidx41, align 1, !tbaa !18
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %s)
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%31 = load i32, ptr %N, align 4, !tbaa !16
%sub46 = add nsw i32 %31, -1
%32 = sext i32 %sub46 to i64
%cmp47 = icmp slt i64 %indvars.iv.next134, %32
br i1 %cmp47, label %for.body48, label %for.end61.loopexit, !llvm.loop !21
for.end61.loopexit: ; preds = %for.body48
%33 = and i64 %indvars.iv.next134, 4294967295
br label %for.end61
for.end61: ; preds = %for.end61.loopexit, %for.end33
%i.3.lcssa = phi i64 [ 0, %for.end33 ], [ %33, %for.end61.loopexit ]
%arrayidx63 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %i.3.lcssa
%34 = load i8, ptr %arrayidx63, align 2, !tbaa !15
store i8 %34, ptr %s, align 1, !tbaa !18
%value68 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %i.3.lcssa, i32 1
%35 = load i8, ptr %value68, align 1, !tbaa !5
store i8 %35, ptr %arrayidx41, align 1, !tbaa !18
%puts97 = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%36 = load i32, ptr %N, align 4, !tbaa !16
%cmp10.i105 = icmp sgt i32 %36, 0
br i1 %cmp10.i105, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %for.end61
%wide.trip.count.i106 = zext i32 %36 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i109 = add nuw nsw i64 %indvars.iv.i107, 1
%exitcond.not.i110 = icmp eq i64 %indvars.iv.next.i109, %wide.trip.count.i106
br i1 %exitcond.not.i110, label %if.end, label %for.body.i, !llvm.loop !14
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i107 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i109, %for.cond.i ]
%arrayidx.i108 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i107
%37 = load i8, ptr %arrayidx.i108, align 2, !tbaa !15
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i107
%38 = load i8, ptr %arrayidx2.i, align 2, !tbaa !15
%cmp5.not.i = icmp eq i8 %37, %38
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %for.end61
%str.6.sink = phi ptr [ @str.7, %for.end61 ], [ @str.7, %for.cond.i ], [ @str.6, %for.body.i ]
%puts98 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <string.h>
#define NUM 36
int myatoi(char);
int main()
{
char a[NUM][5],b[NUM][5],d[5];
int c[NUM],f[NUM],n;
int i,j,k = 0,flag = 1,minj = 0;
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%s",a[i]);
strcpy(b[i],a[i]);
c[i] = myatoi(a[i][1]);
f[i] = c[i];
}
while(flag){
flag = 0;
for(j = i-1;j > 0;j--){
if(c[j] < c[j-1]){
strcpy(d,a[j-1]);
strcpy(a[j-1],a[j]);
strcpy(a[j],d);
k = c[j];
c[j] = c[j-1];
c[j-1] = k;
flag = 1;
}
}
}
printf("%s",a[0]);
for(i = 1;i < n;i++){
printf(" %s",a[i]);
}
printf("\n");
printf("Stable\n");
for(i = 0;i < n;i++){
minj = i;
for(j = i;j < n;j++){
if(f[j] < f[minj]) minj = j;
}
if(i != minj){
strcpy(d,b[i]);
strcpy(b[i],b[minj]);
strcpy(b[minj],d);
k = f[i];
f[i] = f[minj];
f[minj] = k;
}
}
printf("%s",b[0]);
for(i = 1;i < n;i++){
printf(" %s",b[i]);
}
printf("\n");
for(i = 0;i < n;i++){
k = strcmp(a[i],b[i]);
if(k != 0) break;
}
if(k == 0) printf("Stable\n");
else printf("Not stable\n");
return 0;
}
int myatoi(char x)
{
if(x == '1') return 1;
if(x == '2') return 2;
if(x == '3') return 3;
if(x == '4') return 4;
if(x == '5') return 5;
if(x == '6') return 6;
if(x == '7') return 7;
if(x == '8') return 8;
if(x == '9') return 9;
else return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [36 x [5 x i8]], align 16
%b = alloca [36 x [5 x i8]], align 16
%d = alloca [5 x i8], align 1
%c = alloca [36 x i32], align 16
%f = alloca [36 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 180, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 180, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %d) #7
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %c) #7
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %f) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp213 = icmp sgt i32 %0, 0
br i1 %cmp213, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%1 = trunc i64 %indvars.iv.next to i32
%cmp20216 = icmp sgt i32 %1, 1
br i1 %cmp20216, label %for.cond19.preheader.us.preheader, label %while.end
for.cond19.preheader.us.preheader: ; preds = %while.cond.preheader
%2 = and i64 %indvars.iv.next, 4294967295
br label %for.body21.us
for.body21.us: ; preds = %for.body21.us.backedge, %for.cond19.preheader.us.preheader
%indvars.iv238 = phi i64 [ %2, %for.cond19.preheader.us.preheader ], [ %indvars.iv238.be, %for.body21.us.backedge ]
%flag.1219.us = phi i32 [ 0, %for.cond19.preheader.us.preheader ], [ %flag.1219.us.be, %for.body21.us.backedge ]
%k.1218.us = phi i32 [ 0, %for.cond19.preheader.us.preheader ], [ %k.2.us, %for.body21.us.backedge ]
%indvars.iv.next239 = add nsw i64 %indvars.iv238, -1
%arrayidx23.us = getelementptr inbounds [36 x i32], ptr %c, i64 0, i64 %indvars.iv.next239
%3 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
%4 = add nsw i64 %indvars.iv238, -2
%arrayidx26.us = getelementptr inbounds [36 x i32], ptr %c, i64 0, i64 %4
%5 = load i32, ptr %arrayidx26.us, align 4, !tbaa !5
%cmp27.us = icmp slt i32 %3, %5
br i1 %cmp27.us, label %if.then.us, label %for.inc57.us
if.then.us: ; preds = %for.body21.us
%arrayidx31.us = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %4
%call33.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %d, ptr noundef nonnull dereferenceable(1) %arrayidx31.us) #7
%arrayidx39.us = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv.next239
%call41.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx31.us, ptr noundef nonnull dereferenceable(1) %arrayidx39.us) #7
%call46.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx39.us, ptr noundef nonnull dereferenceable(1) %d) #7
store i32 %5, ptr %arrayidx23.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx26.us, align 4, !tbaa !5
br label %for.inc57.us
for.inc57.us: ; preds = %if.then.us, %for.body21.us
%k.2.us = phi i32 [ %3, %if.then.us ], [ %k.1218.us, %for.body21.us ]
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.1219.us, %for.body21.us ]
%cmp20.us = icmp sgt i64 %indvars.iv238, 2
br i1 %cmp20.us, label %for.body21.us.backedge, label %for.cond19.while.cond.loopexit_crit_edge.us
for.body21.us.backedge: ; preds = %for.inc57.us, %for.cond19.while.cond.loopexit_crit_edge.us
%indvars.iv238.be = phi i64 [ %indvars.iv.next239, %for.inc57.us ], [ %2, %for.cond19.while.cond.loopexit_crit_edge.us ]
%flag.1219.us.be = phi i32 [ %flag.2.us, %for.inc57.us ], [ 0, %for.cond19.while.cond.loopexit_crit_edge.us ]
br label %for.body21.us, !llvm.loop !9
for.cond19.while.cond.loopexit_crit_edge.us: ; preds = %for.inc57.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %while.end, label %for.body21.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [36 x [5 x i8]], ptr %b, i64 0, i64 %indvars.iv
%call8 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx3, ptr noundef nonnull dereferenceable(1) %arrayidx) #7
%arrayidx11 = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv, i64 1
%6 = load i8, ptr %arrayidx11, align 1, !tbaa !11
%switch.tableidx = add i8 %6, -49
%7 = icmp ult i8 %switch.tableidx, 9
%switch.idx.cast = zext i8 %switch.tableidx to i32
%switch.offset = add nuw nsw i32 %switch.idx.cast, 1
%retval.0.i = select i1 %7, i32 %switch.offset, i32 0
%arrayidx14 = getelementptr inbounds [36 x i32], ptr %c, i64 0, i64 %indvars.iv
store i32 %retval.0.i, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [36 x i32], ptr %f, i64 0, i64 %indvars.iv
store i32 %retval.0.i, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.cond19.while.cond.loopexit_crit_edge.us, %entry, %while.cond.preheader
%.us-phi = phi i32 [ 0, %while.cond.preheader ], [ 0, %entry ], [ %k.2.us, %for.cond19.while.cond.loopexit_crit_edge.us ]
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %a)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp63224 = icmp sgt i32 %10, 1
br i1 %cmp63224, label %for.body64, label %for.end71
for.body64: ; preds = %while.end, %for.body64
%indvars.iv242 = phi i64 [ %indvars.iv.next243, %for.body64 ], [ 1, %while.end ]
%arrayidx66 = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv242
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx66)
%indvars.iv.next243 = add nuw nsw i64 %indvars.iv242, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp63 = icmp slt i64 %indvars.iv.next243, %12
br i1 %cmp63, label %for.body64, label %for.end71, !llvm.loop !13
for.end71: ; preds = %for.body64, %while.end
%putchar = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp75228 = icmp sgt i32 %13, 0
br i1 %cmp75228, label %for.cond77.preheader.preheader, label %for.end120
for.cond77.preheader.preheader: ; preds = %for.end71
%14 = zext i32 %13 to i64
%wide.trip.count = zext i32 %13 to i64
br label %for.cond77.preheader
for.cond77.preheader: ; preds = %for.cond77.preheader.preheader, %for.inc118
%indvars.iv245 = phi i64 [ 0, %for.cond77.preheader.preheader ], [ %indvars.iv.next246, %for.inc118 ]
%k.3230 = phi i32 [ %.us-phi, %for.cond77.preheader.preheader ], [ %k.4, %for.inc118 ]
%15 = trunc i64 %indvars.iv245 to i32
br label %for.body79
for.body79: ; preds = %for.cond77.preheader, %for.body79
%indvars.iv247 = phi i64 [ %indvars.iv245, %for.cond77.preheader ], [ %indvars.iv.next248, %for.body79 ]
%minj.0227 = phi i32 [ %15, %for.cond77.preheader ], [ %spec.select, %for.body79 ]
%arrayidx81 = getelementptr inbounds [36 x i32], ptr %f, i64 0, i64 %indvars.iv247
%16 = load i32, ptr %arrayidx81, align 4, !tbaa !5
%idxprom82 = sext i32 %minj.0227 to i64
%arrayidx83 = getelementptr inbounds [36 x i32], ptr %f, i64 0, i64 %idxprom82
%17 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%cmp84 = icmp slt i32 %16, %17
%18 = trunc i64 %indvars.iv247 to i32
%spec.select = select i1 %cmp84, i32 %18, i32 %minj.0227
%indvars.iv.next248 = add nuw nsw i64 %indvars.iv247, 1
%cmp78 = icmp ult i64 %indvars.iv.next248, %14
br i1 %cmp78, label %for.body79, label %for.end89, !llvm.loop !14
for.end89: ; preds = %for.body79
%19 = zext i32 %spec.select to i64
%cmp90.not = icmp eq i64 %indvars.iv245, %19
br i1 %cmp90.not, label %for.inc118, label %if.then91
if.then91: ; preds = %for.end89
%arrayidx94 = getelementptr inbounds [36 x [5 x i8]], ptr %b, i64 0, i64 %indvars.iv245
%call96 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %d, ptr noundef nonnull dereferenceable(1) %arrayidx94) #7
%idxprom100 = sext i32 %spec.select to i64
%arrayidx101 = getelementptr inbounds [36 x [5 x i8]], ptr %b, i64 0, i64 %idxprom100
%call103 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx94, ptr noundef nonnull dereferenceable(1) %arrayidx101) #7
%call108 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx101, ptr noundef nonnull dereferenceable(1) %d) #7
%arrayidx110 = getelementptr inbounds [36 x i32], ptr %f, i64 0, i64 %indvars.iv245
%20 = load i32, ptr %arrayidx110, align 4, !tbaa !5
%arrayidx112 = getelementptr inbounds [36 x i32], ptr %f, i64 0, i64 %idxprom100
%21 = load i32, ptr %arrayidx112, align 4, !tbaa !5
store i32 %21, ptr %arrayidx110, align 4, !tbaa !5
store i32 %20, ptr %arrayidx112, align 4, !tbaa !5
br label %for.inc118
for.inc118: ; preds = %for.end89, %if.then91
%k.4 = phi i32 [ %20, %if.then91 ], [ %k.3230, %for.end89 ]
%indvars.iv.next246 = add nuw nsw i64 %indvars.iv245, 1
%exitcond.not = icmp eq i64 %indvars.iv.next246, %wide.trip.count
br i1 %exitcond.not, label %for.end120, label %for.cond77.preheader, !llvm.loop !15
for.end120: ; preds = %for.inc118, %for.end71
%k.3.lcssa = phi i32 [ %.us-phi, %for.end71 ], [ %k.4, %for.inc118 ]
%call123 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %b)
%22 = load i32, ptr %n, align 4, !tbaa !5
%cmp125232 = icmp sgt i32 %22, 1
br i1 %cmp125232, label %for.body126, label %for.end133
for.body126: ; preds = %for.end120, %for.body126
%indvars.iv251 = phi i64 [ %indvars.iv.next252, %for.body126 ], [ 1, %for.end120 ]
%arrayidx128 = getelementptr inbounds [36 x [5 x i8]], ptr %b, i64 0, i64 %indvars.iv251
%call130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx128)
%indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp125 = icmp slt i64 %indvars.iv.next252, %24
br i1 %cmp125, label %for.body126, label %for.end133, !llvm.loop !16
for.end133: ; preds = %for.body126, %for.end120
%putchar207 = call i32 @putchar(i32 10)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp136234 = icmp sgt i32 %25, 0
br i1 %cmp136234, label %for.body137.preheader, label %for.end150
for.body137.preheader: ; preds = %for.end133
%wide.trip.count257 = zext i32 %25 to i64
br label %for.body137
for.cond135: ; preds = %for.body137
%indvars.iv.next255 = add nuw nsw i64 %indvars.iv254, 1
%exitcond258.not = icmp eq i64 %indvars.iv.next255, %wide.trip.count257
br i1 %exitcond258.not, label %if.end155, label %for.body137, !llvm.loop !17
for.body137: ; preds = %for.body137.preheader, %for.cond135
%indvars.iv254 = phi i64 [ 0, %for.body137.preheader ], [ %indvars.iv.next255, %for.cond135 ]
%arrayidx139 = getelementptr inbounds [36 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv254
%arrayidx142 = getelementptr inbounds [36 x [5 x i8]], ptr %b, i64 0, i64 %indvars.iv254
%call144 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx139, ptr noundef nonnull dereferenceable(1) %arrayidx142) #8
%cmp145.not = icmp eq i32 %call144, 0
br i1 %cmp145.not, label %for.cond135, label %if.else
for.end150: ; preds = %for.end133
%26 = icmp eq i32 %k.3.lcssa, 0
br i1 %26, label %if.end155, label %if.else
if.else: ; preds = %for.body137, %for.end150
br label %if.end155
if.end155: ; preds = %for.cond135, %for.end150, %if.else
%str.6.sink = phi ptr [ @str.6, %if.else ], [ @str.7, %for.end150 ], [ @str.7, %for.cond135 ]
%puts208 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %f) #7
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %d) #7
call void @llvm.lifetime.end.p0(i64 180, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 180, 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 nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @myatoi(i8 noundef signext %x) local_unnamed_addr #4 {
entry:
%switch.tableidx = add i8 %x, -49
%0 = icmp ult i8 %switch.tableidx, 9
%switch.idx.cast = zext i8 %switch.tableidx to i32
%switch.offset = add nuw nsw i32 %switch.idx.cast, 1
%retval.0 = select i1 %0, i32 %switch.offset, i32 0
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(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 #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
typedef struct card
{
char a;
int b;
}card_in;
void BubbleSort(card_in C[],int N)
{
int i,j;
card_in temp[N];
for(i=0;i<N;i++)
{
for(j=N-1;j>=i+1;j--)
{
if(C[j].b<C[j-1].b)
{
temp[j]=C[j];
C[j]=C[j-1];
C[j-1]=temp[j];
}
}
}
}
void SelectionSort(card_in C[],int N)
{
int i,minj,j;
card_in temp[N];
for(i=0;i<N;i++)
{
minj=i;
for(j=i;j<N;j++)
{
if(C[j].b<C[minj].b)
{
minj=j;
}
}
temp[i]=C[i];
C[i]=C[minj];
C[minj]=temp[i];
}
}
void isStable(card_in in[],card_in out[],int N)
{
int i,j,a,b;
int c=0;
for(i=0;i<N;i++)
{
for(j=i+1;j<N;j++)
{
for(a=0;a<N;a++)
{
for(b=a+1;b<N;b++)
{
if((in[i].b==in[j].b)&&(in[i].a==out[b].a)&&(in[i].b==out[b].b)&&(in[j].a==out[a].a)&&(in[j].b==out[a].b))
{
if(c>=1)
{
break;
}
printf("Not stable\n");
c++;
break;
}
}
}
}
}
if(c==0) printf("Stable\n");
}
int main(void)
{
int n;
int i;
scanf("%d",&n);
card_in C1[n];
card_in C2[n];
card_in C3[n];
for(i=0;i<n;i++)
{
scanf(" %c%d",&C1[i].a,&C1[i].b);
}
for(i=0;i<n;i++)
{
C2[i]=C1[i];
C3[i]=C1[i];
}
BubbleSort(C1,n);
for(i=0;i<n;i++)
{
if(i!=0)
{
printf(" ");
}
printf("%c%d",C1[i].a,C1[i].b);
}printf("\n");
isStable(C1,C3,n);
SelectionSort(C2,n);
for(i=0;i<n;i++)
{
if(i!=0)
{
printf(" ");
}
printf("%c%d",C2[i].a,C2[i].b);
}printf("\n");
isStable(C2,C3,n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113958/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i32 }
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp47 = icmp sgt i32 %N, 0
br i1 %cmp47, label %for.cond1.preheader.lr.ph, label %for.end24
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.cond1.preheader, !llvm.loop !5
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv51 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next52, %for.cond.loopexit ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%cmp2.not.not44 = icmp ult i64 %indvars.iv.next52, %0
br i1 %cmp2.not.not44, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%b = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next, i32 1
%1 = load i32, ptr %b, align 4, !tbaa !7
%2 = add nsw i64 %indvars.iv, -2
%b7 = getelementptr inbounds %struct.card, ptr %C, i64 %2, i32 1
%3 = load i32, ptr %b7, align 4, !tbaa !7
%cmp8 = icmp slt i32 %1, %3
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %C, i64 %2
%4 = load <2 x i64>, ptr %arrayidx6, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next52
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !12
for.end24: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp44 = icmp sgt i32 %N, 0
br i1 %cmp44, label %for.cond1.preheader.preheader, label %for.end22
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv46 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next47, %for.body3 ]
%minj.043 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%b = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv46, i32 1
%2 = load i32, ptr %b, align 4, !tbaa !7
%idxprom4 = sext i32 %minj.043 to i64
%b6 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4, i32 1
%3 = load i32, ptr %b6, align 4, !tbaa !7
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv46 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.043
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp2 = icmp ult i64 %indvars.iv.next47, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
%5 = load i64, ptr %arrayidx11, align 4
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom14
%6 = load i64, ptr %arrayidx15, align 4
store i64 %6, ptr %arrayidx11, align 4
store i64 %5, ptr %arrayidx15, align 4
%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.end22, label %for.cond1.preheader, !llvm.loop !14
for.end22: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @isStable(ptr nocapture noundef readonly %in, ptr nocapture noundef readonly %out, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp119 = icmp sgt i32 %N, 0
br i1 %cmp119, label %for.body.us.preheader, label %if.then70
for.body.us.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count143 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv140 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next141, %for.cond.loopexit.us ]
%indvars.iv133 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next134, %for.cond.loopexit.us ]
%c.0121.us = phi i32 [ 0, %for.body.us.preheader ], [ %c.1.lcssa.us, %for.cond.loopexit.us ]
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%cmp2109.us = icmp ult i64 %indvars.iv.next141, %0
br i1 %cmp2109.us, label %for.cond4.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond4.for.inc62_crit_edge.us.us, %for.body.us
%c.1.lcssa.us = phi i32 [ %c.0121.us, %for.body.us ], [ %c.3.us.us, %for.cond4.for.inc62_crit_edge.us.us ]
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond144.not = icmp eq i64 %indvars.iv.next141, %wide.trip.count143
br i1 %exitcond144.not, label %for.end67, label %for.body.us, !llvm.loop !15
for.cond4.preheader.lr.ph.us: ; preds = %for.body.us
%b11.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv140, i32 1
%arrayidx.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv140
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc62_crit_edge.us.us, %for.cond4.preheader.lr.ph.us
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.cond4.for.inc62_crit_edge.us.us ], [ %indvars.iv133, %for.cond4.preheader.lr.ph.us ]
%c.1111.us.us = phi i32 [ %c.3.us.us, %for.cond4.for.inc62_crit_edge.us.us ], [ %c.0121.us, %for.cond4.preheader.lr.ph.us ]
%arrayidx13.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv135
%b14.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv135, i32 1
br label %for.body6.us.us
for.body6.us.us: ; preds = %for.inc59.us.us, %for.cond4.preheader.us.us
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc59.us.us ], [ 0, %for.cond4.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc59.us.us ], [ 1, %for.cond4.preheader.us.us ]
%c.2108.us.us = phi i32 [ %c.3.us.us, %for.inc59.us.us ], [ %c.1111.us.us, %for.cond4.preheader.us.us ]
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%cmp9104.us.us = icmp ult i64 %indvars.iv.next129, %0
br i1 %cmp9104.us.us, label %for.body10.lr.ph.us.us, label %for.inc59.us.us
if.end.us.us: ; preds = %if.then.split.us.us.us
%puts103.us.us = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc59.us.us
for.inc59.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.us.us, %for.body6.us.us, %if.then.split.us.us.us, %if.end.us.us
%c.3.us.us = phi i32 [ 1, %if.then.split.us.us.us ], [ 1, %if.end.us.us ], [ %c.2108.us.us, %for.body6.us.us ], [ %c.2108.us.us, %for.body10.lr.ph.us.us ], [ %c.2108.us.us, %for.inc.us.us.us ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond132.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count143
br i1 %exitcond132.not, label %for.cond4.for.inc62_crit_edge.us.us, label %for.body6.us.us, !llvm.loop !16
for.body10.lr.ph.us.us: ; preds = %for.body6.us.us
%1 = load i32, ptr %b11.us, align 4, !tbaa !7
%2 = load i32, ptr %b14.us.us, align 4, !tbaa !7
%cmp15.us.us = icmp eq i32 %1, %2
%arrayidx40.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv128
%b51.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv128, i32 1
br i1 %cmp15.us.us, label %for.body10.lr.ph.split.us.us.us, label %for.inc59.us.us
for.body10.lr.ph.split.us.us.us: ; preds = %for.body10.lr.ph.us.us
%3 = load i8, ptr %arrayidx.us, align 4, !tbaa !17
br label %for.body10.us.us.us
for.body10.us.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.split.us.us.us
%indvars.iv125 = phi i64 [ %indvars.iv.next126, %for.inc.us.us.us ], [ %indvars.iv, %for.body10.lr.ph.split.us.us.us ]
%arrayidx20.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv125
%4 = load i8, ptr %arrayidx20.us.us.us, align 4, !tbaa !17
%cmp23.us.us.us = icmp eq i8 %3, %4
br i1 %cmp23.us.us.us, label %land.lhs.true25.us.us.us, label %for.inc.us.us.us
land.lhs.true25.us.us.us: ; preds = %for.body10.us.us.us
%b31.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv125, i32 1
%5 = load i32, ptr %b31.us.us.us, align 4, !tbaa !7
%cmp32.us.us.us = icmp eq i32 %1, %5
br i1 %cmp32.us.us.us, label %land.lhs.true34.us.us.us, label %for.inc.us.us.us
land.lhs.true34.us.us.us: ; preds = %land.lhs.true25.us.us.us
%6 = load i8, ptr %arrayidx13.us.us, align 4, !tbaa !17
%7 = load i8, ptr %arrayidx40.us.us, align 4, !tbaa !17
%cmp43.us.us.us = icmp eq i8 %6, %7
br i1 %cmp43.us.us.us, label %land.lhs.true45.us.us.us, label %for.inc.us.us.us
land.lhs.true45.us.us.us: ; preds = %land.lhs.true34.us.us.us
%8 = load i32, ptr %b51.us.us, align 4, !tbaa !7
%cmp52.us.us.us = icmp eq i32 %1, %8
br i1 %cmp52.us.us.us, label %if.then.split.us.us.us, label %for.inc.us.us.us
for.inc.us.us.us: ; preds = %land.lhs.true45.us.us.us, %land.lhs.true34.us.us.us, %land.lhs.true25.us.us.us, %for.body10.us.us.us
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%exitcond.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count143
br i1 %exitcond.not, label %for.inc59.us.us, label %for.body10.us.us.us, !llvm.loop !18
if.then.split.us.us.us: ; preds = %land.lhs.true45.us.us.us
%cmp54.us.us = icmp sgt i32 %c.2108.us.us, 0
br i1 %cmp54.us.us, label %for.inc59.us.us, label %if.end.us.us
for.cond4.for.inc62_crit_edge.us.us: ; preds = %for.inc59.us.us
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%exitcond139.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count143
br i1 %exitcond139.not, label %for.cond.loopexit.us, label %for.cond4.preheader.us.us, !llvm.loop !19
for.end67: ; preds = %for.cond.loopexit.us
%9 = icmp eq i32 %c.1.lcssa.us, 0
br i1 %9, label %if.then70, label %if.end72
if.then70: ; preds = %entry, %for.end67
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end72
if.end72: ; preds = %if.then70, %for.end67
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !20
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.card, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !20
%4 = zext i32 %3 to i64
%vla1 = alloca %struct.card, i64 %4, align 16
%vla2 = alloca %struct.card, i64 %4, align 16
%cmp150 = icmp sgt i32 %3, 0
br i1 %cmp150, label %for.body, label %for.end34
for.cond6.preheader: ; preds = %for.body
%cmp7152 = icmp sgt i32 %.pr, 0
br i1 %cmp7152, label %for.cond1.preheader.lr.ph.i, label %for.end34
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv
%b = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv, i32 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !20
%5 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond6.preheader
%6 = zext i32 %.pr to i64
%7 = shl nuw nsw i64 %6, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla1, ptr nonnull align 16 %vla, i64 %7, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla2, ptr nonnull align 16 %vla, i64 %7, i1 false)
%8 = zext i32 %.pr to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next52.i, %8
br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !5
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv51.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next52.i, %for.cond.loopexit.i ]
%indvars.iv.next52.i = add nuw nsw i64 %indvars.iv51.i, 1
%cmp2.not.not44.i = icmp ult i64 %indvars.iv.next52.i, %8
br i1 %cmp2.not.not44.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %8, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%b.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv.next.i, i32 1
%9 = load i32, ptr %b.i, align 4, !tbaa !7
%10 = add nsw i64 %indvars.iv.i, -2
%b7.i = getelementptr inbounds %struct.card, ptr %vla, i64 %10, i32 1
%11 = load i32, ptr %b7.i, align 4, !tbaa !7
%cmp8.i = icmp slt i32 %9, %11
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %vla, i64 %10
%12 = load <2 x i64>, ptr %arrayidx6.i, align 8
%13 = shufflevector <2 x i64> %12, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %13, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next52.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !12
BubbleSort.exit: ; preds = %for.cond.loopexit.i
br i1 %cmp7152, label %if.end.peel, label %for.end34
if.end.peel: ; preds = %BubbleSort.exit
%b30.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %vla, i64 0, i32 1
%.pre170 = load i32, ptr %b30.peel.phi.trans.insert, align 4, !tbaa !7
%.pre = load i8, ptr %vla, align 16, !tbaa !17
%conv.peel = sext i8 %.pre to i32
%call31.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel, i32 noundef %.pre170)
%14 = load i32, ptr %n, align 4, !tbaa !20
%cmp21.peel = icmp sgt i32 %14, 1
br i1 %cmp21.peel, label %if.end, label %for.end34
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv162 = phi i64 [ %indvars.iv.next163, %if.end ], [ 1, %if.end.peel ]
%putchar78 = call i32 @putchar(i32 32)
%arrayidx26 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv162
%15 = load i8, ptr %arrayidx26, align 8, !tbaa !17
%conv = sext i8 %15 to i32
%b30 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv162, i32 1
%16 = load i32, ptr %b30, align 4, !tbaa !7
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv, i32 noundef %16)
%indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
%17 = load i32, ptr %n, align 4, !tbaa !20
%18 = sext i32 %17 to i64
%cmp21 = icmp slt i64 %indvars.iv.next163, %18
br i1 %cmp21, label %if.end, label %for.end34, !llvm.loop !22
for.end34: ; preds = %if.end, %for.cond6.preheader, %entry, %if.end.peel, %BubbleSort.exit
%putchar = call i32 @putchar(i32 10)
%19 = load i32, ptr %n, align 4, !tbaa !20
%cmp119.i = icmp sgt i32 %19, 0
br i1 %cmp119.i, label %for.body.us.preheader.i, label %if.then70.i
for.body.us.preheader.i: ; preds = %for.end34
%20 = zext i32 %19 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv140.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next141.i, %for.cond.loopexit.us.i ]
%indvars.iv133.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next134.i, %for.cond.loopexit.us.i ]
%c.0121.us.i = phi i32 [ 0, %for.body.us.preheader.i ], [ %c.1.lcssa.us.i, %for.cond.loopexit.us.i ]
%indvars.iv.next141.i = add nuw nsw i64 %indvars.iv140.i, 1
%cmp2109.us.i = icmp ult i64 %indvars.iv.next141.i, %20
br i1 %cmp2109.us.i, label %for.cond4.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond4.for.inc62_crit_edge.us.us.i, %for.body.us.i
%c.1.lcssa.us.i = phi i32 [ %c.0121.us.i, %for.body.us.i ], [ %c.3.us.us.i, %for.cond4.for.inc62_crit_edge.us.us.i ]
%indvars.iv.next134.i = add nuw nsw i64 %indvars.iv133.i, 1
%exitcond144.not.i = icmp eq i64 %indvars.iv.next141.i, %20
br i1 %exitcond144.not.i, label %for.end67.i, label %for.body.us.i, !llvm.loop !15
for.cond4.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%b11.us.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv140.i, i32 1
%arrayidx.us.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv140.i
br label %for.cond4.preheader.us.us.i
for.cond4.preheader.us.us.i: ; preds = %for.cond4.for.inc62_crit_edge.us.us.i, %for.cond4.preheader.lr.ph.us.i
%indvars.iv135.i = phi i64 [ %indvars.iv.next136.i, %for.cond4.for.inc62_crit_edge.us.us.i ], [ %indvars.iv133.i, %for.cond4.preheader.lr.ph.us.i ]
%c.1111.us.us.i = phi i32 [ %c.3.us.us.i, %for.cond4.for.inc62_crit_edge.us.us.i ], [ %c.0121.us.i, %for.cond4.preheader.lr.ph.us.i ]
%arrayidx13.us.us.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv135.i
%b14.us.us.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv135.i, i32 1
br label %for.body6.us.us.i
for.body6.us.us.i: ; preds = %for.inc59.us.us.i, %for.cond4.preheader.us.us.i
%indvars.iv128.i = phi i64 [ %indvars.iv.next129.i, %for.inc59.us.us.i ], [ 0, %for.cond4.preheader.us.us.i ]
%indvars.iv.i79 = phi i64 [ %indvars.iv.next.i80, %for.inc59.us.us.i ], [ 1, %for.cond4.preheader.us.us.i ]
%c.2108.us.us.i = phi i32 [ %c.3.us.us.i, %for.inc59.us.us.i ], [ %c.1111.us.us.i, %for.cond4.preheader.us.us.i ]
%indvars.iv.next129.i = add nuw nsw i64 %indvars.iv128.i, 1
%cmp9104.us.us.i = icmp ult i64 %indvars.iv.next129.i, %20
br i1 %cmp9104.us.us.i, label %for.body10.lr.ph.us.us.i, label %for.inc59.us.us.i
if.end.us.us.i: ; preds = %if.then.split.us.us.us.i
%puts103.us.us.i = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc59.us.us.i
for.inc59.us.us.i: ; preds = %for.inc.us.us.us.i, %if.then.split.us.us.us.i, %for.body10.lr.ph.us.us.i, %if.end.us.us.i, %for.body6.us.us.i
%c.3.us.us.i = phi i32 [ 1, %if.then.split.us.us.us.i ], [ 1, %if.end.us.us.i ], [ %c.2108.us.us.i, %for.body6.us.us.i ], [ %c.2108.us.us.i, %for.body10.lr.ph.us.us.i ], [ %c.2108.us.us.i, %for.inc.us.us.us.i ]
%indvars.iv.next.i80 = add nuw nsw i64 %indvars.iv.i79, 1
%exitcond132.not.i = icmp eq i64 %indvars.iv.next129.i, %20
br i1 %exitcond132.not.i, label %for.cond4.for.inc62_crit_edge.us.us.i, label %for.body6.us.us.i, !llvm.loop !16
for.body10.lr.ph.us.us.i: ; preds = %for.body6.us.us.i
%21 = load i32, ptr %b11.us.i, align 4, !tbaa !7
%22 = load i32, ptr %b14.us.us.i, align 4, !tbaa !7
%cmp15.us.us.i = icmp eq i32 %21, %22
%arrayidx40.us.us.i = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv128.i
%b51.us.us.i = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv128.i, i32 1
br i1 %cmp15.us.us.i, label %for.body10.lr.ph.split.us.us.us.i, label %for.inc59.us.us.i
for.body10.lr.ph.split.us.us.us.i: ; preds = %for.body10.lr.ph.us.us.i
%23 = load i8, ptr %arrayidx.us.i, align 8, !tbaa !17
br label %for.body10.us.us.us.i
for.body10.us.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.split.us.us.us.i
%indvars.iv125.i = phi i64 [ %indvars.iv.next126.i, %for.inc.us.us.us.i ], [ %indvars.iv.i79, %for.body10.lr.ph.split.us.us.us.i ]
%arrayidx20.us.us.us.i = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv125.i
%24 = load i8, ptr %arrayidx20.us.us.us.i, align 8, !tbaa !17
%cmp23.us.us.us.i = icmp eq i8 %23, %24
br i1 %cmp23.us.us.us.i, label %land.lhs.true25.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true25.us.us.us.i: ; preds = %for.body10.us.us.us.i
%b31.us.us.us.i = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv125.i, i32 1
%25 = load i32, ptr %b31.us.us.us.i, align 4, !tbaa !7
%cmp32.us.us.us.i = icmp eq i32 %21, %25
br i1 %cmp32.us.us.us.i, label %land.lhs.true34.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true34.us.us.us.i: ; preds = %land.lhs.true25.us.us.us.i
%26 = load i8, ptr %arrayidx13.us.us.i, align 8, !tbaa !17
%27 = load i8, ptr %arrayidx40.us.us.i, align 8, !tbaa !17
%cmp43.us.us.us.i = icmp eq i8 %26, %27
br i1 %cmp43.us.us.us.i, label %land.lhs.true45.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true45.us.us.us.i: ; preds = %land.lhs.true34.us.us.us.i
%28 = load i32, ptr %b51.us.us.i, align 4, !tbaa !7
%cmp52.us.us.us.i = icmp eq i32 %21, %28
br i1 %cmp52.us.us.us.i, label %if.then.split.us.us.us.i, label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true45.us.us.us.i, %land.lhs.true34.us.us.us.i, %land.lhs.true25.us.us.us.i, %for.body10.us.us.us.i
%indvars.iv.next126.i = add nuw nsw i64 %indvars.iv125.i, 1
%exitcond.not.i81 = icmp eq i64 %indvars.iv.next126.i, %20
br i1 %exitcond.not.i81, label %for.inc59.us.us.i, label %for.body10.us.us.us.i, !llvm.loop !18
if.then.split.us.us.us.i: ; preds = %land.lhs.true45.us.us.us.i
%cmp54.us.us.i = icmp sgt i32 %c.2108.us.us.i, 0
br i1 %cmp54.us.us.i, label %for.inc59.us.us.i, label %if.end.us.us.i
for.cond4.for.inc62_crit_edge.us.us.i: ; preds = %for.inc59.us.us.i
%indvars.iv.next136.i = add nuw nsw i64 %indvars.iv135.i, 1
%exitcond139.not.i = icmp eq i64 %indvars.iv.next136.i, %20
br i1 %exitcond139.not.i, label %for.cond.loopexit.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !19
for.end67.i: ; preds = %for.cond.loopexit.us.i
%29 = icmp eq i32 %c.1.lcssa.us.i, 0
br i1 %29, label %if.then70.i, label %isStable.exit
if.then70.i: ; preds = %for.end67.i, %for.end34
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %isStable.exit
isStable.exit: ; preds = %for.end67.i, %if.then70.i
%30 = load i32, ptr %n, align 4, !tbaa !20
%cmp44.i = icmp sgt i32 %30, 0
br i1 %cmp44.i, label %for.cond1.preheader.preheader.i, label %for.end55
for.cond1.preheader.preheader.i: ; preds = %isStable.exit
%31 = zext i32 %30 to i64
br label %for.cond1.preheader.i83
for.cond1.preheader.i83: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i84 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i87, %for.end.i ]
%32 = trunc i64 %indvars.iv.i84 to i32
br label %for.body3.i85
for.body3.i85: ; preds = %for.body3.i85, %for.cond1.preheader.i83
%indvars.iv46.i = phi i64 [ %indvars.iv.i84, %for.cond1.preheader.i83 ], [ %indvars.iv.next47.i, %for.body3.i85 ]
%minj.043.i = phi i32 [ %32, %for.cond1.preheader.i83 ], [ %spec.select.i, %for.body3.i85 ]
%b.i86 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv46.i, i32 1
%33 = load i32, ptr %b.i86, align 4, !tbaa !7
%idxprom4.i = sext i32 %minj.043.i to i64
%b6.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %idxprom4.i, i32 1
%34 = load i32, ptr %b6.i, align 4, !tbaa !7
%cmp7.i = icmp slt i32 %33, %34
%35 = trunc i64 %indvars.iv46.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %35, i32 %minj.043.i
%indvars.iv.next47.i = add nuw nsw i64 %indvars.iv46.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next47.i, %31
br i1 %cmp2.i, label %for.body3.i85, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body3.i85
%arrayidx11.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv.i84
%36 = load i64, ptr %arrayidx11.i, align 8
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %idxprom14.i
%37 = load i64, ptr %arrayidx15.i, align 8
store i64 %37, ptr %arrayidx11.i, align 8
store i64 %36, ptr %arrayidx15.i, align 8
%indvars.iv.next.i87 = add nuw nsw i64 %indvars.iv.i84, 1
%exitcond.not.i88 = icmp eq i64 %indvars.iv.next.i87, %31
br i1 %exitcond.not.i88, label %SelectionSort.exit, label %for.cond1.preheader.i83, !llvm.loop !14
SelectionSort.exit: ; preds = %for.end.i
br i1 %cmp44.i, label %if.end44.peel, label %for.end55
if.end44.peel: ; preds = %SelectionSort.exit
%38 = load i8, ptr %vla1, align 16, !tbaa !17
%conv48.peel = sext i8 %38 to i32
%b51.peel = getelementptr inbounds %struct.card, ptr %vla1, i64 0, i32 1
%39 = load i32, ptr %b51.peel, align 4, !tbaa !7
%call52.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv48.peel, i32 noundef %39)
%40 = load i32, ptr %n, align 4, !tbaa !20
%cmp37.peel = icmp sgt i32 %40, 1
br i1 %cmp37.peel, label %if.end44, label %for.end55
if.end44: ; preds = %if.end44.peel, %if.end44
%indvars.iv166 = phi i64 [ %indvars.iv.next167, %if.end44 ], [ 1, %if.end44.peel ]
%putchar77 = call i32 @putchar(i32 32)
%arrayidx46 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv166
%41 = load i8, ptr %arrayidx46, align 8, !tbaa !17
%conv48 = sext i8 %41 to i32
%b51 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv166, i32 1
%42 = load i32, ptr %b51, align 4, !tbaa !7
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv48, i32 noundef %42)
%indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1
%43 = load i32, ptr %n, align 4, !tbaa !20
%44 = sext i32 %43 to i64
%cmp37 = icmp slt i64 %indvars.iv.next167, %44
br i1 %cmp37, label %if.end44, label %for.end55, !llvm.loop !24
for.end55: ; preds = %if.end44, %isStable.exit, %if.end44.peel, %SelectionSort.exit
%putchar76 = call i32 @putchar(i32 10)
%45 = load i32, ptr %n, align 4, !tbaa !20
%cmp119.i89 = icmp sgt i32 %45, 0
br i1 %cmp119.i89, label %for.body.us.preheader.i92, label %if.then70.i90
for.body.us.preheader.i92: ; preds = %for.end55
%46 = zext i32 %45 to i64
br label %for.body.us.i94
for.body.us.i94: ; preds = %for.cond.loopexit.us.i100, %for.body.us.preheader.i92
%indvars.iv140.i95 = phi i64 [ 0, %for.body.us.preheader.i92 ], [ %indvars.iv.next141.i98, %for.cond.loopexit.us.i100 ]
%indvars.iv133.i96 = phi i64 [ 1, %for.body.us.preheader.i92 ], [ %indvars.iv.next134.i102, %for.cond.loopexit.us.i100 ]
%c.0121.us.i97 = phi i32 [ 0, %for.body.us.preheader.i92 ], [ %c.1.lcssa.us.i101, %for.cond.loopexit.us.i100 ]
%indvars.iv.next141.i98 = add nuw nsw i64 %indvars.iv140.i95, 1
%cmp2109.us.i99 = icmp ult i64 %indvars.iv.next141.i98, %46
br i1 %cmp2109.us.i99, label %for.cond4.preheader.lr.ph.us.i105, label %for.cond.loopexit.us.i100
for.cond.loopexit.us.i100: ; preds = %for.cond4.for.inc62_crit_edge.us.us.i123, %for.body.us.i94
%c.1.lcssa.us.i101 = phi i32 [ %c.0121.us.i97, %for.body.us.i94 ], [ %c.3.us.us.i120, %for.cond4.for.inc62_crit_edge.us.us.i123 ]
%indvars.iv.next134.i102 = add nuw nsw i64 %indvars.iv133.i96, 1
%exitcond144.not.i103 = icmp eq i64 %indvars.iv.next141.i98, %46
br i1 %exitcond144.not.i103, label %for.end67.i104, label %for.body.us.i94, !llvm.loop !15
for.cond4.preheader.lr.ph.us.i105: ; preds = %for.body.us.i94
%b11.us.i106 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv140.i95, i32 1
%arrayidx.us.i107 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv140.i95
br label %for.cond4.preheader.us.us.i108
for.cond4.preheader.us.us.i108: ; preds = %for.cond4.for.inc62_crit_edge.us.us.i123, %for.cond4.preheader.lr.ph.us.i105
%indvars.iv135.i109 = phi i64 [ %indvars.iv.next136.i124, %for.cond4.for.inc62_crit_edge.us.us.i123 ], [ %indvars.iv133.i96, %for.cond4.preheader.lr.ph.us.i105 ]
%c.1111.us.us.i110 = phi i32 [ %c.3.us.us.i120, %for.cond4.for.inc62_crit_edge.us.us.i123 ], [ %c.0121.us.i97, %for.cond4.preheader.lr.ph.us.i105 ]
%arrayidx13.us.us.i111 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv135.i109
%b14.us.us.i112 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv135.i109, i32 1
br label %for.body6.us.us.i113
for.body6.us.us.i113: ; preds = %for.inc59.us.us.i119, %for.cond4.preheader.us.us.i108
%indvars.iv128.i114 = phi i64 [ %indvars.iv.next129.i117, %for.inc59.us.us.i119 ], [ 0, %for.cond4.preheader.us.us.i108 ]
%indvars.iv.i115 = phi i64 [ %indvars.iv.next.i121, %for.inc59.us.us.i119 ], [ 1, %for.cond4.preheader.us.us.i108 ]
%c.2108.us.us.i116 = phi i32 [ %c.3.us.us.i120, %for.inc59.us.us.i119 ], [ %c.1111.us.us.i110, %for.cond4.preheader.us.us.i108 ]
%indvars.iv.next129.i117 = add nuw nsw i64 %indvars.iv128.i114, 1
%cmp9104.us.us.i118 = icmp ult i64 %indvars.iv.next129.i117, %46
br i1 %cmp9104.us.us.i118, label %for.body10.lr.ph.us.us.i126, label %for.inc59.us.us.i119
if.end.us.us.i147: ; preds = %if.then.split.us.us.us.i145
%puts103.us.us.i148 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc59.us.us.i119
for.inc59.us.us.i119: ; preds = %for.inc.us.us.us.i135, %if.then.split.us.us.us.i145, %for.body10.lr.ph.us.us.i126, %if.end.us.us.i147, %for.body6.us.us.i113
%c.3.us.us.i120 = phi i32 [ 1, %if.then.split.us.us.us.i145 ], [ 1, %if.end.us.us.i147 ], [ %c.2108.us.us.i116, %for.body6.us.us.i113 ], [ %c.2108.us.us.i116, %for.body10.lr.ph.us.us.i126 ], [ %c.2108.us.us.i116, %for.inc.us.us.us.i135 ]
%indvars.iv.next.i121 = add nuw nsw i64 %indvars.iv.i115, 1
%exitcond132.not.i122 = icmp eq i64 %indvars.iv.next129.i117, %46
br i1 %exitcond132.not.i122, label %for.cond4.for.inc62_crit_edge.us.us.i123, label %for.body6.us.us.i113, !llvm.loop !16
for.body10.lr.ph.us.us.i126: ; preds = %for.body6.us.us.i113
%47 = load i32, ptr %b11.us.i106, align 4, !tbaa !7
%48 = load i32, ptr %b14.us.us.i112, align 4, !tbaa !7
%cmp15.us.us.i127 = icmp eq i32 %47, %48
%arrayidx40.us.us.i128 = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv128.i114
%b51.us.us.i129 = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv128.i114, i32 1
br i1 %cmp15.us.us.i127, label %for.body10.lr.ph.split.us.us.us.i130, label %for.inc59.us.us.i119
for.body10.lr.ph.split.us.us.us.i130: ; preds = %for.body10.lr.ph.us.us.i126
%49 = load i8, ptr %arrayidx.us.i107, align 8, !tbaa !17
br label %for.body10.us.us.us.i131
for.body10.us.us.us.i131: ; preds = %for.inc.us.us.us.i135, %for.body10.lr.ph.split.us.us.us.i130
%indvars.iv125.i132 = phi i64 [ %indvars.iv.next126.i136, %for.inc.us.us.us.i135 ], [ %indvars.iv.i115, %for.body10.lr.ph.split.us.us.us.i130 ]
%arrayidx20.us.us.us.i133 = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv125.i132
%50 = load i8, ptr %arrayidx20.us.us.us.i133, align 8, !tbaa !17
%cmp23.us.us.us.i134 = icmp eq i8 %49, %50
br i1 %cmp23.us.us.us.i134, label %land.lhs.true25.us.us.us.i138, label %for.inc.us.us.us.i135
land.lhs.true25.us.us.us.i138: ; preds = %for.body10.us.us.us.i131
%b31.us.us.us.i139 = getelementptr inbounds %struct.card, ptr %vla2, i64 %indvars.iv125.i132, i32 1
%51 = load i32, ptr %b31.us.us.us.i139, align 4, !tbaa !7
%cmp32.us.us.us.i140 = icmp eq i32 %47, %51
br i1 %cmp32.us.us.us.i140, label %land.lhs.true34.us.us.us.i141, label %for.inc.us.us.us.i135
land.lhs.true34.us.us.us.i141: ; preds = %land.lhs.true25.us.us.us.i138
%52 = load i8, ptr %arrayidx13.us.us.i111, align 8, !tbaa !17
%53 = load i8, ptr %arrayidx40.us.us.i128, align 8, !tbaa !17
%cmp43.us.us.us.i142 = icmp eq i8 %52, %53
br i1 %cmp43.us.us.us.i142, label %land.lhs.true45.us.us.us.i143, label %for.inc.us.us.us.i135
land.lhs.true45.us.us.us.i143: ; preds = %land.lhs.true34.us.us.us.i141
%54 = load i32, ptr %b51.us.us.i129, align 4, !tbaa !7
%cmp52.us.us.us.i144 = icmp eq i32 %47, %54
br i1 %cmp52.us.us.us.i144, label %if.then.split.us.us.us.i145, label %for.inc.us.us.us.i135
for.inc.us.us.us.i135: ; preds = %land.lhs.true45.us.us.us.i143, %land.lhs.true34.us.us.us.i141, %land.lhs.true25.us.us.us.i138, %for.body10.us.us.us.i131
%indvars.iv.next126.i136 = add nuw nsw i64 %indvars.iv125.i132, 1
%exitcond.not.i137 = icmp eq i64 %indvars.iv.next126.i136, %46
br i1 %exitcond.not.i137, label %for.inc59.us.us.i119, label %for.body10.us.us.us.i131, !llvm.loop !18
if.then.split.us.us.us.i145: ; preds = %land.lhs.true45.us.us.us.i143
%cmp54.us.us.i146 = icmp sgt i32 %c.2108.us.us.i116, 0
br i1 %cmp54.us.us.i146, label %for.inc59.us.us.i119, label %if.end.us.us.i147
for.cond4.for.inc62_crit_edge.us.us.i123: ; preds = %for.inc59.us.us.i119
%indvars.iv.next136.i124 = add nuw nsw i64 %indvars.iv135.i109, 1
%exitcond139.not.i125 = icmp eq i64 %indvars.iv.next136.i124, %46
br i1 %exitcond139.not.i125, label %for.cond.loopexit.us.i100, label %for.cond4.preheader.us.us.i108, !llvm.loop !19
for.end67.i104: ; preds = %for.cond.loopexit.us.i100
%55 = icmp eq i32 %c.1.lcssa.us.i101, 0
br i1 %55, label %if.then70.i90, label %isStable.exit149
if.then70.i90: ; preds = %for.end67.i104, %for.end55
%puts.i91 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %isStable.exit149
isStable.exit149: ; preds = %for.end67.i104, %if.then70.i90
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 #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !11, i64 4}
!8 = !{!"card", !9, i64 0, !11, i64 4}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = !{!8, !9, i64 0}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = !{!11, !11, i64 0}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6, !23}
!23 = !{!"llvm.loop.peeled.count", i32 1}
!24 = distinct !{!24, !6, !23}
|
#include<stdio.h>
#include<math.h>
int main()
{
long long int t,n,x;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
x=ceil((1.0*n)/2);
printf("%lld\n",x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11400/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11400/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec4 = add nsw i64 %0, -1
store i64 %dec4, ptr %t, align 8, !tbaa !5
%tobool.not5 = icmp eq i64 %0, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%conv = sitofp i64 %1 to double
%div = fmul double %conv, 5.000000e-01
%2 = call double @llvm.ceil.f64(double %div)
%conv2 = fptosi double %2 to i64
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %conv2)
%3 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %3, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
int i,j;
Card t;
for(i = 0; i<N; i++) {
for(j = N-1; j >= i; j--) {
if(A[j].value < A[j-1].value) {
t = A[j]; A[j] = A[j-1]; A[j-1] = t;
}
}
}
}
void selection(Card A[], int N) {
int i,j,minj;
Card t;
for(i=0;i<N;i++) {
minj = i;
for(j=i; j<N; j++) {
if(A[j].value < A[minj].value) minj = j;
}
t = A[i]; A[i] = A[minj]; A[minj] = t;
}
}
void print(Card A[], int N) {
int i;
for(i=0; i<N; i++) {
if(i>0) printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
int i;
for(i=0; i<N; i++) {
if(C1[i].suit != C2[i].suit) return 0;
}
return 1;
}
void str2Card(Card *t,char str[]) {
t->suit = str[0];
t->value = str[1] - '0';
}
int main(void) {
Card C1[100], C2[100];
int N,i;
char str[3];
scanf("%d",&N);
for(i=0;i<N; i++) {
scanf("%s",str);
str2Card(&C1[i],str);
}
for(i=0; i<N; i++) C2[i] = C1[i];
bubble(C1,N);
selection(C2,N);
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114043/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114043/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %N, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %N, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%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 ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 !15
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 #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @str2Card(ptr nocapture noundef writeonly %t, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !18
store i8 %0, ptr %t, align 1, !tbaa !14
%arrayidx1 = getelementptr inbounds i8, ptr %str, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !18
%sub = add i8 %1, -48
%value = getelementptr inbounds %struct.Card, ptr %t, i64 0, i32 1
store i8 %sub, ptr %value, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%N = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx1.i = getelementptr inbounds i8, ptr %str, i64 1
br label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp478 = icmp sgt i32 %3, 0
br i1 %cmp478, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %str, align 1, !tbaa !18
store i8 %1, ptr %arrayidx, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx1.i, align 1, !tbaa !18
%sub.i = add i8 %2, -48
%value.i = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %sub.i, ptr %value.i, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !19
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond3.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i31 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i31, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx6.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i33, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i33: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i34 = phi i64 [ %indvars.iv.next.i37, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i34 to i32
br label %for.body3.i35
for.body3.i35: ; preds = %for.body3.i35, %for.cond1.preheader.i33
%indvars.iv41.i = phi i64 [ %indvars.iv.i34, %for.cond1.preheader.i33 ], [ %indvars.iv.next42.i, %for.body3.i35 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i33 ], [ %spec.select.i, %for.body3.i35 ]
%value.i36 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i36, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i35, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i35
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i34
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i34, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %7
br i1 %exitcond.not.i38, label %if.end.peel.i, label %for.cond1.preheader.i33, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %C1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i41 = phi i64 [ %indvars.iv.next.i44, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41
%19 = load i8, ptr %arrayidx.i42, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41, i32 1
%20 = load i8, ptr %value.i43, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i41, 1
%exitcond.not.i45 = icmp eq i64 %indvars.iv.next.i44, %7
br i1 %exitcond.not.i45, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond3.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %N, align 4, !tbaa !19
%cmp13.i46 = icmp sgt i32 %21, 0
br i1 %cmp13.i46, label %if.end.peel.i49, label %print.exit68
if.end.peel.i49: ; preds = %print.exit
%wide.trip.count.i50 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i51 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre17.i52 = load i8, ptr %value.peel.phi.trans.insert.i51, align 1, !tbaa !5
%.pre.i53 = load i8, ptr %C2, align 16, !tbaa !14
%conv.peel.i54 = sext i8 %.pre.i53 to i32
%conv4.peel.i55 = sext i8 %.pre17.i52 to i32
%call5.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i54, i32 noundef %conv4.peel.i55)
%exitcond.peel.not.i57 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i57, label %print.exit68, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i49, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i66, %if.end.i58 ], [ 1, %if.end.peel.i49 ]
%putchar12.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%22 = load i8, ptr %arrayidx.i61, align 2, !tbaa !14
%conv.i62 = sext i8 %22 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%23 = load i8, ptr %value.i63, align 1, !tbaa !5
%conv4.i64 = sext i8 %23 to i32
%call5.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %conv4.i64)
%indvars.iv.next.i66 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i67 = icmp eq i64 %indvars.iv.next.i66, %wide.trip.count.i50
br i1 %exitcond.not.i67, label %print.exit68, label %if.end.i58, !llvm.loop !15
print.exit68: ; preds = %if.end.i58, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit68
%wide.trip.count.i69 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i69
br i1 %exitcond.not.i73, label %if.end, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i70 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i72, %for.cond.i ]
%arrayidx.i71 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i70
%25 = load i8, ptr %arrayidx.i71, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i70
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit68
%str.7.sink = phi ptr [ @str.8, %print.exit68 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress 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 #7 = { nofree nounwind }
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, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!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 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
typedef struct{
char suit;
int value;
}Card;
void bubblesort(Card A[],int N ){
int i,j;
Card n;
for(i=0;i<N;i++){
for(j=N-1;j>=i+1;j--){
if(A[j].value < A[j-1].value){
n=A[j];
A[j]=A[j-1];
A[j-1]=n;
}
}
}
}
void selectionSort(Card A[],int N){
int i,j,minj;
Card n;
for(i=0;i<N;i++){
minj=i;
for(j=i;j<N;j++){
if(A[j].value < A[minj].value){
minj=j;
}
}
n=A[i];
A[i]=A[minj];
A[minj]=n;
}
}
int handan(Card C1[],Card C2[],int N){
int i;
for(i=0;i<N;i++){
if(C1[i].suit!=C2[i].suit){
return 0;
}
}
return 1;
}
void print(Card A[],int N){
int i;
for(i=0;i<N;i++){
if(i>0)printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int main(){
int n,i;
Card C1[36],C2[36];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf(" %c%d",&C1[i].suit,&C1[i].value);
}
/*for(i=0;i<n;i++){
printf("%c%d ",C1[i].suit,C1[i].value);
}
putchar('\n');*/
for(i=0;i<n;i++) C2[i]=C1[i];
bubblesort(C1,n);
selectionSort(C2,n);
print(C1,n);
printf("Stable\n");
print(C2,n);
if(handan(C1,C2,n)==1){
printf("Stable\n");
}else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114087/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114087/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i32 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubblesort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp40 = icmp sgt i32 %N, 0
br i1 %cmp40, label %for.cond1.preheader.lr.ph, label %for.end20
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !5
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next45, %for.cond.loopexit ]
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%cmp2.not.not37 = icmp ult i64 %indvars.iv.next45, %0
br i1 %cmp2.not.not37, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i32, ptr %value, align 4, !tbaa !7
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i32, ptr %value7, align 4, !tbaa !7
%cmp8 = icmp slt i32 %1, %3
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i64>, ptr %arrayidx6, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next45
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !12
for.end20: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selectionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%minj.036 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv39, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !7
%idxprom4 = sext i32 %minj.036 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i32, ptr %value6, align 4, !tbaa !7
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.036
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %spec.select to i64
%arrayidx13 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom12
%6 = load i64, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx9, align 4
store i64 %5, ptr %arrayidx13, align 4
%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.end18, label %for.cond1.preheader, !llvm.loop !14
for.end18: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @handan(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !15
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 4, !tbaa !16
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp12 = icmp sgt i32 %N, 0
br i1 %cmp12, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre16 = load i32, ptr %value.peel.phi.trans.insert, align 4, !tbaa !7
%.pre = load i8, ptr %A, align 4, !tbaa !16
%conv.peel = sext i8 %.pre to i32
%call4.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %.pre16)
%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 ]
%putchar11 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !16
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i32, ptr %value, align 4, !tbaa !7
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %1)
%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 !17
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 #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%C1 = alloca [36 x %struct.Card], align 16
%C2 = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C1) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C2) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !19
%cmp75 = icmp sgt i32 %0, 0
br i1 %cmp75, label %for.body, label %print.exit
for.cond4.preheader: ; preds = %for.body
%cmp577 = icmp sgt i32 %1, 0
br i1 %cmp577, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !19
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !20
for.cond1.preheader.lr.ph.i: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %4, i1 false)
%5 = zext i32 %1 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next45.i, %5
br i1 %exitcond.not.i, label %for.cond1.preheader.i34, label %for.cond1.preheader.i, !llvm.loop !5
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv44.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next45.i, %for.cond.loopexit.i ]
%indvars.iv.next45.i = add nuw nsw i64 %indvars.iv44.i, 1
%cmp2.not.not37.i = icmp ult i64 %indvars.iv.next45.i, %5
br i1 %cmp2.not.not37.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%6 = load i32, ptr %value.i, align 4, !tbaa !7
%7 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %7, i32 1
%8 = load i32, ptr %value7.i, align 4, !tbaa !7
%cmp8.i = icmp slt i32 %6, %8
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %7
%9 = load <2 x i64>, ptr %arrayidx6.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !12
for.cond1.preheader.i34: ; preds = %for.cond.loopexit.i, %for.end.i
%indvars.iv.i35 = phi i64 [ %indvars.iv.next.i38, %for.end.i ], [ 0, %for.cond.loopexit.i ]
%11 = trunc i64 %indvars.iv.i35 to i32
br label %for.body3.i36
for.body3.i36: ; preds = %for.body3.i36, %for.cond1.preheader.i34
%indvars.iv39.i = phi i64 [ %indvars.iv.i35, %for.cond1.preheader.i34 ], [ %indvars.iv.next40.i, %for.body3.i36 ]
%minj.036.i = phi i32 [ %11, %for.cond1.preheader.i34 ], [ %spec.select.i, %for.body3.i36 ]
%value.i37 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv39.i, i32 1
%12 = load i32, ptr %value.i37, align 4, !tbaa !7
%idxprom4.i = sext i32 %minj.036.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%13 = load i32, ptr %value6.i, align 4, !tbaa !7
%cmp7.i = icmp slt i32 %12, %13
%14 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %14, i32 %minj.036.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next40.i, %5
br i1 %cmp2.i, label %for.body3.i36, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body3.i36
%arrayidx9.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i35
%15 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %spec.select.i to i64
%arrayidx13.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom12.i
%16 = load i64, ptr %arrayidx13.i, align 8
store i64 %16, ptr %arrayidx9.i, align 8
store i64 %15, ptr %arrayidx13.i, align 8
%indvars.iv.next.i38 = add nuw nsw i64 %indvars.iv.i35, 1
%exitcond.not.i39 = icmp eq i64 %indvars.iv.next.i38, %5
br i1 %exitcond.not.i39, label %if.end.peel.i, label %for.cond1.preheader.i34, !llvm.loop !14
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre16.i = load i32, ptr %value.peel.phi.trans.insert.i, align 4, !tbaa !7
%.pre.i = load i8, ptr %C1, align 16, !tbaa !16
%conv.peel.i = sext i8 %.pre.i to i32
%call4.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %.pre16.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i42 = phi i64 [ %indvars.iv.next.i45, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar11.i = call i32 @putchar(i32 32)
%arrayidx.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i42
%17 = load i8, ptr %arrayidx.i43, align 8, !tbaa !16
%conv.i = sext i8 %17 to i32
%value.i44 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i42, i32 1
%18 = load i32, ptr %value.i44, align 4, !tbaa !7
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %18)
%indvars.iv.next.i45 = add nuw nsw i64 %indvars.iv.i42, 1
%exitcond.not.i46 = icmp eq i64 %indvars.iv.next.i45, %5
br i1 %exitcond.not.i46, label %print.exit, label %if.end.i, !llvm.loop !17
print.exit: ; preds = %if.end.i, %entry, %for.cond4.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%19 = load i32, ptr %n, align 4, !tbaa !19
%cmp12.i47 = icmp sgt i32 %19, 0
br i1 %cmp12.i47, label %if.end.peel.i50, label %print.exit67
if.end.peel.i50: ; preds = %print.exit
%wide.trip.count.i51 = zext i32 %19 to i64
%value.peel.phi.trans.insert.i52 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre16.i53 = load i32, ptr %value.peel.phi.trans.insert.i52, align 4, !tbaa !7
%.pre.i54 = load i8, ptr %C2, align 16, !tbaa !16
%conv.peel.i55 = sext i8 %.pre.i54 to i32
%call4.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i55, i32 noundef %.pre16.i53)
%exitcond.peel.not.i57 = icmp eq i32 %19, 1
br i1 %exitcond.peel.not.i57, label %print.exit67, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i50, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i65, %if.end.i58 ], [ 1, %if.end.peel.i50 ]
%putchar11.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%20 = load i8, ptr %arrayidx.i61, align 8, !tbaa !16
%conv.i62 = sext i8 %20 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%21 = load i32, ptr %value.i63, align 4, !tbaa !7
%call4.i64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %21)
%indvars.iv.next.i65 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i66 = icmp eq i64 %indvars.iv.next.i65, %wide.trip.count.i51
br i1 %exitcond.not.i66, label %print.exit67, label %if.end.i58, !llvm.loop !17
print.exit67: ; preds = %if.end.i58, %print.exit, %if.end.peel.i50
%putchar.i49 = call i32 @putchar(i32 10)
%22 = load i32, ptr %n, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %22, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit67
%wide.trip.count.i68 = zext i32 %22 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i71 = add nuw nsw i64 %indvars.iv.i69, 1
%exitcond.not.i72 = icmp eq i64 %indvars.iv.next.i71, %wide.trip.count.i68
br i1 %exitcond.not.i72, label %if.end, label %for.body.i, !llvm.loop !15
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i69 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i71, %for.cond.i ]
%arrayidx.i70 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i69
%23 = load i8, ptr %arrayidx.i70, align 8, !tbaa !16
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i69
%24 = load i8, ptr %arrayidx2.i, align 8, !tbaa !16
%cmp5.not.i = icmp eq i8 %23, %24
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit67
%str.7.sink = phi ptr [ @str.8, %print.exit67 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C2) #7
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !11, i64 4}
!8 = !{!"", !9, i64 0, !11, i64 4}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!8, !9, i64 0}
!17 = distinct !{!17, !6, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = !{!11, !11, i64 0}
!20 = distinct !{!20, !6}
|
#include<stdio.h>
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
int ans;
scanf("%d",&n);
if(n==1){ans=1;}
if(n>1 && n%2!=0){ans=(n/2)+1;}
if(n%2==0){ans=n/2;}
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11413/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11413/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec13 = add nsw i32 %0, -1
store i32 %dec13, ptr %t, align 4, !tbaa !5
%tobool.not14 = icmp eq i32 %0, 0
br i1 %tobool.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%ans.015 = phi i32 [ %ans.3, %while.body ], [ 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 = icmp eq i32 %1, 1
%spec.select = select i1 %cmp, i32 1, i32 %ans.015
%cmp2 = icmp slt i32 %1, 2
%rem = and i32 %1, 1
%cmp3.not = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp2, %cmp3.not
%div12 = lshr i32 %1, 1
%add = add nuw nsw i32 %div12, 1
%ans.2 = select i1 %or.cond, i32 %spec.select, i32 %add
%div9 = sdiv i32 %1, 2
%ans.3 = select i1 %cmp3.not, i32 %div9, i32 %ans.2
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.3)
%2 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 N 36
typedef struct {
char v;
int n;}
tmp;
int main () {
int num, i, j, a, mini;
tmp b[N], c[N], t;
scanf("%d", &num);
for ( i = 0; i < num; i++ ) {
scanf("%c%c%d", &b[i].v, &b[i].v, &b[i].n);
c[i] = b[i];
}
for ( i = 0; i < num; i++ ) {
for ( j = num - 1; j >= i + 1; j-- ) {
if ( b[j].n < b[j-1].n ) {
t = b[j];
b[j] = b[j-1];
b[j-1] = t;
}
}
}
for ( i = 0; i < num; i++ ) {
mini = i;
for ( j = i; j < num; j++ )
if ( c[j].n < c[mini].n )
mini = j;
t = c[i];
c[i] = c[mini];
c[mini] = t;
}
for ( i = 0; i < num - 1; i++ ) {
printf("%c%d ", b[i].v, b[i].n);
}
printf("%c%d\n", b[num-1].v, b[num-1].n);
printf("Stable\n");
for ( i = 0; i < num - 1; i++ ) {
printf("%c%d ", c[i].v, c[i].n);
}
printf("%c%d\n", c[num-1].v, c[num-1].n);
a = 1;
for ( i = 0; i < num; i++ )
if ( b[i].v != c[i].v )
a = 0;
if ( a == 1 )
printf("Stable\n");
else
printf("Not stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114173/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114173/source.c"
target datalayout = "e-m:e-p270: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.tmp = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%b = alloca [36 x %struct.tmp], align 16
%c = alloca [36 x %struct.tmp], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp188 = icmp sgt i32 %0, 0
br i1 %cmp188, label %for.body, label %for.cond69.preheader.for.end82_crit_edge
for.cond11.preheader: ; preds = %for.body
%cmp12195 = icmp sgt i32 %3, 0
br i1 %cmp12195, label %for.cond14.preheader.lr.ph, label %for.cond69.preheader.for.end82_crit_edge
for.cond14.preheader.lr.ph: ; preds = %for.cond11.preheader
%1 = zext i32 %3 to i64
%wide.trip.count = zext i32 %3 to i64
br label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv
%n = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv, i32 1
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx, ptr noundef nonnull %n)
%arrayidx8 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv
%2 = load i64, ptr %arrayidx, align 8
store i64 %2, ptr %arrayidx8, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !9
for.cond11.loopexit: ; preds = %for.inc35, %for.cond14.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next222, %wide.trip.count
br i1 %exitcond.not, label %for.cond40.preheader, label %for.cond14.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond14.preheader.lr.ph, %for.cond11.loopexit
%indvars.iv221 = phi i64 [ 0, %for.cond14.preheader.lr.ph ], [ %indvars.iv.next222, %for.cond11.loopexit ]
%indvars.iv.next222 = add nuw nsw i64 %indvars.iv221, 1
%cmp15.not.not191 = icmp ult i64 %indvars.iv.next222, %1
br i1 %cmp15.not.not191, label %for.body16, label %for.cond11.loopexit
for.cond40.preheader: ; preds = %for.cond11.loopexit
br i1 %cmp12195, label %for.cond43.preheader.preheader, label %for.cond69.preheader
for.cond43.preheader.preheader: ; preds = %for.cond40.preheader
%5 = zext i32 %3 to i64
%wide.trip.count230 = zext i32 %3 to i64
br label %for.cond43.preheader
for.body16: ; preds = %for.cond14.preheader, %for.inc35
%indvars.iv217 = phi i64 [ %indvars.iv.next218, %for.inc35 ], [ %1, %for.cond14.preheader ]
%indvars.iv.next218 = add nsw i64 %indvars.iv217, -1
%n19 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv.next218, i32 1
%6 = load i32, ptr %n19, align 4, !tbaa !12
%7 = add nsw i64 %indvars.iv217, -2
%n23 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %7, i32 1
%8 = load i32, ptr %n23, align 4, !tbaa !12
%cmp24 = icmp slt i32 %6, %8
br i1 %cmp24, label %if.then, label %for.inc35
if.then: ; preds = %for.body16
%arrayidx22 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %7
%9 = load <2 x i64>, ptr %arrayidx22, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx22, align 8
br label %for.inc35
for.inc35: ; preds = %for.body16, %if.then
%cmp15.not.not = icmp sgt i64 %indvars.iv.next218, %indvars.iv.next222
br i1 %cmp15.not.not, label %for.body16, label %for.cond11.loopexit, !llvm.loop !14
for.cond43.preheader: ; preds = %for.cond43.preheader.preheader, %for.end57
%indvars.iv224 = phi i64 [ 0, %for.cond43.preheader.preheader ], [ %indvars.iv.next225, %for.end57 ]
%11 = trunc i64 %indvars.iv224 to i32
br label %for.body45
for.cond69.preheader: ; preds = %for.end57, %for.cond40.preheader
%cmp71202 = icmp sgt i32 %3, 1
br i1 %cmp71202, label %for.body72, label %for.cond69.preheader.for.end82_crit_edge
for.cond69.preheader.for.end82_crit_edge: ; preds = %for.cond11.preheader, %entry, %for.cond69.preheader
%12 = phi i32 [ %3, %for.cond69.preheader ], [ %3, %for.cond11.preheader ], [ %0, %entry ]
%sub70201 = add nsw i32 %12, -1
%.pre = sext i32 %sub70201 to i64
br label %for.end82
for.body45: ; preds = %for.cond43.preheader, %for.body45
%indvars.iv226 = phi i64 [ %indvars.iv224, %for.cond43.preheader ], [ %indvars.iv.next227, %for.body45 ]
%mini.0198 = phi i32 [ %11, %for.cond43.preheader ], [ %spec.select, %for.body45 ]
%n48 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv226, i32 1
%13 = load i32, ptr %n48, align 4, !tbaa !12
%idxprom49 = sext i32 %mini.0198 to i64
%n51 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %idxprom49, i32 1
%14 = load i32, ptr %n51, align 4, !tbaa !12
%cmp52 = icmp slt i32 %13, %14
%15 = trunc i64 %indvars.iv226 to i32
%spec.select = select i1 %cmp52, i32 %15, i32 %mini.0198
%indvars.iv.next227 = add nuw nsw i64 %indvars.iv226, 1
%cmp44 = icmp ult i64 %indvars.iv.next227, %5
br i1 %cmp44, label %for.body45, label %for.end57, !llvm.loop !15
for.end57: ; preds = %for.body45
%arrayidx59 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv224
%16 = load i64, ptr %arrayidx59, align 8
%idxprom62 = sext i32 %spec.select to i64
%arrayidx63 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %idxprom62
%17 = load i64, ptr %arrayidx63, align 8
store i64 %17, ptr %arrayidx59, align 8
store i64 %16, ptr %arrayidx63, align 8
%indvars.iv.next225 = add nuw nsw i64 %indvars.iv224, 1
%exitcond231.not = icmp eq i64 %indvars.iv.next225, %wide.trip.count230
br i1 %exitcond231.not, label %for.cond69.preheader, label %for.cond43.preheader, !llvm.loop !16
for.body72: ; preds = %for.cond69.preheader, %for.body72
%indvars.iv232 = phi i64 [ %indvars.iv.next233, %for.body72 ], [ 0, %for.cond69.preheader ]
%arrayidx74 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv232
%18 = load i8, ptr %arrayidx74, align 8, !tbaa !17
%conv = sext i8 %18 to i32
%n78 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv232, i32 1
%19 = load i32, ptr %n78, align 4, !tbaa !12
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%indvars.iv.next233 = add nuw nsw i64 %indvars.iv232, 1
%20 = load i32, ptr %num, align 4, !tbaa !5
%sub70 = add nsw i32 %20, -1
%21 = sext i32 %sub70 to i64
%cmp71 = icmp slt i64 %indvars.iv.next233, %21
br i1 %cmp71, label %for.body72, label %for.end82, !llvm.loop !18
for.end82: ; preds = %for.body72, %for.cond69.preheader.for.end82_crit_edge
%idxprom84.pre-phi = phi i64 [ %.pre, %for.cond69.preheader.for.end82_crit_edge ], [ %21, %for.body72 ]
%arrayidx85 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %idxprom84.pre-phi
%22 = load i8, ptr %arrayidx85, align 8, !tbaa !17
%conv87 = sext i8 %22 to i32
%n91 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %idxprom84.pre-phi, i32 1
%23 = load i32, ptr %n91, align 4, !tbaa !12
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv87, i32 noundef %23)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%24 = load i32, ptr %num, align 4, !tbaa !5
%cmp96206 = icmp sgt i32 %24, 1
br i1 %cmp96206, label %for.body98, label %for.end82.for.end109_crit_edge
for.end82.for.end109_crit_edge: ; preds = %for.end82
%sub95205 = add nsw i32 %24, -1
%.pre243 = sext i32 %sub95205 to i64
br label %for.end109
for.body98: ; preds = %for.end82, %for.body98
%indvars.iv235 = phi i64 [ %indvars.iv.next236, %for.body98 ], [ 0, %for.end82 ]
%arrayidx100 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv235
%25 = load i8, ptr %arrayidx100, align 8, !tbaa !17
%conv102 = sext i8 %25 to i32
%n105 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv235, i32 1
%26 = load i32, ptr %n105, align 4, !tbaa !12
%call106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv102, i32 noundef %26)
%indvars.iv.next236 = add nuw nsw i64 %indvars.iv235, 1
%27 = load i32, ptr %num, align 4, !tbaa !5
%sub95 = add nsw i32 %27, -1
%28 = sext i32 %sub95 to i64
%cmp96 = icmp slt i64 %indvars.iv.next236, %28
br i1 %cmp96, label %for.body98, label %for.end109, !llvm.loop !19
for.end109: ; preds = %for.body98, %for.end82.for.end109_crit_edge
%idxprom111.pre-phi = phi i64 [ %.pre243, %for.end82.for.end109_crit_edge ], [ %28, %for.body98 ]
%arrayidx112 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %idxprom111.pre-phi
%29 = load i8, ptr %arrayidx112, align 8, !tbaa !17
%conv114 = sext i8 %29 to i32
%n118 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %idxprom111.pre-phi, i32 1
%30 = load i32, ptr %n118, align 4, !tbaa !12
%call119 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv114, i32 noundef %30)
%31 = load i32, ptr %num, align 4, !tbaa !5
%cmp121209 = icmp sgt i32 %31, 0
br i1 %cmp121209, label %for.body123.preheader, label %if.end144
for.body123.preheader: ; preds = %for.end109
%wide.trip.count241 = zext i32 %31 to i64
%xtraiter = and i64 %wide.trip.count241, 3
%32 = icmp ult i32 %31, 4
br i1 %32, label %for.end138.unr-lcssa, label %for.body123.preheader.new
for.body123.preheader.new: ; preds = %for.body123.preheader
%unroll_iter = and i64 %wide.trip.count241, 4294967292
br label %for.body123
for.body123: ; preds = %for.body123, %for.body123.preheader.new
%indvars.iv238 = phi i64 [ 0, %for.body123.preheader.new ], [ %indvars.iv.next239.3, %for.body123 ]
%a.0211 = phi i32 [ 1, %for.body123.preheader.new ], [ %spec.select187.3, %for.body123 ]
%niter = phi i64 [ 0, %for.body123.preheader.new ], [ %niter.next.3, %for.body123 ]
%arrayidx125 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv238
%33 = load i8, ptr %arrayidx125, align 16, !tbaa !17
%arrayidx129 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv238
%34 = load i8, ptr %arrayidx129, align 16, !tbaa !17
%cmp132.not = icmp eq i8 %33, %34
%indvars.iv.next239 = or i64 %indvars.iv238, 1
%arrayidx125.1 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv.next239
%35 = load i8, ptr %arrayidx125.1, align 8, !tbaa !17
%arrayidx129.1 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv.next239
%36 = load i8, ptr %arrayidx129.1, align 8, !tbaa !17
%cmp132.not.1 = icmp eq i8 %35, %36
%indvars.iv.next239.1 = or i64 %indvars.iv238, 2
%arrayidx125.2 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv.next239.1
%37 = load i8, ptr %arrayidx125.2, align 16, !tbaa !17
%arrayidx129.2 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv.next239.1
%38 = load i8, ptr %arrayidx129.2, align 16, !tbaa !17
%cmp132.not.2 = icmp eq i8 %37, %38
%indvars.iv.next239.2 = or i64 %indvars.iv238, 3
%arrayidx125.3 = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv.next239.2
%39 = load i8, ptr %arrayidx125.3, align 8, !tbaa !17
%arrayidx129.3 = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv.next239.2
%40 = load i8, ptr %arrayidx129.3, align 8, !tbaa !17
%cmp132.not.3 = icmp eq i8 %39, %40
%41 = select i1 %cmp132.not.3, i1 %cmp132.not.2, i1 false
%42 = select i1 %41, i1 %cmp132.not.1, i1 false
%43 = select i1 %42, i1 %cmp132.not, i1 false
%spec.select187.3 = select i1 %43, i32 %a.0211, i32 0
%indvars.iv.next239.3 = add nuw nsw i64 %indvars.iv238, 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.end138.unr-lcssa, label %for.body123, !llvm.loop !20
for.end138.unr-lcssa: ; preds = %for.body123, %for.body123.preheader
%spec.select187.lcssa.ph = phi i32 [ undef, %for.body123.preheader ], [ %spec.select187.3, %for.body123 ]
%indvars.iv238.unr = phi i64 [ 0, %for.body123.preheader ], [ %indvars.iv.next239.3, %for.body123 ]
%a.0211.unr = phi i32 [ 1, %for.body123.preheader ], [ %spec.select187.3, %for.body123 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end138, label %for.body123.epil
for.body123.epil: ; preds = %for.end138.unr-lcssa, %for.body123.epil
%indvars.iv238.epil = phi i64 [ %indvars.iv.next239.epil, %for.body123.epil ], [ %indvars.iv238.unr, %for.end138.unr-lcssa ]
%a.0211.epil = phi i32 [ %spec.select187.epil, %for.body123.epil ], [ %a.0211.unr, %for.end138.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body123.epil ], [ 0, %for.end138.unr-lcssa ]
%arrayidx125.epil = getelementptr inbounds [36 x %struct.tmp], ptr %b, i64 0, i64 %indvars.iv238.epil
%44 = load i8, ptr %arrayidx125.epil, align 8, !tbaa !17
%arrayidx129.epil = getelementptr inbounds [36 x %struct.tmp], ptr %c, i64 0, i64 %indvars.iv238.epil
%45 = load i8, ptr %arrayidx129.epil, align 8, !tbaa !17
%cmp132.not.epil = icmp eq i8 %44, %45
%spec.select187.epil = select i1 %cmp132.not.epil, i32 %a.0211.epil, i32 0
%indvars.iv.next239.epil = add nuw nsw i64 %indvars.iv238.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.end138, label %for.body123.epil, !llvm.loop !21
for.end138: ; preds = %for.body123.epil, %for.end138.unr-lcssa
%spec.select187.lcssa = phi i32 [ %spec.select187.lcssa.ph, %for.end138.unr-lcssa ], [ %spec.select187.epil, %for.body123.epil ]
%46 = icmp eq i32 %spec.select187.lcssa, 1
%spec.select251 = select i1 %46, ptr @str.7, ptr @str.6
br label %if.end144
if.end144: ; preds = %for.end138, %for.end109
%str.6.sink = phi ptr [ @str.7, %for.end109 ], [ %spec.select251, %for.end138 ]
%puts185 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"", !7, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!13, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
#include<stdlib.h>
#define NMIN 1
#define NMAX 36
struct card{
char mark;
char value;
};
void bubble(struct card A[],int n){
int i,j;
struct card t;
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(A[j].value<A[j-1].value){
t=A[j];
A[j]=A[j-1];
A[j-1]=t;
}
}
}
}
void selection(struct card A[],int n){
int i,j,mi;
struct card t;
for(i=0;i<n;i++){
mi=i;
for(j=i;j<n;j++){
if(A[j].value<A[mi].value)mi=j;
}
t=A[i];
A[i]=A[mi];
A[mi]=t;
}
}
void print(struct card A[],int n){
int i;
for(i=0;i<n;i++){
if(i>0)printf(" ");
printf("%c%c",A[i].mark,A[i].value);
}
printf("\n");
}
int isStable(struct card c1[],struct card c2[],int n){
int i;
for(i=0;i<n;i++){
if(c1[i].mark!=c2[i].mark) return 0;
}
return 1;
}
int main(){
int n,i,j;
struct card c1[NMAX],c2[NMAX];
char ch;
scanf("%d",&n);
if(n<NMIN || n>NMAX)exit(1);
for(i=0;i<n;i++){
scanf(" %c%c",&c1[i].mark,&c1[i].value);
}
for(i=0;i<n;i++){
c2[i]=c1[i];
}
bubble(c1,n);
selection(c2,n);
print(c1,n);
printf("Stable\n");
print(c2,n);
if(isStable(c1,c2,n)==1){
printf("Stable\n");
}
else {printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114216/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c" %c%c\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp42 = icmp sgt i32 %n, 0
br i1 %cmp42, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%j.038 = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.038 to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv50 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next51, %for.inc21 ]
%cmp239 = icmp ult i64 %indvars.iv50, %2
br i1 %cmp239, label %for.body3, label %for.inc21
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next45 = add nsw i64 %indvars.iv44, -1
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%3 = load i8, ptr %value, align 1, !tbaa !5
%4 = add nsw i64 %indvars.iv44, -2
%value7 = getelementptr inbounds %struct.card, ptr %A, i64 %4, i32 1
%5 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %3, %5
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %A, i64 %4
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%6 = load i16, ptr %arrayidx, align 1
%7 = load i16, ptr %arrayidx6, align 1
store i16 %7, ptr %arrayidx, align 1
store i16 %6, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv50
br i1 %cmp2, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %n, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%mi.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %mi.038 to i64
%value6 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %mi.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%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 ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 !15
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 #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %n, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
%c1 = alloca [36 x %struct.card], align 16
%c2 = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %c1) #9
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %c2) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%1 = add i32 %0, -37
%or.cond = icmp ult i32 %1, -36
br i1 %or.cond, label %if.then, label %for.body
if.then: ; preds = %entry
call void @exit(i32 noundef 1) #10
unreachable
for.cond6.preheader: ; preds = %for.body
%cmp784 = icmp sgt i32 %.pr, 0
br i1 %cmp784, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv, i32 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !18
%2 = sext i32 %.pr to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp2, label %for.body, label %for.cond6.preheader, !llvm.loop !20
for.cond1.preheader.lr.ph.i: ; preds = %for.cond6.preheader
%3 = zext i32 %.pr to i64
%4 = shl nuw nsw i64 %3, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %c2, ptr nonnull align 16 %c1, i64 %4, i1 false)
%j.038.i = add nsw i32 %.pr, -1
%5 = zext i32 %.pr to i64
%6 = add nsw i64 %5, -1
%7 = zext i32 %j.038.i to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv50.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next51.i, %for.inc21.i ]
%cmp239.i = icmp ult i64 %indvars.iv50.i, %7
br i1 %cmp239.i, label %for.body3.i, label %for.inc21.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv44.i = phi i64 [ %indvars.iv.next45.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %6, %for.cond1.preheader.i ]
%indvars.iv.next45.i = add nsw i64 %indvars.iv44.i, -1
%value.i = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i, i32 1
%8 = load i8, ptr %value.i, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv44.i, -2
%value7.i = getelementptr inbounds %struct.card, ptr %c1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %c1, i64 %9
%arrayidx.i = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i
%11 = load i16, ptr %arrayidx.i, align 2
%12 = load i16, ptr %arrayidx6.i, align 2
store i16 %12, ptr %arrayidx.i, align 2
store i16 %11, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.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.iv50.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.next51.i = add nuw nsw i64 %indvars.iv50.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next51.i, %5
br i1 %exitcond.not.i, label %for.cond1.preheader.i38, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i38: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i39 = phi i64 [ %indvars.iv.next.i43, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i39 to i32
br label %for.body3.i40
for.body3.i40: ; preds = %for.body3.i40, %for.cond1.preheader.i38
%indvars.iv41.i = phi i64 [ %indvars.iv.i39, %for.cond1.preheader.i38 ], [ %indvars.iv.next42.i, %for.body3.i40 ]
%mi.038.i = phi i32 [ %13, %for.cond1.preheader.i38 ], [ %spec.select.i, %for.body3.i40 ]
%value.i41 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i41, align 1, !tbaa !5
%idxprom4.i = sext i32 %mi.038.i to i64
%value6.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %mi.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i42 = icmp ult i64 %indvars.iv.next42.i, %5
br i1 %cmp2.i42, label %for.body3.i40, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i40
%arrayidx11.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i39
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i43 = add nuw nsw i64 %indvars.iv.i39, 1
%exitcond.not.i44 = icmp eq i64 %indvars.iv.next.i43, %5
br i1 %exitcond.not.i44, label %if.end.peel.i, label %for.cond1.preheader.i38, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.card, ptr %c1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %c1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %.pr, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i47 = phi i64 [ %indvars.iv.next.i50, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i48 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i47
%19 = load i8, ptr %arrayidx.i48, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i49 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i47, i32 1
%20 = load i8, ptr %value.i49, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i50 = add nuw nsw i64 %indvars.iv.i47, 1
%exitcond.not.i51 = icmp eq i64 %indvars.iv.next.i50, %5
br i1 %exitcond.not.i51, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %for.cond6.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %n, align 4, !tbaa !18
%cmp13.i52 = icmp sgt i32 %21, 0
br i1 %cmp13.i52, label %if.end.peel.i55, label %print.exit74
if.end.peel.i55: ; preds = %print.exit
%wide.trip.count.i56 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i57 = getelementptr inbounds %struct.card, ptr %c2, i64 0, i32 1
%.pre17.i58 = load i8, ptr %value.peel.phi.trans.insert.i57, align 1, !tbaa !5
%.pre.i59 = load i8, ptr %c2, align 16, !tbaa !14
%conv.peel.i60 = sext i8 %.pre.i59 to i32
%conv4.peel.i61 = sext i8 %.pre17.i58 to i32
%call5.peel.i62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i60, i32 noundef %conv4.peel.i61)
%exitcond.peel.not.i63 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i63, label %print.exit74, label %if.end.i64
if.end.i64: ; preds = %if.end.peel.i55, %if.end.i64
%indvars.iv.i65 = phi i64 [ %indvars.iv.next.i72, %if.end.i64 ], [ 1, %if.end.peel.i55 ]
%putchar12.i66 = call i32 @putchar(i32 32)
%arrayidx.i67 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i65
%22 = load i8, ptr %arrayidx.i67, align 2, !tbaa !14
%conv.i68 = sext i8 %22 to i32
%value.i69 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i65, i32 1
%23 = load i8, ptr %value.i69, align 1, !tbaa !5
%conv4.i70 = sext i8 %23 to i32
%call5.i71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i68, i32 noundef %conv4.i70)
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i65, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i56
br i1 %exitcond.not.i73, label %print.exit74, label %if.end.i64, !llvm.loop !15
print.exit74: ; preds = %if.end.i64, %print.exit, %if.end.peel.i55
%putchar.i54 = call i32 @putchar(i32 10)
%24 = load i32, ptr %n, align 4, !tbaa !18
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end27
for.body.preheader.i: ; preds = %print.exit74
%wide.trip.count.i75 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i78 = add nuw nsw i64 %indvars.iv.i76, 1
%exitcond.not.i79 = icmp eq i64 %indvars.iv.next.i78, %wide.trip.count.i75
br i1 %exitcond.not.i79, label %if.end27, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i76 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i78, %for.cond.i ]
%arrayidx.i77 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i76
%25 = load i8, ptr %arrayidx.i77, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i76
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end27
if.end27: ; preds = %for.body.i, %for.cond.i, %print.exit74
%str.7.sink = phi ptr [ @str.8, %print.exit74 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts35 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %c2) #9
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %c1) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 #8 = { nofree nounwind }
attributes #9 = { nounwind }
attributes #10 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"card", !7, i64 0, !7, i64 1}
!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 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = distinct !{!20, !10}
|
//jidan al abrar
#include<stdio.h>
int main()
{
long long int t,n;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
printf("%lld\n",(n+1)/2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11426/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11426/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec3 = add nsw i64 %0, -1
store i64 %dec3, ptr %t, align 8, !tbaa !5
%tobool.not4 = icmp eq i64 %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, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %1, 1
%div = sdiv i64 %add, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div)
%2 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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<math.h>
#include<stdio.h>
#include <stdlib.h>
int main()
{ int n,m;
scanf("%d%d",&n,&m);
int ans=(1900*m+(n-m)*100)*pow(2,m);
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114317/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114317/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%mul = mul nsw i32 %0, 1900
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = sub nsw i32 %1, %0
%mul1 = mul nsw i32 %sub, 100
%add = add nsw i32 %mul1, %mul
%conv = sitofp i32 %add to double
%ldexp = call double @ldexp(double 1.000000e+00, i32 %0) #4
%mul4 = fmul double %ldexp, %conv
%conv5 = fptosi double %mul4 to i32
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) 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 willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void){
int n, m;
scanf("%d", &n);
scanf("%d", &m);
printf("%0.f", ((100 * ( n- m)) + 1900 * m) * pow(2, m) );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114360/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114360/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"%0.f\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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%mul = mul nsw i32 %sub, 100
%mul2 = mul nsw i32 %1, 1900
%add = add nsw i32 %mul, %mul2
%conv = sitofp i32 %add to double
%ldexp = call double @ldexp(double 1.000000e+00, i32 %1) #4
%mul5 = fmul double %ldexp, %conv
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) 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 willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int d=a;
for(;;){
if(d%b==c){printf("YES\n");return 0;}
d=d+a;
if(d==a*b){break;}
}
printf("NO\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114410/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114410/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
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
%2 = load i32, ptr %c, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
br label %for.cond
for.cond: ; preds = %if.end, %entry
%d.0 = phi i32 [ %0, %entry ], [ %add, %if.end ]
%rem = srem i32 %d.0, %1
%cmp = icmp eq i32 %rem, %2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %for.cond
%add = add nsw i32 %d.0, %0
%cmp2 = icmp eq i32 %add, %mul
br i1 %cmp2, label %cleanup, label %for.cond
cleanup: ; preds = %if.end, %for.cond
%str.sink = phi ptr [ @str.3, %for.cond ], [ @str, %if.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>
#include<time.h>
int main(void){
int A, B, C;
scanf("%d %d %d", &A, &B, &C);
int i = 1;
time_t start = time(NULL);
while(1) {
if(i*A % B == C) {
printf("YES\n");
return 0;
}
if(time(NULL) - start > 0.0001) {
printf("NO\n");
return 0;
}
i++;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114454/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114454/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = 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: 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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%call1 = call i64 @time(ptr noundef null) #5
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%rem15 = srem i32 %0, %1
%2 = load i32, ptr %C, align 4, !tbaa !5
%cmp16 = icmp eq i32 %rem15, %2
br i1 %cmp16, label %cleanup, label %if.end
while.cond: ; preds = %if.end
%inc = add nuw nsw i32 %i.017, 1
%3 = load i32, ptr %A, align 4, !tbaa !5
%mul = mul nsw i32 %3, %inc
%4 = load i32, ptr %B, align 4, !tbaa !5
%rem = srem i32 %mul, %4
%5 = load i32, ptr %C, align 4, !tbaa !5
%cmp = icmp eq i32 %rem, %5
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry, %while.cond
%i.017 = phi i32 [ %inc, %while.cond ], [ 1, %entry ]
%call3 = call i64 @time(ptr noundef null) #5
%cmp4 = icmp sgt i64 %call3, %call1
br i1 %cmp4, label %cleanup, label %while.cond
cleanup: ; preds = %if.end, %while.cond, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str.3, %while.cond ], [ @str, %if.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 "no-trapping-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"}
|
//set many funcs template
//Ver.20180716
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.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;}
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;}
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);}
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);}
void shuffledget(int x[],int n){
srand(time(0));
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;
}
int main(void){
int i,j,n,m,k,a,b,c,h,w,r=0,l,t;
double d;
char s[524288];
scanf("%d%d%d",&a,&b,&c);
//l=strlen(s);
//for(i=0;i<n;i++){scanf("%d",&a[i]);}
//shuffledget(a,n);
//qsort(a,n,sizeof(int),sortfncsj);
t=gcd(a,b);
if(c%t==0){printf("YES\n");}
else{printf("NO\n");}
//printf("%d\n",r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114498/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114498/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@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.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: 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 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 !16
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 !16
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 !17
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 !17
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 !18
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 !19
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 !21
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 !22
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 !23
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 !24
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(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: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%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 #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%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 #4 {
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 #4 {
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 #4 {
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 #4 {
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 #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; 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 #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #15
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #15
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #15
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
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.preheader61, 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 !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%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 !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, 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.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
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 [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 !25
%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.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #15
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #15
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; 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 #10 {
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 !25
%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 !37
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 i32 @main() local_unnamed_addr #11 {
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) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp.not4.i = icmp eq i32 %1, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %0, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %1, %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 [ %0, %entry ], [ %b.addr.05.i, %while.body.i ]
%2 = load i32, ptr %c, align 4, !tbaa !25
%rem = srem i32 %2, %a.addr.0.lcssa.i
%cmp = icmp eq i32 %rem, 0
%str.4.str = select i1 %cmp, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #13
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: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 = { nofree nounwind "no-trapping-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 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 #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"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 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
|
#include<stdio.h>
int main()
{
int a,b,c,end=0;
scanf("%d%d%d",&a,&b,&c);
for(int i=1;i<=100;i++)
{
if((a*i)%b==c)
{
end=3;
break;
}
}
if(end==3)
printf("YES");
else
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114540/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114540/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
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
%2 = load i32, ptr %c, align 4, !tbaa !5
br label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.013, 1
%mul.1 = mul nsw i32 %0, %inc
%rem.1 = srem i32 %mul.1, %1
%cmp1.1 = icmp eq i32 %rem.1, %2
br i1 %cmp1.1, label %if.end6, label %for.cond.1
for.cond.1: ; preds = %for.cond
%inc.1 = add nuw nsw i32 %i.013, 2
%exitcond.not.1 = icmp eq i32 %inc.1, 101
br i1 %exitcond.not.1, label %if.end6, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.1, %entry
%i.013 = phi i32 [ 1, %entry ], [ %inc.1, %for.cond.1 ]
%mul = mul nsw i32 %0, %i.013
%rem = srem i32 %mul, %1
%cmp1 = icmp eq i32 %rem, %2
br i1 %cmp1, label %if.end6, label %for.cond
if.end6: ; preds = %for.cond.1, %for.cond, %for.body
%.str.2.sink = phi ptr [ @.str.1, %for.body ], [ @.str.1, %for.cond ], [ @.str.2, %for.cond.1 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
int A, B, C;
scanf("%d %d %d",&A,&B,&C);
int flag = 0;
int i;
for (i = 0; i < B; i++) {
if ((i*A) % B == C) {
flag = 1;
}
}
if (flag == 1) {
printf("YES\n");
}
else {
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114584/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114584/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
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 %B, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body.lr.ph, label %if.else
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
%2 = load i32, ptr %C, align 4, !tbaa !5
%xtraiter = and i32 %0, 1
%3 = icmp eq i32 %0, 1
br i1 %3, label %for.end.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%i.012 = phi i32 [ 0, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%flag.011 = phi i32 [ 0, %for.body.lr.ph.new ], [ %spec.select.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%mul = mul nsw i32 %1, %i.012
%rem = srem i32 %mul, %0
%cmp1 = icmp eq i32 %rem, %2
%inc = or i32 %i.012, 1
%mul.1 = mul nsw i32 %1, %inc
%rem.1 = srem i32 %mul.1, %0
%cmp1.1 = icmp eq i32 %rem.1, %2
%4 = select i1 %cmp1.1, i1 true, i1 %cmp1
%spec.select.1 = select i1 %4, i32 1, i32 %flag.011
%inc.1 = add nuw nsw i32 %i.012, 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.unr-lcssa, label %for.body, !llvm.loop !9
for.end.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %spec.select.1, %for.body ]
%i.012.unr = phi i32 [ 0, %for.body.lr.ph ], [ %inc.1, %for.body ]
%flag.011.unr = phi i32 [ 0, %for.body.lr.ph ], [ %spec.select.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.unr-lcssa
%mul.epil = mul nsw i32 %1, %i.012.unr
%rem.epil = srem i32 %mul.epil, %0
%cmp1.epil = icmp eq i32 %rem.epil, %2
%spec.select.epil = select i1 %cmp1.epil, i32 1, i32 %flag.011.unr
br label %for.end
for.end: ; preds = %for.end.unr-lcssa, %for.body.epil
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.end.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%5 = icmp eq i32 %spec.select.lcssa, 1
br i1 %5, label %if.end6, label %if.else
if.else: ; preds = %entry, %for.end
br label %if.end6
if.end6: ; preds = %for.end, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define NUMBER 100
void print_array(int array[],int num)
{
int i;
for(i = 0; i < num - 1; i++){
printf("%d ", array[i]);
}
printf("%d\n", array[i]);
}
void insertSort(int array[],int num)
{
int i, v, j;
for(i = 1; i <= num - 1; i++){
print_array(array, num);
v = array[i];
j = i - 1;
while(j >= 0 && array[j] > v){
array[j + 1] = array[j];
j--;
}
array[j + 1] = v;
}
}
int main(void)
{
int i, num;
int array[NUMBER];
scanf("%d", &num);
for(i = 0; i < num; i++)
{
scanf("%d", &array[i]);
}
insertSort(array , num);
print_array(array , num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114634/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114634/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_array(ptr nocapture noundef readonly %array, i32 noundef %num) local_unnamed_addr #0 {
entry:
%sub = add i32 %num, -1
%cmp8 = icmp sgt i32 %num, 1
br i1 %cmp8, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = 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.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%1 = zext i32 %sub to i64
br label %for.end
for.end: ; preds = %entry, %for.end.loopexit
%i.0.lcssa = phi i64 [ %1, %for.end.loopexit ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %i.0.lcssa
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
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 void @insertSort(ptr nocapture noundef %array, i32 noundef %num) local_unnamed_addr #0 {
entry:
%cmp.not.not31 = icmp sgt i32 %num, 1
br i1 %cmp.not.not31, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub.i = add nsw i32 %num, -1
%wide.trip.count.i = zext i32 %sub.i to i64
%arrayidx2.i.us = getelementptr inbounds i32, ptr %array, i64 %wide.trip.count.i
%wide.trip.count = zext i32 %num to i64
br label %for.body.us
for.body.us: ; preds = %while.end.us, %for.body.lr.ph
%indvars.iv = phi i64 [ %indvars.iv.next, %while.end.us ], [ 1, %for.body.lr.ph ]
br label %for.body.i.us
for.body.i.us: ; preds = %for.body.i.us, %for.body.us
%indvars.iv.i.us = phi i64 [ 0, %for.body.us ], [ %indvars.iv.next.i.us, %for.body.i.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.us
%0 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %print_array.exit.loopexit.us, label %for.body.i.us, !llvm.loop !9
land.rhs.us: ; preds = %while.body.us, %print_array.exit.loopexit.us
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %while.body.us ], [ %indvars.iv, %print_array.exit.loopexit.us ]
%indvars.iv.next34 = add nsw i64 %indvars.iv33, -1
%idxprom3.us = and i64 %indvars.iv.next34, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %array, i64 %idxprom3.us
%1 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp sgt i32 %1, %4
br i1 %cmp5.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv33, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom11.us = ashr exact i64 %sext, 32
%arrayidx12.us = getelementptr inbounds i32, ptr %array, i64 %idxprom11.us
store i32 %4, ptr %arrayidx12.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !11
while.body.us: ; preds = %land.rhs.us
%arrayidx9.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv33
store i32 %1, ptr %arrayidx9.us, align 4, !tbaa !5
%2 = icmp sgt i64 %indvars.iv33, 1
br i1 %2, label %land.rhs.us, label %while.end.us, !llvm.loop !12
print_array.exit.loopexit.us: ; preds = %for.body.i.us
%3 = load i32, ptr %arrayidx2.i.us, align 4, !tbaa !5
%call3.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%arrayidx.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%4 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
for.end: ; preds = %while.end.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%array = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %array) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %print_array.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 %array, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %num, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp.not.not31.i = icmp sgt i32 %1, 1
br i1 %cmp.not.not31.i, label %for.body.lr.ph.i, label %print_array.exit
for.body.lr.ph.i: ; preds = %for.end
%sub.i.i = add nsw i32 %1, -1
%wide.trip.count.i.i = zext i32 %sub.i.i to i64
%arrayidx2.i.us.i = getelementptr inbounds i32, ptr %array, i64 %wide.trip.count.i.i
%wide.trip.count.i = zext i32 %1 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %while.end.us.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.end.us.i ], [ 1, %for.body.lr.ph.i ]
br label %for.body.i.us.i
for.body.i.us.i: ; preds = %for.body.i.us.i, %for.body.us.i
%indvars.iv.i.us.i = phi i64 [ 0, %for.body.us.i ], [ %indvars.iv.next.i.us.i, %for.body.i.us.i ]
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.us.i
%3 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %print_array.exit.loopexit.us.i, label %for.body.i.us.i, !llvm.loop !9
land.rhs.us.i: ; preds = %print_array.exit.loopexit.us.i, %while.body.us.i
%indvars.iv33.i = phi i64 [ %indvars.iv.next34.i, %while.body.us.i ], [ %indvars.iv.i, %print_array.exit.loopexit.us.i ]
%indvars.iv.next34.i = add nsw i64 %indvars.iv33.i, -1
%idxprom3.us.i = and i64 %indvars.iv.next34.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %array, i64 %idxprom3.us.i
%4 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp sgt i32 %4, %7
br i1 %cmp5.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv33.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom11.us.i = ashr exact i64 %sext.i, 32
%arrayidx12.us.i = getelementptr inbounds i32, ptr %array, i64 %idxprom11.us.i
store i32 %7, ptr %arrayidx12.us.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %insertSort.exit, label %for.body.us.i, !llvm.loop !11
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx9.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv33.i
store i32 %4, ptr %arrayidx9.us.i, align 4, !tbaa !5
%5 = icmp sgt i64 %indvars.iv33.i, 1
br i1 %5, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
print_array.exit.loopexit.us.i: ; preds = %for.body.i.us.i
%6 = load i32, ptr %arrayidx2.i.us.i, align 4, !tbaa !5
%call3.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%arrayidx.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
insertSort.exit: ; preds = %while.end.us.i
%.pr = load i32, ptr %num, align 4, !tbaa !5
%cmp8.i = icmp sgt i32 %.pr, 1
br i1 %cmp8.i, label %for.body.preheader.i, label %print_array.exit
for.body.preheader.i: ; preds = %insertSort.exit
%sub.i = add nsw i32 %.pr, -1
%wide.trip.count.i5 = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i6 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i7, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i6
%8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%indvars.iv.next.i7 = add nuw nsw i64 %indvars.iv.i6, 1
%exitcond.not.i8 = icmp eq i64 %indvars.iv.next.i7, %wide.trip.count.i5
br i1 %exitcond.not.i8, label %print_array.exit, label %for.body.i, !llvm.loop !9
print_array.exit: ; preds = %for.body.i, %entry, %for.end, %insertSort.exit
%i.0.lcssa.i = phi i64 [ 0, %insertSort.exit ], [ 0, %for.end ], [ 0, %entry ], [ %wide.trip.count.i5, %for.body.i ]
%arrayidx2.i = getelementptr inbounds i32, ptr %array, i64 %i.0.lcssa.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%call3.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %array) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
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 insertionSort(int A[], int N){
int j, i, v;
for(i = 1; i < N; i++){
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v){
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
trace(A, N);
}
}
int main(){
int N, i;
int A[100];
scanf("%d", &N);
for(i = 0; i < N; i++) scanf("%d", &A[i]);
trace(A, N);
insertionSort(A, N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114678/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114678/source.c"
target datalayout = "e-m:e-p270:32: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
; 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: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %N, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %trace.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv34, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %trace.exit.loopexit.us, %entry
ret void
}
; 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.1, 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 %trace.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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 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
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%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, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %4, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %trace.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %trace.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i5
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%6 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %6, %5
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %5, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us.i
%7 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %trace.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34.i
store i32 %6, ptr %arrayidx8.us.i, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %8, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
trace.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %wide.trip.count.i.i
br i1 %exitcond.not.i7, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !13
insertionSort.exit: ; preds = %trace.exit.loopexit.us.i, %trace.exit
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, !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>
void trace( int *A, int n )
{
int i=0;
while( i<n ) {
printf( "%d", A[i++] );
if( i != n ) { printf( " " ); }
}
printf( "\n" );
return;
}
void insertionSort( int *A, int n )
{
int i,j;
int key;
for( i=1; i<n; i++ ) {
key = A[i];
j = i-1;
while( 0<=j && key<A[j] ) {
A[j+1] = A[j];
j--;
}
A[j+1] = key;
trace( A, n );
}
return;
}
int main( void )
{
int n;
int A[101];
int i;
scanf( "%d", &n );
for( i=0; i<n; i++ ) {
scanf( "%d", &A[i] );
}
trace( A, n );
insertionSort( A, n );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114720/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114720/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 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 %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end
%indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %if.end ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%cmp1.not = icmp eq i64 %indvars.iv.next, %0
br i1 %cmp1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%putchar7 = tail call i32 @putchar(i32 32)
br label %if.end
if.end: ; preds = %if.then, %while.body
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %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: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp33 = icmp sgt i32 %n, 1
br i1 %cmp33, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%0 = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %while.body.i.trace.exit.loopexit_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %while.body.i.trace.exit.loopexit_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next38 = add nsw i64 %indvars.iv37, -1
%idxprom2.us = and i64 %indvars.iv.next38, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %1, %2
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv37, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %1, ptr %arrayidx11.us, align 4, !tbaa !5
%3 = load i32, ptr %A, align 4, !tbaa !5
%call.i30.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.next.i32.us = phi i64 [ 1, %while.end.us ], [ %indvars.iv.next.i.us, %if.end.i.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.next.i32.us, 1
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i32.us
%4 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%cmp1.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %0
br i1 %cmp1.not.i.us, label %while.body.i.trace.exit.loopexit_crit_edge.us, label %if.end.i.us
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv37
store i32 %2, ptr %arrayidx8.us, align 4, !tbaa !5
%5 = icmp sgt i64 %indvars.iv37, 1
br i1 %5, label %land.rhs.us, label %while.end.us, !llvm.loop !11
while.body.i.trace.exit.loopexit_crit_edge.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !12
for.end: ; preds = %while.body.i.trace.exit.loopexit_crit_edge.us, %entry
ret void
}
; 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
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %trace.exit
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.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %while.body.preheader.i, label %trace.exit
while.body.preheader.i: ; preds = %for.end
%3 = zext i32 %1 to i64
%4 = load i32, ptr %A, align 16, !tbaa !5
%call.i10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%cmp1.not.i11 = icmp eq i32 %1, 1
br i1 %cmp1.not.i11, label %trace.exit, label %if.end.i
if.end.i: ; preds = %while.body.preheader.i, %if.end.i
%indvars.iv.next.i12 = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %while.body.preheader.i ]
%putchar7.i = call i32 @putchar(i32 32)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.next.i12, 1
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i12
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%cmp1.not.i = icmp eq i64 %indvars.iv.next.i, %3
br i1 %cmp1.not.i, label %trace.exit, label %if.end.i
trace.exit: ; preds = %if.end.i, %entry, %while.body.preheader.i, %for.end
%putchar.i = call i32 @putchar(i32 10)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp33.i = icmp sgt i32 %6, 1
br i1 %cmp33.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%7 = zext i32 %6 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %while.body.i.trace.exit.loopexit_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %while.body.i.trace.exit.loopexit_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i5
%8 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv37.i = phi i64 [ %indvars.iv.next38.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next38.i = add nsw i64 %indvars.iv37.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next38.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%9 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp slt i32 %8, %9
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv37.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %8, ptr %arrayidx11.us.i, align 4, !tbaa !5
%10 = load i32, ptr %A, align 16, !tbaa !5
%call.i30.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.next.i32.us.i = phi i64 [ 1, %while.end.us.i ], [ %indvars.iv.next.i.us.i, %if.end.i.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.next.i32.us.i, 1
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i32.us.i
%11 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%cmp1.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %7
br i1 %cmp1.not.i.us.i, label %while.body.i.trace.exit.loopexit_crit_edge.us.i, label %if.end.i.us.i
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv37.i
store i32 %9, ptr %arrayidx8.us.i, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv37.i, 1
br i1 %12, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !11
while.body.i.trace.exit.loopexit_crit_edge.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %7
br i1 %exitcond.not.i7, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !12
insertionSort.exit: ; preds = %while.body.i.trace.exit.loopexit_crit_edge.us.i, %trace.exit
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: 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 t,n,i,j,stick;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d",&n);
if(n%2==0)
{
stick=n/2;
printf("%d\n",stick);
}
else if(n%2!=0)
{
stick=(n+1)/2;
printf("%d\n",stick);
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not12 = icmp slt i32 %0, 1
br i1 %cmp.not12, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%i.013 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = and i32 %1, 1
%.sink = add i32 %1, %2
%div = sdiv i32 %.sink, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%inc = add nuw nsw i32 %i.013, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.013, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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>
#include <stdlib.h>
int main()
{
int i,j,k,v;
//??\???
int n;
scanf("%d", &n);
int A[n];
for( i = 0; i < n; ++i ){
scanf("%d", &A[i]);
}
for(i = 0; i < n; i++){
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v){
A[j+1] = A[j];
j--;
}
A[j+1] = v;
for(k = 0; k < n; k++){
printf("%d", A[k]);
if( k != n-1 ){
printf(" ");
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114843/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%cmp50 = icmp sgt i32 %3, 0
br i1 %cmp50, label %for.body, label %for.end33
for.cond2.preheader: ; preds = %for.body
%cmp359 = icmp sgt i32 %4, 0
br i1 %cmp359, label %for.body4, label %for.end33
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end29
%6 = phi i32 [ %15, %for.end29 ], [ %4, %for.cond2.preheader ]
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.end29 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv62
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp753.not = icmp eq i64 %indvars.iv62, 0
br i1 %cmp753.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %while.body ], [ %indvars.iv62, %for.body4 ]
%indvars.iv.next65 = add nsw i64 %indvars.iv64, -1
%idxprom8 = and i64 %indvars.iv.next65, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %8, %7
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv64
store i32 %8, ptr %arrayidx14, align 4, !tbaa !5
%9 = icmp sgt i64 %indvars.iv64, 1
br i1 %9, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%j.0.in.lcssa = phi i64 [ 0, %for.body4 ], [ 0, %while.body ], [ %indvars.iv64, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %idxprom16
store i32 %7, ptr %arrayidx17, align 4, !tbaa !5
%cmp1957 = icmp sgt i32 %6, 0
br i1 %cmp1957, label %for.body20, label %for.end29
for.body20: ; preds = %while.end, %for.inc27
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.inc27 ], [ 0, %while.end ]
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv67
%10 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
%11 = load i32, ptr %n, align 4, !tbaa !5
%sub24 = add nsw i32 %11, -1
%12 = zext i32 %sub24 to i64
%cmp25.not = icmp eq i64 %indvars.iv67, %12
br i1 %cmp25.not, label %for.inc27, label %if.then
if.then: ; preds = %for.body20
%putchar49 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc27
for.inc27: ; preds = %for.body20, %if.then
%13 = phi i32 [ %11, %for.body20 ], [ %.pre, %if.then ]
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%14 = sext i32 %13 to i64
%cmp19 = icmp slt i64 %indvars.iv.next68, %14
br i1 %cmp19, label %for.body20, label %for.end29, !llvm.loop !12
for.end29: ; preds = %for.inc27, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp3 = icmp slt i64 %indvars.iv.next63, %16
br i1 %cmp3, label %for.body4, label %for.end33, !llvm.loop !13
for.end33: ; preds = %for.end29, %entry, %for.cond2.preheader
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}
|
#include<stdio.h>
int main(){
int num,A[999],v,j,i,c;
scanf("%d",&num);
for(i = 0;i < num;i++){
scanf("%d",&A[i]);
}
for(i = 0;i < num-1;i++){
printf("%d ",A[i]);
}
printf("%d",A[num-1]);
printf("\n");
for(i = 1;i <= num-1;i++){
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v){
A[j+1] = A[j];
j--;
}
A[j+1] = v;
for(c = 0;c < num-1;c++){
printf("%d ",A[c]);
}
printf("%d",A[num-1]);
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114887/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%A = alloca [999 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 3996, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp373 = icmp sgt i32 %2, 1
br i1 %cmp373, label %for.body4, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader.for.end10_crit_edge: ; preds = %entry, %for.cond2.preheader
%1 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ]
%sub72 = add nsw i32 %1, -1
%.pre = sext i32 %sub72 to i64
br label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [999 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 %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %indvars.iv87
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%5 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next88, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.cond2.preheader.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %num, align 4, !tbaa !5
%cmp18.not.not82 = icmp sgt i32 %8, 1
br i1 %cmp18.not.not82, label %for.body19, label %for.end51
for.body19: ; preds = %for.end10, %for.end43
%9 = phi i32 [ %17, %for.end43 ], [ %8, %for.end10 ]
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.end43 ], [ 1, %for.end10 ]
%arrayidx21 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %indvars.iv90
%10 = load i32, ptr %arrayidx21, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body19, %while.body
%indvars.iv92 = phi i64 [ %indvars.iv90, %for.body19 ], [ %indvars.iv.next93, %while.body ]
%indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
%idxprom24 = and i64 %indvars.iv.next93, 4294967295
%arrayidx25 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %idxprom24
%11 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %11, %10
br i1 %cmp26, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx30 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %indvars.iv92
store i32 %11, ptr %arrayidx30, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv92, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv92, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom32 = ashr exact i64 %sext, 32
%arrayidx33 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %idxprom32
store i32 %10, ptr %arrayidx33, align 4, !tbaa !5
%cmp3679 = icmp sgt i32 %9, 1
br i1 %cmp3679, label %for.body37, label %while.end.for.end43_crit_edge
while.end.for.end43_crit_edge: ; preds = %while.end
%sub3578 = add nsw i32 %9, -1
%.pre101 = sext i32 %sub3578 to i64
br label %for.end43
for.body37: ; preds = %while.end, %for.body37
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body37 ], [ 0, %while.end ]
%arrayidx39 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %indvars.iv95
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%14 = load i32, ptr %num, align 4, !tbaa !5
%sub35 = add nsw i32 %14, -1
%15 = sext i32 %sub35 to i64
%cmp36 = icmp slt i64 %indvars.iv.next96, %15
br i1 %cmp36, label %for.body37, label %for.end43, !llvm.loop !13
for.end43: ; preds = %for.body37, %while.end.for.end43_crit_edge
%idxprom45.pre-phi = phi i64 [ %.pre101, %while.end.for.end43_crit_edge ], [ %15, %for.body37 ]
%arrayidx46 = getelementptr inbounds [999 x i32], ptr %A, i64 0, i64 %idxprom45.pre-phi
%16 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
%putchar69 = call i32 @putchar(i32 10)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%17 = load i32, ptr %num, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp18.not.not = icmp slt i64 %indvars.iv.next91, %18
br i1 %cmp18.not.not, label %for.body19, label %for.end51, !llvm.loop !14
for.end51: ; preds = %for.end43, %for.end10
call void @llvm.lifetime.end.p0(i64 3996, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int t, i=0;
scanf("%d", &t);
while(i<t){
long n;
scanf("%ld", &n);
if(n&1)
n = n/2+1;
else
n = n/2;
printf("%ld\n", n);
i++;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11493/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11493/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.06 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !9
%and = and i64 %1, 1
%div2 = sdiv i64 %1, 2
%storemerge = add nsw i64 %div2, %and
store i64 %storemerge, ptr %n, align 8, !tbaa !9
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %storemerge)
%inc = add nuw nsw i32 %i.06, 1
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
%2 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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 main(){
int h,i,j,v,N;
int A[1000];
scanf("%d",&N);
for(i = 0; i < N; i++){
scanf("%d",&A[i]);
}
for(i = 0; i < N; i++){
printf("%d",A[i]);
if(i == N-1)printf("\n");
else printf(" ");
}
for(i = 1; i < N; i++){
v = A[i];
j = i - 1;
while(j>=0 && A[j]>v){
A[j+1] = A[j];
j--;
}
A[j+1] = v;
for(h = 0; h < N; h++){
printf("%d",A[h]);
if(h == N-1)printf("\n");
else printf(" ");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114973/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4000, 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
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.end49
for.cond2.preheader: ; preds = %for.body
%cmp374 = icmp sgt i32 %1, 0
br i1 %cmp374, label %for.body4, label %for.end49
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond14.preheader: ; preds = %for.body4
%cmp1581 = icmp sgt i32 %6, 1
br i1 %cmp1581, label %for.body16, label %for.end49
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv84
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%4 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %4, -1
%5 = zext i32 %sub to i64
%cmp8 = icmp eq i64 %indvars.iv84, %5
%. = select i1 %cmp8, i32 10, i32 32
%putchar71 = call i32 @putchar(i32 %.)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next85, %7
br i1 %cmp3, label %for.body4, label %for.cond14.preheader, !llvm.loop !11
for.body16: ; preds = %for.cond14.preheader, %for.inc47
%8 = phi i32 [ %17, %for.inc47 ], [ %6, %for.cond14.preheader ]
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.inc47 ], [ 1, %for.cond14.preheader ]
%arrayidx18 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv87
%9 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body16 ], [ %indvars.iv.next90, %while.body ]
%indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
%idxprom21 = and i64 %indvars.iv.next90, 4294967295
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom21
%10 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %10, %9
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv89
store i32 %10, ptr %arrayidx27, align 4, !tbaa !5
%11 = icmp sgt i64 %indvars.iv89, 1
br i1 %11, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv89, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom29
store i32 %9, ptr %arrayidx30, align 4, !tbaa !5
%cmp3279 = icmp sgt i32 %8, 0
br i1 %cmp3279, label %for.body33, label %while.end.for.inc47_crit_edge
while.end.for.inc47_crit_edge: ; preds = %while.end
%.pre = sext i32 %8 to i64
br label %for.inc47
for.body33: ; preds = %while.end, %for.body33
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.body33 ], [ 0, %while.end ]
%arrayidx35 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv92
%12 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%13 = load i32, ptr %N, align 4, !tbaa !5
%sub37 = add nsw i32 %13, -1
%14 = zext i32 %sub37 to i64
%cmp38 = icmp eq i64 %indvars.iv92, %14
%.104 = select i1 %cmp38, i32 10, i32 32
%putchar69 = call i32 @putchar(i32 %.104)
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp32 = icmp slt i64 %indvars.iv.next93, %16
br i1 %cmp32, label %for.body33, label %for.inc47, !llvm.loop !13
for.inc47: ; preds = %for.body33, %while.end.for.inc47_crit_edge
%.pre-phi = phi i64 [ %.pre, %while.end.for.inc47_crit_edge ], [ %16, %for.body33 ]
%17 = phi i32 [ %8, %while.end.for.inc47_crit_edge ], [ %15, %for.body33 ]
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%cmp15 = icmp slt i64 %indvars.iv.next88, %.pre-phi
br i1 %cmp15, label %for.body16, label %for.end49, !llvm.loop !14
for.end49: ; preds = %for.inc47, %entry, %for.cond2.preheader, %for.cond14.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
int n,t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if(n%2==0 )printf("%d\n",n/2);
else printf("%d\n",n/2+1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11503/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11503/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec5 = add nsw i32 %0, -1
store i32 %dec5, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = and i32 %1, 1
%div = sdiv i32 %1, 2
%add.sink = add nsw i32 %div, %2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int i, a[1000], n, v, j, k;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
for(i = 1; i < n+1; i++){
for(k = 0; k < n; k++){
printf("%d", a[k]);
if(k == n-1) printf("\n");
else printf(" ");
}
v = a[i];
j = i - 1;
while((j >= 0) && (a[j] > v)){
a[j+1] = a[j];
j--;
}
a[j+1] = v;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115073/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115073/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end34
for.cond2.preheader: ; preds = %for.body
%cmp3.not58 = icmp slt i32 %1, 1
br i1 %cmp3.not58, label %for.end34, label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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, %while.end
%3 = phi i32 [ %9, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %while.end ], [ 1, %for.cond2.preheader ]
%cmp653 = icmp sgt i32 %3, 0
br i1 %cmp653, label %for.body7, label %for.end16
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv69
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp11 = icmp eq i64 %indvars.iv69, %6
%. = select i1 %cmp11, i32 10, i32 32
%putchar50 = call i32 @putchar(i32 %.)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp6 = icmp slt i64 %indvars.iv.next70, %8
br i1 %cmp6, label %for.body7, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body7, %for.cond5.preheader
%9 = phi i32 [ %3, %for.cond5.preheader ], [ %7, %for.body7 ]
%arrayidx18 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv73
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end16, %while.body
%indvars.iv75 = phi i64 [ %indvars.iv73, %for.end16 ], [ %indvars.iv.next76, %while.body ]
%indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
%idxprom21 = and i64 %indvars.iv.next76, 4294967295
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom21
%11 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %11, %10
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv75
store i32 %11, ptr %arrayidx28, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv75, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv75, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom30 = ashr exact i64 %sext, 32
%arrayidx31 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom30
store i32 %10, ptr %arrayidx31, align 4, !tbaa !5
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%13 = sext i32 %9 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv73, %13
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.end34, !llvm.loop !13
for.end34: ; preds = %while.end, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
void insertionsort(int *A,int n){
int i,j,k,v;
for(i=1;i<n;i++){
for(k=0;k<n-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[n-1]);
v = A[i];
j = i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
A[j+1]=v;
}
}
for(k=0;k<n-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[n-1]);
}
int main(){
int n,i,A[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
insertionsort(A,n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115116/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115116/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionsort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp71 = icmp sgt i32 %n, 1
%sub = add i32 %n, -1
br i1 %cmp71, label %for.cond1.preheader.us.preheader, label %for.end34
for.cond1.preheader.us.preheader: ; preds = %entry
%idxprom5 = zext i32 %sub to i64
%arrayidx6 = getelementptr inbounds i32, ptr %A, i64 %idxprom5
%wide.trip.count84 = zext i32 %n to i64
%wide.trip.count = zext i32 %sub to i64
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.inc22.us
%indvars.iv77 = phi i64 [ 1, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next78, %for.inc22.us ]
br label %for.body3.us
land.rhs.us: ; preds = %while.body.us, %for.cond1.for.end_crit_edge.us
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %while.body.us ], [ %indvars.iv77, %for.cond1.for.end_crit_edge.us ]
%indvars.iv.next80 = add nsw i64 %indvars.iv79, -1
%idxprom12.us = and i64 %indvars.iv.next80, 4294967295
%arrayidx13.us = getelementptr inbounds i32, ptr %A, i64 %idxprom12.us
%0 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%cmp14.us = icmp sgt i32 %0, %4
br i1 %cmp14.us, label %while.body.us, label %for.inc22.us
for.inc22.us: ; preds = %while.body.us, %land.rhs.us
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count84
br i1 %exitcond85.not, label %for.cond25.preheader, label %for.cond1.preheader.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx18.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv79
store i32 %0, ptr %arrayidx18.us, align 4, !tbaa !5
store i32 %4, ptr %arrayidx13.us, align 4, !tbaa !5
%1 = icmp sgt i64 %indvars.iv79, 1
br i1 %1, label %land.rhs.us, label %for.inc22.us, !llvm.loop !11
for.body3.us: ; preds = %for.cond1.preheader.us, %for.body3.us
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.body3.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%2 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%call.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%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.for.end_crit_edge.us, label %for.body3.us, !llvm.loop !12
for.cond1.for.end_crit_edge.us: ; preds = %for.body3.us
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv77
%4 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
br label %land.rhs.us
for.cond25.preheader: ; preds = %for.inc22.us
br i1 %cmp71, label %for.body28.preheader, label %for.end34
for.body28.preheader: ; preds = %for.cond25.preheader
%wide.trip.count90 = zext i32 %sub to i64
br label %for.body28
for.body28: ; preds = %for.body28.preheader, %for.body28
%indvars.iv86 = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next87, %for.body28 ]
%arrayidx30 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv86
%5 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%call31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond91.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count90
br i1 %exitcond91.not, label %for.end34, label %for.body28, !llvm.loop !13
for.end34: ; preds = %for.body28, %entry, %for.cond25.preheader
%idxprom36 = sext i32 %sub to i64
%arrayidx37 = getelementptr inbounds i32, ptr %A, i64 %idxprom36
%6 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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 !14
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @insertionsort(ptr noundef nonnull %A, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
char s[1024], t[1024];
int main()
{
int i, j;
scanf(" %s %s", s, t);
for ( i = 0, j = 0; s[i] && t[j]; ++j )
if ( s[i] == t[j] )
++i;
printf("%d\n", i+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %s %s\00", align 1
@s = dso_local global [1024 x i8] zeroinitializer, align 16
@t = dso_local global [1024 x i8] 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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull @t)
%0 = load i8, ptr @s, align 16, !tbaa !5
%tobool.not19 = icmp eq i8 %0, 0
br i1 %tobool.not19, label %for.end, label %land.rhs
land.rhs: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %3, %for.body ], [ %0, %entry ]
%i.020 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds [1024 x i8], ptr @t, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%tobool4.not = icmp eq i8 %2, 0
br i1 %tobool4.not, label %for.end.loopexit, label %for.body
for.body: ; preds = %land.rhs
%cmp = icmp eq i8 %1, %2
%inc = zext i1 %cmp to i32
%spec.select = add nuw nsw i32 %i.020, %inc
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%idxprom = zext i32 %spec.select to i64
%arrayidx = getelementptr inbounds [1024 x i8], ptr @s, i64 0, i64 %idxprom
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %for.end.loopexit, label %land.rhs, !llvm.loop !8
for.end.loopexit: ; preds = %for.body, %land.rhs
%i.0.lcssa.ph = phi i32 [ %i.020, %land.rhs ], [ %spec.select, %for.body ]
%4 = add nuw nsw i32 %i.0.lcssa.ph, 1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i32 [ 1, %entry ], [ %4, %for.end.loopexit ]
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int i, j, k, v, n, a[100];
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(i=1; i<n; i++)
{
for(k=0; k<n; k++)
{
printf("%d", a[k]);
if(k+1<n)printf(" ");
}
printf("\n");
v = a[i];
j = i-1;
while(j>=0 && a[j]>v)
{
a[j+1] = a[j];
j--;
}
a[j+1] = v;
}
for(i=0; i<n; i++)
{
printf("%d", a[i]);
if(i+1<n)printf(" ");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115202/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%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
%cmp71 = icmp sgt i32 %0, 0
br i1 %cmp71, label %for.body, label %for.end47
for.cond2.preheader: ; preds = %for.body
%cmp378 = icmp sgt i32 %1, 1
br i1 %cmp378, label %for.cond5.preheader, label %for.cond34.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
%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, %while.end
%3 = phi i32 [ %11, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %while.end ], [ 1, %for.cond2.preheader ]
%cmp673 = icmp sgt i32 %3, 0
br i1 %cmp673, label %for.body7, label %for.end15
for.cond34.preheader: ; preds = %while.end, %for.cond2.preheader
%4 = phi i32 [ %1, %for.cond2.preheader ], [ %11, %while.end ]
%cmp3580 = icmp sgt i32 %4, 0
br i1 %cmp3580, label %for.body36, label %for.end47
for.body7: ; preds = %for.cond5.preheader, %for.inc13
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc13 ], [ 0, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv83
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp11 = icmp slt i64 %indvars.iv.next84, %7
br i1 %cmp11, label %if.then, label %for.inc13
if.then: ; preds = %for.body7
%putchar70 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%.pre98 = sext i32 %.pre to i64
br label %for.inc13
for.inc13: ; preds = %for.body7, %if.then
%.pre-phi = phi i64 [ %7, %for.body7 ], [ %.pre98, %if.then ]
%cmp6 = icmp slt i64 %indvars.iv.next84, %.pre-phi
br i1 %cmp6, label %for.body7, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.inc13, %for.cond5.preheader
%putchar69 = call i32 @putchar(i32 10)
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv86
%8 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end15, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.end15 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom20 = and i64 %indvars.iv.next89, 4294967295
%arrayidx21 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom20
%9 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %9, %8
br i1 %cmp22, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv88
store i32 %9, ptr %arrayidx27, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv88, 1
br i1 %10, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv88, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom29
store i32 %8, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp3 = icmp slt i64 %indvars.iv.next87, %12
br i1 %cmp3, label %for.cond5.preheader, label %for.cond34.preheader, !llvm.loop !13
for.body36: ; preds = %for.cond34.preheader, %for.inc45
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.inc45 ], [ 0, %for.cond34.preheader ]
%arrayidx38 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv93
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp41 = icmp slt i64 %indvars.iv.next94, %15
br i1 %cmp41, label %if.then42, label %for.inc45
if.then42: ; preds = %for.body36
%putchar68 = call i32 @putchar(i32 32)
%.pre97 = load i32, ptr %n, align 4, !tbaa !5
%.pre99 = sext i32 %.pre97 to i64
br label %for.inc45
for.inc45: ; preds = %for.body36, %if.then42
%.pre-phi100 = phi i64 [ %15, %for.body36 ], [ %.pre99, %if.then42 ]
%cmp35 = icmp slt i64 %indvars.iv.next94, %.pre-phi100
br i1 %cmp35, label %for.body36, label %for.end47, !llvm.loop !14
for.end47: ; preds = %for.inc45, %entry, %for.cond34.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
int N,i,v,j,k,A[1000];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
for(k=0;k<N-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[N-1]);
for(i=1;i<=N-1;i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
for(k=0;k<N-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[N-1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115246/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115246/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp370 = icmp sgt i32 %2, 1
br i1 %cmp370, label %for.body4, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader.for.end10_crit_edge: ; preds = %entry, %for.cond2.preheader
%1 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ]
%sub69 = add nsw i32 %1, -1
%.pre = sext i32 %sub69 to i64
br label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv84
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next85, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.cond2.preheader.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp17.not.not79 = icmp sgt i32 %8, 1
br i1 %cmp17.not.not79, label %for.body18, label %for.end49
for.body18: ; preds = %for.end10, %for.end42
%9 = phi i32 [ %17, %for.end42 ], [ %8, %for.end10 ]
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.end42 ], [ 1, %for.end10 ]
%arrayidx20 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv87
%10 = load i32, ptr %arrayidx20, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body18, %while.body
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body18 ], [ %indvars.iv.next90, %while.body ]
%indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
%idxprom23 = and i64 %indvars.iv.next90, 4294967295
%arrayidx24 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom23
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %11, %10
br i1 %cmp25, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv89
store i32 %11, ptr %arrayidx29, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv89, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv89, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom31 = ashr exact i64 %sext, 32
%arrayidx32 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom31
store i32 %10, ptr %arrayidx32, align 4, !tbaa !5
%cmp3576 = icmp sgt i32 %9, 1
br i1 %cmp3576, label %for.body36, label %while.end.for.end42_crit_edge
while.end.for.end42_crit_edge: ; preds = %while.end
%sub3475 = add nsw i32 %9, -1
%.pre98 = sext i32 %sub3475 to i64
br label %for.end42
for.body36: ; preds = %while.end, %for.body36
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.body36 ], [ 0, %while.end ]
%arrayidx38 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv92
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%14 = load i32, ptr %N, align 4, !tbaa !5
%sub34 = add nsw i32 %14, -1
%15 = sext i32 %sub34 to i64
%cmp35 = icmp slt i64 %indvars.iv.next93, %15
br i1 %cmp35, label %for.body36, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.body36, %while.end.for.end42_crit_edge
%idxprom44.pre-phi = phi i64 [ %.pre98, %while.end.for.end42_crit_edge ], [ %15, %for.body36 ]
%arrayidx45 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom44.pre-phi
%16 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%17 = load i32, ptr %N, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp17.not.not = icmp slt i64 %indvars.iv.next88, %18
br i1 %cmp17.not.not, label %for.body18, label %for.end49, !llvm.loop !14
for.end49: ; preds = %for.end42, %for.end10
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define N 100
int main(){
int a,b[N],i,d,k,j;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d",&b[i]);
}
for(j=0;j<a;j++) {
printf("%d",b[j]);
if(j<a-1)printf(" ");
}
printf("\n");
for(i=1;i<=a-1;i++){
d=i;
while(d>0 && b[d]< b[d-1]){
k=b[d];
b[d]=b[d-1];
b[d-1]=k;
d--;
}
for(j=0;j<a;j++) {
printf("%d",b[j]);
if(j<a-1)printf(" ");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115297/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115297/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca [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 %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, 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 %b, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.inc10 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv86
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv86, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar75 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %a, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next87, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr %a, align 4, !tbaa !5
%cmp16.not.not83 = icmp sgt i32 %9, 1
br i1 %cmp16.not.not83, label %while.cond.preheader, label %for.end52
while.cond.preheader: ; preds = %for.end12, %for.end48
%10 = phi i32 [ %17, %for.end48 ], [ %9, %for.end12 ]
%i.184 = phi i32 [ %inc51, %for.end48 ], [ 1, %for.end12 ]
%idxprom19.phi.trans.insert = zext i32 %i.184 to i64
%arrayidx20.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom19.phi.trans.insert
%.pre92 = load i32, ptr %arrayidx20.phi.trans.insert, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %while.cond.preheader, %while.body
%d.080 = phi i32 [ %i.184, %while.cond.preheader ], [ %sub21, %while.body ]
%sub21 = add nsw i32 %d.080, -1
%idxprom22 = zext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom22
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp slt i32 %.pre92, %11
br i1 %cmp24, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom19 = zext i32 %d.080 to i64
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom19
store i32 %11, ptr %arrayidx20, align 4, !tbaa !5
store i32 %.pre92, ptr %arrayidx23, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %d.080, 1
br i1 %cmp18, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%cmp3681 = icmp sgt i32 %10, 0
br i1 %cmp3681, label %for.body37, label %for.end48
for.body37: ; preds = %while.end, %for.inc46
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.inc46 ], [ 0, %while.end ]
%arrayidx39 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv89
%12 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%13 = load i32, ptr %a, align 4, !tbaa !5
%sub41 = add nsw i32 %13, -1
%14 = sext i32 %sub41 to i64
%cmp42 = icmp slt i64 %indvars.iv89, %14
br i1 %cmp42, label %if.then43, label %for.inc46
if.then43: ; preds = %for.body37
%putchar74 = call i32 @putchar(i32 32)
%.pre93 = load i32, ptr %a, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body37, %if.then43
%15 = phi i32 [ %13, %for.body37 ], [ %.pre93, %if.then43 ]
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%16 = sext i32 %15 to i64
%cmp36 = icmp slt i64 %indvars.iv.next90, %16
br i1 %cmp36, label %for.body37, label %for.end48, !llvm.loop !13
for.end48: ; preds = %for.inc46, %while.end
%putchar73 = call i32 @putchar(i32 10)
%inc51 = add nuw nsw i32 %i.184, 1
%17 = load i32, ptr %a, align 4, !tbaa !5
%cmp16.not.not = icmp slt i32 %inc51, %17
br i1 %cmp16.not.not, label %while.cond.preheader, label %for.end52, !llvm.loop !14
for.end52: ; preds = %for.end48, %for.end12
call void @llvm.lifetime.end.p0(i64 400, 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int i,j,k,l,t,n;
int h[100010];
int main(){
scanf("%d",&n);
h[0]=0;
for(i=1;i<=n;i++){
scanf("%d",&h[i]);
if(h[i]>h[i-1]){t=t+h[i]-h[i-1];}
else{t=t+h[i-1]-h[i];}
}
printf("%d\n",t+2*n-1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@h = dso_local global [100010 x i32] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@j = dso_local local_unnamed_addr global i32 0, align 4
@k = dso_local local_unnamed_addr global i32 0, align 4
@l = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @h, align 16, !tbaa !5
store i32 1, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not29 = icmp slt i32 %0, 1
br i1 %cmp.not29, label %entry.for.end_crit_edge, label %for.body
entry.for.end_crit_edge: ; preds = %entry
%.pre = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.body: ; preds = %entry, %for.body
%storemerge30 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%idxprom = sext i32 %storemerge30 to i64
%arrayidx = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%idxprom2 = sext i32 %1 to i64
%arrayidx3 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %idxprom4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %2, %3
%4 = load i32, ptr @t, align 4, !tbaa !5
%add = sub i32 %2, %3
%add16 = sub i32 %3, %2
%add.sink = select i1 %cmp6, i32 %add, i32 %add16
%sub12 = add i32 %add.sink, %4
store i32 %sub12, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %1, %5
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%6 = phi i32 [ %.pre, %entry.for.end_crit_edge ], [ %sub12, %for.body ]
%.lcssa = phi i32 [ %0, %entry.for.end_crit_edge ], [ %5, %for.body ]
%mul = shl nsw i32 %.lcssa, 1
%add20 = add i32 %mul, -1
%sub21 = add i32 %add20, %6
%call22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub21)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
void trace(int A[], int N) {
int i;
for ( i = 0; i < N; i++ ) {
if ( i > 0 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int insertionSort(int A[], int N) {
int j, i, v;
for ( i = 1; i < N; i++ ) {
v = A[i];
j = i - 1;
while (j >= 0 && A[j] > v) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
trace(A, N);
}
}
int main(void) {
int N, i, j;
int A[100];
scanf("%d", &N);
for ( i = 0; i < N; i++ ) scanf("%d", &A[i]);
trace(A, N);
insertionSort(A, N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115383/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115383/source.c"
target datalayout = "e-m:e-p270:32: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
; 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: nofree nounwind uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %N, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %trace.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv34, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %trace.exit.loopexit.us, %entry
ret i32 undef
}
; 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.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %trace.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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 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
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%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, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %4, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %trace.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i6 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i7, %trace.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i6
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i6, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%6 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %6, %5
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %5, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us.i
%7 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %trace.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34.i
store i32 %6, ptr %arrayidx8.us.i, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %8, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
trace.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i7 = add nuw nsw i64 %indvars.iv.i6, 1
%exitcond.not.i8 = icmp eq i64 %indvars.iv.next.i7, %wide.trip.count.i.i
br i1 %exitcond.not.i8, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !13
insertionSort.exit: ; preds = %trace.exit.loopexit.us.i, %trace.exit
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, !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>
int main(){
int N,A[100],i,j,k,v;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
for(i=0;i<N;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
A[j+1]=v;
}
for(k=0;k<N;k++){
if(k>=1&&k<N){
printf(" ");
}
printf("%d",A[k]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115433/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115433/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%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
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end33
for.cond2.preheader: ; preds = %for.body
%cmp360 = icmp sgt i32 %1, 0
br i1 %cmp360, label %for.body4, label %for.end33
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end29
%3 = phi i32 [ %11, %for.end29 ], [ %1, %for.cond2.preheader ]
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.end29 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv63
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp755.not = icmp eq i64 %indvars.iv63, 0
br i1 %cmp755.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %while.body ], [ %indvars.iv63, %for.body4 ]
%indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
%idxprom8 = and i64 %indvars.iv.next66, 4294967295
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %5, %4
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv65
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
store i32 %4, ptr %arrayidx9, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv65, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%cmp1958 = icmp sgt i32 %3, 0
br i1 %cmp1958, label %if.end.peel, label %for.end29
if.end.peel: ; preds = %while.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call26.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp19.peel = icmp sgt i32 %7, 1
br i1 %cmp19.peel, label %if.end, label %for.end29
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %if.end ], [ 1, %if.end.peel ]
%putchar51 = call i32 @putchar(i32 32)
%arrayidx25 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv68
%8 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp19 = icmp slt i64 %indvars.iv.next69, %10
br i1 %cmp19, label %if.end, label %for.end29, !llvm.loop !12
for.end29: ; preds = %if.end, %if.end.peel, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%11 = load i32, ptr %N, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp3 = icmp slt i64 %indvars.iv.next64, %12
br i1 %cmp3, label %for.body4, label %for.end33, !llvm.loop !14
for.end33: ; preds = %for.end29, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int num,i,j,k,v;
int A[1000];
scanf("%d",&num);
for(i=0;i<num;i++){
scanf("%d",&A[i]);
}
for(i=0;i<num-1;i++){
printf("%d ",A[i]);
}
printf("%d\n",A[i]);
for(i = 1 ; i <= num-1 ; i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
for(k=0;k<num-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[k]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115527/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115527/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.end10
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 1
br i1 %1, label %for.body4, label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv82
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%5 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next83, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next83, 4294967295
br label %for.end10
for.end10: ; preds = %entry, %for.end10.loopexit, %for.cond2.preheader
%i.1.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ %7, %for.end10.loopexit ], [ 0, %entry ]
%arrayidx12 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr %num, align 4, !tbaa !5
%cmp16.not.not79 = icmp sgt i32 %9, 1
br i1 %cmp16.not.not79, label %for.body17, label %for.end47
for.body17: ; preds = %for.end10, %for.end41
%10 = phi i32 [ %18, %for.end41 ], [ %9, %for.end10 ]
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.end41 ], [ 1, %for.end10 ]
%arrayidx19 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv85
%11 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body17, %while.body
%indvars.iv87 = phi i64 [ %indvars.iv85, %for.body17 ], [ %indvars.iv.next88, %while.body ]
%indvars.iv.next88 = add nsw i64 %indvars.iv87, -1
%idxprom22 = and i64 %indvars.iv.next88, 4294967295
%arrayidx23 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom22
%12 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %12, %11
br i1 %cmp24, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv87
store i32 %12, ptr %arrayidx28, align 4, !tbaa !5
%13 = icmp sgt i64 %indvars.iv87, 1
br i1 %13, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv87, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom30 = ashr exact i64 %sext, 32
%arrayidx31 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom30
store i32 %11, ptr %arrayidx31, align 4, !tbaa !5
%cmp3476 = icmp sgt i32 %10, 1
br i1 %cmp3476, label %for.body35, label %for.end41
for.body35: ; preds = %while.end, %for.body35
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body35 ], [ 0, %while.end ]
%arrayidx37 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv90
%14 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%15 = load i32, ptr %num, align 4, !tbaa !5
%sub33 = add nsw i32 %15, -1
%16 = sext i32 %sub33 to i64
%cmp34 = icmp slt i64 %indvars.iv.next91, %16
br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13
for.end41: ; preds = %for.body35, %while.end
%k.0.lcssa = phi i64 [ 0, %while.end ], [ %indvars.iv.next91, %for.body35 ]
%idxprom42 = and i64 %k.0.lcssa, 4294967295
%arrayidx43 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom42
%17 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%18 = load i32, ptr %num, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp16.not.not = icmp slt i64 %indvars.iv.next86, %19
br i1 %cmp16.not.not, label %for.body17, label %for.end47, !llvm.loop !14
for.end47: ; preds = %for.end41, %for.end10
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #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}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define N 100
int main(void)
{
int i,j,n,a[N],temp;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("%d",a[0]);
for(j=1;j<n;j++)
printf(" %d",a[j]);
printf("\n");
for(i=1;i<n;i++){
temp = a[i];
for(j=i-1;j>=0 && a[j]>temp;j--)
a[j+1] = a[j];
a[j+1] = temp;
printf("%d",a[0]);
for(j=1;j<n;j++)
printf(" %d",a[j]);
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115570/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115570/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%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
%cmp68 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp68)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp570 = icmp sgt i32 %3, 1
br i1 %cmp570, label %for.body6, label %for.end12
for.body6: ; preds = %for.end.loopexit, %for.body6
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body6 ], [ 1, %for.end.loopexit ]
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv80
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp5 = icmp slt i64 %indvars.iv.next81, %6
br i1 %cmp5, label %for.body6, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body6, %for.end.loopexit
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp1577 = icmp sgt i32 %7, 1
br i1 %cmp1577, label %for.body16, label %for.end48
for.body16: ; preds = %for.end12, %for.end44
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.end44 ], [ 1, %for.end12 ]
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv83
%8 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %for.body24
%indvars.iv85 = phi i64 [ %indvars.iv83, %for.body16 ], [ %indvars.iv.next86, %for.body24 ]
%indvars.iv.next86 = add nsw i64 %indvars.iv85, -1
%idxprom21 = and i64 %indvars.iv.next86, 4294967295
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom21
%9 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %9, %8
br i1 %cmp23, label %for.body24, label %for.end30
for.body24: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv85
store i32 %9, ptr %arrayidx28, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv85, 1
br i1 %10, label %land.rhs, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.body24, %land.rhs
%j.1.in.lcssa = phi i64 [ 0, %for.body24 ], [ %indvars.iv85, %land.rhs ]
%sext = shl i64 %j.1.in.lcssa, 32
%idxprom32 = ashr exact i64 %sext, 32
%arrayidx33 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom32
store i32 %8, ptr %arrayidx33, align 4, !tbaa !5
%11 = load i32, ptr %a, align 16, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp3775 = icmp sgt i32 %12, 1
br i1 %cmp3775, label %for.body38, label %for.end44
for.body38: ; preds = %for.end30, %for.body38
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.body38 ], [ 1, %for.end30 ]
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv88
%13 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp37 = icmp slt i64 %indvars.iv.next89, %15
br i1 %cmp37, label %for.body38, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.body38, %for.end30
%putchar67 = call i32 @putchar(i32 10)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp15 = icmp slt i64 %indvars.iv.next84, %17
br i1 %cmp15, label %for.body16, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end44, %for.end12
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
int N;
int A[1000];
int show(int *A, int N) {
REP(i, N - 1)printf("%d ", A[i]);
printf("%d\n", A[N - 1]);
}
int insertionSort(int *A, int N) {
show(A,N);
FOR(i, 1, N) {
int v = A[i];
int j = i - 1;
while (0 <= j && v < A[j]) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
show(A, N);
}
}
void solver() {
scanf("%d", &N);
REP(i, N)scanf("%d", &A[i]);
insertionSort(A, N);
}
int main() {
solver();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115620/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@A = dso_local global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @show(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%sub = add i32 %N, -1
%cmp9 = icmp sgt i32 %N, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %idxprom2
%0 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
ret i32 undef
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%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 !9
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%sub.i = add i32 %N, -1
%cmp9.i = icmp sgt i32 %N, 1
br i1 %cmp9.i, label %for.body.preheader.i, label %show.exit.thread
show.exit.thread: ; preds = %entry
%idxprom2.i54 = sext i32 %sub.i to i64
%arrayidx3.i55 = getelementptr inbounds i32, ptr %A, i64 %idxprom2.i54
%0 = load i32, ptr %arrayidx3.i55, align 4, !tbaa !5
%call4.i56 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
br label %for.cond.cleanup
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %show.exit, label %for.body.i, !llvm.loop !9
show.exit: ; preds = %for.body.i
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.i
%2 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%call4.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br i1 %cmp9.i, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %show.exit
%wide.trip.count.i36 = zext i32 %sub.i to i64
%wide.trip.count = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %show.exit43.loopexit.us, %for.body.lr.ph
%indvars.iv = phi i64 [ %indvars.iv.next, %show.exit43.loopexit.us ], [ 1, %for.body.lr.ph ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%3 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next50 = add nsw i64 %indvars.iv49, -1
%idxprom2.us = and i64 %indvars.iv.next50, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%4 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %3, %4
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv49, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %3, ptr %arrayidx11.us, align 4, !tbaa !5
br label %for.body.i37.us
for.body.i37.us: ; preds = %for.body.i37.us, %while.end.us
%indvars.iv.i38.us = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next.i41.us, %for.body.i37.us ]
%arrayidx.i39.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i38.us
%5 = load i32, ptr %arrayidx.i39.us, align 4, !tbaa !5
%call.i40.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next.i41.us = add nuw nsw i64 %indvars.iv.i38.us, 1
%exitcond.not.i42.us = icmp eq i64 %indvars.iv.next.i41.us, %wide.trip.count.i36
br i1 %exitcond.not.i42.us, label %show.exit43.loopexit.us, label %for.body.i37.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv49
store i32 %4, ptr %arrayidx8.us, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv49, 1
br i1 %6, label %land.rhs.us, label %while.end.us, !llvm.loop !11
show.exit43.loopexit.us: ; preds = %for.body.i37.us
%7 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%call4.i34.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%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.us, !llvm.loop !12
for.cond.cleanup: ; preds = %show.exit43.loopexit.us, %show.exit.thread, %show.exit
ret i32 undef
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @solver() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%call2 = tail call i32 @insertionSort(ptr noundef nonnull @A, i32 noundef %.lcssa)
ret void
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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.cond.cleanup, !llvm.loop !13
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp5.i = icmp sgt i32 %0, 0
br i1 %cmp5.i, label %for.body.i, label %solver.exit
for.body.i: ; preds = %entry, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %entry ]
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv.i
%call1.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%1 = load i32, ptr @N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.i = icmp slt i64 %indvars.iv.next.i, %2
br i1 %cmp.i, label %for.body.i, label %solver.exit, !llvm.loop !13
solver.exit: ; preds = %for.body.i, %entry
%.lcssa.i = phi i32 [ %0, %entry ], [ %1, %for.body.i ]
%call2.i = tail call i32 @insertionSort(ptr noundef nonnull @A, i32 noundef %.lcssa.i)
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
void InsertionSort(int A[],int length)
{
int i,j,key,k;
for(k=0; k<length-1; k++)
printf("%d ",A[k]);
printf("%d\n",A[k]);
for(i=1; i<=length-1; i++)
{
key=A[i];
j=i-1;
while(j>=0&&A[j]>key)
{
A[j+1]=A[j];
j--;
}
A[j+1]=key;
for(k=0; k<length-1; k++)
printf("%d ",A[k]);
printf("%d\n",A[k]);
}
}
int main()
{
int a[10000],i,n;
scanf("%d",&n);
for(i=0; i<n; i++)
scanf("%d",&a[i]);
InsertionSort(a,n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115664/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115664/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @InsertionSort(ptr nocapture noundef %A, i32 noundef %length) local_unnamed_addr #0 {
entry:
%sub = add i32 %length, -1
%cmp64 = icmp sgt i32 %length, 1
br i1 %cmp64, label %for.body.preheader, label %for.end.thread
for.end.thread: ; preds = %entry
%0 = load i32, ptr %A, align 4, !tbaa !5
%call394 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
br label %for.end37
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%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 !9
for.end: ; preds = %for.body
%2 = zext i32 %sub to i64
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %2
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
br i1 %cmp64, label %for.body7.us.preheader, label %for.end37
for.body7.us.preheader: ; preds = %for.end
%wide.trip.count90 = zext i32 %length to i64
%wide.trip.count86 = zext i32 %sub to i64
%arrayidx33.us = getelementptr inbounds i32, ptr %A, i64 %wide.trip.count86
br label %for.body7.us
for.body7.us: ; preds = %for.body7.us.preheader, %for.cond22.for.end31_crit_edge.us
%indvars.iv77 = phi i64 [ 1, %for.body7.us.preheader ], [ %indvars.iv.next78, %for.cond22.for.end31_crit_edge.us ]
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv77
%4 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body7.us
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %while.body.us ], [ %indvars.iv77, %for.body7.us ]
%indvars.iv.next80 = add nsw i64 %indvars.iv79, -1
%idxprom12.us = and i64 %indvars.iv.next80, 4294967295
%arrayidx13.us = getelementptr inbounds i32, ptr %A, i64 %idxprom12.us
%5 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%cmp14.us = icmp sgt i32 %5, %4
br i1 %cmp14.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv79, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom20.us = ashr exact i64 %sext, 32
%arrayidx21.us = getelementptr inbounds i32, ptr %A, i64 %idxprom20.us
store i32 %4, ptr %arrayidx21.us, align 4, !tbaa !5
br label %for.body25.us
for.body25.us: ; preds = %while.end.us, %for.body25.us
%indvars.iv82 = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next83, %for.body25.us ]
%arrayidx27.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv82
%6 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
%call28.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count86
br i1 %exitcond87.not, label %for.cond22.for.end31_crit_edge.us, label %for.body25.us, !llvm.loop !11
while.body.us: ; preds = %land.rhs.us
%arrayidx18.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv79
store i32 %5, ptr %arrayidx18.us, align 4, !tbaa !5
%7 = icmp sgt i64 %indvars.iv79, 1
br i1 %7, label %land.rhs.us, label %while.end.us, !llvm.loop !12
for.cond22.for.end31_crit_edge.us: ; preds = %for.body25.us
%8 = load i32, ptr %arrayidx33.us, align 4, !tbaa !5
%call34.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond91.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count90
br i1 %exitcond91.not, label %for.end37, label %for.body7.us, !llvm.loop !13
for.end37: ; preds = %for.cond22.for.end31_crit_edge.us, %for.end.thread, %for.end
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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:
%a = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%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.2, 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 !14
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @InsertionSort(ptr noundef nonnull %a, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
//Insertion Sort
#include<stdio.h>
int length;
int A[1000]={0};
void intput()
{
int i;
scanf("%d",&length);
for(i=1;i<=length;i++)
scanf("%d",&A[i]);
}
void output()
{
int i,j;
for(i=1;i<length;i++){
printf("%d ",A[i]);
}
printf("%d\n",A[i]);
}
void Sort()
{
int i,j;
int key;
for(i=1;i<=length;i++){
key = A[i];
for(j=i-1;j>=0;j--){
if(A[j]<=key){
A[j+1]=key;
break;
}
A[j+1] = A[j];
}
output();
}
}
int main()
{
intput();
Sort();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115707/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115707/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@length = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @intput() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @length)
%0 = load i32, ptr @length, align 4, !tbaa !5
%cmp.not4 = icmp slt i32 %0, 1
br i1 %cmp.not4, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @length, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @output() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @length, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 1
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @length, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !11
for.end.loopexit: ; preds = %for.body
%4 = and i64 %indvars.iv.next, 4294967295
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ 1, %entry ], [ %4, %for.end.loopexit ]
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %i.0.lcssa
%5 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Sort() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @length, align 4, !tbaa !5
%cmp.not30 = icmp slt i32 %0, 1
br i1 %cmp.not30, label %for.end15, label %for.body
for.body: ; preds = %entry, %output.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %output.exit ], [ 1, %entry ]
%1 = phi i32 [ %10, %output.exit ], [ %0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %for.body3
for.body3: ; preds = %for.body, %if.end
%indvars.iv33 = phi i64 [ %indvars.iv, %for.body ], [ %indvars.iv.next34, %if.end ]
%indvars.iv.next34 = add nsw i64 %indvars.iv33, -1
%idxprom4 = and i64 %indvars.iv.next34, 4294967295
%arrayidx5 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6.not = icmp sgt i32 %3, %2
br i1 %cmp6.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom7 = and i64 %indvars.iv33, 4294967295
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom7
store i32 %2, ptr %arrayidx8, align 4, !tbaa !5
br label %for.end
if.end: ; preds = %for.body3
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv33
store i32 %3, ptr %arrayidx13, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv33, 1
br i1 %4, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %if.end, %if.then
%cmp7.i = icmp sgt i32 %1, 1
br i1 %cmp7.i, label %for.body.i, label %output.exit
for.body.i: ; preds = %for.end, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 1, %for.end ]
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%6 = load i32, ptr @length, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.i = icmp slt i64 %indvars.iv.next.i, %7
br i1 %cmp.i, label %for.body.i, label %for.end.loopexit.i, !llvm.loop !11
for.end.loopexit.i: ; preds = %for.body.i
%8 = and i64 %indvars.iv.next.i, 4294967295
br label %output.exit
output.exit: ; preds = %for.end, %for.end.loopexit.i
%i.0.lcssa.i = phi i64 [ 1, %for.end ], [ %8, %for.end.loopexit.i ]
%arrayidx2.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %i.0.lcssa.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%call3.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr @length, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %11
br i1 %cmp.not.not, label %for.body, label %for.end15, !llvm.loop !13
for.end15: ; preds = %output.exit, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @length)
%0 = load i32, ptr @length, align 4, !tbaa !5
%cmp.not4.i = icmp slt i32 %0, 1
br i1 %cmp.not4.i, label %Sort.exit, label %for.body.i
for.body.i: ; preds = %entry, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 1, %entry ]
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv.i
%call1.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%1 = load i32, ptr @length, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not.i = icmp slt i64 %indvars.iv.i, %2
br i1 %cmp.not.not.i, label %for.body.i, label %intput.exit, !llvm.loop !9
intput.exit: ; preds = %for.body.i
%cmp.not30.i = icmp slt i32 %1, 1
br i1 %cmp.not30.i, label %Sort.exit, label %for.body.i1
for.body.i1: ; preds = %intput.exit, %output.exit.i
%indvars.iv.i2 = phi i64 [ %indvars.iv.next.i4, %output.exit.i ], [ 1, %intput.exit ]
%3 = phi i32 [ %12, %output.exit.i ], [ %1, %intput.exit ]
%arrayidx.i3 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv.i2
%4 = load i32, ptr %arrayidx.i3, align 4, !tbaa !5
br label %for.body3.i
for.body3.i: ; preds = %if.end.i, %for.body.i1
%indvars.iv33.i = phi i64 [ %indvars.iv.i2, %for.body.i1 ], [ %indvars.iv.next34.i, %if.end.i ]
%indvars.iv.next34.i = add nsw i64 %indvars.iv33.i, -1
%idxprom4.i = and i64 %indvars.iv.next34.i, 4294967295
%arrayidx5.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom4.i
%5 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.not.i = icmp sgt i32 %5, %4
br i1 %cmp6.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %for.body3.i
%idxprom7.i = and i64 %indvars.iv33.i, 4294967295
%arrayidx8.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom7.i
store i32 %4, ptr %arrayidx8.i, align 4, !tbaa !5
br label %for.end.i
if.end.i: ; preds = %for.body3.i
%arrayidx13.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv33.i
store i32 %5, ptr %arrayidx13.i, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv33.i, 1
br i1 %6, label %for.body3.i, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %if.end.i, %if.then.i
%cmp7.i.i = icmp sgt i32 %3, 1
br i1 %cmp7.i.i, label %for.body.i.i, label %output.exit.i
for.body.i.i: ; preds = %for.end.i, %for.body.i.i
%indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i, %for.body.i.i ], [ 1, %for.end.i ]
%arrayidx.i.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv.i.i
%7 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%call.i.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%8 = load i32, ptr @length, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp.i.i = icmp slt i64 %indvars.iv.next.i.i, %9
br i1 %cmp.i.i, label %for.body.i.i, label %for.end.loopexit.i.i, !llvm.loop !11
for.end.loopexit.i.i: ; preds = %for.body.i.i
%10 = and i64 %indvars.iv.next.i.i, 4294967295
br label %output.exit.i
output.exit.i: ; preds = %for.end.loopexit.i.i, %for.end.i
%i.0.lcssa.i.i = phi i64 [ 1, %for.end.i ], [ %10, %for.end.loopexit.i.i ]
%arrayidx2.i.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %i.0.lcssa.i.i
%11 = load i32, ptr %arrayidx2.i.i, align 4, !tbaa !5
%call3.i.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%indvars.iv.next.i4 = add nuw nsw i64 %indvars.iv.i2, 1
%12 = load i32, ptr @length, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp.not.not.i5 = icmp slt i64 %indvars.iv.i2, %13
br i1 %cmp.not.not.i5, label %for.body.i1, label %Sort.exit, !llvm.loop !13
Sort.exit: ; preds = %output.exit.i, %entry, %intput.exit
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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,k,v;
int a[100];
scanf("%d",&N);
for(i = 0;i < N; i++){
scanf("%d",&a[i]);
}
for(i = 1;i <= N-1; i++){
for(k = 0;k < N; k++){
printf("%d",a[k]);
if(k != N-1)
printf(" ");
}
printf("\n");
v = a[i];
j = i-1;
while(j >= 0&&a[j]>v){
a[j+1] = a[j];
j--;
a[j+1] = v;
}
}
for(k = 0;k < N; k++){
printf("%d",a[k]);
if(k != N-1)
printf(" ");
}
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115750/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115750/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%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
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.end48
for.cond2.preheader: ; preds = %for.body
%cmp3.not.not80 = icmp sgt i32 %1, 1
br i1 %cmp3.not.not80, label %for.cond5.preheader, label %for.cond35.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
%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.inc32
%3 = phi i32 [ %13, %for.inc32 ], [ %1, %for.cond2.preheader ]
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.inc32 ], [ 1, %for.cond2.preheader ]
%cmp675 = icmp sgt i32 %3, 0
br i1 %cmp675, label %for.body7, label %for.end16
for.cond35.preheader: ; preds = %for.inc32, %for.cond2.preheader
%4 = phi i32 [ %1, %for.cond2.preheader ], [ %13, %for.inc32 ]
%cmp3682 = icmp sgt i32 %4, 0
br i1 %cmp3682, label %for.body37, label %for.end48
for.body7: ; preds = %for.cond5.preheader, %for.inc14
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc14 ], [ 0, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv85
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr %N, align 4, !tbaa !5
%sub11 = add nsw i32 %6, -1
%7 = zext i32 %sub11 to i64
%cmp12.not = icmp eq i64 %indvars.iv85, %7
br i1 %cmp12.not, label %for.inc14, label %if.then
if.then: ; preds = %for.body7
%putchar72 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc14
for.inc14: ; preds = %for.body7, %if.then
%8 = phi i32 [ %6, %for.body7 ], [ %.pre, %if.then ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%9 = sext i32 %8 to i64
%cmp6 = icmp slt i64 %indvars.iv.next86, %9
br i1 %cmp6, label %for.body7, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.inc14, %for.cond5.preheader
%putchar71 = call i32 @putchar(i32 10)
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv88
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end16, %while.body
%indvars.iv90 = phi i64 [ %indvars.iv88, %for.end16 ], [ %indvars.iv.next91, %while.body ]
%indvars.iv.next91 = add nsw i64 %indvars.iv90, -1
%idxprom22 = and i64 %indvars.iv.next91, 4294967295
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom22
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %11, %10
br i1 %cmp24, label %while.body, label %for.inc32
while.body: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv90
store i32 %11, ptr %arrayidx28, align 4, !tbaa !5
store i32 %10, ptr %arrayidx23, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv90, 1
br i1 %12, label %land.rhs, label %for.inc32, !llvm.loop !12
for.inc32: ; preds = %land.rhs, %while.body
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv.next89, %14
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.cond35.preheader, !llvm.loop !13
for.body37: ; preds = %for.cond35.preheader, %for.inc46
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.inc46 ], [ 0, %for.cond35.preheader ]
%arrayidx39 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv95
%15 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%16 = load i32, ptr %N, align 4, !tbaa !5
%sub41 = add nsw i32 %16, -1
%17 = zext i32 %sub41 to i64
%cmp42.not = icmp eq i64 %indvars.iv95, %17
br i1 %cmp42.not, label %for.inc46, label %if.then43
if.then43: ; preds = %for.body37
%putchar70 = call i32 @putchar(i32 32)
%.pre99 = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body37, %if.then43
%18 = phi i32 [ %16, %for.body37 ], [ %.pre99, %if.then43 ]
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%19 = sext i32 %18 to i64
%cmp36 = icmp slt i64 %indvars.iv.next96, %19
br i1 %cmp36, label %for.body37, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.inc46, %entry, %for.cond35.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
static const int N = 1000;
void trace(int A[], int n){
int i;
for ( i = 1; i <= n; i++ ){
if ( i > 1 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int main(){
int n, i, j,v;
int A[N+1];
scanf("%d", &n);
for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
for(i=1;i<=n;i++){
v = A[i];
j = i-1;
while( (0<=j) && (A[j]>v) ){
A[j+1] = A[j];
j--;
A[j+1] = v;
}trace(A, n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115794/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115794/source.c"
target datalayout = "e-m:e-p270:32: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
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not8 = icmp slt i32 %n, 1
br i1 %cmp.not8, label %for.end, label %if.end.peel
if.end.peel: ; preds = %entry
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%arrayidx.peel.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 1
%.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.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %0, 2
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 ], [ 2, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla34 = alloca [1001 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not35 = icmp slt i32 %1, 1
br i1 %cmp.not35, label %for.end20, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not40 = icmp slt i32 %2, 1
br i1 %cmp3.not40, label %for.end20, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %for.cond2.preheader
%arrayidx.peel.phi.trans.insert.i = getelementptr inbounds i32, ptr %vla34, i64 1
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla34, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.body4: ; preds = %for.body4.lr.ph, %trace.exit
%indvars.iv44 = phi i64 [ 1, %for.body4.lr.ph ], [ %indvars.iv.next45, %trace.exit ]
%4 = phi i32 [ %2, %for.body4.lr.ph ], [ %.pr, %trace.exit ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla34, i64 %indvars.iv44
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv46 = phi i64 [ %indvars.iv44, %for.body4 ], [ %indvars.iv.next47, %while.body ]
%indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
%idxprom8 = and i64 %indvars.iv.next47, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla34, i64 %idxprom8
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %6, %5
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds i32, ptr %vla34, i64 %indvars.iv46
store i32 %6, ptr %arrayidx14, align 4, !tbaa !5
store i32 %5, ptr %arrayidx9, align 4, !tbaa !5
%7 = icmp sgt i64 %indvars.iv46, 1
br i1 %7, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%cmp.not8.i = icmp slt i32 %4, 1
br i1 %cmp.not8.i, label %trace.exit, label %if.end.peel.i
if.end.peel.i: ; preds = %while.end
%8 = add nuw i32 %4, 1
%wide.trip.count.i = zext i32 %8 to i64
%.pre.i = load i32, ptr %arrayidx.peel.phi.trans.insert.i, align 4, !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 %8, 2
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 ], [ 2, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %vla34, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%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, %while.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %.pr to i64
%cmp3.not.not = icmp slt i64 %indvars.iv44, %10
br i1 %cmp3.not.not, label %for.body4, label %for.end20, !llvm.loop !14
for.end20: ; preds = %trace.exit, %entry, %for.cond2.preheader
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; 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 void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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, !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 *A;
int i,n,v,j,k;
scanf("%d",&n);
A = (int *)malloc(n * sizeof(int));
for(i=0;i<n; i++) scanf("%d",&A[i]);
for(i=0; i<n; i++){
v = A[i];
j = i-1;
while(j >=0 && A[j] > v){
A[j+1] = A[j];
j--;
}
A[j+1] =v;
for(k=0;k<n; k++){
printf("%d",A[k]);
if(k<n-1)printf(" ");
}
printf("\n");
}
free(A);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115837/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115837/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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: 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
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.end40
for.cond4.preheader: ; preds = %for.body
%cmp573 = icmp sgt i32 %1, 0
br i1 %cmp573, label %for.body7, label %for.end40
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body7: ; preds = %for.cond4.preheader, %for.end36
%3 = phi i32 [ %12, %for.end36 ], [ %1, %for.cond4.preheader ]
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.end36 ], [ 0, %for.cond4.preheader ]
%arrayidx9 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv76
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp1067.not = icmp eq i64 %indvars.iv76, 0
br i1 %cmp1067.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body7, %while.body
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %while.body ], [ %indvars.iv76, %for.body7 ]
%indvars.iv.next79 = add nsw i64 %indvars.iv78, -1
%idxprom12 = and i64 %indvars.iv.next79, 4294967295
%arrayidx13 = getelementptr inbounds i32, ptr %call1, i64 %idxprom12
%5 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %5, %4
br i1 %cmp14, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx19 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv78
store i32 %5, ptr %arrayidx19, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv78, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body7
%j.0.in.lcssa = phi i64 [ 0, %for.body7 ], [ 0, %while.body ], [ %indvars.iv78, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom21 = ashr exact i64 %sext, 32
%arrayidx22 = getelementptr inbounds i32, ptr %call1, i64 %idxprom21
store i32 %4, ptr %arrayidx22, align 4, !tbaa !5
%cmp2471 = icmp sgt i32 %3, 0
br i1 %cmp2471, label %for.body26, label %for.end36
for.body26: ; preds = %while.end, %for.inc34
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.inc34 ], [ 0, %while.end ]
%arrayidx28 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv81
%7 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%8 = load i32, ptr %n, align 4, !tbaa !5
%sub30 = add nsw i32 %8, -1
%9 = sext i32 %sub30 to i64
%cmp31 = icmp slt i64 %indvars.iv81, %9
br i1 %cmp31, label %if.then, label %for.inc34
if.then: ; preds = %for.body26
%putchar63 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc34
for.inc34: ; preds = %for.body26, %if.then
%10 = phi i32 [ %8, %for.body26 ], [ %.pre, %if.then ]
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%11 = sext i32 %10 to i64
%cmp24 = icmp slt i64 %indvars.iv.next82, %11
br i1 %cmp24, label %for.body26, label %for.end36, !llvm.loop !12
for.end36: ; preds = %for.inc34, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp5 = icmp slt i64 %indvars.iv.next77, %13
br i1 %cmp5, label %for.body7, label %for.end40, !llvm.loop !13
for.end40: ; preds = %for.end36, %entry, %for.cond4.preheader
call void @free(ptr noundef %call1) #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 nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 n,i,v,j,k;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
}
printf("\n");
for(i=1;i<n;i++){
v=a[i];
j=i-1;
while(j>=0 && a[j]>v){
a[j+1]=a[j];
j--;
}
a[j+1]=v;
for(k=0;k<n;k++){
printf("%d",a[k]);
if(k!=n-1)printf(" ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115880/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115880/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%cmp71 = icmp sgt i32 %3, 0
br i1 %cmp71, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%4 = icmp sgt i32 %5, 0
br i1 %4, label %for.body4, label %for.end12
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
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc10 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv83
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%8 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
%9 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv83, %9
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar70 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%10 = phi i32 [ %8, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%11 = sext i32 %10 to i64
%cmp3 = icmp slt i64 %indvars.iv.next84, %11
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp1580 = icmp sgt i32 %12, 1
br i1 %cmp1580, label %for.body16, label %for.end48
for.body16: ; preds = %for.end12, %for.end44
%13 = phi i32 [ %22, %for.end44 ], [ %12, %for.end12 ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.end44 ], [ 1, %for.end12 ]
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv86
%14 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.body16 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom21 = and i64 %indvars.iv.next89, 4294967295
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %idxprom21
%15 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %15, %14
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv88
store i32 %15, ptr %arrayidx27, align 4, !tbaa !5
%16 = icmp sgt i64 %indvars.iv88, 1
br i1 %16, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv88, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds i32, ptr %vla, i64 %idxprom29
store i32 %14, ptr %arrayidx30, align 4, !tbaa !5
%cmp3278 = icmp sgt i32 %13, 0
br i1 %cmp3278, label %for.body33, label %for.end44
for.body33: ; preds = %while.end, %for.inc42
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.inc42 ], [ 0, %while.end ]
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv91
%17 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%18 = load i32, ptr %n, align 4, !tbaa !5
%sub37 = add nsw i32 %18, -1
%19 = zext i32 %sub37 to i64
%cmp38.not = icmp eq i64 %indvars.iv91, %19
br i1 %cmp38.not, label %for.inc42, label %if.then39
if.then39: ; preds = %for.body33
%putchar69 = call i32 @putchar(i32 32)
%.pre97 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body33, %if.then39
%20 = phi i32 [ %18, %for.body33 ], [ %.pre97, %if.then39 ]
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%21 = sext i32 %20 to i64
%cmp32 = icmp slt i64 %indvars.iv.next92, %21
br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.inc42, %while.end
%putchar68 = call i32 @putchar(i32 10)
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%22 = load i32, ptr %n, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp15 = icmp slt i64 %indvars.iv.next87, %23
br i1 %cmp15, label %for.body16, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end44, %for.end12
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}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
int a[1000], n, i, j, k, v;
scanf("%d", &n);
for(k = 0; k < n; k++)
{
scanf("%d",&a[k]);
}
for(k = 0; k < n-1; k++)
{
printf("%d ",a[k]);
}
printf("%d\n", a[n-1]);
for(i = 1; i < n; i++)
{
v = a[i];
j = i - 1;
while (j >= 0 && a[j] > v)
{
a[j+1] = a[j];
j--;
a[j+1] = v;
}
for(k = 0; k < n-1; k++)
{
printf("%d ",a[k]);
}
printf("%d\n", a[n-1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115923/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115923/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp370 = icmp sgt i32 %2, 1
br i1 %cmp370, label %for.body4, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader.for.end10_crit_edge: ; preds = %entry, %for.cond2.preheader
%1 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ]
%sub69 = add nsw i32 %1, -1
%.pre = sext i32 %sub69 to i64
br label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv84
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next85, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.cond2.preheader.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp1679 = icmp sgt i32 %8, 1
br i1 %cmp1679, label %for.body17, label %for.end48
for.body17: ; preds = %for.end10, %for.end41
%9 = phi i32 [ %17, %for.end41 ], [ %8, %for.end10 ]
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.end41 ], [ 1, %for.end10 ]
%arrayidx19 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv87
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body17, %while.body
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body17 ], [ %indvars.iv.next90, %while.body ]
%indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
%idxprom22 = and i64 %indvars.iv.next90, 4294967295
%arrayidx23 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom22
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %11, %10
br i1 %cmp24, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv89
store i32 %11, ptr %arrayidx28, align 4, !tbaa !5
store i32 %10, ptr %arrayidx23, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv89, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%cmp3476 = icmp sgt i32 %9, 1
br i1 %cmp3476, label %for.body35, label %while.end.for.end41_crit_edge
while.end.for.end41_crit_edge: ; preds = %while.end
%sub3375 = add nsw i32 %9, -1
%.pre98 = sext i32 %sub3375 to i64
br label %for.end41
for.body35: ; preds = %while.end, %for.body35
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.body35 ], [ 0, %while.end ]
%arrayidx37 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv92
%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.next93 = add nuw nsw i64 %indvars.iv92, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%sub33 = add nsw i32 %14, -1
%15 = sext i32 %sub33 to i64
%cmp34 = icmp slt i64 %indvars.iv.next93, %15
br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13
for.end41: ; preds = %for.body35, %while.end.for.end41_crit_edge
%idxprom43.pre-phi = phi i64 [ %.pre98, %while.end.for.end41_crit_edge ], [ %15, %for.body35 ]
%arrayidx44 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom43.pre-phi
%16 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp16 = icmp slt i64 %indvars.iv.next88, %18
br i1 %cmp16, label %for.body17, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end41, %for.end10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define N 100
#define FAC 1000
int main()
{
int i,j,k,v,card[N],n;
scanf("%d",&n);
if( n > N )
exit(1);
for( i = 0; i < n; i++ )
{
scanf("%d",&card[i]);
if( card [i] > FAC || card[i] < 0 )
exit(1);
}
for( i = 1; i <= n; i++ )
{
for( k = 0; k < n; k++ )
{
if( k == n-1 )printf("%d",card[k]);
else printf("%d ",card[k]);
}
printf("\n");
v = card[i];
j = i-1;
while ( j >= 0 && card[j] > v )
{
card[j+1] = card[j];
j--;
card[j+1] = v;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115967/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115967/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%card = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %card) #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
%cmp = icmp sgt i32 %0, 100
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp168 = icmp sgt i32 %0, 0
br i1 %cmp168, label %for.body, label %for.end46
if.then: ; preds = %entry
call void @exit(i32 noundef 1) #6
unreachable
for.cond: ; preds = %for.body
%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
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.cond11.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.cond
%cmp12.not75 = icmp slt i32 %1, 1
br i1 %cmp12.not75, label %for.end46, label %for.cond14.preheader
for.body: ; preds = %for.cond.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %card, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond = icmp ugt i32 %3, 1000
br i1 %or.cond, label %if.then9, label %for.cond
if.then9: ; preds = %for.body
call void @exit(i32 noundef 1) #6
unreachable
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc44
%4 = phi i32 [ %13, %for.inc44 ], [ %1, %for.cond11.preheader ]
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.inc44 ], [ 1, %for.cond11.preheader ]
%cmp1570 = icmp sgt i32 %4, 0
br i1 %cmp1570, label %for.body16, label %for.end28
for.body16: ; preds = %for.cond14.preheader, %for.body16
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body16 ], [ 0, %for.cond14.preheader ]
%5 = phi i32 [ %8, %for.body16 ], [ %4, %for.cond14.preheader ]
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp17 = icmp eq i64 %indvars.iv78, %6
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %card, i64 0, i64 %indvars.iv78
%7 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp17, ptr @.str, ptr @.str.1
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %7)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp15 = icmp slt i64 %indvars.iv.next79, %9
br i1 %cmp15, label %for.body16, label %for.end28, !llvm.loop !11
for.end28: ; preds = %for.body16, %for.cond14.preheader
%putchar = call i32 @putchar(i32 10)
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %card, i64 0, i64 %indvars.iv81
%10 = load i32, ptr %arrayidx31, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end28, %while.body
%indvars.iv83 = phi i64 [ %indvars.iv81, %for.end28 ], [ %indvars.iv.next84, %while.body ]
%indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
%idxprom34 = and i64 %indvars.iv.next84, 4294967295
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %card, i64 0, i64 %idxprom34
%11 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %11, %10
br i1 %cmp36, label %while.body, label %for.inc44
while.body: ; preds = %land.rhs
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %card, i64 0, i64 %indvars.iv83
store i32 %11, ptr %arrayidx40, align 4, !tbaa !5
store i32 %10, ptr %arrayidx35, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv83, 1
br i1 %12, label %land.rhs, label %for.inc44, !llvm.loop !12
for.inc44: ; preds = %land.rhs, %while.body
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp12.not.not = icmp slt i64 %indvars.iv81, %14
br i1 %cmp12.not.not, label %for.cond14.preheader, label %for.end46, !llvm.loop !13
for.end46: ; preds = %for.inc44, %for.cond.preheader, %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %card) #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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int i=0,j=0,v,N=15,k=0,l;
int A[125];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
for(i=0;i<N;i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1] = v;
for(l=0;l<N;++l){
if(l!=N-1){
printf("%d",A[l]);
printf(" ");}
if(l==N-1&&i!=N-1){
printf("%d",A[l]);
}
if(l==N-1&&i==N-1){
printf("%d",A[l]);
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116009/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116009/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [125 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
store i32 15, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 500, 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
%cmp77 = icmp sgt i32 %0, 0
br i1 %cmp77, label %for.body, label %for.end52
for.cond2.preheader: ; preds = %for.body
%cmp386 = icmp sgt i32 %1, 0
br i1 %cmp386, label %for.body4, label %for.end52
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [125 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.body4: ; preds = %for.cond2.preheader, %for.end48
%3 = phi i32 [ %16, %for.end48 ], [ %1, %for.cond2.preheader ]
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.end48 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %indvars.iv89
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp780.not = icmp eq i64 %indvars.iv89, 0
br i1 %cmp780.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %while.body ], [ %indvars.iv89, %for.body4 ]
%indvars.iv.next92 = add nsw i64 %indvars.iv91, -1
%idxprom8 = and i64 %indvars.iv.next92, 4294967295
%arrayidx9 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %5, %4
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %indvars.iv91
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv91, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%j.0.in.lcssa = phi i64 [ 0, %for.body4 ], [ 0, %while.body ], [ %indvars.iv91, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %idxprom16
store i32 %4, ptr %arrayidx17, align 4, !tbaa !5
%cmp1984 = icmp sgt i32 %3, 0
br i1 %cmp1984, label %for.body20, label %for.end48
for.body20: ; preds = %while.end, %for.inc46
%7 = phi i32 [ %14, %for.inc46 ], [ %3, %while.end ]
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.inc46 ], [ 0, %while.end ]
%sub21 = add nsw i32 %7, -1
%8 = zext i32 %sub21 to i64
%cmp22.not = icmp eq i64 %indvars.iv94, %8
br i1 %cmp22.not, label %if.end, label %if.then
if.then: ; preds = %for.body20
%arrayidx24 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %indvars.iv94
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%putchar75 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %N, align 4, !tbaa !5
%.pre102 = add nsw i32 %.pre, -1
%.pre103 = zext i32 %.pre102 to i64
br label %if.end
if.end: ; preds = %if.then, %for.body20
%.pre-phi = phi i64 [ %.pre103, %if.then ], [ %8, %for.body20 ]
%10 = phi i32 [ %.pre, %if.then ], [ %7, %for.body20 ]
%cmp28 = icmp ne i64 %indvars.iv94, %.pre-phi
%cmp30.not = icmp eq i64 %indvars.iv89, %.pre-phi
%or.cond = or i1 %cmp28, %cmp30.not
br i1 %or.cond, label %if.end35, label %if.then31
if.then31: ; preds = %if.end
%arrayidx33 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %indvars.iv94
%11 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%.pre100 = load i32, ptr %N, align 4, !tbaa !5
%.pre104 = add nsw i32 %.pre100, -1
%.pre105 = zext i32 %.pre104 to i64
br label %if.end35
if.end35: ; preds = %if.then31, %if.end
%.pre-phi106 = phi i64 [ %.pre105, %if.then31 ], [ %.pre-phi, %if.end ]
%12 = phi i32 [ %.pre100, %if.then31 ], [ %10, %if.end ]
%cmp37 = icmp eq i64 %indvars.iv94, %.pre-phi106
%cmp40 = icmp eq i64 %indvars.iv89, %.pre-phi106
%or.cond76 = and i1 %cmp37, %cmp40
br i1 %or.cond76, label %if.then41, label %for.inc46
if.then41: ; preds = %if.end35
%arrayidx43 = getelementptr inbounds [125 x i32], ptr %A, i64 0, i64 %indvars.iv94
%13 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%.pre101 = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %if.end35, %if.then41
%14 = phi i32 [ %12, %if.end35 ], [ %.pre101, %if.then41 ]
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%15 = sext i32 %14 to i64
%cmp19 = icmp slt i64 %indvars.iv.next95, %15
br i1 %cmp19, label %for.body20, label %for.end48, !llvm.loop !12
for.end48: ; preds = %for.inc46, %while.end
%putchar = call i32 @putchar(i32 10)
%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
%cmp3 = icmp slt i64 %indvars.iv.next90, %17
br i1 %cmp3, label %for.body4, label %for.end52, !llvm.loop !13
for.end52: ; preds = %for.end48, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(int argc, char* argv[])
{
int n, b[200];
int i, j, k, key;
scanf("%d", &n);
for(i = 1; i <= n; i++){
scanf("%d", &b[i]);
}
for(j = 2; j <= n; j++){
for(k = 1; k < n; k++){
printf("%d ", b[k]);
}
printf("%d\n", b[k]);
key = b[j];
i = j - 1;
while(i > 0 && b[i] > key){
b[i+1] = b[i];
i = i - 1;
}
b[i+1] = key;
}
for(k = 1; k < n; k++){
printf("%d ", b[k]);
}
printf("%d\n", b[k]);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116052/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116052/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not65 = icmp slt i32 %0, 1
br i1 %cmp.not65, label %for.end42, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not72 = icmp slt i32 %1, 2
br i1 %cmp3.not72, label %for.end42, label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %while.end
%3 = phi i32 [ %12, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %while.end ], [ 2, %for.cond2.preheader ]
%cmp667 = icmp sgt i32 %3, 1
br i1 %cmp667, label %for.body7, label %for.end13
for.cond34.preheader: ; preds = %while.end
%4 = icmp sgt i32 %12, 1
br i1 %4, label %for.body36, label %for.end42
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body7 ], [ 1, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv78
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp6 = icmp slt i64 %indvars.iv.next79, %7
br i1 %cmp6, label %for.body7, label %for.end13, !llvm.loop !11
for.end13: ; preds = %for.body7, %for.cond5.preheader
%k.0.lcssa = phi i64 [ 1, %for.cond5.preheader ], [ %indvars.iv.next79, %for.body7 ]
%idxprom14 = and i64 %k.0.lcssa, 4294967295
%arrayidx15 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %idxprom14
%8 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx18 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv81
%9 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end13, %while.body
%indvars.iv83 = phi i64 [ %indvars.iv81, %for.end13 ], [ %indvars.iv.next84, %while.body ]
%indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
%idxprom20 = and i64 %indvars.iv.next84, 4294967295
%arrayidx21 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %idxprom20
%10 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %10, %9
br i1 %cmp22, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx26 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv83
store i32 %10, ptr %arrayidx26, align 4, !tbaa !5
%11 = icmp sgt i64 %indvars.iv83, 2
br i1 %11, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%i.1.in.lcssa = phi i64 [ 1, %while.body ], [ %indvars.iv83, %land.rhs ]
%sext = shl i64 %i.1.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %idxprom29
store i32 %9, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv81, %13
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.cond34.preheader, !llvm.loop !13
for.body36: ; preds = %for.cond34.preheader, %for.body36
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.body36 ], [ 1, %for.cond34.preheader ]
%arrayidx38 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv88
%14 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp35 = icmp slt i64 %indvars.iv.next89, %16
br i1 %cmp35, label %for.body36, label %for.end42.loopexit, !llvm.loop !14
for.end42.loopexit: ; preds = %for.body36
%17 = and i64 %indvars.iv.next89, 4294967295
br label %for.end42
for.end42: ; preds = %entry, %for.cond2.preheader, %for.end42.loopexit, %for.cond34.preheader
%k.1.lcssa = phi i64 [ 1, %for.cond34.preheader ], [ %17, %for.end42.loopexit ], [ 1, %for.cond2.preheader ], [ 1, %entry ]
%arrayidx44 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %k.1.lcssa
%18 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
int i,j=0,k;
int key;
int A[100];
int ans,num=0;
scanf("%d",&num);
for(i=0;i<num;i++)
{
ans=scanf("%d",&A[i]);
}
for(i=0;i<num;i++)
{
key=A[i];
j=i-1;
while(j>= 0 && A[j]>key)
{
A[j+1] = A[j];
j--;
A[j+1] = key;
}
for(k=0;k<num;k++)
{
if(k==num-1) printf("%d",A[k]);
else printf("%d ",A[k]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116096/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116096/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
store i32 0, ptr %num, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %for.end35
for.cond2.preheader: ; preds = %for.body
%cmp362 = icmp sgt i32 %1, 0
br i1 %cmp362, label %for.body4, label %for.end35
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 %num, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end31
%3 = phi i32 [ %12, %for.end31 ], [ %1, %for.cond2.preheader ]
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.end31 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv65
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp757.not = icmp eq i64 %indvars.iv65, 0
br i1 %cmp757.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %while.body ], [ %indvars.iv65, %for.body4 ]
%indvars.iv.next68 = add nsw i64 %indvars.iv67, -1
%idxprom8 = and i64 %indvars.iv.next68, 4294967295
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %5, %4
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv67
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
store i32 %4, ptr %arrayidx9, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv67, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%cmp1960 = icmp sgt i32 %3, 0
br i1 %cmp1960, label %for.body20, label %for.end31
for.body20: ; preds = %while.end, %for.body20
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body20 ], [ 0, %while.end ]
%7 = phi i32 [ %10, %for.body20 ], [ %3, %while.end ]
%sub21 = add nsw i32 %7, -1
%8 = zext i32 %sub21 to i64
%cmp22 = icmp eq i64 %indvars.iv70, %8
%arrayidx24 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv70
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp22, ptr @.str, ptr @.str.1
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %9)
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%10 = load i32, ptr %num, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp19 = icmp slt i64 %indvars.iv.next71, %11
br i1 %cmp19, label %for.body20, label %for.end31, !llvm.loop !12
for.end31: ; preds = %for.body20, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%12 = load i32, ptr %num, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3 = icmp slt i64 %indvars.iv.next66, %13
br i1 %cmp3, label %for.body4, label %for.end35, !llvm.loop !13
for.end35: ; preds = %for.end31, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.