Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <string.h>
char dict[30600000];
char word[26];
long encode(const char *key){
int n=strlen(key),i;
long sum=0;
long keta=1;
for(i=0;i<n;i++){
int keyi=key[i];
sum = sum + keta * word[keyi];
keta=keta*5;
}
return (sum);
}
void insert(const char *key2) {
long key=encode(key2);
long keta=key/8;
dict[keta]=(dict[keta]|(1<<(key%8)));
}
int find_h(const char *key2) {
long key=encode(key2);
return (dict[key/8] & 1<<(key%8));
}
int main(void) {
long n,i;
word['A'] = 1;
word['C'] = 2;
word['G'] = 3;
word['T'] = 4;
scanf("%ld\n",&n);
for(i=0;i<n;i++){
char cmd[8], str[14]; scanf("%s %s\n",cmd, str);
if(cmd[0]=='i') {
insert(str);
}
else {
if(find_h(str)) printf("yes\n");
else printf("no\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@word = dso_local local_unnamed_addr global [26 x i8] zeroinitializer, align 16
@dict = dso_local local_unnamed_addr global [30600000 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%s %s\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @encode(ptr nocapture noundef readonly %key) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %key) #7
%conv = trunc i64 %call to i32
%cmp12 = icmp sgt i32 %conv, 0
br i1 %cmp12, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call, 4294967295
%0 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %call, 3
%1 = icmp ult i64 %0, 3
br i1 %1, 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 ]
%keta.014 = phi i64 [ 1, %for.body.preheader.new ], [ %mul6.3, %for.body ]
%sum.013 = phi i64 [ 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 i8, ptr %key, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%idxprom3 = sext i8 %2 to i64
%arrayidx4 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3
%3 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%conv5 = sext i8 %3 to i64
%mul = mul nsw i64 %keta.014, %conv5
%add = add nsw i64 %mul, %sum.013
%mul6 = mul nsw i64 %keta.014, 5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %key, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%idxprom3.1 = sext i8 %4 to i64
%arrayidx4.1 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.1
%5 = load i8, ptr %arrayidx4.1, align 1, !tbaa !5
%conv5.1 = sext i8 %5 to i64
%mul.1 = mul nsw i64 %mul6, %conv5.1
%add.1 = add nsw i64 %mul.1, %add
%mul6.1 = mul i64 %keta.014, 25
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i8, ptr %key, i64 %indvars.iv.next.1
%6 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%idxprom3.2 = sext i8 %6 to i64
%arrayidx4.2 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.2
%7 = load i8, ptr %arrayidx4.2, align 1, !tbaa !5
%conv5.2 = sext i8 %7 to i64
%mul.2 = mul nsw i64 %mul6.1, %conv5.2
%add.2 = add nsw i64 %mul.2, %add.1
%mul6.2 = mul i64 %keta.014, 125
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i8, ptr %key, i64 %indvars.iv.next.2
%8 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%idxprom3.3 = sext i8 %8 to i64
%arrayidx4.3 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.3
%9 = load i8, ptr %arrayidx4.3, align 1, !tbaa !5
%conv5.3 = sext i8 %9 to i64
%mul.3 = mul nsw i64 %mul6.2, %conv5.3
%add.3 = add nsw i64 %mul.3, %add.2
%mul6.3 = mul i64 %keta.014, 625
%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 i64 [ undef, %for.body.preheader ], [ %add.3, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%keta.014.unr = phi i64 [ 1, %for.body.preheader ], [ %mul6.3, %for.body ]
%sum.013.unr = phi i64 [ 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 ]
%keta.014.epil = phi i64 [ %mul6.epil, %for.body.epil ], [ %keta.014.unr, %for.end.loopexit.unr-lcssa ]
%sum.013.epil = phi i64 [ %add.epil, %for.body.epil ], [ %sum.013.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 i8, ptr %key, i64 %indvars.iv.epil
%10 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%idxprom3.epil = sext i8 %10 to i64
%arrayidx4.epil = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.epil
%11 = load i8, ptr %arrayidx4.epil, align 1, !tbaa !5
%conv5.epil = sext i8 %11 to i64
%mul.epil = mul nsw i64 %keta.014.epil, %conv5.epil
%add.epil = add nsw i64 %mul.epil, %sum.013.epil
%mul6.epil = mul nsw i64 %keta.014.epil, 5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !10
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %key2) local_unnamed_addr #3 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %key2) #7
%conv.i = trunc i64 %call.i to i32
%cmp12.i = icmp sgt i32 %conv.i, 0
br i1 %cmp12.i, label %for.body.preheader.i, label %encode.exit
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = and i64 %call.i, 4294967295
%0 = add nsw i64 %wide.trip.count.i, -1
%xtraiter = and i64 %call.i, 3
%1 = icmp ult i64 %0, 3
br i1 %1, label %encode.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = sub nsw i64 %wide.trip.count.i, %xtraiter
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%keta.014.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %mul6.i.3, %for.body.i ]
%sum.013.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%idxprom3.i = sext i8 %2 to i64
%arrayidx4.i = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i
%3 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5
%conv5.i = sext i8 %3 to i64
%mul.i = mul nsw i64 %keta.014.i, %conv5.i
%add.i = add nsw i64 %mul.i, %sum.013.i
%mul6.i = mul nsw i64 %keta.014.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%idxprom3.i.1 = sext i8 %4 to i64
%arrayidx4.i.1 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.1
%5 = load i8, ptr %arrayidx4.i.1, align 1, !tbaa !5
%conv5.i.1 = sext i8 %5 to i64
%mul.i.1 = mul nsw i64 %mul6.i, %conv5.i.1
%add.i.1 = add nsw i64 %mul.i.1, %add.i
%mul6.i.1 = mul i64 %keta.014.i, 25
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i.1
%6 = load i8, ptr %arrayidx.i.2, align 1, !tbaa !5
%idxprom3.i.2 = sext i8 %6 to i64
%arrayidx4.i.2 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.2
%7 = load i8, ptr %arrayidx4.i.2, align 1, !tbaa !5
%conv5.i.2 = sext i8 %7 to i64
%mul.i.2 = mul nsw i64 %mul6.i.1, %conv5.i.2
%add.i.2 = add nsw i64 %mul.i.2, %add.i.1
%mul6.i.2 = mul i64 %keta.014.i, 125
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i.2
%8 = load i8, ptr %arrayidx.i.3, align 1, !tbaa !5
%idxprom3.i.3 = sext i8 %8 to i64
%arrayidx4.i.3 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.3
%9 = load i8, ptr %arrayidx4.i.3, align 1, !tbaa !5
%conv5.i.3 = sext i8 %9 to i64
%mul.i.3 = mul nsw i64 %mul6.i.2, %conv5.i.3
%add.i.3 = add nsw i64 %mul.i.3, %add.i.2
%mul6.i.3 = mul i64 %keta.014.i, 625
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %encode.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
encode.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%add.i.lcssa.ph = phi i64 [ undef, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%keta.014.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %mul6.i.3, %for.body.i ]
%sum.013.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %encode.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %encode.exit.loopexit.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %encode.exit.loopexit.unr-lcssa ]
%keta.014.i.epil = phi i64 [ %mul6.i.epil, %for.body.i.epil ], [ %keta.014.i.unr, %encode.exit.loopexit.unr-lcssa ]
%sum.013.i.epil = phi i64 [ %add.i.epil, %for.body.i.epil ], [ %sum.013.i.unr, %encode.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %encode.exit.loopexit.unr-lcssa ]
%arrayidx.i.epil = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.i.epil
%10 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%idxprom3.i.epil = sext i8 %10 to i64
%arrayidx4.i.epil = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.epil
%11 = load i8, ptr %arrayidx4.i.epil, align 1, !tbaa !5
%conv5.i.epil = sext i8 %11 to i64
%mul.i.epil = mul nsw i64 %keta.014.i.epil, %conv5.i.epil
%add.i.epil = add nsw i64 %mul.i.epil, %sum.013.i.epil
%mul6.i.epil = mul nsw i64 %keta.014.i.epil, 5
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %encode.exit, label %for.body.i.epil, !llvm.loop !12
encode.exit: ; preds = %encode.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry
%sum.0.lcssa.i = phi i64 [ 0, %entry ], [ %add.i.lcssa.ph, %encode.exit.loopexit.unr-lcssa ], [ %add.i.epil, %for.body.i.epil ]
%div = sdiv i64 %sum.0.lcssa.i, 8
%arrayidx = getelementptr inbounds [30600000 x i8], ptr @dict, i64 0, i64 %div
%12 = load i8, ptr %arrayidx, align 1, !tbaa !5
%rem = srem i64 %sum.0.lcssa.i, 8
%sh_prom = trunc i64 %rem to i32
%shl = shl nuw nsw i32 1, %sh_prom
%13 = trunc i32 %shl to i8
%conv1 = or i8 %12, %13
store i8 %conv1, ptr %arrayidx, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find_h(ptr nocapture noundef readonly %key2) local_unnamed_addr #0 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %key2) #7
%conv.i = trunc i64 %call.i to i32
%cmp12.i = icmp sgt i32 %conv.i, 0
br i1 %cmp12.i, label %for.body.preheader.i, label %encode.exit
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = and i64 %call.i, 4294967295
%0 = add nsw i64 %wide.trip.count.i, -1
%xtraiter = and i64 %call.i, 3
%1 = icmp ult i64 %0, 3
br i1 %1, label %encode.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = sub nsw i64 %wide.trip.count.i, %xtraiter
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%keta.014.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %mul6.i.3, %for.body.i ]
%sum.013.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%idxprom3.i = sext i8 %2 to i64
%arrayidx4.i = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i
%3 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5
%conv5.i = sext i8 %3 to i64
%mul.i = mul nsw i64 %keta.014.i, %conv5.i
%add.i = add nsw i64 %mul.i, %sum.013.i
%mul6.i = mul nsw i64 %keta.014.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%idxprom3.i.1 = sext i8 %4 to i64
%arrayidx4.i.1 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.1
%5 = load i8, ptr %arrayidx4.i.1, align 1, !tbaa !5
%conv5.i.1 = sext i8 %5 to i64
%mul.i.1 = mul nsw i64 %mul6.i, %conv5.i.1
%add.i.1 = add nsw i64 %mul.i.1, %add.i
%mul6.i.1 = mul i64 %keta.014.i, 25
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i.1
%6 = load i8, ptr %arrayidx.i.2, align 1, !tbaa !5
%idxprom3.i.2 = sext i8 %6 to i64
%arrayidx4.i.2 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.2
%7 = load i8, ptr %arrayidx4.i.2, align 1, !tbaa !5
%conv5.i.2 = sext i8 %7 to i64
%mul.i.2 = mul nsw i64 %mul6.i.1, %conv5.i.2
%add.i.2 = add nsw i64 %mul.i.2, %add.i.1
%mul6.i.2 = mul i64 %keta.014.i, 125
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.next.i.2
%8 = load i8, ptr %arrayidx.i.3, align 1, !tbaa !5
%idxprom3.i.3 = sext i8 %8 to i64
%arrayidx4.i.3 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.3
%9 = load i8, ptr %arrayidx4.i.3, align 1, !tbaa !5
%conv5.i.3 = sext i8 %9 to i64
%mul.i.3 = mul nsw i64 %mul6.i.2, %conv5.i.3
%add.i.3 = add nsw i64 %mul.i.3, %add.i.2
%mul6.i.3 = mul i64 %keta.014.i, 625
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %encode.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
encode.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%add.i.lcssa.ph = phi i64 [ undef, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%keta.014.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %mul6.i.3, %for.body.i ]
%sum.013.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %encode.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %encode.exit.loopexit.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %encode.exit.loopexit.unr-lcssa ]
%keta.014.i.epil = phi i64 [ %mul6.i.epil, %for.body.i.epil ], [ %keta.014.i.unr, %encode.exit.loopexit.unr-lcssa ]
%sum.013.i.epil = phi i64 [ %add.i.epil, %for.body.i.epil ], [ %sum.013.i.unr, %encode.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %encode.exit.loopexit.unr-lcssa ]
%arrayidx.i.epil = getelementptr inbounds i8, ptr %key2, i64 %indvars.iv.i.epil
%10 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%idxprom3.i.epil = sext i8 %10 to i64
%arrayidx4.i.epil = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.epil
%11 = load i8, ptr %arrayidx4.i.epil, align 1, !tbaa !5
%conv5.i.epil = sext i8 %11 to i64
%mul.i.epil = mul nsw i64 %keta.014.i.epil, %conv5.i.epil
%add.i.epil = add nsw i64 %mul.i.epil, %sum.013.i.epil
%mul6.i.epil = mul nsw i64 %keta.014.i.epil, 5
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %encode.exit, label %for.body.i.epil, !llvm.loop !13
encode.exit: ; preds = %encode.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry
%sum.0.lcssa.i = phi i64 [ 0, %entry ], [ %add.i.lcssa.ph, %encode.exit.loopexit.unr-lcssa ], [ %add.i.epil, %for.body.i.epil ]
%div = sdiv i64 %sum.0.lcssa.i, 8
%arrayidx = getelementptr inbounds [30600000 x i8], ptr @dict, i64 0, i64 %div
%12 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv = sext i8 %12 to i32
%rem = srem i64 %sum.0.lcssa.i, 8
%sh_prom = trunc i64 %rem to i32
%shl = shl nuw nsw i32 1, %sh_prom
%and = and i32 %shl, %conv
ret i32 %and
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i64, align 8
%cmd = alloca [8 x i8], align 1
%str = alloca [14 x i8], align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
store i8 1, ptr getelementptr inbounds ([26 x i8], ptr @word, i64 2, i64 13), align 1, !tbaa !5
store i8 2, ptr getelementptr inbounds ([26 x i8], ptr @word, i64 2, i64 15), align 1, !tbaa !5
store i8 3, ptr getelementptr inbounds ([26 x i8], ptr @word, i64 2, i64 19), align 1, !tbaa !5
store i8 4, ptr getelementptr inbounds ([26 x i8], ptr @word, i64 3, i64 6), align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !14
%cmp39 = icmp sgt i64 %0, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end12
%i.040 = phi i64 [ %inc, %if.end12 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %cmd) #8
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #8
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %cmd, ptr noundef nonnull %str)
%1 = load i8, ptr %cmd, align 1, !tbaa !5
%cmp3 = icmp eq i8 %1, 105
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv.i.i = trunc i64 %call.i.i to i32
%cmp12.i.i = icmp sgt i32 %conv.i.i, 0
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
br i1 %cmp12.i.i, label %for.body.preheader.i.i, label %insert.exit
for.body.preheader.i.i: ; preds = %if.then
%wide.trip.count.i.i = and i64 %call.i.i, 4294967295
%2 = add nsw i64 %wide.trip.count.i.i, -1
%xtraiter42 = and i64 %call.i.i, 3
%3 = icmp ult i64 %2, 3
br i1 %3, label %insert.exit.loopexit.unr-lcssa, label %for.body.preheader.i.i.new
for.body.preheader.i.i.new: ; preds = %for.body.preheader.i.i
%unroll_iter46 = sub nsw i64 %wide.trip.count.i.i, %xtraiter42
br label %for.body.i.i
for.body.i.i: ; preds = %for.body.i.i, %for.body.preheader.i.i.new
%indvars.iv.i.i = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %indvars.iv.next.i.i.3, %for.body.i.i ]
%keta.014.i.i = phi i64 [ 1, %for.body.preheader.i.i.new ], [ %mul6.i.i.3, %for.body.i.i ]
%sum.013.i.i = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %add.i.i.3, %for.body.i.i ]
%niter47 = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %niter47.next.3, %for.body.i.i ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.i
%4 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
%idxprom3.i.i = sext i8 %4 to i64
%arrayidx4.i.i = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i
%5 = load i8, ptr %arrayidx4.i.i, align 1, !tbaa !5
%conv5.i.i = sext i8 %5 to i64
%mul.i.i = mul nsw i64 %keta.014.i.i, %conv5.i.i
%add.i.i = add nsw i64 %mul.i.i, %sum.013.i.i
%mul6.i.i = mul nsw i64 %keta.014.i.i, 5
%indvars.iv.next.i.i = or i64 %indvars.iv.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i
%6 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
%idxprom3.i.i.1 = sext i8 %6 to i64
%arrayidx4.i.i.1 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i.1
%7 = load i8, ptr %arrayidx4.i.i.1, align 1, !tbaa !5
%conv5.i.i.1 = sext i8 %7 to i64
%mul.i.i.1 = mul nsw i64 %mul6.i.i, %conv5.i.i.1
%add.i.i.1 = add nsw i64 %mul.i.i.1, %add.i.i
%mul6.i.i.1 = mul i64 %keta.014.i.i, 25
%indvars.iv.next.i.i.1 = or i64 %indvars.iv.i.i, 2
%arrayidx.i.i.2 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i.1
%8 = load i8, ptr %arrayidx.i.i.2, align 1, !tbaa !5
%idxprom3.i.i.2 = sext i8 %8 to i64
%arrayidx4.i.i.2 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i.2
%9 = load i8, ptr %arrayidx4.i.i.2, align 1, !tbaa !5
%conv5.i.i.2 = sext i8 %9 to i64
%mul.i.i.2 = mul nsw i64 %mul6.i.i.1, %conv5.i.i.2
%add.i.i.2 = add nsw i64 %mul.i.i.2, %add.i.i.1
%mul6.i.i.2 = mul i64 %keta.014.i.i, 125
%indvars.iv.next.i.i.2 = or i64 %indvars.iv.i.i, 3
%arrayidx.i.i.3 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i.2
%10 = load i8, ptr %arrayidx.i.i.3, align 1, !tbaa !5
%idxprom3.i.i.3 = sext i8 %10 to i64
%arrayidx4.i.i.3 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i.3
%11 = load i8, ptr %arrayidx4.i.i.3, align 1, !tbaa !5
%conv5.i.i.3 = sext i8 %11 to i64
%mul.i.i.3 = mul nsw i64 %mul6.i.i.2, %conv5.i.i.3
%add.i.i.3 = add nsw i64 %mul.i.i.3, %add.i.i.2
%mul6.i.i.3 = mul i64 %keta.014.i.i, 625
%indvars.iv.next.i.i.3 = add nuw nsw i64 %indvars.iv.i.i, 4
%niter47.next.3 = add i64 %niter47, 4
%niter47.ncmp.3 = icmp eq i64 %niter47.next.3, %unroll_iter46
br i1 %niter47.ncmp.3, label %insert.exit.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
insert.exit.loopexit.unr-lcssa: ; preds = %for.body.i.i, %for.body.preheader.i.i
%add.i.i.lcssa.ph = phi i64 [ undef, %for.body.preheader.i.i ], [ %add.i.i.3, %for.body.i.i ]
%indvars.iv.i.i.unr = phi i64 [ 0, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i.3, %for.body.i.i ]
%keta.014.i.i.unr = phi i64 [ 1, %for.body.preheader.i.i ], [ %mul6.i.i.3, %for.body.i.i ]
%sum.013.i.i.unr = phi i64 [ 0, %for.body.preheader.i.i ], [ %add.i.i.3, %for.body.i.i ]
%lcmp.mod44.not = icmp eq i64 %xtraiter42, 0
br i1 %lcmp.mod44.not, label %insert.exit, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %insert.exit.loopexit.unr-lcssa, %for.body.i.i.epil
%indvars.iv.i.i.epil = phi i64 [ %indvars.iv.next.i.i.epil, %for.body.i.i.epil ], [ %indvars.iv.i.i.unr, %insert.exit.loopexit.unr-lcssa ]
%keta.014.i.i.epil = phi i64 [ %mul6.i.i.epil, %for.body.i.i.epil ], [ %keta.014.i.i.unr, %insert.exit.loopexit.unr-lcssa ]
%sum.013.i.i.epil = phi i64 [ %add.i.i.epil, %for.body.i.i.epil ], [ %sum.013.i.i.unr, %insert.exit.loopexit.unr-lcssa ]
%epil.iter43 = phi i64 [ %epil.iter43.next, %for.body.i.i.epil ], [ 0, %insert.exit.loopexit.unr-lcssa ]
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.i.epil
%12 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
%idxprom3.i.i.epil = sext i8 %12 to i64
%arrayidx4.i.i.epil = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i.epil
%13 = load i8, ptr %arrayidx4.i.i.epil, align 1, !tbaa !5
%conv5.i.i.epil = sext i8 %13 to i64
%mul.i.i.epil = mul nsw i64 %keta.014.i.i.epil, %conv5.i.i.epil
%add.i.i.epil = add nsw i64 %mul.i.i.epil, %sum.013.i.i.epil
%mul6.i.i.epil = mul nsw i64 %keta.014.i.i.epil, 5
%indvars.iv.next.i.i.epil = add nuw nsw i64 %indvars.iv.i.i.epil, 1
%epil.iter43.next = add i64 %epil.iter43, 1
%epil.iter43.cmp.not = icmp eq i64 %epil.iter43.next, %xtraiter42
br i1 %epil.iter43.cmp.not, label %insert.exit, label %for.body.i.i.epil, !llvm.loop !16
insert.exit: ; preds = %insert.exit.loopexit.unr-lcssa, %for.body.i.i.epil, %if.then
%sum.0.lcssa.i.i = phi i64 [ 0, %if.then ], [ %add.i.i.lcssa.ph, %insert.exit.loopexit.unr-lcssa ], [ %add.i.i.epil, %for.body.i.i.epil ]
%div.i = sdiv i64 %sum.0.lcssa.i.i, 8
%arrayidx.i = getelementptr inbounds [30600000 x i8], ptr @dict, i64 0, i64 %div.i
%14 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%rem.i = srem i64 %sum.0.lcssa.i.i, 8
%sh_prom.i = trunc i64 %rem.i to i32
%shl.i = shl nuw nsw i32 1, %sh_prom.i
%15 = trunc i32 %shl.i to i8
%conv1.i = or i8 %14, %15
store i8 %conv1.i, ptr %arrayidx.i, align 1, !tbaa !5
br label %if.end12
if.else: ; preds = %for.body
br i1 %cmp12.i.i, label %for.body.preheader.i.i24, label %find_h.exit
for.body.preheader.i.i24: ; preds = %if.else
%wide.trip.count.i.i25 = and i64 %call.i.i, 4294967295
%16 = add nsw i64 %wide.trip.count.i.i25, -1
%xtraiter = and i64 %call.i.i, 3
%17 = icmp ult i64 %16, 3
br i1 %17, label %find_h.exit.loopexit.unr-lcssa, label %for.body.preheader.i.i24.new
for.body.preheader.i.i24.new: ; preds = %for.body.preheader.i.i24
%unroll_iter = sub nsw i64 %wide.trip.count.i.i25, %xtraiter
br label %for.body.i.i26
for.body.i.i26: ; preds = %for.body.i.i26, %for.body.preheader.i.i24.new
%indvars.iv.i.i27 = phi i64 [ 0, %for.body.preheader.i.i24.new ], [ %indvars.iv.next.i.i37.3, %for.body.i.i26 ]
%keta.014.i.i28 = phi i64 [ 1, %for.body.preheader.i.i24.new ], [ %mul6.i.i36.3, %for.body.i.i26 ]
%sum.013.i.i29 = phi i64 [ 0, %for.body.preheader.i.i24.new ], [ %add.i.i35.3, %for.body.i.i26 ]
%niter = phi i64 [ 0, %for.body.preheader.i.i24.new ], [ %niter.next.3, %for.body.i.i26 ]
%arrayidx.i.i30 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.i27
%18 = load i8, ptr %arrayidx.i.i30, align 1, !tbaa !5
%idxprom3.i.i31 = sext i8 %18 to i64
%arrayidx4.i.i32 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i31
%19 = load i8, ptr %arrayidx4.i.i32, align 1, !tbaa !5
%conv5.i.i33 = sext i8 %19 to i64
%mul.i.i34 = mul nsw i64 %keta.014.i.i28, %conv5.i.i33
%add.i.i35 = add nsw i64 %mul.i.i34, %sum.013.i.i29
%mul6.i.i36 = mul nsw i64 %keta.014.i.i28, 5
%indvars.iv.next.i.i37 = or i64 %indvars.iv.i.i27, 1
%arrayidx.i.i30.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i37
%20 = load i8, ptr %arrayidx.i.i30.1, align 1, !tbaa !5
%idxprom3.i.i31.1 = sext i8 %20 to i64
%arrayidx4.i.i32.1 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i31.1
%21 = load i8, ptr %arrayidx4.i.i32.1, align 1, !tbaa !5
%conv5.i.i33.1 = sext i8 %21 to i64
%mul.i.i34.1 = mul nsw i64 %mul6.i.i36, %conv5.i.i33.1
%add.i.i35.1 = add nsw i64 %mul.i.i34.1, %add.i.i35
%mul6.i.i36.1 = mul i64 %keta.014.i.i28, 25
%indvars.iv.next.i.i37.1 = or i64 %indvars.iv.i.i27, 2
%arrayidx.i.i30.2 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i37.1
%22 = load i8, ptr %arrayidx.i.i30.2, align 1, !tbaa !5
%idxprom3.i.i31.2 = sext i8 %22 to i64
%arrayidx4.i.i32.2 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i31.2
%23 = load i8, ptr %arrayidx4.i.i32.2, align 1, !tbaa !5
%conv5.i.i33.2 = sext i8 %23 to i64
%mul.i.i34.2 = mul nsw i64 %mul6.i.i36.1, %conv5.i.i33.2
%add.i.i35.2 = add nsw i64 %mul.i.i34.2, %add.i.i35.1
%mul6.i.i36.2 = mul i64 %keta.014.i.i28, 125
%indvars.iv.next.i.i37.2 = or i64 %indvars.iv.i.i27, 3
%arrayidx.i.i30.3 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i37.2
%24 = load i8, ptr %arrayidx.i.i30.3, align 1, !tbaa !5
%idxprom3.i.i31.3 = sext i8 %24 to i64
%arrayidx4.i.i32.3 = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i31.3
%25 = load i8, ptr %arrayidx4.i.i32.3, align 1, !tbaa !5
%conv5.i.i33.3 = sext i8 %25 to i64
%mul.i.i34.3 = mul nsw i64 %mul6.i.i36.2, %conv5.i.i33.3
%add.i.i35.3 = add nsw i64 %mul.i.i34.3, %add.i.i35.2
%mul6.i.i36.3 = mul i64 %keta.014.i.i28, 625
%indvars.iv.next.i.i37.3 = add nuw nsw i64 %indvars.iv.i.i27, 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 %find_h.exit.loopexit.unr-lcssa, label %for.body.i.i26, !llvm.loop !8
find_h.exit.loopexit.unr-lcssa: ; preds = %for.body.i.i26, %for.body.preheader.i.i24
%add.i.i35.lcssa.ph = phi i64 [ undef, %for.body.preheader.i.i24 ], [ %add.i.i35.3, %for.body.i.i26 ]
%indvars.iv.i.i27.unr = phi i64 [ 0, %for.body.preheader.i.i24 ], [ %indvars.iv.next.i.i37.3, %for.body.i.i26 ]
%keta.014.i.i28.unr = phi i64 [ 1, %for.body.preheader.i.i24 ], [ %mul6.i.i36.3, %for.body.i.i26 ]
%sum.013.i.i29.unr = phi i64 [ 0, %for.body.preheader.i.i24 ], [ %add.i.i35.3, %for.body.i.i26 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %find_h.exit, label %for.body.i.i26.epil
for.body.i.i26.epil: ; preds = %find_h.exit.loopexit.unr-lcssa, %for.body.i.i26.epil
%indvars.iv.i.i27.epil = phi i64 [ %indvars.iv.next.i.i37.epil, %for.body.i.i26.epil ], [ %indvars.iv.i.i27.unr, %find_h.exit.loopexit.unr-lcssa ]
%keta.014.i.i28.epil = phi i64 [ %mul6.i.i36.epil, %for.body.i.i26.epil ], [ %keta.014.i.i28.unr, %find_h.exit.loopexit.unr-lcssa ]
%sum.013.i.i29.epil = phi i64 [ %add.i.i35.epil, %for.body.i.i26.epil ], [ %sum.013.i.i29.unr, %find_h.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.i26.epil ], [ 0, %find_h.exit.loopexit.unr-lcssa ]
%arrayidx.i.i30.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.i27.epil
%26 = load i8, ptr %arrayidx.i.i30.epil, align 1, !tbaa !5
%idxprom3.i.i31.epil = sext i8 %26 to i64
%arrayidx4.i.i32.epil = getelementptr inbounds [26 x i8], ptr @word, i64 0, i64 %idxprom3.i.i31.epil
%27 = load i8, ptr %arrayidx4.i.i32.epil, align 1, !tbaa !5
%conv5.i.i33.epil = sext i8 %27 to i64
%mul.i.i34.epil = mul nsw i64 %keta.014.i.i28.epil, %conv5.i.i33.epil
%add.i.i35.epil = add nsw i64 %mul.i.i34.epil, %sum.013.i.i29.epil
%mul6.i.i36.epil = mul nsw i64 %keta.014.i.i28.epil, 5
%indvars.iv.next.i.i37.epil = add nuw nsw i64 %indvars.iv.i.i27.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 %find_h.exit, label %for.body.i.i26.epil, !llvm.loop !17
find_h.exit: ; preds = %find_h.exit.loopexit.unr-lcssa, %for.body.i.i26.epil, %if.else
%sum.0.lcssa.i.i18 = phi i64 [ 0, %if.else ], [ %add.i.i35.lcssa.ph, %find_h.exit.loopexit.unr-lcssa ], [ %add.i.i35.epil, %for.body.i.i26.epil ]
%div.i19 = sdiv i64 %sum.0.lcssa.i.i18, 8
%arrayidx.i20 = getelementptr inbounds [30600000 x i8], ptr @dict, i64 0, i64 %div.i19
%28 = load i8, ptr %arrayidx.i20, align 1, !tbaa !5
%conv.i = sext i8 %28 to i32
%rem.i21 = srem i64 %sum.0.lcssa.i.i18, 8
%sh_prom.i22 = trunc i64 %rem.i21 to i32
%shl.i23 = shl nuw nsw i32 1, %sh_prom.i22
%and.i = and i32 %shl.i23, %conv.i
%tobool.not = icmp eq i32 %and.i, 0
br i1 %tobool.not, label %if.else10, label %if.then8
if.then8: ; preds = %find_h.exit
%puts14 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end12
if.else10: ; preds = %find_h.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end12
if.end12: ; preds = %if.then8, %if.else10, %insert.exit
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cmd) #8
%inc = add nuw nsw i64 %i.040, 1
%29 = load i64, ptr %n, align 8, !tbaa !14
%cmp = icmp slt i64 %inc, %29
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %if.end12, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 willreturn memory(read) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.unroll.disable"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !6, i64 0}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !9}
|
#include <stdio.h>
#include <string.h>
typedef long long ll;
int main (void)
{
ll a,b,x,y;
ll n;
scanf("%lld",&n);
while (n--) {
scanf("%lld %lld %lld %lld",&x,&y,&a,&b);
ll dis=y-x;
if (dis<0) dis=-dis;
if (dis%(a+b)==0) {
printf ("%lld\n",dis/(a+b));
}else {
printf ("-1\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%dec12 = add nsw i64 %0, -1
store i64 %dec12, ptr %n, align 8, !tbaa !5
%tobool.not13 = icmp eq i64 %0, 0
br i1 %tobool.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end8
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i64, ptr %y, align 8, !tbaa !5
%2 = load i64, ptr %x, align 8, !tbaa !5
%sub = sub nsw i64 %1, %2
%spec.select = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%3 = load i64, ptr %a, align 8, !tbaa !5
%4 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %4, %3
%rem = srem i64 %spec.select, %add
%div = sdiv i64 %spec.select, %add
%cmp3 = icmp eq i64 %rem, 0
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %while.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
br label %if.end8
if.else: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end8
if.end8: ; preds = %if.else, %if.then4
%5 = load i64, ptr %n, align 8, !tbaa !5
%dec = add nsw i64 %5, -1
store i64 %dec, ptr %n, align 8, !tbaa !5
%tobool.not = icmp eq i64 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end8, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }
int find(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0)return 0;
}
return 0;
}
int insert(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0){
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246063/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246063/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define HASH_M 9973
#define HASH_A 128
#define STR_SIZE 16
typedef struct DATA{
struct DATA *next;
char str[STR_SIZE];
}Data;
Data dlist[HASH_M]; //?????????????´?????????????????????????
int getHashAddr(char str[STR_SIZE], int M, int a){
int i = 0, h = 0;
if( M <= 0 ){ M = HASH_M; }
if( a <= 0 ){ a = HASH_A; }
for( i = 0; str[i] != '\0'; i++ ){ h = (a*h + str[i]) % M; }
return h;
}
void hashShow(int addr){
Data *tmp = &dlist[addr];
printf("addr=%d\n", addr);
if( tmp == NULL ){ return; }
while( tmp->next != NULL ){
tmp = tmp->next;
printf("%s\n", tmp->str);
}
return;
}
void hashAdd(char str[STR_SIZE]){
int addr = getHashAddr(str, HASH_M, HASH_A);
Data *data = (Data*)malloc(sizeof(Data));
strcpy(data->str, str);
data->next = NULL;
Data *tmp = &dlist[addr];
while( tmp->next != NULL ){ tmp = tmp->next; }
tmp->next = data;
//hashShow(addr);
return;
}
void hashRemove(char str[STR_SIZE]){
int addr = getHashAddr(str, HASH_M, HASH_A);
Data *tmp = &dlist[addr];
Data *target;
while( tmp->next != NULL ){
if( strcmp(tmp->next->str, str) == 1 ){
target = tmp->next;
tmp->next = tmp->next->next;
free(target);
return;
}
}
return;
}
int hashFind(char str[STR_SIZE]){
int addr = getHashAddr(str, HASH_M, HASH_A);
Data *tmp = &dlist[addr];
while( tmp->next != NULL ){
tmp = tmp->next;
if( strcmp(tmp->str, str) == 0 ){ return 1; }
}
return 0;
}
int main(){
int n, i;
char com[128], str[STR_SIZE];
Data dummy;
dummy.next = NULL;
dummy.str[0] = '\0';
for( i = 0; i < HASH_M; i++ ){ dlist[i] = dummy; }
scanf("%d", &n);
for( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if( strcmp(com, "insert\0") == 0 ){
hashAdd(str);
}else if( strcmp(com, "remove\0") == 0 ){
hashRemove(str);
}else if( strcmp(com, "find\0") == 0 ){
printf("%s\n", (hashFind(str)?"yes":"no"));
}else{
printf("it is not command\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246106/source.c"
target datalayout = "e-m:e-p270: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.DATA = type { ptr, [16 x i8] }
@dlist = dso_local local_unnamed_addr global [9973 x %struct.DATA] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"addr=%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"insert\00\00", align 1
@.str.5 = private unnamed_addr constant [8 x i8] c"remove\00\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"find\00\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@.str.8 = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str = private unnamed_addr constant [18 x i8] c"it is not command\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @getHashAddr(ptr nocapture noundef readonly %str, i32 noundef %M, i32 noundef %a) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %M, 1
%spec.store.select = select i1 %cmp, i32 9973, i32 %M
%cmp1 = icmp slt i32 %a, 1
%spec.store.select9 = select i1 %cmp1, i32 128, i32 %a
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp4.not16 = icmp eq i8 %0, 0
br i1 %cmp4.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body ], [ %0, %entry ]
%h.018 = phi i32 [ %rem, %for.body ], [ 0, %entry ]
%conv = sext i8 %1 to i32
%mul = mul nsw i32 %h.018, %spec.store.select9
%add = add nsw i32 %mul, %conv
%rem = srem i32 %add, %spec.store.select
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp4.not = icmp eq i8 %2, 0
br i1 %cmp4.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%h.0.lcssa = phi i32 [ 0, %entry ], [ %rem, %for.body ]
ret i32 %h.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @hashShow(i32 noundef %addr) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %addr to i64
%arrayidx = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %idxprom
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %addr)
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !10
%cmp1.not8 = icmp eq ptr %0, null
br i1 %cmp1.not8, label %cleanup, label %while.body
while.body: ; preds = %entry, %while.body
%1 = phi ptr [ %2, %while.body ], [ %0, %entry ]
%str = getelementptr inbounds %struct.DATA, ptr %1, i64 0, i32 1
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str)
%2 = load ptr, ptr %1, align 8, !tbaa !10
%cmp1.not = icmp eq ptr %2, null
br i1 %cmp1.not, label %cleanup, label %while.body, !llvm.loop !13
cleanup: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @hashAdd(ptr nocapture noundef readonly %str) local_unnamed_addr #2 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp4.not16.i = icmp eq i8 %0, 0
br i1 %cmp4.not16.i, label %getHashAddr.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 ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body.i ], [ %0, %entry ]
%h.018.i = phi i32 [ %rem.i, %for.body.i ], [ 0, %entry ]
%conv.i = sext i8 %1 to i32
%mul.i = shl nsw i32 %h.018.i, 7
%add.i = add nsw i32 %mul.i, %conv.i
%rem.i = srem i32 %add.i, 9973
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp4.not.i = icmp eq i8 %2, 0
br i1 %cmp4.not.i, label %getHashAddr.exit.loopexit, label %for.body.i, !llvm.loop !8
getHashAddr.exit.loopexit: ; preds = %for.body.i
%3 = sext i32 %rem.i to i64
br label %getHashAddr.exit
getHashAddr.exit: ; preds = %getHashAddr.exit.loopexit, %entry
%h.0.lcssa.i = phi i64 [ 0, %entry ], [ %3, %getHashAddr.exit.loopexit ]
%call1 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%str2 = getelementptr inbounds %struct.DATA, ptr %call1, i64 0, i32 1
%call3 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str2, ptr noundef nonnull dereferenceable(1) %str) #13
store ptr null, ptr %call1, align 8, !tbaa !10
%arrayidx = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i
br label %while.cond
while.cond: ; preds = %while.cond, %getHashAddr.exit
%tmp.0 = phi ptr [ %arrayidx, %getHashAddr.exit ], [ %4, %while.cond ]
%4 = load ptr, ptr %tmp.0, align 8, !tbaa !10
%cmp.not = icmp eq ptr %4, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !14
while.end: ; preds = %while.cond
store ptr %call1, ptr %tmp.0, align 8, !tbaa !10
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nounwind uwtable
define dso_local void @hashRemove(ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp4.not16.i = icmp eq i8 %0, 0
br i1 %cmp4.not16.i, label %getHashAddr.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 ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body.i ], [ %0, %entry ]
%h.018.i = phi i32 [ %rem.i, %for.body.i ], [ 0, %entry ]
%conv.i = sext i8 %1 to i32
%mul.i = shl nsw i32 %h.018.i, 7
%add.i = add nsw i32 %mul.i, %conv.i
%rem.i = srem i32 %add.i, 9973
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp4.not.i = icmp eq i8 %2, 0
br i1 %cmp4.not.i, label %getHashAddr.exit.loopexit, label %for.body.i, !llvm.loop !8
getHashAddr.exit.loopexit: ; preds = %for.body.i
%3 = sext i32 %rem.i to i64
br label %getHashAddr.exit
getHashAddr.exit: ; preds = %getHashAddr.exit.loopexit, %entry
%h.0.lcssa.i = phi i64 [ 0, %entry ], [ %3, %getHashAddr.exit.loopexit ]
%arrayidx = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i
%4 = load ptr, ptr %arrayidx, align 8, !tbaa !10
%cmp.not = icmp eq ptr %4, null
br i1 %cmp.not, label %cleanup, label %getHashAddr.exit.split
getHashAddr.exit.split: ; preds = %getHashAddr.exit
%str2 = getelementptr inbounds %struct.DATA, ptr %4, i64 0, i32 1
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str2, ptr noundef nonnull dereferenceable(1) %str) #14
%cmp4 = icmp eq i32 %call3, 1
br i1 %cmp4, label %if.then, label %while.cond, !llvm.loop !15
while.cond: ; preds = %getHashAddr.exit.split, %while.cond
br label %while.cond
if.then: ; preds = %getHashAddr.exit.split
%5 = load ptr, ptr %4, align 8, !tbaa !10
store ptr %5, ptr %arrayidx, align 8, !tbaa !10
tail call void @free(ptr noundef nonnull %4) #13
br label %cleanup
cleanup: ; preds = %getHashAddr.exit, %if.then
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @hashFind(ptr nocapture noundef readonly %str) local_unnamed_addr #9 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp4.not16.i = icmp eq i8 %0, 0
br i1 %cmp4.not16.i, label %getHashAddr.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 ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body.i ], [ %0, %entry ]
%h.018.i = phi i32 [ %rem.i, %for.body.i ], [ 0, %entry ]
%conv.i = sext i8 %1 to i32
%mul.i = shl nsw i32 %h.018.i, 7
%add.i = add nsw i32 %mul.i, %conv.i
%rem.i = srem i32 %add.i, 9973
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp4.not.i = icmp eq i8 %2, 0
br i1 %cmp4.not.i, label %getHashAddr.exit.loopexit, label %for.body.i, !llvm.loop !8
getHashAddr.exit.loopexit: ; preds = %for.body.i
%3 = sext i32 %rem.i to i64
br label %getHashAddr.exit
getHashAddr.exit: ; preds = %getHashAddr.exit.loopexit, %entry
%h.0.lcssa.i = phi i64 [ 0, %entry ], [ %3, %getHashAddr.exit.loopexit ]
%arrayidx = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i
br label %while.cond
while.cond: ; preds = %while.body, %getHashAddr.exit
%tmp.0 = phi ptr [ %arrayidx, %getHashAddr.exit ], [ %4, %while.body ]
%4 = load ptr, ptr %tmp.0, align 8, !tbaa !10
%cmp.not = icmp eq ptr %4, null
br i1 %cmp.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%str2 = getelementptr inbounds %struct.DATA, ptr %4, i64 0, i32 1
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str2, ptr noundef nonnull dereferenceable(1) %str) #14
%cmp4 = icmp eq i32 %call3, 0
br i1 %cmp4, label %cleanup, label %while.cond, !llvm.loop !16
cleanup: ; preds = %while.cond, %while.body
%retval.0 = phi i32 [ 1, %while.body ], [ 0, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
%com = alloca [128 x i8], align 16
%str = alloca [16 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #13
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %com) #13
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %str) #13
br label %for.body
for.body: ; preds = %for.body.1, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.1 ]
%arrayidx2 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %indvars.iv
store ptr null, ptr %arrayidx2, align 16, !tbaa.struct !17
%dummy.sroa.4.0.arrayidx2.sroa_idx = getelementptr inbounds i8, ptr %arrayidx2, i64 8
store i8 0, ptr %dummy.sroa.4.0.arrayidx2.sroa_idx, align 8, !tbaa.struct !19
%indvars.iv.next = or i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 9973
br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !20
for.body.1: ; preds = %for.body
%arrayidx2.1 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %indvars.iv.next
store ptr null, ptr %arrayidx2.1, align 8, !tbaa.struct !17
%dummy.sroa.4.0.arrayidx2.sroa_idx.1 = getelementptr inbounds i8, ptr %arrayidx2.1, i64 8
store i8 0, ptr %dummy.sroa.4.0.arrayidx2.sroa_idx.1, align 16, !tbaa.struct !19
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx2.2 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %indvars.iv.next.1
store ptr null, ptr %arrayidx2.2, align 16, !tbaa.struct !17
%dummy.sroa.4.0.arrayidx2.sroa_idx.2 = getelementptr inbounds i8, ptr %arrayidx2.2, i64 8
store i8 0, ptr %dummy.sroa.4.0.arrayidx2.sroa_idx.2, align 8, !tbaa.struct !19
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx2.3 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %indvars.iv.next.2
store ptr null, ptr %arrayidx2.3, align 8, !tbaa.struct !17
%dummy.sroa.4.0.arrayidx2.sroa_idx.3 = getelementptr inbounds i8, ptr %arrayidx2.3, i64 8
store i8 0, ptr %dummy.sroa.4.0.arrayidx2.sroa_idx.3, align 16, !tbaa.struct !19
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !21
%cmp482 = icmp sgt i32 %0, 0
br i1 %cmp482, label %for.body5, label %for.end31
for.body5: ; preds = %for.end, %for.inc29
%i.183 = phi i32 [ %inc30, %for.inc29 ], [ 0, %for.end ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %com, ptr noundef nonnull %str)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @.str.4, i64 7)
%cmp10 = icmp eq i32 %bcmp, 0
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %for.body5
%1 = load i8, ptr %str, align 16, !tbaa !5
%cmp4.not16.i.i = icmp eq i8 %1, 0
br i1 %cmp4.not16.i.i, label %getHashAddr.exit.i, label %for.body.i.i
for.body.i.i: ; preds = %if.then, %for.body.i.i
%indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i, %for.body.i.i ], [ 0, %if.then ]
%2 = phi i8 [ %3, %for.body.i.i ], [ %1, %if.then ]
%h.018.i.i = phi i32 [ %rem.i.i, %for.body.i.i ], [ 0, %if.then ]
%conv.i.i = sext i8 %2 to i32
%mul.i.i = shl nsw i32 %h.018.i.i, 7
%add.i.i = add nsw i32 %mul.i.i, %conv.i.i
%rem.i.i = srem i32 %add.i.i, 9973
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
%cmp4.not.i.i = icmp eq i8 %3, 0
br i1 %cmp4.not.i.i, label %getHashAddr.exit.loopexit.i, label %for.body.i.i, !llvm.loop !8
getHashAddr.exit.loopexit.i: ; preds = %for.body.i.i
%4 = sext i32 %rem.i.i to i64
br label %getHashAddr.exit.i
getHashAddr.exit.i: ; preds = %getHashAddr.exit.loopexit.i, %if.then
%h.0.lcssa.i.i = phi i64 [ 0, %if.then ], [ %4, %getHashAddr.exit.loopexit.i ]
%call1.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%str2.i = getelementptr inbounds %struct.DATA, ptr %call1.i, i64 0, i32 1
%call3.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str2.i, ptr noundef nonnull dereferenceable(1) %str) #13
store ptr null, ptr %call1.i, align 8, !tbaa !10
%arrayidx.i = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i.i
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %getHashAddr.exit.i
%tmp.0.i = phi ptr [ %arrayidx.i, %getHashAddr.exit.i ], [ %5, %while.cond.i ]
%5 = load ptr, ptr %tmp.0.i, align 8, !tbaa !10
%cmp.not.i = icmp eq ptr %5, null
br i1 %cmp.not.i, label %hashAdd.exit, label %while.cond.i, !llvm.loop !14
hashAdd.exit: ; preds = %while.cond.i
store ptr %call1.i, ptr %tmp.0.i, align 8, !tbaa !10
br label %for.inc29
if.else: ; preds = %for.body5
%bcmp36 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @.str.5, i64 7)
%cmp14 = icmp eq i32 %bcmp36, 0
br i1 %cmp14, label %if.then15, label %if.else17
if.then15: ; preds = %if.else
%6 = load i8, ptr %str, align 16, !tbaa !5
%cmp4.not16.i.i39 = icmp eq i8 %6, 0
br i1 %cmp4.not16.i.i39, label %getHashAddr.exit.i51, label %for.body.i.i40
for.body.i.i40: ; preds = %if.then15, %for.body.i.i40
%indvars.iv.i.i41 = phi i64 [ %indvars.iv.next.i.i47, %for.body.i.i40 ], [ 0, %if.then15 ]
%7 = phi i8 [ %8, %for.body.i.i40 ], [ %6, %if.then15 ]
%h.018.i.i42 = phi i32 [ %rem.i.i46, %for.body.i.i40 ], [ 0, %if.then15 ]
%conv.i.i43 = sext i8 %7 to i32
%mul.i.i44 = shl nsw i32 %h.018.i.i42, 7
%add.i.i45 = add nsw i32 %mul.i.i44, %conv.i.i43
%rem.i.i46 = srem i32 %add.i.i45, 9973
%indvars.iv.next.i.i47 = add nuw nsw i64 %indvars.iv.i.i41, 1
%arrayidx.i.i48 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i47
%8 = load i8, ptr %arrayidx.i.i48, align 1, !tbaa !5
%cmp4.not.i.i49 = icmp eq i8 %8, 0
br i1 %cmp4.not.i.i49, label %getHashAddr.exit.loopexit.i50, label %for.body.i.i40, !llvm.loop !8
getHashAddr.exit.loopexit.i50: ; preds = %for.body.i.i40
%9 = sext i32 %rem.i.i46 to i64
br label %getHashAddr.exit.i51
getHashAddr.exit.i51: ; preds = %getHashAddr.exit.loopexit.i50, %if.then15
%h.0.lcssa.i.i52 = phi i64 [ 0, %if.then15 ], [ %9, %getHashAddr.exit.loopexit.i50 ]
%arrayidx.i53 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i.i52
%10 = load ptr, ptr %arrayidx.i53, align 8, !tbaa !10
%cmp.not.i54 = icmp eq ptr %10, null
br i1 %cmp.not.i54, label %for.inc29, label %getHashAddr.exit.split.i
getHashAddr.exit.split.i: ; preds = %getHashAddr.exit.i51
%str2.i55 = getelementptr inbounds %struct.DATA, ptr %10, i64 0, i32 1
%call3.i56 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str2.i55, ptr noundef nonnull dereferenceable(1) %str) #14
%cmp4.i = icmp eq i32 %call3.i56, 1
br i1 %cmp4.i, label %if.then.i, label %while.cond.i57, !llvm.loop !15
while.cond.i57: ; preds = %getHashAddr.exit.split.i, %while.cond.i57
br label %while.cond.i57
if.then.i: ; preds = %getHashAddr.exit.split.i
%11 = load ptr, ptr %10, align 8, !tbaa !10
store ptr %11, ptr %arrayidx.i53, align 8, !tbaa !10
call void @free(ptr noundef nonnull %10) #13
br label %for.inc29
if.else17: ; preds = %if.else
%bcmp37 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %com, ptr noundef nonnull dereferenceable(5) @.str.6, i64 5)
%cmp20 = icmp eq i32 %bcmp37, 0
br i1 %cmp20, label %if.then21, label %if.else25
if.then21: ; preds = %if.else17
%12 = load i8, ptr %str, align 16, !tbaa !5
%cmp4.not16.i.i58 = icmp eq i8 %12, 0
br i1 %cmp4.not16.i.i58, label %getHashAddr.exit.i70, label %for.body.i.i59
for.body.i.i59: ; preds = %if.then21, %for.body.i.i59
%indvars.iv.i.i60 = phi i64 [ %indvars.iv.next.i.i66, %for.body.i.i59 ], [ 0, %if.then21 ]
%13 = phi i8 [ %14, %for.body.i.i59 ], [ %12, %if.then21 ]
%h.018.i.i61 = phi i32 [ %rem.i.i65, %for.body.i.i59 ], [ 0, %if.then21 ]
%conv.i.i62 = sext i8 %13 to i32
%mul.i.i63 = shl nsw i32 %h.018.i.i61, 7
%add.i.i64 = add nsw i32 %mul.i.i63, %conv.i.i62
%rem.i.i65 = srem i32 %add.i.i64, 9973
%indvars.iv.next.i.i66 = add nuw nsw i64 %indvars.iv.i.i60, 1
%arrayidx.i.i67 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i.i66
%14 = load i8, ptr %arrayidx.i.i67, align 1, !tbaa !5
%cmp4.not.i.i68 = icmp eq i8 %14, 0
br i1 %cmp4.not.i.i68, label %getHashAddr.exit.loopexit.i69, label %for.body.i.i59, !llvm.loop !8
getHashAddr.exit.loopexit.i69: ; preds = %for.body.i.i59
%15 = sext i32 %rem.i.i65 to i64
br label %getHashAddr.exit.i70
getHashAddr.exit.i70: ; preds = %getHashAddr.exit.loopexit.i69, %if.then21
%h.0.lcssa.i.i71 = phi i64 [ 0, %if.then21 ], [ %15, %getHashAddr.exit.loopexit.i69 ]
%arrayidx.i72 = getelementptr inbounds [9973 x %struct.DATA], ptr @dlist, i64 0, i64 %h.0.lcssa.i.i71
br label %while.cond.i73
while.cond.i73: ; preds = %while.body.i, %getHashAddr.exit.i70
%tmp.0.i74 = phi ptr [ %arrayidx.i72, %getHashAddr.exit.i70 ], [ %16, %while.body.i ]
%16 = load ptr, ptr %tmp.0.i74, align 8, !tbaa !10
%cmp.not.i75 = icmp eq ptr %16, null
br i1 %cmp.not.i75, label %hashFind.exit, label %while.body.i
while.body.i: ; preds = %while.cond.i73
%str2.i76 = getelementptr inbounds %struct.DATA, ptr %16, i64 0, i32 1
%call3.i77 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str2.i76, ptr noundef nonnull dereferenceable(1) %str) #14
%cmp4.i78 = icmp eq i32 %call3.i77, 0
br i1 %cmp4.i78, label %hashFind.exit, label %while.cond.i73, !llvm.loop !16
hashFind.exit: ; preds = %while.cond.i73, %while.body.i
%17 = phi ptr [ @.str.7, %while.body.i ], [ @.str.8, %while.cond.i73 ]
%puts38 = call i32 @puts(ptr nonnull dereferenceable(1) %17)
br label %for.inc29
if.else25: ; preds = %if.else17
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc29
for.inc29: ; preds = %if.then.i, %getHashAddr.exit.i51, %hashAdd.exit, %hashFind.exit, %if.else25
%inc30 = add nuw nsw i32 %i.183, 1
%18 = load i32, ptr %n, align 4, !tbaa !21
%cmp4 = icmp slt i32 %inc30, %18
br i1 %cmp4, label %for.body5, label %for.end31, !llvm.loop !23
for.end31: ; preds = %for.inc29, %for.end
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %str) #13
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %com) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #13
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #10
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #11
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind }
attributes #11 = { nofree nounwind willreturn memory(argmem: read) }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { nounwind }
attributes #14 = { 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 = !{!11, !12, i64 0}
!11 = !{!"DATA", !12, i64 0, !6, i64 8}
!12 = !{!"any pointer", !6, i64 0}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
!16 = distinct !{!16, !9}
!17 = !{i64 0, i64 8, !18, i64 8, i64 16, !5}
!18 = !{!12, !12, i64 0}
!19 = !{i64 0, i64 16, !5}
!20 = distinct !{!20, !9}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !6, i64 0}
!23 = distinct !{!23, !9}
|
#include <stdio.h>
int main(void)
{
int t, x, y, a, b;
scanf("%d", &t);
while(t--){
scanf("%d %d %d %d",&x,&y,&a,&b);
if( x<y&&(y-x)%(a+b)==0 )
printf("%d\n", (y-x)/(a+b));
else
printf("-1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24615/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24615/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec8 = add nsw i32 %0, -1
store i32 %dec8, ptr %t, align 4, !tbaa !5
%tobool.not9 = icmp eq i32 %0, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp slt i32 %1, %2
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %while.body
%sub = sub nsw i32 %2, %1
%3 = load i32, ptr %a, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %4, %3
%rem = srem i32 %sub, %add
%div = sdiv i32 %sub, %add
%cmp2 = icmp eq i32 %rem, 0
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %if.end
if.else: ; preds = %land.lhs.true, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
%5 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }
int find(char str[]){
int i,h;
h= (h1(getKey(str)) + i * h2(getKey(str))) % M;
for(i=0;i<14;i++){
h= (h1(getKey(str)) + i * h2(getKey(str))) % M;
if(strcmp( H[h], str)==0) return 1;
}
return 0;
}
int insert(char str[]){
int i;
if(find(str)) return 0;
for(i=0;i<14;i++){
if(H[ (h1(getKey(str)) + i * h2(getKey(str))) % M ][0]=='\0'){
strcpy(H[ (h1(getKey(str)) + i * h2(getKey(str))) % M ],str);
return 1;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246193/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246193/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit44.split.us, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add i64 %call.i, -1
%xtraiter = and i64 %call.i, 1
%1 = icmp eq i64 %0, 0
%unroll_iter = and i64 %call.i, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%xtraiter100 = and i64 %call.i, 1
%2 = icmp eq i64 %0, 0
%unroll_iter103 = and i64 %call.i, -2
%lcmp.mod101.not = icmp eq i64 %xtraiter100, 0
br label %for.body
getKey.exit44.split.us: ; preds = %entry
%call15.us = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @H, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us = icmp eq i32 %call15.us, 0
br i1 %cmp16.us, label %cleanup, label %for.cond.us
for.cond.us: ; preds = %getKey.exit44.split.us
%call15.us.1 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 1), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.1 = icmp eq i32 %call15.us.1, 0
br i1 %cmp16.us.1, label %cleanup, label %for.cond.us.1
for.cond.us.1: ; preds = %for.cond.us
%call15.us.2 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 2), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.2 = icmp eq i32 %call15.us.2, 0
br i1 %cmp16.us.2, label %cleanup, label %for.cond.us.2
for.cond.us.2: ; preds = %for.cond.us.1
%call15.us.3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 3), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.3 = icmp eq i32 %call15.us.3, 0
br i1 %cmp16.us.3, label %cleanup, label %for.cond.us.3
for.cond.us.3: ; preds = %for.cond.us.2
%call15.us.4 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 4), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.4 = icmp eq i32 %call15.us.4, 0
br i1 %cmp16.us.4, label %cleanup, label %for.cond.us.4
for.cond.us.4: ; preds = %for.cond.us.3
%call15.us.5 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 5), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.5 = icmp eq i32 %call15.us.5, 0
br i1 %cmp16.us.5, label %cleanup, label %for.cond.us.5
for.cond.us.5: ; preds = %for.cond.us.4
%call15.us.6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 6), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.6 = icmp eq i32 %call15.us.6, 0
br i1 %cmp16.us.6, label %cleanup, label %for.cond.us.6
for.cond.us.6: ; preds = %for.cond.us.5
%call15.us.7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 7), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.7 = icmp eq i32 %call15.us.7, 0
br i1 %cmp16.us.7, label %cleanup, label %for.cond.us.7
for.cond.us.7: ; preds = %for.cond.us.6
%call15.us.8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 8), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.8 = icmp eq i32 %call15.us.8, 0
br i1 %cmp16.us.8, label %cleanup, label %for.cond.us.8
for.cond.us.8: ; preds = %for.cond.us.7
%call15.us.9 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 9), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.9 = icmp eq i32 %call15.us.9, 0
br i1 %cmp16.us.9, label %cleanup, label %for.cond.us.9
for.cond.us.9: ; preds = %for.cond.us.8
%call15.us.10 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 10), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.10 = icmp eq i32 %call15.us.10, 0
br i1 %cmp16.us.10, label %cleanup, label %for.cond.us.10
for.cond.us.10: ; preds = %for.cond.us.9
%call15.us.11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 11), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.11 = icmp eq i32 %call15.us.11, 0
br i1 %cmp16.us.11, label %cleanup, label %for.cond.us.11
for.cond.us.11: ; preds = %for.cond.us.10
%call15.us.12 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 12), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.12 = icmp eq i32 %call15.us.12, 0
br i1 %cmp16.us.12, label %cleanup, label %for.cond.us.12
for.cond.us.12: ; preds = %for.cond.us.11
%call15.us.13 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 13), ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16.us.13 = icmp eq i32 %call15.us.13, 0
%spec.select = zext i1 %cmp16.us.13 to i32
br label %cleanup
for.cond: ; preds = %getKey.exit85.loopexit
%inc = add nuw nsw i32 %i.094, 1
%exitcond.not = icmp eq i32 %inc, 14
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
for.body: ; preds = %for.body.preheader, %for.cond
%i.094 = phi i32 [ %inc, %for.cond ], [ 0, %for.body.preheader ]
br i1 %1, label %for.body.i69.preheader.unr-lcssa, label %for.body.i49
for.body.i49: ; preds = %for.body, %getChar.exit.i55.1
%i.011.i50 = phi i64 [ %inc.i60.1, %getChar.exit.i55.1 ], [ 0, %for.body ]
%p.010.i51 = phi i32 [ %mul2.i59.1, %getChar.exit.i55.1 ], [ 1, %for.body ]
%sum.09.i52 = phi i32 [ %add.i58.1, %getChar.exit.i55.1 ], [ 0, %for.body ]
%niter = phi i64 [ %niter.next.1, %getChar.exit.i55.1 ], [ 0, %for.body ]
%arrayidx.i53 = getelementptr inbounds i8, ptr %str, i64 %i.011.i50
%3 = load i8, ptr %arrayidx.i53, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i55 [
i8 84, label %if.then15.i.i64
i8 67, label %if.then5.i.i63
i8 71, label %if.then10.i.i54
]
if.then5.i.i63: ; preds = %for.body.i49
br label %getChar.exit.i55
if.then10.i.i54: ; preds = %for.body.i49
br label %getChar.exit.i55
if.then15.i.i64: ; preds = %for.body.i49
br label %getChar.exit.i55
getChar.exit.i55: ; preds = %if.then15.i.i64, %if.then10.i.i54, %if.then5.i.i63, %for.body.i49
%retval.0.i.i56 = phi i32 [ 2, %if.then5.i.i63 ], [ 3, %if.then10.i.i54 ], [ 4, %if.then15.i.i64 ], [ 1, %for.body.i49 ]
%mul.i57 = mul i32 %retval.0.i.i56, %p.010.i51
%add.i58 = add i32 %mul.i57, %sum.09.i52
%mul2.i59 = mul i32 %p.010.i51, 5
%inc.i60 = or i64 %i.011.i50, 1
%arrayidx.i53.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i60
%4 = load i8, ptr %arrayidx.i53.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i55.1 [
i8 84, label %if.then15.i.i64.1
i8 67, label %if.then5.i.i63.1
i8 71, label %if.then10.i.i54.1
]
if.then10.i.i54.1: ; preds = %getChar.exit.i55
br label %getChar.exit.i55.1
if.then5.i.i63.1: ; preds = %getChar.exit.i55
br label %getChar.exit.i55.1
if.then15.i.i64.1: ; preds = %getChar.exit.i55
br label %getChar.exit.i55.1
getChar.exit.i55.1: ; preds = %if.then15.i.i64.1, %if.then5.i.i63.1, %if.then10.i.i54.1, %getChar.exit.i55
%retval.0.i.i56.1 = phi i32 [ 2, %if.then5.i.i63.1 ], [ 3, %if.then10.i.i54.1 ], [ 4, %if.then15.i.i64.1 ], [ 1, %getChar.exit.i55 ]
%mul.i57.1 = mul i32 %retval.0.i.i56.1, %mul2.i59
%add.i58.1 = add i32 %mul.i57.1, %add.i58
%mul2.i59.1 = mul i32 %p.010.i51, 25
%inc.i60.1 = add nuw nsw i64 %i.011.i50, 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.body.i69.preheader.unr-lcssa, label %for.body.i49, !llvm.loop !8
for.body.i69.preheader.unr-lcssa: ; preds = %getChar.exit.i55.1, %for.body
%add.i58.lcssa.ph = phi i32 [ undef, %for.body ], [ %add.i58.1, %getChar.exit.i55.1 ]
%i.011.i50.unr = phi i64 [ 0, %for.body ], [ %inc.i60.1, %getChar.exit.i55.1 ]
%p.010.i51.unr = phi i32 [ 1, %for.body ], [ %mul2.i59.1, %getChar.exit.i55.1 ]
%sum.09.i52.unr = phi i32 [ 0, %for.body ], [ %add.i58.1, %getChar.exit.i55.1 ]
br i1 %lcmp.mod.not, label %for.body.i69.preheader, label %for.body.i49.epil
for.body.i49.epil: ; preds = %for.body.i69.preheader.unr-lcssa
%arrayidx.i53.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i50.unr
%5 = load i8, ptr %arrayidx.i53.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i55.epil [
i8 84, label %if.then15.i.i64.epil
i8 67, label %if.then5.i.i63.epil
i8 71, label %if.then10.i.i54.epil
]
if.then10.i.i54.epil: ; preds = %for.body.i49.epil
br label %getChar.exit.i55.epil
if.then5.i.i63.epil: ; preds = %for.body.i49.epil
br label %getChar.exit.i55.epil
if.then15.i.i64.epil: ; preds = %for.body.i49.epil
br label %getChar.exit.i55.epil
getChar.exit.i55.epil: ; preds = %if.then15.i.i64.epil, %if.then5.i.i63.epil, %if.then10.i.i54.epil, %for.body.i49.epil
%retval.0.i.i56.epil = phi i32 [ 2, %if.then5.i.i63.epil ], [ 3, %if.then10.i.i54.epil ], [ 4, %if.then15.i.i64.epil ], [ 1, %for.body.i49.epil ]
%mul.i57.epil = mul i32 %retval.0.i.i56.epil, %p.010.i51.unr
%add.i58.epil = add i32 %mul.i57.epil, %sum.09.i52.unr
br label %for.body.i69.preheader
for.body.i69.preheader: ; preds = %for.body.i69.preheader.unr-lcssa, %getChar.exit.i55.epil
%add.i58.lcssa = phi i32 [ %add.i58.lcssa.ph, %for.body.i69.preheader.unr-lcssa ], [ %add.i58.epil, %getChar.exit.i55.epil ]
br i1 %2, label %getKey.exit85.loopexit.unr-lcssa, label %for.body.i69
for.body.i69: ; preds = %for.body.i69.preheader, %getChar.exit.i75.1
%i.011.i70 = phi i64 [ %inc.i80.1, %getChar.exit.i75.1 ], [ 0, %for.body.i69.preheader ]
%p.010.i71 = phi i32 [ %mul2.i79.1, %getChar.exit.i75.1 ], [ 1, %for.body.i69.preheader ]
%sum.09.i72 = phi i32 [ %add.i78.1, %getChar.exit.i75.1 ], [ 0, %for.body.i69.preheader ]
%niter104 = phi i64 [ %niter104.next.1, %getChar.exit.i75.1 ], [ 0, %for.body.i69.preheader ]
%arrayidx.i73 = getelementptr inbounds i8, ptr %str, i64 %i.011.i70
%6 = load i8, ptr %arrayidx.i73, align 1, !tbaa !5
switch i8 %6, label %getChar.exit.i75 [
i8 84, label %if.then15.i.i84
i8 67, label %if.then5.i.i83
i8 71, label %if.then10.i.i74
]
if.then5.i.i83: ; preds = %for.body.i69
br label %getChar.exit.i75
if.then10.i.i74: ; preds = %for.body.i69
br label %getChar.exit.i75
if.then15.i.i84: ; preds = %for.body.i69
br label %getChar.exit.i75
getChar.exit.i75: ; preds = %if.then15.i.i84, %if.then10.i.i74, %if.then5.i.i83, %for.body.i69
%retval.0.i.i76 = phi i32 [ 2, %if.then5.i.i83 ], [ 3, %if.then10.i.i74 ], [ 4, %if.then15.i.i84 ], [ 1, %for.body.i69 ]
%mul.i77 = mul i32 %retval.0.i.i76, %p.010.i71
%add.i78 = add i32 %mul.i77, %sum.09.i72
%mul2.i79 = mul i32 %p.010.i71, 5
%inc.i80 = or i64 %i.011.i70, 1
%arrayidx.i73.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i80
%7 = load i8, ptr %arrayidx.i73.1, align 1, !tbaa !5
switch i8 %7, label %getChar.exit.i75.1 [
i8 84, label %if.then15.i.i84.1
i8 67, label %if.then5.i.i83.1
i8 71, label %if.then10.i.i74.1
]
if.then10.i.i74.1: ; preds = %getChar.exit.i75
br label %getChar.exit.i75.1
if.then5.i.i83.1: ; preds = %getChar.exit.i75
br label %getChar.exit.i75.1
if.then15.i.i84.1: ; preds = %getChar.exit.i75
br label %getChar.exit.i75.1
getChar.exit.i75.1: ; preds = %if.then15.i.i84.1, %if.then5.i.i83.1, %if.then10.i.i74.1, %getChar.exit.i75
%retval.0.i.i76.1 = phi i32 [ 2, %if.then5.i.i83.1 ], [ 3, %if.then10.i.i74.1 ], [ 4, %if.then15.i.i84.1 ], [ 1, %getChar.exit.i75 ]
%mul.i77.1 = mul i32 %retval.0.i.i76.1, %mul2.i79
%add.i78.1 = add i32 %mul.i77.1, %add.i78
%mul2.i79.1 = mul i32 %p.010.i71, 25
%inc.i80.1 = add nuw nsw i64 %i.011.i70, 2
%niter104.next.1 = add i64 %niter104, 2
%niter104.ncmp.1 = icmp eq i64 %niter104.next.1, %unroll_iter103
br i1 %niter104.ncmp.1, label %getKey.exit85.loopexit.unr-lcssa, label %for.body.i69, !llvm.loop !8
getKey.exit85.loopexit.unr-lcssa: ; preds = %getChar.exit.i75.1, %for.body.i69.preheader
%add.i78.lcssa.ph = phi i32 [ undef, %for.body.i69.preheader ], [ %add.i78.1, %getChar.exit.i75.1 ]
%i.011.i70.unr = phi i64 [ 0, %for.body.i69.preheader ], [ %inc.i80.1, %getChar.exit.i75.1 ]
%p.010.i71.unr = phi i32 [ 1, %for.body.i69.preheader ], [ %mul2.i79.1, %getChar.exit.i75.1 ]
%sum.09.i72.unr = phi i32 [ 0, %for.body.i69.preheader ], [ %add.i78.1, %getChar.exit.i75.1 ]
br i1 %lcmp.mod101.not, label %getKey.exit85.loopexit, label %for.body.i69.epil
for.body.i69.epil: ; preds = %getKey.exit85.loopexit.unr-lcssa
%arrayidx.i73.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i70.unr
%8 = load i8, ptr %arrayidx.i73.epil, align 1, !tbaa !5
switch i8 %8, label %getChar.exit.i75.epil [
i8 84, label %if.then15.i.i84.epil
i8 67, label %if.then5.i.i83.epil
i8 71, label %if.then10.i.i74.epil
]
if.then10.i.i74.epil: ; preds = %for.body.i69.epil
br label %getChar.exit.i75.epil
if.then5.i.i83.epil: ; preds = %for.body.i69.epil
br label %getChar.exit.i75.epil
if.then15.i.i84.epil: ; preds = %for.body.i69.epil
br label %getChar.exit.i75.epil
getChar.exit.i75.epil: ; preds = %if.then15.i.i84.epil, %if.then5.i.i83.epil, %if.then10.i.i74.epil, %for.body.i69.epil
%retval.0.i.i76.epil = phi i32 [ 2, %if.then5.i.i83.epil ], [ 3, %if.then10.i.i74.epil ], [ 4, %if.then15.i.i84.epil ], [ 1, %for.body.i69.epil ]
%mul.i77.epil = mul i32 %retval.0.i.i76.epil, %p.010.i71.unr
%add.i78.epil = add i32 %mul.i77.epil, %sum.09.i72.unr
br label %getKey.exit85.loopexit
getKey.exit85.loopexit: ; preds = %getKey.exit85.loopexit.unr-lcssa, %getChar.exit.i75.epil
%add.i78.lcssa = phi i32 [ %add.i78.lcssa.ph, %getKey.exit85.loopexit.unr-lcssa ], [ %add.i78.epil, %getChar.exit.i75.epil ]
%rem.i66 = srem i32 %add.i58.lcssa, 1000000
%rem.i86 = srem i32 %add.i78.lcssa, 999999
%add.i87 = add nsw i32 %rem.i86, 1
%mul12 = mul nsw i32 %add.i87, %i.094
%add13 = add nsw i32 %mul12, %rem.i66
%rem14 = srem i32 %add13, 1000000
%idxprom = sext i32 %rem14 to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%call15 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp16 = icmp eq i32 %call15, 0
br i1 %cmp16, label %cleanup, label %for.cond
cleanup: ; preds = %getKey.exit85.loopexit, %for.cond, %for.cond.us.12, %getKey.exit44.split.us, %for.cond.us, %for.cond.us.1, %for.cond.us.2, %for.cond.us.3, %for.cond.us.4, %for.cond.us.5, %for.cond.us.6, %for.cond.us.7, %for.cond.us.8, %for.cond.us.9, %for.cond.us.10, %for.cond.us.11
%.us-phi = phi i32 [ 1, %getKey.exit44.split.us ], [ 1, %for.cond.us ], [ 1, %for.cond.us.1 ], [ 1, %for.cond.us.2 ], [ 1, %for.cond.us.3 ], [ 1, %for.cond.us.4 ], [ 1, %for.cond.us.5 ], [ 1, %for.cond.us.6 ], [ 1, %for.cond.us.7 ], [ 1, %for.cond.us.8 ], [ 1, %for.cond.us.9 ], [ 1, %for.cond.us.10 ], [ 1, %for.cond.us.11 ], [ %spec.select, %for.cond.us.12 ], [ 1, %getKey.exit85.loopexit ], [ 0, %for.cond ]
ret i32 %.us-phi
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call = tail call i32 @find(ptr noundef %str), !range !11
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %entry
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %for.body.us.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%0 = add i64 %call.i, -1
%xtraiter = and i64 %call.i, 1
%1 = icmp eq i64 %0, 0
%unroll_iter = and i64 %call.i, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%xtraiter118 = and i64 %call.i, 1
%2 = icmp eq i64 %0, 0
%unroll_iter121 = and i64 %call.i, -2
%lcmp.mod119.not = icmp eq i64 %xtraiter118, 0
br label %for.body
for.body.us.preheader: ; preds = %for.cond.preheader
%3 = load i8, ptr @H, align 16, !tbaa !5
%cmp8.us = icmp eq i8 %3, 0
br i1 %cmp8.us, label %getKey.exit91, label %for.inc.us
for.inc.us: ; preds = %for.body.us.preheader
%4 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 1), align 2, !tbaa !5
%cmp8.us.1 = icmp eq i8 %4, 0
br i1 %cmp8.us.1, label %getKey.exit91, label %for.inc.us.1
for.inc.us.1: ; preds = %for.inc.us
%5 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 2), align 4, !tbaa !5
%cmp8.us.2 = icmp eq i8 %5, 0
br i1 %cmp8.us.2, label %getKey.exit91, label %for.inc.us.2
for.inc.us.2: ; preds = %for.inc.us.1
%6 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 3), align 2, !tbaa !5
%cmp8.us.3 = icmp eq i8 %6, 0
br i1 %cmp8.us.3, label %getKey.exit91, label %for.inc.us.3
for.inc.us.3: ; preds = %for.inc.us.2
%7 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 4), align 8, !tbaa !5
%cmp8.us.4 = icmp eq i8 %7, 0
br i1 %cmp8.us.4, label %getKey.exit91, label %for.inc.us.4
for.inc.us.4: ; preds = %for.inc.us.3
%8 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 5), align 2, !tbaa !5
%cmp8.us.5 = icmp eq i8 %8, 0
br i1 %cmp8.us.5, label %getKey.exit91, label %for.inc.us.5
for.inc.us.5: ; preds = %for.inc.us.4
%9 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 6), align 4, !tbaa !5
%cmp8.us.6 = icmp eq i8 %9, 0
br i1 %cmp8.us.6, label %getKey.exit91, label %for.inc.us.6
for.inc.us.6: ; preds = %for.inc.us.5
%10 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 7), align 2, !tbaa !5
%cmp8.us.7 = icmp eq i8 %10, 0
br i1 %cmp8.us.7, label %getKey.exit91, label %for.inc.us.7
for.inc.us.7: ; preds = %for.inc.us.6
%11 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 8), align 16, !tbaa !5
%cmp8.us.8 = icmp eq i8 %11, 0
br i1 %cmp8.us.8, label %getKey.exit91, label %for.inc.us.8
for.inc.us.8: ; preds = %for.inc.us.7
%12 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 9), align 2, !tbaa !5
%cmp8.us.9 = icmp eq i8 %12, 0
br i1 %cmp8.us.9, label %getKey.exit91, label %for.inc.us.9
for.inc.us.9: ; preds = %for.inc.us.8
%13 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 10), align 4, !tbaa !5
%cmp8.us.10 = icmp eq i8 %13, 0
br i1 %cmp8.us.10, label %getKey.exit91, label %for.inc.us.10
for.inc.us.10: ; preds = %for.inc.us.9
%14 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 11), align 2, !tbaa !5
%cmp8.us.11 = icmp eq i8 %14, 0
br i1 %cmp8.us.11, label %getKey.exit91, label %for.inc.us.11
for.inc.us.11: ; preds = %for.inc.us.10
%15 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 12), align 8, !tbaa !5
%cmp8.us.12 = icmp eq i8 %15, 0
br i1 %cmp8.us.12, label %getKey.exit91, label %for.inc.us.12
for.inc.us.12: ; preds = %for.inc.us.11
%16 = load i8, ptr getelementptr inbounds ([1000000 x [14 x i8]], ptr @H, i64 0, i64 13), align 2, !tbaa !5
%cmp8.us.13 = icmp eq i8 %16, 0
br i1 %cmp8.us.13, label %getKey.exit91, label %cleanup
for.body: ; preds = %for.body.preheader, %for.inc
%i.0103 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
br i1 %1, label %for.body.i34.preheader.unr-lcssa, label %for.body.i
for.body.i: ; preds = %for.body, %getChar.exit.i.1
%i.011.i = phi i64 [ %inc.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%p.010.i = phi i32 [ %mul2.i.1, %getChar.exit.i.1 ], [ 1, %for.body ]
%sum.09.i = phi i32 [ %add.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%niter = phi i64 [ %niter.next.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%17 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %17, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%18 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %18, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.body.i34.preheader.unr-lcssa, label %for.body.i, !llvm.loop !8
for.body.i34.preheader.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body
%add.i.lcssa.ph = phi i32 [ undef, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
br i1 %lcmp.mod.not, label %for.body.i34.preheader, label %for.body.i.epil
for.body.i.epil: ; preds = %for.body.i34.preheader.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%19 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %19, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %for.body.i34.preheader
for.body.i34.preheader: ; preds = %for.body.i34.preheader.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i32 [ %add.i.lcssa.ph, %for.body.i34.preheader.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
br i1 %2, label %getKey.exit50.loopexit.unr-lcssa, label %for.body.i34
for.body.i34: ; preds = %for.body.i34.preheader, %getChar.exit.i40.1
%i.011.i35 = phi i64 [ %inc.i45.1, %getChar.exit.i40.1 ], [ 0, %for.body.i34.preheader ]
%p.010.i36 = phi i32 [ %mul2.i44.1, %getChar.exit.i40.1 ], [ 1, %for.body.i34.preheader ]
%sum.09.i37 = phi i32 [ %add.i43.1, %getChar.exit.i40.1 ], [ 0, %for.body.i34.preheader ]
%niter122 = phi i64 [ %niter122.next.1, %getChar.exit.i40.1 ], [ 0, %for.body.i34.preheader ]
%arrayidx.i38 = getelementptr inbounds i8, ptr %str, i64 %i.011.i35
%20 = load i8, ptr %arrayidx.i38, align 1, !tbaa !5
switch i8 %20, label %getChar.exit.i40 [
i8 84, label %if.then15.i.i49
i8 67, label %if.then5.i.i48
i8 71, label %if.then10.i.i39
]
if.then5.i.i48: ; preds = %for.body.i34
br label %getChar.exit.i40
if.then10.i.i39: ; preds = %for.body.i34
br label %getChar.exit.i40
if.then15.i.i49: ; preds = %for.body.i34
br label %getChar.exit.i40
getChar.exit.i40: ; preds = %if.then15.i.i49, %if.then10.i.i39, %if.then5.i.i48, %for.body.i34
%retval.0.i.i41 = phi i32 [ 2, %if.then5.i.i48 ], [ 3, %if.then10.i.i39 ], [ 4, %if.then15.i.i49 ], [ 1, %for.body.i34 ]
%mul.i42 = mul i32 %retval.0.i.i41, %p.010.i36
%add.i43 = add i32 %mul.i42, %sum.09.i37
%mul2.i44 = mul i32 %p.010.i36, 5
%inc.i45 = or i64 %i.011.i35, 1
%arrayidx.i38.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i45
%21 = load i8, ptr %arrayidx.i38.1, align 1, !tbaa !5
switch i8 %21, label %getChar.exit.i40.1 [
i8 84, label %if.then15.i.i49.1
i8 67, label %if.then5.i.i48.1
i8 71, label %if.then10.i.i39.1
]
if.then10.i.i39.1: ; preds = %getChar.exit.i40
br label %getChar.exit.i40.1
if.then5.i.i48.1: ; preds = %getChar.exit.i40
br label %getChar.exit.i40.1
if.then15.i.i49.1: ; preds = %getChar.exit.i40
br label %getChar.exit.i40.1
getChar.exit.i40.1: ; preds = %if.then15.i.i49.1, %if.then5.i.i48.1, %if.then10.i.i39.1, %getChar.exit.i40
%retval.0.i.i41.1 = phi i32 [ 2, %if.then5.i.i48.1 ], [ 3, %if.then10.i.i39.1 ], [ 4, %if.then15.i.i49.1 ], [ 1, %getChar.exit.i40 ]
%mul.i42.1 = mul i32 %retval.0.i.i41.1, %mul2.i44
%add.i43.1 = add i32 %mul.i42.1, %add.i43
%mul2.i44.1 = mul i32 %p.010.i36, 25
%inc.i45.1 = add nuw nsw i64 %i.011.i35, 2
%niter122.next.1 = add i64 %niter122, 2
%niter122.ncmp.1 = icmp eq i64 %niter122.next.1, %unroll_iter121
br i1 %niter122.ncmp.1, label %getKey.exit50.loopexit.unr-lcssa, label %for.body.i34, !llvm.loop !8
getKey.exit50.loopexit.unr-lcssa: ; preds = %getChar.exit.i40.1, %for.body.i34.preheader
%add.i43.lcssa.ph = phi i32 [ undef, %for.body.i34.preheader ], [ %add.i43.1, %getChar.exit.i40.1 ]
%i.011.i35.unr = phi i64 [ 0, %for.body.i34.preheader ], [ %inc.i45.1, %getChar.exit.i40.1 ]
%p.010.i36.unr = phi i32 [ 1, %for.body.i34.preheader ], [ %mul2.i44.1, %getChar.exit.i40.1 ]
%sum.09.i37.unr = phi i32 [ 0, %for.body.i34.preheader ], [ %add.i43.1, %getChar.exit.i40.1 ]
br i1 %lcmp.mod119.not, label %getKey.exit50.loopexit, label %for.body.i34.epil
for.body.i34.epil: ; preds = %getKey.exit50.loopexit.unr-lcssa
%arrayidx.i38.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i35.unr
%22 = load i8, ptr %arrayidx.i38.epil, align 1, !tbaa !5
switch i8 %22, label %getChar.exit.i40.epil [
i8 84, label %if.then15.i.i49.epil
i8 67, label %if.then5.i.i48.epil
i8 71, label %if.then10.i.i39.epil
]
if.then10.i.i39.epil: ; preds = %for.body.i34.epil
br label %getChar.exit.i40.epil
if.then5.i.i48.epil: ; preds = %for.body.i34.epil
br label %getChar.exit.i40.epil
if.then15.i.i49.epil: ; preds = %for.body.i34.epil
br label %getChar.exit.i40.epil
getChar.exit.i40.epil: ; preds = %if.then15.i.i49.epil, %if.then5.i.i48.epil, %if.then10.i.i39.epil, %for.body.i34.epil
%retval.0.i.i41.epil = phi i32 [ 2, %if.then5.i.i48.epil ], [ 3, %if.then10.i.i39.epil ], [ 4, %if.then15.i.i49.epil ], [ 1, %for.body.i34.epil ]
%mul.i42.epil = mul i32 %retval.0.i.i41.epil, %p.010.i36.unr
%add.i43.epil = add i32 %mul.i42.epil, %sum.09.i37.unr
br label %getKey.exit50.loopexit
getKey.exit50.loopexit: ; preds = %getKey.exit50.loopexit.unr-lcssa, %getChar.exit.i40.epil
%add.i43.lcssa = phi i32 [ %add.i43.lcssa.ph, %getKey.exit50.loopexit.unr-lcssa ], [ %add.i43.epil, %getChar.exit.i40.epil ]
%rem.i = srem i32 %add.i.lcssa, 1000000
%rem.i51 = srem i32 %add.i43.lcssa, 999999
%add.i52 = add nsw i32 %rem.i51, 1
%mul = mul nsw i32 %add.i52, %i.0103
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000000
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%23 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp8 = icmp eq i8 %23, 0
br i1 %cmp8, label %if.then10, label %for.inc
if.then10: ; preds = %getKey.exit50.loopexit
br i1 %cmp8.not.i, label %getKey.exit91, label %for.body.i55.preheader
for.body.i55.preheader: ; preds = %if.then10
%xtraiter123 = and i64 %call.i, 1
%24 = icmp eq i64 %0, 0
br i1 %24, label %for.body.i75.preheader.unr-lcssa, label %for.body.i55.preheader.new
for.body.i55.preheader.new: ; preds = %for.body.i55.preheader
%unroll_iter126 = and i64 %call.i, -2
br label %for.body.i55
for.body.i55: ; preds = %getChar.exit.i61.1, %for.body.i55.preheader.new
%i.011.i56 = phi i64 [ 0, %for.body.i55.preheader.new ], [ %inc.i66.1, %getChar.exit.i61.1 ]
%p.010.i57 = phi i32 [ 1, %for.body.i55.preheader.new ], [ %mul2.i65.1, %getChar.exit.i61.1 ]
%sum.09.i58 = phi i32 [ 0, %for.body.i55.preheader.new ], [ %add.i64.1, %getChar.exit.i61.1 ]
%niter127 = phi i64 [ 0, %for.body.i55.preheader.new ], [ %niter127.next.1, %getChar.exit.i61.1 ]
%arrayidx.i59 = getelementptr inbounds i8, ptr %str, i64 %i.011.i56
%25 = load i8, ptr %arrayidx.i59, align 1, !tbaa !5
switch i8 %25, label %getChar.exit.i61 [
i8 84, label %if.then15.i.i70
i8 67, label %if.then5.i.i69
i8 71, label %if.then10.i.i60
]
if.then5.i.i69: ; preds = %for.body.i55
br label %getChar.exit.i61
if.then10.i.i60: ; preds = %for.body.i55
br label %getChar.exit.i61
if.then15.i.i70: ; preds = %for.body.i55
br label %getChar.exit.i61
getChar.exit.i61: ; preds = %if.then15.i.i70, %if.then10.i.i60, %if.then5.i.i69, %for.body.i55
%retval.0.i.i62 = phi i32 [ 2, %if.then5.i.i69 ], [ 3, %if.then10.i.i60 ], [ 4, %if.then15.i.i70 ], [ 1, %for.body.i55 ]
%mul.i63 = mul i32 %retval.0.i.i62, %p.010.i57
%add.i64 = add i32 %mul.i63, %sum.09.i58
%mul2.i65 = mul i32 %p.010.i57, 5
%inc.i66 = or i64 %i.011.i56, 1
%arrayidx.i59.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i66
%26 = load i8, ptr %arrayidx.i59.1, align 1, !tbaa !5
switch i8 %26, label %getChar.exit.i61.1 [
i8 84, label %if.then15.i.i70.1
i8 67, label %if.then5.i.i69.1
i8 71, label %if.then10.i.i60.1
]
if.then10.i.i60.1: ; preds = %getChar.exit.i61
br label %getChar.exit.i61.1
if.then5.i.i69.1: ; preds = %getChar.exit.i61
br label %getChar.exit.i61.1
if.then15.i.i70.1: ; preds = %getChar.exit.i61
br label %getChar.exit.i61.1
getChar.exit.i61.1: ; preds = %if.then15.i.i70.1, %if.then5.i.i69.1, %if.then10.i.i60.1, %getChar.exit.i61
%retval.0.i.i62.1 = phi i32 [ 2, %if.then5.i.i69.1 ], [ 3, %if.then10.i.i60.1 ], [ 4, %if.then15.i.i70.1 ], [ 1, %getChar.exit.i61 ]
%mul.i63.1 = mul i32 %retval.0.i.i62.1, %mul2.i65
%add.i64.1 = add i32 %mul.i63.1, %add.i64
%mul2.i65.1 = mul i32 %p.010.i57, 25
%inc.i66.1 = add nuw nsw i64 %i.011.i56, 2
%niter127.next.1 = add i64 %niter127, 2
%niter127.ncmp.1 = icmp eq i64 %niter127.next.1, %unroll_iter126
br i1 %niter127.ncmp.1, label %for.body.i75.preheader.unr-lcssa, label %for.body.i55, !llvm.loop !8
for.body.i75.preheader.unr-lcssa: ; preds = %getChar.exit.i61.1, %for.body.i55.preheader
%add.i64.lcssa.ph = phi i32 [ undef, %for.body.i55.preheader ], [ %add.i64.1, %getChar.exit.i61.1 ]
%i.011.i56.unr = phi i64 [ 0, %for.body.i55.preheader ], [ %inc.i66.1, %getChar.exit.i61.1 ]
%p.010.i57.unr = phi i32 [ 1, %for.body.i55.preheader ], [ %mul2.i65.1, %getChar.exit.i61.1 ]
%sum.09.i58.unr = phi i32 [ 0, %for.body.i55.preheader ], [ %add.i64.1, %getChar.exit.i61.1 ]
%lcmp.mod124.not = icmp eq i64 %xtraiter123, 0
br i1 %lcmp.mod124.not, label %for.body.i75.preheader, label %for.body.i55.epil
for.body.i55.epil: ; preds = %for.body.i75.preheader.unr-lcssa
%arrayidx.i59.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i56.unr
%27 = load i8, ptr %arrayidx.i59.epil, align 1, !tbaa !5
switch i8 %27, label %getChar.exit.i61.epil [
i8 84, label %if.then15.i.i70.epil
i8 67, label %if.then5.i.i69.epil
i8 71, label %if.then10.i.i60.epil
]
if.then10.i.i60.epil: ; preds = %for.body.i55.epil
br label %getChar.exit.i61.epil
if.then5.i.i69.epil: ; preds = %for.body.i55.epil
br label %getChar.exit.i61.epil
if.then15.i.i70.epil: ; preds = %for.body.i55.epil
br label %getChar.exit.i61.epil
getChar.exit.i61.epil: ; preds = %if.then15.i.i70.epil, %if.then5.i.i69.epil, %if.then10.i.i60.epil, %for.body.i55.epil
%retval.0.i.i62.epil = phi i32 [ 2, %if.then5.i.i69.epil ], [ 3, %if.then10.i.i60.epil ], [ 4, %if.then15.i.i70.epil ], [ 1, %for.body.i55.epil ]
%mul.i63.epil = mul i32 %retval.0.i.i62.epil, %p.010.i57.unr
%add.i64.epil = add i32 %mul.i63.epil, %sum.09.i58.unr
br label %for.body.i75.preheader
for.body.i75.preheader: ; preds = %for.body.i75.preheader.unr-lcssa, %getChar.exit.i61.epil
%add.i64.lcssa = phi i32 [ %add.i64.lcssa.ph, %for.body.i75.preheader.unr-lcssa ], [ %add.i64.epil, %getChar.exit.i61.epil ]
%xtraiter128 = and i64 %call.i, 1
%28 = icmp eq i64 %0, 0
br i1 %28, label %getKey.exit91.loopexit.unr-lcssa, label %for.body.i75.preheader.new
for.body.i75.preheader.new: ; preds = %for.body.i75.preheader
%unroll_iter131 = and i64 %call.i, -2
br label %for.body.i75
for.body.i75: ; preds = %getChar.exit.i81.1, %for.body.i75.preheader.new
%i.011.i76 = phi i64 [ 0, %for.body.i75.preheader.new ], [ %inc.i86.1, %getChar.exit.i81.1 ]
%p.010.i77 = phi i32 [ 1, %for.body.i75.preheader.new ], [ %mul2.i85.1, %getChar.exit.i81.1 ]
%sum.09.i78 = phi i32 [ 0, %for.body.i75.preheader.new ], [ %add.i84.1, %getChar.exit.i81.1 ]
%niter132 = phi i64 [ 0, %for.body.i75.preheader.new ], [ %niter132.next.1, %getChar.exit.i81.1 ]
%arrayidx.i79 = getelementptr inbounds i8, ptr %str, i64 %i.011.i76
%29 = load i8, ptr %arrayidx.i79, align 1, !tbaa !5
switch i8 %29, label %getChar.exit.i81 [
i8 84, label %if.then15.i.i90
i8 67, label %if.then5.i.i89
i8 71, label %if.then10.i.i80
]
if.then5.i.i89: ; preds = %for.body.i75
br label %getChar.exit.i81
if.then10.i.i80: ; preds = %for.body.i75
br label %getChar.exit.i81
if.then15.i.i90: ; preds = %for.body.i75
br label %getChar.exit.i81
getChar.exit.i81: ; preds = %if.then15.i.i90, %if.then10.i.i80, %if.then5.i.i89, %for.body.i75
%retval.0.i.i82 = phi i32 [ 2, %if.then5.i.i89 ], [ 3, %if.then10.i.i80 ], [ 4, %if.then15.i.i90 ], [ 1, %for.body.i75 ]
%mul.i83 = mul i32 %retval.0.i.i82, %p.010.i77
%add.i84 = add i32 %mul.i83, %sum.09.i78
%mul2.i85 = mul i32 %p.010.i77, 5
%inc.i86 = or i64 %i.011.i76, 1
%arrayidx.i79.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i86
%30 = load i8, ptr %arrayidx.i79.1, align 1, !tbaa !5
switch i8 %30, label %getChar.exit.i81.1 [
i8 84, label %if.then15.i.i90.1
i8 67, label %if.then5.i.i89.1
i8 71, label %if.then10.i.i80.1
]
if.then10.i.i80.1: ; preds = %getChar.exit.i81
br label %getChar.exit.i81.1
if.then5.i.i89.1: ; preds = %getChar.exit.i81
br label %getChar.exit.i81.1
if.then15.i.i90.1: ; preds = %getChar.exit.i81
br label %getChar.exit.i81.1
getChar.exit.i81.1: ; preds = %if.then15.i.i90.1, %if.then5.i.i89.1, %if.then10.i.i80.1, %getChar.exit.i81
%retval.0.i.i82.1 = phi i32 [ 2, %if.then5.i.i89.1 ], [ 3, %if.then10.i.i80.1 ], [ 4, %if.then15.i.i90.1 ], [ 1, %getChar.exit.i81 ]
%mul.i83.1 = mul i32 %retval.0.i.i82.1, %mul2.i85
%add.i84.1 = add i32 %mul.i83.1, %add.i84
%mul2.i85.1 = mul i32 %p.010.i77, 25
%inc.i86.1 = add nuw nsw i64 %i.011.i76, 2
%niter132.next.1 = add i64 %niter132, 2
%niter132.ncmp.1 = icmp eq i64 %niter132.next.1, %unroll_iter131
br i1 %niter132.ncmp.1, label %getKey.exit91.loopexit.unr-lcssa, label %for.body.i75, !llvm.loop !8
getKey.exit91.loopexit.unr-lcssa: ; preds = %getChar.exit.i81.1, %for.body.i75.preheader
%add.i84.lcssa.ph = phi i32 [ undef, %for.body.i75.preheader ], [ %add.i84.1, %getChar.exit.i81.1 ]
%i.011.i76.unr = phi i64 [ 0, %for.body.i75.preheader ], [ %inc.i86.1, %getChar.exit.i81.1 ]
%p.010.i77.unr = phi i32 [ 1, %for.body.i75.preheader ], [ %mul2.i85.1, %getChar.exit.i81.1 ]
%sum.09.i78.unr = phi i32 [ 0, %for.body.i75.preheader ], [ %add.i84.1, %getChar.exit.i81.1 ]
%lcmp.mod129.not = icmp eq i64 %xtraiter128, 0
br i1 %lcmp.mod129.not, label %getKey.exit91.loopexit, label %for.body.i75.epil
for.body.i75.epil: ; preds = %getKey.exit91.loopexit.unr-lcssa
%arrayidx.i79.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i76.unr
%31 = load i8, ptr %arrayidx.i79.epil, align 1, !tbaa !5
switch i8 %31, label %getChar.exit.i81.epil [
i8 84, label %if.then15.i.i90.epil
i8 67, label %if.then5.i.i89.epil
i8 71, label %if.then10.i.i80.epil
]
if.then10.i.i80.epil: ; preds = %for.body.i75.epil
br label %getChar.exit.i81.epil
if.then5.i.i89.epil: ; preds = %for.body.i75.epil
br label %getChar.exit.i81.epil
if.then15.i.i90.epil: ; preds = %for.body.i75.epil
br label %getChar.exit.i81.epil
getChar.exit.i81.epil: ; preds = %if.then15.i.i90.epil, %if.then5.i.i89.epil, %if.then10.i.i80.epil, %for.body.i75.epil
%retval.0.i.i82.epil = phi i32 [ 2, %if.then5.i.i89.epil ], [ 3, %if.then10.i.i80.epil ], [ 4, %if.then15.i.i90.epil ], [ 1, %for.body.i75.epil ]
%mul.i83.epil = mul i32 %retval.0.i.i82.epil, %p.010.i77.unr
%add.i84.epil = add i32 %mul.i83.epil, %sum.09.i78.unr
br label %getKey.exit91.loopexit
getKey.exit91.loopexit: ; preds = %getKey.exit91.loopexit.unr-lcssa, %getChar.exit.i81.epil
%add.i84.lcssa = phi i32 [ %add.i84.lcssa.ph, %getKey.exit91.loopexit.unr-lcssa ], [ %add.i84.epil, %getChar.exit.i81.epil ]
%rem.i72 = srem i32 %add.i64.lcssa, 1000000
%32 = srem i32 %add.i84.lcssa, 999999
%33 = add nsw i32 %32, 1
br label %getKey.exit91
getKey.exit91: ; preds = %for.inc.us.12, %for.inc.us.11, %for.inc.us.10, %for.inc.us.9, %for.inc.us.8, %for.inc.us.7, %for.inc.us.6, %for.inc.us.5, %for.inc.us.4, %for.inc.us.3, %for.inc.us.2, %for.inc.us.1, %for.inc.us, %for.body.us.preheader, %getKey.exit91.loopexit, %if.then10
%.us-phi105113 = phi i32 [ %i.0103, %if.then10 ], [ %i.0103, %getKey.exit91.loopexit ], [ 13, %for.inc.us.12 ], [ 12, %for.inc.us.11 ], [ 11, %for.inc.us.10 ], [ 10, %for.inc.us.9 ], [ 9, %for.inc.us.8 ], [ 8, %for.inc.us.7 ], [ 7, %for.inc.us.6 ], [ 6, %for.inc.us.5 ], [ 5, %for.inc.us.4 ], [ 4, %for.inc.us.3 ], [ 3, %for.inc.us.2 ], [ 2, %for.inc.us.1 ], [ 1, %for.inc.us ], [ 0, %for.body.us.preheader ]
%rem.i72101 = phi i32 [ 0, %if.then10 ], [ %rem.i72, %getKey.exit91.loopexit ], [ 0, %for.inc.us.12 ], [ 0, %for.inc.us.11 ], [ 0, %for.inc.us.10 ], [ 0, %for.inc.us.9 ], [ 0, %for.inc.us.8 ], [ 0, %for.inc.us.7 ], [ 0, %for.inc.us.6 ], [ 0, %for.inc.us.5 ], [ 0, %for.inc.us.4 ], [ 0, %for.inc.us.3 ], [ 0, %for.inc.us.2 ], [ 0, %for.inc.us.1 ], [ 0, %for.inc.us ], [ 0, %for.body.us.preheader ]
%sum.0.lcssa.i88 = phi i32 [ 1, %if.then10 ], [ %33, %getKey.exit91.loopexit ], [ 1, %for.inc.us.12 ], [ 1, %for.inc.us.11 ], [ 1, %for.inc.us.10 ], [ 1, %for.inc.us.9 ], [ 1, %for.inc.us.8 ], [ 1, %for.inc.us.7 ], [ 1, %for.inc.us.6 ], [ 1, %for.inc.us.5 ], [ 1, %for.inc.us.4 ], [ 1, %for.inc.us.3 ], [ 1, %for.inc.us.2 ], [ 1, %for.inc.us.1 ], [ 1, %for.inc.us ], [ 1, %for.body.us.preheader ]
%mul17 = mul nsw i32 %sum.0.lcssa.i88, %.us-phi105113
%add18 = add nsw i32 %mul17, %rem.i72101
%rem19 = srem i32 %add18, 1000000
%idxprom20 = sext i32 %rem19 to i64
%arrayidx21 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom20
%call22 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx21, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
for.inc: ; preds = %getKey.exit50.loopexit
%inc = add nuw nsw i32 %i.0103, 1
%exitcond.not = icmp eq i32 %inc, 14
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !12
cleanup: ; preds = %for.inc, %for.inc.us.12, %entry, %getKey.exit91
%retval.0 = phi i32 [ 1, %getKey.exit91 ], [ 0, %entry ], [ 0, %for.inc.us.12 ], [ 0, %for.inc ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !14
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !11
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !11
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !14
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !16
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{i32 0, i32 2}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !6, i64 0}
!16 = distinct !{!16, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1031555/* your task*/
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M/* your task */; }
int h2(int key){ return 1+(key%(M-1))/* your task */; }
int h(int key,int i){ return (h1(key)+i*h2(key))%M;}
int find(char str[]){
/* your task */
long long key,i=0,j;
key=getKey(str);
while(1){
j=h(key,i);
if(strcmp(H[j],str)==0){
return 1;
}else if(strlen(H[j])==0){
return 0;
}
i++;
}
}
int insert(char str[]){
/* your task */
long long key,i=0,j;
key=getKey(str);
while(1){
j=h(key,i);
if(strcmp(H[j],str)==0)
return 1;
else if(strlen(H[j])==0){
strcpy(H[j],str);
return 0;
}
i++;
}
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246236/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246236/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1031555 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1031555
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1031554
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h(i32 noundef %key, i32 noundef %i) local_unnamed_addr #0 {
entry:
%rem.i = srem i32 %key, 1031555
%rem.i3 = srem i32 %key, 1031554
%add.i = add nsw i32 %rem.i3, 1
%mul = mul nsw i32 %add.i, %i
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1031555
ret i32 %rem
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i, 1031555
%rem.i3.i = srem i32 %sum.0.lcssa.i, 1031554
%add.i.i = add nsw i32 %rem.i3.i, 1
%conv320 = sext i32 %rem.i.i to i64
%arrayidx21 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %conv320
%call422 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx21, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp23 = icmp eq i32 %call422, 0
br i1 %cmp23, label %cleanup, label %if.else
while.cond: ; preds = %if.else
%inc = add i32 %i.024, 1
%mul.i18 = mul nsw i32 %inc, %add.i.i
%add.i19 = add nsw i32 %mul.i18, %rem.i.i
%rem.i = srem i32 %add.i19, 1031555
%conv3 = sext i32 %rem.i to i64
%arrayidx = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %conv3
%call4 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call4, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx25 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx21, %getKey.exit ]
%i.024 = phi i32 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx25, align 1
%cmp9 = icmp eq i8 %char0, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i, 1031555
%rem.i3.i = srem i32 %sum.0.lcssa.i, 1031554
%add.i.i = add nsw i32 %rem.i3.i, 1
%conv326 = sext i32 %rem.i.i to i64
%arrayidx27 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %conv326
%call428 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx27, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp29 = icmp eq i32 %call428, 0
br i1 %cmp29, label %cleanup, label %if.else
while.cond: ; preds = %if.else
%inc = add i32 %i.030, 1
%mul.i23 = mul nsw i32 %inc, %add.i.i
%add.i24 = add nsw i32 %mul.i23, %rem.i.i
%rem.i = srem i32 %add.i24, 1031555
%conv3 = sext i32 %rem.i to i64
%arrayidx = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %conv3
%call4 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call4, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx31 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx27, %getKey.exit ]
%i.030 = phi i32 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx31, align 1
%cmp9 = icmp eq i8 %char0, 0
br i1 %cmp9, label %if.then11, label %while.cond
if.then11: ; preds = %if.else
%call14 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx31, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %while.cond, %getKey.exit, %if.then11
%retval.0 = phi i32 [ 0, %if.then11 ], [ 1, %getKey.exit ], [ 1, %while.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1031555 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1031555
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<stdlib.h>
int main()
{
long long int x,y,a,b,m,n,t;
scanf("%lld",&t);
while(t--){
scanf("%lld %lld %lld %lld",&x,&y,&a,&b);
m=a+b;
n=abs(y-x);
if(n%m==0){
printf("%lld\n",n/m);
}
else{
printf("-1\n");
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
%y = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
%t = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec8 = add nsw i64 %0, -1
store i64 %dec8, ptr %t, align 8, !tbaa !5
%tobool.not9 = icmp eq i64 %0, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%3 = load i64, ptr %y, align 8, !tbaa !5
%4 = load i64, ptr %x, align 8, !tbaa !5
%sub = sub nsw i64 %3, %4
%conv = trunc i64 %sub to i32
%5 = call i32 @llvm.abs.i32(i32 %conv, i1 true)
%conv2 = zext i32 %5 to i64
%rem = srem i64 %conv2, %add
%div = sdiv i64 %conv2, %add
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
br label %if.end
if.else: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
%6 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %6, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
if(ch == 'A') return 1;
else if(ch == 'C') return 2;
else if(ch == 'G') return 3;
else if(ch == 'T') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for(i = 0 ; i < strlen(str) ; i++){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M - 1));}
int find(char str[]){
long long key, i, h;
key = getKey(str);
for(i = 0 ; ; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0) return 0;
}
return 0;
}
int insert(char str[]){
long long key, i, h;
key = getKey(str);
for(i = 0 ; ; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0){
strcpy(H[h], str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for(i = 0 ; i < M ; i++) H[i][0] = '\0';
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%s %s", com, str);
if(com[0] == 'i'){
insert(str);
}
else{
if(find(str)){
printf("yes\n");
}
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246322/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246322/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000000 /* your task*/
#define NIL (-1)
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
long long h1(long long key){ return(key % M) /* your task */; }
long long h2(long long key){ return((key + 1) % M) /* your task */; }
int find(char str[]){
/* your task */
long long key, nkey;
key = getKey(str);
key = h1(key);
if(H[key][0] == '\0'){
return(1);
}
nkey = key;
while(strcmp(H[nkey], str) != 0){
nkey = h2(nkey);
if((key == nkey) || (H[nkey][0] == '\0')){
return(1);
}
}
return(0);
}
int insert(char str[]){
/* your task */
long long key, nkey;
key = getKey(str);
key = h1(key);
if(find(str) == 0){
return(0);
}
if(H[key][0] == '\0'){
strcpy(H[key], str);
}else{
nkey = key;
do{
nkey = h2(nkey);
if(H[nkey][0] == '\0'){
strcpy(H[nkey], str);
break;
}
}while(key != nkey);
if(key == nkey){
printf("???????????????");
return(1);
}
}
return(0);
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ){
H[i][0] = '\0';
}
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str) == 0){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [16 x i8] c"???????????????\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @h1(i64 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i64 %key, 1000000
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @h2(i64 noundef %key) local_unnamed_addr #0 {
entry:
%add = add nsw i64 %key, 1
%rem = srem i64 %add, 1000000
ret i64 %rem
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i64 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.loopexit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit.loopexit
getKey.exit.loopexit: ; preds = %getKey.exit.loopexit.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i64 [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%4 = urem i64 %add.i.lcssa, 1000000
br label %getKey.exit
getKey.exit: ; preds = %getKey.exit.loopexit, %entry
%sum.0.lcssa.i = phi i64 [ 0, %entry ], [ %4, %getKey.exit.loopexit ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i
%5 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp = icmp eq i8 %5, 0
br i1 %cmp, label %cleanup, label %while.cond
while.cond: ; preds = %getKey.exit, %lor.lhs.false
%nkey.0 = phi i64 [ %rem.i27, %lor.lhs.false ], [ %sum.0.lcssa.i, %getKey.exit ]
%arrayidx4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %nkey.0
%call5 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx4, ptr noundef nonnull dereferenceable(1) %str) #9
%cmp6.not = icmp eq i32 %call5, 0
br i1 %cmp6.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%add.i26 = add nsw i64 %nkey.0, 1
%rem.i27 = srem i64 %add.i26, 1000000
%cmp9 = icmp eq i64 %sum.0.lcssa.i, %rem.i27
br i1 %cmp9, label %cleanup, label %lor.lhs.false
lor.lhs.false: ; preds = %while.body
%arrayidx11 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.i27
%6 = load i8, ptr %arrayidx11, align 2, !tbaa !5
%cmp14 = icmp eq i8 %6, 0
br i1 %cmp14, label %cleanup, label %while.cond, !llvm.loop !10
cleanup: ; preds = %while.cond, %while.body, %lor.lhs.false, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %while.cond ], [ 1, %while.body ], [ 1, %lor.lhs.false ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%0 = add i64 %call.i, -1
%xtraiter = and i64 %call.i, 1
%1 = icmp eq i64 %0, 0
br i1 %1, label %for.body.i.i.preheader.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i64 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%3 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.body.i.i.preheader.unr-lcssa, label %for.body.i, !llvm.loop !8
for.body.i.i.preheader.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.i.preheader, label %for.body.i.epil
for.body.i.epil: ; preds = %for.body.i.i.preheader.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %for.body.i.i.preheader.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i64 [ %add.i.lcssa.ph, %for.body.i.i.preheader.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%xtraiter62 = and i64 %call.i, 1
%5 = icmp eq i64 %0, 0
br i1 %5, label %getKey.exit.loopexit.i.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter65 = and i64 %call.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i64 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter66 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter66.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%6 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %6, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i64 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul nsw i64 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add nuw nsw i64 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul nsw i64 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%7 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %7, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i64 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul nsw i64 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add nuw nsw i64 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i64 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter66.next.1 = add i64 %niter66, 2
%niter66.ncmp.1 = icmp eq i64 %niter66.next.1, %unroll_iter65
br i1 %niter66.ncmp.1, label %getKey.exit.loopexit.i.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.loopexit.i.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i64 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i64 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod63.not = icmp eq i64 %xtraiter62, 0
br i1 %lcmp.mod63.not, label %getKey.exit.loopexit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.loopexit.i.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%8 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %8, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i64 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul nsw i64 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add nuw nsw i64 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.loopexit.i
getKey.exit.loopexit.i: ; preds = %getKey.exit.loopexit.i.unr-lcssa, %getChar.exit.i.i.epil
%add.i.i.lcssa = phi i64 [ %add.i.i.lcssa.ph, %getKey.exit.loopexit.i.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%rem.i = urem i64 %add.i.lcssa, 1000000
%9 = urem i64 %add.i.i.lcssa, 1000000
br label %getKey.exit.i
getKey.exit.i: ; preds = %entry, %getKey.exit.loopexit.i
%rem.i46 = phi i64 [ %rem.i, %getKey.exit.loopexit.i ], [ 0, %entry ]
%sum.0.lcssa.i.i = phi i64 [ %9, %getKey.exit.loopexit.i ], [ 0, %entry ]
%arrayidx.i41 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i.i
%10 = load i8, ptr %arrayidx.i41, align 2, !tbaa !5
%cmp.i = icmp eq i8 %10, 0
br i1 %cmp.i, label %if.end, label %while.cond.i
while.cond.i: ; preds = %getKey.exit.i, %lor.lhs.false.i
%nkey.0.i = phi i64 [ %rem.i27.i, %lor.lhs.false.i ], [ %sum.0.lcssa.i.i, %getKey.exit.i ]
%arrayidx4.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %nkey.0.i
%call5.i = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx4.i, ptr noundef nonnull dereferenceable(1) %str) #9
%cmp6.not.i = icmp eq i32 %call5.i, 0
br i1 %cmp6.not.i, label %cleanup, label %while.body.i
while.body.i: ; preds = %while.cond.i
%add.i26.i = add nsw i64 %nkey.0.i, 1
%rem.i27.i = srem i64 %add.i26.i, 1000000
%cmp9.i = icmp eq i64 %sum.0.lcssa.i.i, %rem.i27.i
br i1 %cmp9.i, label %if.end, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %while.body.i
%arrayidx11.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.i27.i
%11 = load i8, ptr %arrayidx11.i, align 2, !tbaa !5
%cmp14.i = icmp eq i8 %11, 0
br i1 %cmp14.i, label %if.end, label %while.cond.i, !llvm.loop !10
if.end: ; preds = %while.body.i, %lor.lhs.false.i, %getKey.exit.i
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.i46
%12 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp4 = icmp eq i8 %12, 0
br i1 %cmp4, label %if.then6, label %do.body
if.then6: ; preds = %if.end
%call8 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
br label %cleanup
do.body: ; preds = %if.end, %do.cond
%nkey.0 = phi i64 [ %rem.i43, %do.cond ], [ %rem.i46, %if.end ]
%add.i42 = add nsw i64 %nkey.0, 1
%rem.i43 = srem i64 %add.i42, 1000000
%arrayidx10 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.i43
%13 = load i8, ptr %arrayidx10, align 2, !tbaa !5
%cmp13 = icmp eq i8 %13, 0
br i1 %cmp13, label %if.then15, label %do.cond
if.then15: ; preds = %do.body
%call18 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx10, ptr noundef nonnull dereferenceable(1) %str) #10
br label %do.end
do.cond: ; preds = %do.body
%cmp20.not = icmp eq i64 %rem.i46, %rem.i43
br i1 %cmp20.not, label %do.end, label %do.body, !llvm.loop !11
do.end: ; preds = %do.cond, %if.then15
%rem.i4354 = phi i64 [ %rem.i43, %if.then15 ], [ %rem.i46, %do.cond ]
%cmp22 = icmp eq i64 %rem.i46, %rem.i4354
br i1 %cmp22, label %if.then24, label %cleanup
if.then24: ; preds = %do.end
%call25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
br label %cleanup
cleanup: ; preds = %while.cond.i, %if.then6, %do.end, %if.then24
%retval.0 = phi i32 [ 1, %if.then24 ], [ 0, %do.end ], [ 0, %if.then6 ], [ 0, %while.cond.i ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #10
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #10
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp332 = icmp sgt i32 %0, 0
br i1 %cmp332, label %for.body4, label %for.end23
for.body4: ; preds = %for.end, %for.inc21
%i.133 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !15
br label %for.inc21
if.else: ; preds = %for.body4
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8.not.i.i, label %getKey.exit.i, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %getKey.exit.loopexit.i.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i64 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i64 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul nsw i64 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add nuw nsw i64 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul nsw i64 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%4 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i64 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul nsw i64 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add nuw nsw i64 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i64 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.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 %getKey.exit.loopexit.i.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.loopexit.i.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i64 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i64 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.loopexit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.loopexit.i.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%5 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i64 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul nsw i64 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add nuw nsw i64 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.loopexit.i
getKey.exit.loopexit.i: ; preds = %getKey.exit.loopexit.i.unr-lcssa, %getChar.exit.i.i.epil
%add.i.i.lcssa = phi i64 [ %add.i.i.lcssa.ph, %getKey.exit.loopexit.i.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%6 = urem i64 %add.i.i.lcssa, 1000000
br label %getKey.exit.i
getKey.exit.i: ; preds = %getKey.exit.loopexit.i, %if.else
%sum.0.lcssa.i.i = phi i64 [ 0, %if.else ], [ %6, %getKey.exit.loopexit.i ]
%arrayidx.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i.i
%7 = load i8, ptr %arrayidx.i, align 2, !tbaa !5
%cmp.i = icmp eq i8 %7, 0
br i1 %cmp.i, label %if.else18, label %while.cond.i
while.cond.i: ; preds = %getKey.exit.i, %lor.lhs.false.i
%nkey.0.i = phi i64 [ %rem.i27.i, %lor.lhs.false.i ], [ %sum.0.lcssa.i.i, %getKey.exit.i ]
%arrayidx4.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %nkey.0.i
%call5.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx4.i, ptr noundef nonnull dereferenceable(1) %str) #9
%cmp6.not.i = icmp eq i32 %call5.i, 0
br i1 %cmp6.not.i, label %if.then16, label %while.body.i
while.body.i: ; preds = %while.cond.i
%add.i26.i = add nsw i64 %nkey.0.i, 1
%rem.i27.i = srem i64 %add.i26.i, 1000000
%cmp9.i = icmp eq i64 %sum.0.lcssa.i.i, %rem.i27.i
br i1 %cmp9.i, label %if.else18, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %while.body.i
%arrayidx11.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.i27.i
%8 = load i8, ptr %arrayidx11.i, align 2, !tbaa !5
%cmp14.i = icmp eq i8 %8, 0
br i1 %cmp14.i, label %if.else18, label %while.cond.i, !llvm.loop !10
if.then16: ; preds = %while.cond.i
%puts28 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %for.inc21
if.else18: ; preds = %while.body.i, %lor.lhs.false.i, %getKey.exit.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc21
for.inc21: ; preds = %if.then, %if.else18, %if.then16
%inc22 = add nuw nsw i32 %i.133, 1
%9 = load i32, ptr %n, align 4, !tbaa !13
%cmp3 = icmp slt i32 %inc22, %9
br i1 %cmp3, label %for.body4, label %for.end23, !llvm.loop !16
for.end23: ; preds = %for.inc21, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #10
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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: 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{i32 0, i32 2}
!16 = distinct !{!16, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){
key = key%M;
return key;
}
int h2(int key){
key = 1+key%(M-1);
return key;
}
int find(char str[]){
long long sum,key2,i;
sum = getKey(str);
for(i=0;i<20;i++){
key2=(h1(sum)+i*h2(sum))%M;
if(strcmp(H[key2],str)==0)return 1;
else if(strlen(H[key2])==0)return 0;
}
return 0;
}
int insert(char str[]){
long long sum,key2,i;
sum = getKey(str);
for(i=0;i<20;i++){
key2=(h1(sum)+i*h2(sum))%M;
if(strcmp(H[key2],str)==0)return 1;
if(strlen(H[key2])==0){
strcpy(H[key2],str);
return 0;
}
}
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%rem.i23 = srem i32 %sum.0.lcssa.i, 999999
%add.i24 = add nsw i32 %rem.i23, 1
br label %for.body
for.body: ; preds = %if.else, %getKey.exit
%i.026 = phi i64 [ 0, %getKey.exit ], [ %inc, %if.else ]
%4 = trunc i64 %i.026 to i32
%5 = mul nsw i32 %add.i24, %4
%rem.lhs.trunc = add i32 %5, %rem.i
%rem25 = srem i32 %rem.lhs.trunc, 1000000
%rem.sext = sext i32 %rem25 to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.sext
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp7 = icmp eq i32 %call6, 0
br i1 %cmp7, label %cleanup, label %if.else
if.else: ; preds = %for.body
%char0 = load i8, ptr %arrayidx, align 2
%cmp12 = icmp eq i8 %char0, 0
%inc = add nuw nsw i64 %i.026, 1
%exitcond.not = icmp eq i64 %inc, 20
%or.cond = select i1 %cmp12, i1 true, i1 %exitcond.not
br i1 %or.cond, label %cleanup, label %for.body, !llvm.loop !10
cleanup: ; preds = %if.else, %for.body
%retval.0 = phi i32 [ 1, %for.body ], [ 0, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%rem.i28 = srem i32 %sum.0.lcssa.i, 999999
%add.i29 = add nsw i32 %rem.i28, 1
br label %for.body
for.cond: ; preds = %if.end
%inc = add nuw nsw i64 %i.031, 1
%exitcond.not = icmp eq i64 %inc, 20
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !11
for.body: ; preds = %getKey.exit, %for.cond
%i.031 = phi i64 [ 0, %getKey.exit ], [ %inc, %for.cond ]
%4 = trunc i64 %i.031 to i32
%5 = mul nsw i32 %add.i29, %4
%rem.lhs.trunc = add i32 %5, %rem.i
%rem30 = srem i32 %rem.lhs.trunc, 1000000
%rem.sext = sext i32 %rem30 to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.sext
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp7 = icmp eq i32 %call6, 0
br i1 %cmp7, label %cleanup, label %if.end
if.end: ; preds = %for.body
%char0 = load i8, ptr %arrayidx, align 2
%cmp12 = icmp eq i8 %char0, 0
br i1 %cmp12, label %if.then14, label %for.cond
if.then14: ; preds = %if.end
%call17 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %for.body, %if.then14
%retval.0 = phi i32 [ 0, %if.then14 ], [ 1, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp362 = icmp sgt i32 %0, 0
br i1 %cmp362, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.163 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.then
%xtraiter70 = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter73 = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i32 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i32 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter74 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter74.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i32 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul i32 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add i32 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul i32 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%4 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i32 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul i32 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add i32 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i32 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter74.next.1 = add i64 %niter74, 2
%niter74.ncmp.1 = icmp eq i64 %niter74.next.1, %unroll_iter73
br i1 %niter74.ncmp.1, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.i.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i32 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i32 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i32 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod71.not = icmp eq i64 %xtraiter70, 0
br i1 %lcmp.mod71.not, label %getKey.exit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.i.loopexit.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%5 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i32 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul i32 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add i32 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.i
getKey.exit.i: ; preds = %getChar.exit.i.i.epil, %getKey.exit.i.loopexit.unr-lcssa, %if.then
%sum.0.lcssa.i.i = phi i32 [ 0, %if.then ], [ %add.i.i.lcssa.ph, %getKey.exit.i.loopexit.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i.i, 1000000
%rem.i28.i = srem i32 %sum.0.lcssa.i.i, 999999
%add.i29.i = add nsw i32 %rem.i28.i, 1
br label %for.body.i
for.cond.i: ; preds = %if.end.i
%inc.i = add nuw nsw i64 %i.031.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, 20
br i1 %exitcond.not.i, label %for.inc19, label %for.body.i, !llvm.loop !11
for.body.i: ; preds = %for.cond.i, %getKey.exit.i
%i.031.i = phi i64 [ 0, %getKey.exit.i ], [ %inc.i, %for.cond.i ]
%6 = trunc i64 %i.031.i to i32
%7 = mul nsw i32 %add.i29.i, %6
%rem.lhs.trunc.i = add i32 %7, %rem.i.i
%rem30.i = srem i32 %rem.lhs.trunc.i, 1000000
%rem.sext.i = sext i32 %rem30.i to i64
%arrayidx.i = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.sext.i
%call6.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp7.i = icmp eq i32 %call6.i, 0
br i1 %cmp7.i, label %for.inc19, label %if.end.i
if.end.i: ; preds = %for.body.i
%char0.i = load i8, ptr %arrayidx.i, align 2
%cmp12.i = icmp eq i8 %char0.i, 0
br i1 %cmp12.i, label %if.then14.i, label %for.cond.i
if.then14.i: ; preds = %if.end.i
%call17.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.inc19
if.else: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i42, label %for.body.i.i29.preheader
for.body.i.i29.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%8 = icmp eq i64 %call.i.i, 1
br i1 %8, label %getKey.exit.i42.loopexit.unr-lcssa, label %for.body.i.i29.preheader.new
for.body.i.i29.preheader.new: ; preds = %for.body.i.i29.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i29
for.body.i.i29: ; preds = %getChar.exit.i.i35.1, %for.body.i.i29.preheader.new
%i.011.i.i30 = phi i64 [ 0, %for.body.i.i29.preheader.new ], [ %inc.i.i40.1, %getChar.exit.i.i35.1 ]
%p.010.i.i31 = phi i32 [ 1, %for.body.i.i29.preheader.new ], [ %mul2.i.i39.1, %getChar.exit.i.i35.1 ]
%sum.09.i.i32 = phi i32 [ 0, %for.body.i.i29.preheader.new ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%niter = phi i64 [ 0, %for.body.i.i29.preheader.new ], [ %niter.next.1, %getChar.exit.i.i35.1 ]
%arrayidx.i.i33 = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i30
%9 = load i8, ptr %arrayidx.i.i33, align 1, !tbaa !5
switch i8 %9, label %getChar.exit.i.i35 [
i8 84, label %if.then15.i.i.i57
i8 67, label %if.then5.i.i.i56
i8 71, label %if.then10.i.i.i34
]
if.then5.i.i.i56: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
if.then10.i.i.i34: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
if.then15.i.i.i57: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
getChar.exit.i.i35: ; preds = %if.then15.i.i.i57, %if.then10.i.i.i34, %if.then5.i.i.i56, %for.body.i.i29
%retval.0.i.i.i36 = phi i32 [ 2, %if.then5.i.i.i56 ], [ 3, %if.then10.i.i.i34 ], [ 4, %if.then15.i.i.i57 ], [ 1, %for.body.i.i29 ]
%mul.i.i37 = mul i32 %retval.0.i.i.i36, %p.010.i.i31
%add.i.i38 = add i32 %mul.i.i37, %sum.09.i.i32
%mul2.i.i39 = mul i32 %p.010.i.i31, 5
%inc.i.i40 = or i64 %i.011.i.i30, 1
%arrayidx.i.i33.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i40
%10 = load i8, ptr %arrayidx.i.i33.1, align 1, !tbaa !5
switch i8 %10, label %getChar.exit.i.i35.1 [
i8 84, label %if.then15.i.i.i57.1
i8 67, label %if.then5.i.i.i56.1
i8 71, label %if.then10.i.i.i34.1
]
if.then10.i.i.i34.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
if.then5.i.i.i56.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
if.then15.i.i.i57.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
getChar.exit.i.i35.1: ; preds = %if.then15.i.i.i57.1, %if.then5.i.i.i56.1, %if.then10.i.i.i34.1, %getChar.exit.i.i35
%retval.0.i.i.i36.1 = phi i32 [ 2, %if.then5.i.i.i56.1 ], [ 3, %if.then10.i.i.i34.1 ], [ 4, %if.then15.i.i.i57.1 ], [ 1, %getChar.exit.i.i35 ]
%mul.i.i37.1 = mul i32 %retval.0.i.i.i36.1, %mul2.i.i39
%add.i.i38.1 = add i32 %mul.i.i37.1, %add.i.i38
%mul2.i.i39.1 = mul i32 %p.010.i.i31, 25
%inc.i.i40.1 = add nuw nsw i64 %i.011.i.i30, 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 %getKey.exit.i42.loopexit.unr-lcssa, label %for.body.i.i29, !llvm.loop !8
getKey.exit.i42.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i35.1, %for.body.i.i29.preheader
%add.i.i38.lcssa.ph = phi i32 [ undef, %for.body.i.i29.preheader ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%i.011.i.i30.unr = phi i64 [ 0, %for.body.i.i29.preheader ], [ %inc.i.i40.1, %getChar.exit.i.i35.1 ]
%p.010.i.i31.unr = phi i32 [ 1, %for.body.i.i29.preheader ], [ %mul2.i.i39.1, %getChar.exit.i.i35.1 ]
%sum.09.i.i32.unr = phi i32 [ 0, %for.body.i.i29.preheader ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.i42, label %for.body.i.i29.epil
for.body.i.i29.epil: ; preds = %getKey.exit.i42.loopexit.unr-lcssa
%arrayidx.i.i33.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i30.unr
%11 = load i8, ptr %arrayidx.i.i33.epil, align 1, !tbaa !5
switch i8 %11, label %getChar.exit.i.i35.epil [
i8 84, label %if.then15.i.i.i57.epil
i8 67, label %if.then5.i.i.i56.epil
i8 71, label %if.then10.i.i.i34.epil
]
if.then10.i.i.i34.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
if.then5.i.i.i56.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
if.then15.i.i.i57.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
getChar.exit.i.i35.epil: ; preds = %if.then15.i.i.i57.epil, %if.then5.i.i.i56.epil, %if.then10.i.i.i34.epil, %for.body.i.i29.epil
%retval.0.i.i.i36.epil = phi i32 [ 2, %if.then5.i.i.i56.epil ], [ 3, %if.then10.i.i.i34.epil ], [ 4, %if.then15.i.i.i57.epil ], [ 1, %for.body.i.i29.epil ]
%mul.i.i37.epil = mul i32 %retval.0.i.i.i36.epil, %p.010.i.i31.unr
%add.i.i38.epil = add i32 %mul.i.i37.epil, %sum.09.i.i32.unr
br label %getKey.exit.i42
getKey.exit.i42: ; preds = %getChar.exit.i.i35.epil, %getKey.exit.i42.loopexit.unr-lcssa, %if.else
%sum.0.lcssa.i.i43 = phi i32 [ 0, %if.else ], [ %add.i.i38.lcssa.ph, %getKey.exit.i42.loopexit.unr-lcssa ], [ %add.i.i38.epil, %getChar.exit.i.i35.epil ]
%rem.i.i44 = srem i32 %sum.0.lcssa.i.i43, 1000000
%rem.i23.i = srem i32 %sum.0.lcssa.i.i43, 999999
%add.i24.i = add nsw i32 %rem.i23.i, 1
br label %for.body.i45
for.body.i45: ; preds = %if.else.i, %getKey.exit.i42
%i.026.i = phi i64 [ 0, %getKey.exit.i42 ], [ %inc.i53, %if.else.i ]
%12 = trunc i64 %i.026.i to i32
%13 = mul nsw i32 %add.i24.i, %12
%rem.lhs.trunc.i46 = add i32 %13, %rem.i.i44
%rem25.i = srem i32 %rem.lhs.trunc.i46, 1000000
%rem.sext.i47 = sext i32 %rem25.i to i64
%arrayidx.i48 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem.sext.i47
%call6.i49 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i48, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp7.i50 = icmp eq i32 %call6.i49, 0
br i1 %cmp7.i50, label %if.then14, label %if.else.i
if.else.i: ; preds = %for.body.i45
%char0.i51 = load i8, ptr %arrayidx.i48, align 2
%cmp12.i52 = icmp eq i8 %char0.i51, 0
%inc.i53 = add nuw nsw i64 %i.026.i, 1
%exitcond.not.i54 = icmp eq i64 %inc.i53, 20
%or.cond.i = select i1 %cmp12.i52, i1 true, i1 %exitcond.not.i54
br i1 %or.cond.i, label %if.else16, label %for.body.i45, !llvm.loop !10
if.then14: ; preds = %for.body.i45
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %for.body.i, %for.cond.i, %if.then14.i, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.163, 1
%14 = load i32, ptr %n, align 4, !tbaa !13
%cmp3 = icmp slt i32 %inc20, %14
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !15
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = distinct !{!15, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1046257
#define NIL (-1)
#define L 14
char H[M][L];
/* 文字から数値に変換 */
int getChar(char ch) {
if ( ch == 'A' ) return 1;
else if ( ch == 'C' ) return 2;
else if ( ch == 'G' ) return 3;
else if ( ch == 'T' ) return 4;
return 0;
}
/* 文字列から数値へ変換して key を生成する */
long long getKey(char str[]) {
long long sum = 0, p = 1, i;
for(i=0;i<strlen(str);i++) {
sum += p*(getChar(str[i]));
p*= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int find(char str[]) {
long long key, i, h;
key = getKey(str); /* 文字列を数値に変換 */
for(i=0; ;i++) {
h = (h1(key) + i*h2(key)) % M;
if( strcmp(H[h],str) == 0) return 1;
else if ( strlen(H[h]) == 0 ) return 0;
}
return 0;
}
int insert(char str[]) {
long long key, i, h;
key = getKey(str); /* 文字列を数値に変換 */
for(i=0; ; i++) {
h = (h1(key) + i * h2(key)) %M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0) {
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(void) {
int i, n;
char str[L], com[9];
for(i=0;i<M;i++) H[i][0] = '\0';
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%s %s",com,str);
if(com[0] == 'i') {
insert(str);
} else {
if(find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046257 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.end18: ; preds = %entry
br label %return
return: ; preds = %entry, %if.end18, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.end18 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end18.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.end18.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.end18.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.end18.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.end18.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.end18.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.end18.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.end18.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.end18.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.end18.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046257
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046256
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046257
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046256
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046257
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046257
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046256
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046257
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.1, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.1 ]
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1046257
br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !10
for.body.1: ; preds = %for.body
%arrayidx.1 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1046527
#define L 14
#define NIL (-1)
char H[M][L];
int getChar(char alg)
{
if(alg=='A')return 1;
else if(alg=='C')return 2;
else if(alg=='G')return 3;
else if(alg=='T')return 4;
}
long long getKey(char moji[])
{
long long sum=0,p=1,i;
for(i=0;i<strlen(moji);i++)
{
sum+=p*(getChar(moji[i]));
p*=5;
}
return sum;
}
int h1(int key)
{
return key%M;
}
int h2(int key)
{
return 1+(key%(M-1));
}
int find(char str[])
{
long long key, i = 0, h;
key=getKey(str);
while (1) {
h=(h1(key)+i*h2(key))%M;
i++;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0)return 0;
}
return 0;
}
int insert(char str[])
{
long long key,i=0,h;
key=getKey(str);
while(1)
{
h=(h1(key)+i*h2(key))%M;
i++;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0)
{
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main()
{
int i,n,h;
char str[L],com[9];
for(i=0;i<M;i++)H[i][0]='\0';
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%s %s",com,str);
if(com[0]=='i')
{
insert(str);
}
else{
if(find(str))
{
printf("yes\n");
}
else
{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %alg) local_unnamed_addr #0 {
entry:
switch i8 %alg, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %moji) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %moji) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %moji, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %moji, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %moji, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
br label %while.cond
while.cond: ; preds = %if.else, %getKey.exit
%i.0 = phi i64 [ 0, %getKey.exit ], [ %inc, %if.else ]
%mul = mul nsw i64 %i.0, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %while.cond
%inc = add nuw nsw i64 %i.0, 1
%char0 = load i8, ptr %arrayidx, align 2
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %while.cond
cleanup: ; preds = %if.else, %while.cond
%retval.0 = phi i32 [ 1, %while.cond ], [ 0, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
br label %while.cond
while.cond: ; preds = %if.else, %getKey.exit
%i.0 = phi i64 [ 0, %getKey.exit ], [ %inc, %if.else ]
%mul = mul nsw i64 %i.0, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %while.cond
%inc = add nuw nsw i64 %i.0, 1
%char0 = load i8, ptr %arrayidx, align 2
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %while.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %while.cond, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %while.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp366 = icmp sgt i32 %0, 0
br i1 %cmp366, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.167 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.then
%xtraiter74 = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter77 = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i32 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i32 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter78 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter78.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i32 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul i32 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add i32 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul i32 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%4 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i32 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul i32 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add i32 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i32 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter78.next.1 = add i64 %niter78, 2
%niter78.ncmp.1 = icmp eq i64 %niter78.next.1, %unroll_iter77
br i1 %niter78.ncmp.1, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.i.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i32 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i32 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i32 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod75.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod75.not, label %getKey.exit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.i.loopexit.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%5 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i32 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul i32 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add i32 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.i
getKey.exit.i: ; preds = %getChar.exit.i.i.epil, %getKey.exit.i.loopexit.unr-lcssa, %if.then
%sum.0.lcssa.i.i = phi i32 [ 0, %if.then ], [ %add.i.i.lcssa.ph, %getKey.exit.i.loopexit.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i.i, 1046527
%conv2.i = sext i32 %rem.i.i to i64
%rem.i26.i = srem i32 %sum.0.lcssa.i.i, 1046526
%add.i27.i = add nsw i32 %rem.i26.i, 1
%conv5.i = sext i32 %add.i27.i to i64
br label %while.cond.i
while.cond.i: ; preds = %if.else.i, %getKey.exit.i
%i.0.i = phi i64 [ 0, %getKey.exit.i ], [ %inc.i, %if.else.i ]
%mul.i = mul nsw i64 %i.0.i, %conv5.i
%add.i = add nsw i64 %mul.i, %conv2.i
%rem.i = srem i64 %add.i, 1046527
%arrayidx.i = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem.i
%call6.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp.i = icmp eq i32 %call6.i, 0
br i1 %cmp.i, label %for.inc19, label %if.else.i
if.else.i: ; preds = %while.cond.i
%inc.i = add nuw nsw i64 %i.0.i, 1
%char0.i = load i8, ptr %arrayidx.i, align 2
%cmp11.i = icmp eq i8 %char0.i, 0
br i1 %cmp11.i, label %if.then13.i, label %while.cond.i
if.then13.i: ; preds = %if.else.i
%call16.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.inc19
if.else: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i42, label %for.body.i.i29.preheader
for.body.i.i29.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%6 = icmp eq i64 %call.i.i, 1
br i1 %6, label %getKey.exit.i42.loopexit.unr-lcssa, label %for.body.i.i29.preheader.new
for.body.i.i29.preheader.new: ; preds = %for.body.i.i29.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i29
for.body.i.i29: ; preds = %getChar.exit.i.i35.1, %for.body.i.i29.preheader.new
%i.011.i.i30 = phi i64 [ 0, %for.body.i.i29.preheader.new ], [ %inc.i.i40.1, %getChar.exit.i.i35.1 ]
%p.010.i.i31 = phi i32 [ 1, %for.body.i.i29.preheader.new ], [ %mul2.i.i39.1, %getChar.exit.i.i35.1 ]
%sum.09.i.i32 = phi i32 [ 0, %for.body.i.i29.preheader.new ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%niter = phi i64 [ 0, %for.body.i.i29.preheader.new ], [ %niter.next.1, %getChar.exit.i.i35.1 ]
%arrayidx.i.i33 = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i30
%7 = load i8, ptr %arrayidx.i.i33, align 1, !tbaa !5
switch i8 %7, label %getChar.exit.i.i35 [
i8 84, label %if.then15.i.i.i61
i8 67, label %if.then5.i.i.i60
i8 71, label %if.then10.i.i.i34
]
if.then5.i.i.i60: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
if.then10.i.i.i34: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
if.then15.i.i.i61: ; preds = %for.body.i.i29
br label %getChar.exit.i.i35
getChar.exit.i.i35: ; preds = %if.then15.i.i.i61, %if.then10.i.i.i34, %if.then5.i.i.i60, %for.body.i.i29
%retval.0.i.i.i36 = phi i32 [ 2, %if.then5.i.i.i60 ], [ 3, %if.then10.i.i.i34 ], [ 4, %if.then15.i.i.i61 ], [ 1, %for.body.i.i29 ]
%mul.i.i37 = mul i32 %retval.0.i.i.i36, %p.010.i.i31
%add.i.i38 = add i32 %mul.i.i37, %sum.09.i.i32
%mul2.i.i39 = mul i32 %p.010.i.i31, 5
%inc.i.i40 = or i64 %i.011.i.i30, 1
%arrayidx.i.i33.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i40
%8 = load i8, ptr %arrayidx.i.i33.1, align 1, !tbaa !5
switch i8 %8, label %getChar.exit.i.i35.1 [
i8 84, label %if.then15.i.i.i61.1
i8 67, label %if.then5.i.i.i60.1
i8 71, label %if.then10.i.i.i34.1
]
if.then10.i.i.i34.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
if.then5.i.i.i60.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
if.then15.i.i.i61.1: ; preds = %getChar.exit.i.i35
br label %getChar.exit.i.i35.1
getChar.exit.i.i35.1: ; preds = %if.then15.i.i.i61.1, %if.then5.i.i.i60.1, %if.then10.i.i.i34.1, %getChar.exit.i.i35
%retval.0.i.i.i36.1 = phi i32 [ 2, %if.then5.i.i.i60.1 ], [ 3, %if.then10.i.i.i34.1 ], [ 4, %if.then15.i.i.i61.1 ], [ 1, %getChar.exit.i.i35 ]
%mul.i.i37.1 = mul i32 %retval.0.i.i.i36.1, %mul2.i.i39
%add.i.i38.1 = add i32 %mul.i.i37.1, %add.i.i38
%mul2.i.i39.1 = mul i32 %p.010.i.i31, 25
%inc.i.i40.1 = add nuw nsw i64 %i.011.i.i30, 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 %getKey.exit.i42.loopexit.unr-lcssa, label %for.body.i.i29, !llvm.loop !8
getKey.exit.i42.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i35.1, %for.body.i.i29.preheader
%add.i.i38.lcssa.ph = phi i32 [ undef, %for.body.i.i29.preheader ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%i.011.i.i30.unr = phi i64 [ 0, %for.body.i.i29.preheader ], [ %inc.i.i40.1, %getChar.exit.i.i35.1 ]
%p.010.i.i31.unr = phi i32 [ 1, %for.body.i.i29.preheader ], [ %mul2.i.i39.1, %getChar.exit.i.i35.1 ]
%sum.09.i.i32.unr = phi i32 [ 0, %for.body.i.i29.preheader ], [ %add.i.i38.1, %getChar.exit.i.i35.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.i42, label %for.body.i.i29.epil
for.body.i.i29.epil: ; preds = %getKey.exit.i42.loopexit.unr-lcssa
%arrayidx.i.i33.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i30.unr
%9 = load i8, ptr %arrayidx.i.i33.epil, align 1, !tbaa !5
switch i8 %9, label %getChar.exit.i.i35.epil [
i8 84, label %if.then15.i.i.i61.epil
i8 67, label %if.then5.i.i.i60.epil
i8 71, label %if.then10.i.i.i34.epil
]
if.then10.i.i.i34.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
if.then5.i.i.i60.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
if.then15.i.i.i61.epil: ; preds = %for.body.i.i29.epil
br label %getChar.exit.i.i35.epil
getChar.exit.i.i35.epil: ; preds = %if.then15.i.i.i61.epil, %if.then5.i.i.i60.epil, %if.then10.i.i.i34.epil, %for.body.i.i29.epil
%retval.0.i.i.i36.epil = phi i32 [ 2, %if.then5.i.i.i60.epil ], [ 3, %if.then10.i.i.i34.epil ], [ 4, %if.then15.i.i.i61.epil ], [ 1, %for.body.i.i29.epil ]
%mul.i.i37.epil = mul i32 %retval.0.i.i.i36.epil, %p.010.i.i31.unr
%add.i.i38.epil = add i32 %mul.i.i37.epil, %sum.09.i.i32.unr
br label %getKey.exit.i42
getKey.exit.i42: ; preds = %getChar.exit.i.i35.epil, %getKey.exit.i42.loopexit.unr-lcssa, %if.else
%sum.0.lcssa.i.i43 = phi i32 [ 0, %if.else ], [ %add.i.i38.lcssa.ph, %getKey.exit.i42.loopexit.unr-lcssa ], [ %add.i.i38.epil, %getChar.exit.i.i35.epil ]
%rem.i.i44 = srem i32 %sum.0.lcssa.i.i43, 1046527
%conv2.i45 = sext i32 %rem.i.i44 to i64
%rem.i21.i = srem i32 %sum.0.lcssa.i.i43, 1046526
%add.i22.i = add nsw i32 %rem.i21.i, 1
%conv5.i46 = sext i32 %add.i22.i to i64
br label %while.cond.i47
while.cond.i47: ; preds = %if.else.i55, %getKey.exit.i42
%i.0.i48 = phi i64 [ 0, %getKey.exit.i42 ], [ %inc.i56, %if.else.i55 ]
%mul.i49 = mul nsw i64 %i.0.i48, %conv5.i46
%add.i50 = add nsw i64 %mul.i49, %conv2.i45
%rem.i51 = srem i64 %add.i50, 1046527
%arrayidx.i52 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem.i51
%call6.i53 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i52, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp.i54 = icmp eq i32 %call6.i53, 0
br i1 %cmp.i54, label %if.then14, label %if.else.i55
if.else.i55: ; preds = %while.cond.i47
%inc.i56 = add nuw nsw i64 %i.0.i48, 1
%char0.i57 = load i8, ptr %arrayidx.i52, align 2
%cmp11.i58 = icmp eq i8 %char0.i57, 0
br i1 %cmp11.i58, label %if.else16, label %while.cond.i47
if.then14: ; preds = %while.cond.i47
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else.i55
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %while.cond.i, %if.then13.i, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.167, 1
%10 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %10
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !13
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !9}
|
#include<stdio.h>
#include<string.h>
#define MAX 10000000
#define LEN 12
int n;
char dic[MAX][LEN];
long long makekey(char *str){
long long k=0,p=1,i;
int len=strlen(str);
for(i=0;i<len;i++){
if(str[i]=='A') k+=1*p;
else if(str[i]=='C') k+=2*p;
else if(str[i]=='G') k+=3*p;
else if(str[i]=='T') k+=4*p;
p*=5;
}
return k;
}
int insert(char *str){
long long key,place;
int i;
key=makekey(str);
for(i=0;;i++){
place= (key%MAX)+(i*(1+key%(MAX-1)));
if(strcmp(str,dic[place])==0) return 1;
else if(strlen(dic[place])==0) {
strcpy(dic[place],str);
return 0;
}
}
return 0;
}
int find(char *str){
long long key,place;
int i;
key=makekey(str);
for(i=0;;i++){
place=(key%MAX)+(i*(1+key%(MAX-1)));
if(strcmp(str,dic[place])==0) return 1;
else if(strlen(dic[place])==0) return 0;
}
return 0;
}
int main(){
int i;
char com[10],str[LEN+1];
for(i=0;i<MAX;i++) dic[i][0]='\0';
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %s",com,str);
if(com[0]=='i'){
insert(str);
}else if(com[0]=='f'){
if(find(str)==1) printf("yes\n");
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dic = dso_local global [10000000 x [12 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @makekey(ptr nocapture noundef readonly %str) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%0 = trunc i64 %call to i32
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%conv1 = and i64 %call, 4294967295
%smax = tail call i64 @llvm.smax.i64(i64 %conv1, i64 1)
br label %for.body
for.body: ; preds = %for.body.preheader, %if.end31
%k.053 = phi i64 [ %k.1, %if.end31 ], [ 0, %for.body.preheader ]
%i.052 = phi i64 [ %inc, %if.end31 ], [ 0, %for.body.preheader ]
%p.051 = phi i64 [ %mul32, %if.end31 ], [ 1, %for.body.preheader ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.052
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end31 [
i8 65, label %if.then
i8 67, label %if.then10
i8 71, label %if.then18
i8 84, label %if.then26
]
if.then: ; preds = %for.body
%add = add nsw i64 %k.053, %p.051
br label %if.end31
if.then10: ; preds = %for.body
%mul11 = shl nuw nsw i64 %p.051, 1
%add12 = add nsw i64 %k.053, %mul11
br label %if.end31
if.then18: ; preds = %for.body
%mul19 = mul nsw i64 %p.051, 3
%add20 = add nsw i64 %k.053, %mul19
br label %if.end31
if.then26: ; preds = %for.body
%mul27 = shl nsw i64 %p.051, 2
%add28 = add nsw i64 %k.053, %mul27
br label %if.end31
if.end31: ; preds = %for.body, %if.then10, %if.then26, %if.then18, %if.then
%k.1 = phi i64 [ %add, %if.then ], [ %add12, %if.then10 ], [ %add20, %if.then18 ], [ %add28, %if.then26 ], [ %k.053, %for.body ]
%mul32 = mul nsw i64 %p.051, 5
%inc = add nuw nsw i64 %i.052, 1
%exitcond.not = icmp eq i64 %inc, %smax
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %if.end31, %entry
%k.0.lcssa = phi i64 [ 0, %entry ], [ %k.1, %if.end31 ]
ret i64 %k.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #3 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%0 = trunc i64 %call.i to i32
%cmp50.i = icmp sgt i32 %0, 0
br i1 %cmp50.i, label %for.body.preheader.i, label %makekey.exit
for.body.preheader.i: ; preds = %entry
%conv1.i = and i64 %call.i, 4294967295
%smax.i = tail call i64 @llvm.smax.i64(i64 %conv1.i, i64 1)
br label %for.body.i
for.body.i: ; preds = %if.end31.i, %for.body.preheader.i
%k.053.i = phi i64 [ %k.1.i, %if.end31.i ], [ 0, %for.body.preheader.i ]
%i.052.i = phi i64 [ %inc.i, %if.end31.i ], [ 0, %for.body.preheader.i ]
%p.051.i = phi i64 [ %mul32.i, %if.end31.i ], [ 1, %for.body.preheader.i ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.052.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end31.i [
i8 65, label %if.then.i
i8 67, label %if.then10.i
i8 71, label %if.then18.i
i8 84, label %if.then26.i
]
if.then.i: ; preds = %for.body.i
%add.i = add nsw i64 %p.051.i, %k.053.i
br label %if.end31.i
if.then10.i: ; preds = %for.body.i
%mul11.i = shl nuw nsw i64 %p.051.i, 1
%add12.i = add nsw i64 %mul11.i, %k.053.i
br label %if.end31.i
if.then18.i: ; preds = %for.body.i
%mul19.i = mul nsw i64 %p.051.i, 3
%add20.i = add nsw i64 %mul19.i, %k.053.i
br label %if.end31.i
if.then26.i: ; preds = %for.body.i
%mul27.i = shl nsw i64 %p.051.i, 2
%add28.i = add nsw i64 %mul27.i, %k.053.i
br label %if.end31.i
if.end31.i: ; preds = %if.then26.i, %if.then18.i, %if.then10.i, %if.then.i, %for.body.i
%k.1.i = phi i64 [ %add.i, %if.then.i ], [ %add12.i, %if.then10.i ], [ %add20.i, %if.then18.i ], [ %add28.i, %if.then26.i ], [ %k.053.i, %for.body.i ]
%mul32.i = mul nsw i64 %p.051.i, 5
%inc.i = add nuw nsw i64 %i.052.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %smax.i
br i1 %exitcond.not.i, label %makekey.exit, label %for.body.i, !llvm.loop !8
makekey.exit: ; preds = %if.end31.i, %entry
%k.0.lcssa.i = phi i64 [ 0, %entry ], [ %k.1.i, %if.end31.i ]
%rem = srem i64 %k.0.lcssa.i, 10000000
%rem1 = srem i64 %k.0.lcssa.i, 9999999
%add = add nsw i64 %rem1, 1
%arrayidx24 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %rem
%call325 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %arrayidx24) #10
%cmp26 = icmp eq i32 %call325, 0
br i1 %cmp26, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%mul = mul nsw i64 %add, %indvars.iv.next
%add2 = add nsw i64 %mul, %rem
%arrayidx = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %add2
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %arrayidx) #10
%cmp = icmp eq i32 %call3, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %makekey.exit, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %makekey.exit ]
%arrayidx28 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx24, %makekey.exit ]
%char0 = load i8, ptr %arrayidx28, align 1
%cmp8 = icmp eq i8 %char0, 0
br i1 %cmp8, label %if.then10, label %for.cond
if.then10: ; preds = %if.else
%call13 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx28, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %makekey.exit, %if.then10
%retval.0 = phi i32 [ 0, %if.then10 ], [ 1, %makekey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) 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 #4
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%0 = trunc i64 %call.i to i32
%cmp50.i = icmp sgt i32 %0, 0
br i1 %cmp50.i, label %for.body.preheader.i, label %makekey.exit
for.body.preheader.i: ; preds = %entry
%conv1.i = and i64 %call.i, 4294967295
%smax.i = tail call i64 @llvm.smax.i64(i64 %conv1.i, i64 1)
br label %for.body.i
for.body.i: ; preds = %if.end31.i, %for.body.preheader.i
%k.053.i = phi i64 [ %k.1.i, %if.end31.i ], [ 0, %for.body.preheader.i ]
%i.052.i = phi i64 [ %inc.i, %if.end31.i ], [ 0, %for.body.preheader.i ]
%p.051.i = phi i64 [ %mul32.i, %if.end31.i ], [ 1, %for.body.preheader.i ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.052.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end31.i [
i8 65, label %if.then.i
i8 67, label %if.then10.i
i8 71, label %if.then18.i
i8 84, label %if.then26.i
]
if.then.i: ; preds = %for.body.i
%add.i = add nsw i64 %p.051.i, %k.053.i
br label %if.end31.i
if.then10.i: ; preds = %for.body.i
%mul11.i = shl nuw nsw i64 %p.051.i, 1
%add12.i = add nsw i64 %mul11.i, %k.053.i
br label %if.end31.i
if.then18.i: ; preds = %for.body.i
%mul19.i = mul nsw i64 %p.051.i, 3
%add20.i = add nsw i64 %mul19.i, %k.053.i
br label %if.end31.i
if.then26.i: ; preds = %for.body.i
%mul27.i = shl nsw i64 %p.051.i, 2
%add28.i = add nsw i64 %mul27.i, %k.053.i
br label %if.end31.i
if.end31.i: ; preds = %if.then26.i, %if.then18.i, %if.then10.i, %if.then.i, %for.body.i
%k.1.i = phi i64 [ %add.i, %if.then.i ], [ %add12.i, %if.then10.i ], [ %add20.i, %if.then18.i ], [ %add28.i, %if.then26.i ], [ %k.053.i, %for.body.i ]
%mul32.i = mul nsw i64 %p.051.i, 5
%inc.i = add nuw nsw i64 %i.052.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %smax.i
br i1 %exitcond.not.i, label %makekey.exit, label %for.body.i, !llvm.loop !8
makekey.exit: ; preds = %if.end31.i, %entry
%k.0.lcssa.i = phi i64 [ 0, %entry ], [ %k.1.i, %if.end31.i ]
%rem = srem i64 %k.0.lcssa.i, 10000000
%rem1 = srem i64 %k.0.lcssa.i, 9999999
%add = add nsw i64 %rem1, 1
%arrayidx18 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %rem
%call319 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %arrayidx18) #10
%cmp20 = icmp eq i32 %call319, 0
br i1 %cmp20, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%mul = mul nsw i64 %add, %indvars.iv.next
%add2 = add nsw i64 %mul, %rem
%arrayidx = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %add2
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %arrayidx) #10
%cmp = icmp eq i32 %call3, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %makekey.exit, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %makekey.exit ]
%arrayidx22 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx18, %makekey.exit ]
%char0 = load i8, ptr %arrayidx22, align 1
%cmp8 = icmp eq i8 %char0, 0
br i1 %cmp8, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %makekey.exit
%retval.0 = phi i32 [ 1, %makekey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%com = alloca [10 x i8], align 1
%str = alloca [13 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %com) #11
call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %str) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [10000000 x [12 x i8]], ptr @dic, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 4, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 10000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp336 = icmp sgt i32 %0, 0
br i1 %cmp336, label %for.body4, label %for.end29
for.body4: ; preds = %for.end, %for.inc27
%i.137 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
switch i8 %1, label %for.inc27 [
i8 105, label %if.then
i8 102, label %if.then16
]
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc27
if.then16: ; preds = %for.body4
%call18 = call i32 @find(ptr noundef nonnull %str), !range !13
%cmp19.not = icmp eq i32 %call18, 0
br i1 %cmp19.not, label %if.else23, label %if.then21
if.then21: ; preds = %if.then16
%puts34 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc27
if.else23: ; preds = %if.then16
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc27
for.inc27: ; preds = %for.body4, %if.then, %if.then21, %if.else23
%inc28 = add nuw nsw i32 %i.137, 1
%2 = load i32, ptr @n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc28, %2
br i1 %cmp3, label %for.body4, label %for.end29, !llvm.loop !14
for.end29: ; preds = %for.inc27, %for.end
call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %com) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #9
attributes #0 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1000000
char H[M][20];
int toi(char c){
if(c=='A')return 1;
else if(c=='C')return 2;
else if(c=='G')return 3;
else if(c=='T')return 4;
else return 0;
}
long long int gkey(char *str){
long long int sum =0,p=1,i,s;
s=strlen(str);
for(i=0;i<s;i++){
sum+=p*(toi(str[i]));
p=p*5;
}
return sum;
}
int h1(int k){
return k%M;
}
int h2(int k){
return 1+(k%(M-1));
}
int find(char *str){
long long int k ,i,h;
k=gkey(str);
for(i=0;;i++){
h=(h1(k)+i*h2(k))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0) {
//printf("ss\n");
return 0;
}
}
return 0;
}
int in(char str[]){
long long int k,i,h;
k=gkey(str);
// printf("tes\n");
for(i=0;;i++){
h = (h1(k)+i*h2(k))%M;
if(strcmp(H[h],str) == 0)return 1;
else if (strlen(H[h])==0){
//printf("tes\n");
strcpy(H[h],str);
return 0;
}
}
return 0;
}
char strr[M][20],comm[M][10];
int main(){
int i,n,h;
//char str[M][20],com[M][10];
for(i=0;i<M;i++){
H[i][0]='\0';
}
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",comm[i],strr[i]);
}
for(i=0;i<n;i++){
if(comm[i][0]=='i'){
in(strr[i]);
// printf("iii\n");
}
else{
if(find(strr[i]) == 1){
printf("yes\n");
}
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [20 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@comm = dso_local global [1000000 x [10 x i8]] zeroinitializer, align 16
@strr = dso_local global [1000000 x [20 x i8]] zeroinitializer, align 16
@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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @toi(i8 noundef signext %c) local_unnamed_addr #0 {
entry:
switch i8 %c, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @gkey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8 = icmp sgt i64 %call, 0
br i1 %cmp8, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %toi.exit.1, %for.body.preheader.new
%sum.011 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %toi.exit.1 ]
%i.010 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %toi.exit.1 ]
%p.09 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %toi.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %toi.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.010
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %toi.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %toi.exit
if.then10.i: ; preds = %for.body
br label %toi.exit
if.then15.i: ; preds = %for.body
br label %toi.exit
if.else16.i: ; preds = %for.body
br label %toi.exit
toi.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.09
%add = add nuw nsw i64 %mul, %sum.011
%mul2 = mul nsw i64 %p.09, 5
%inc = or i64 %i.010, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %toi.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %toi.exit
br label %toi.exit.1
if.then10.i.1: ; preds = %toi.exit
br label %toi.exit.1
if.then5.i.1: ; preds = %toi.exit
br label %toi.exit.1
if.else16.i.1: ; preds = %toi.exit
br label %toi.exit.1
toi.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %toi.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %toi.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.09, 25
%inc.1 = add nuw nsw i64 %i.010, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %toi.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %toi.exit.1 ]
%sum.011.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %toi.exit.1 ]
%i.010.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %toi.exit.1 ]
%p.09.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %toi.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.010.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %toi.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %toi.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %toi.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %toi.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %toi.exit.epil
toi.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.09.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.011.unr
br label %for.end
for.end: ; preds = %toi.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %toi.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %k) local_unnamed_addr #0 {
entry:
%rem = srem i32 %k, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %k) local_unnamed_addr #0 {
entry:
%rem = srem i32 %k, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.i = icmp sgt i64 %call.i, 0
br i1 %cmp8.i, label %for.body.i.preheader, label %gkey.exit
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %gkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %toi.exit.i.1, %for.body.i.preheader.new
%sum.011.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %toi.exit.i.1 ]
%i.010.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %toi.exit.i.1 ]
%p.09.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %toi.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %toi.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.010.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %toi.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %toi.exit.i
toi.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.09.i
%add.i = add i32 %mul.i, %sum.011.i
%mul2.i = mul i32 %p.09.i, 5
%inc.i = or i64 %i.010.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %toi.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.then10.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.then5.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.else16.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
toi.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %toi.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %toi.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.09.i, 25
%inc.i.1 = add nuw nsw i64 %i.010.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 %gkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
gkey.exit.loopexit.unr-lcssa: ; preds = %toi.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %toi.exit.i.1 ]
%sum.011.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %toi.exit.i.1 ]
%i.010.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %toi.exit.i.1 ]
%p.09.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %toi.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %gkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %gkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.010.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %toi.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
toi.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.09.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.011.i.unr
br label %gkey.exit
gkey.exit: ; preds = %toi.exit.i.epil, %gkey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %gkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %toi.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 999999
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %gkey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %gkey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %gkey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %gkey.exit
%retval.0 = phi i32 [ 1, %gkey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @in(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.i = icmp sgt i64 %call.i, 0
br i1 %cmp8.i, label %for.body.i.preheader, label %gkey.exit
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %gkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %toi.exit.i.1, %for.body.i.preheader.new
%sum.011.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %toi.exit.i.1 ]
%i.010.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %toi.exit.i.1 ]
%p.09.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %toi.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %toi.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.010.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %toi.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %toi.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %toi.exit.i
toi.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.09.i
%add.i = add i32 %mul.i, %sum.011.i
%mul2.i = mul i32 %p.09.i, 5
%inc.i = or i64 %i.010.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %toi.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.then10.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.then5.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
if.else16.i.i.1: ; preds = %toi.exit.i
br label %toi.exit.i.1
toi.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %toi.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %toi.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.09.i, 25
%inc.i.1 = add nuw nsw i64 %i.010.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 %gkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
gkey.exit.loopexit.unr-lcssa: ; preds = %toi.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %toi.exit.i.1 ]
%sum.011.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %toi.exit.i.1 ]
%i.010.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %toi.exit.i.1 ]
%p.09.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %toi.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %gkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %gkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.010.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %toi.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %toi.exit.i.epil
toi.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.09.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.011.i.unr
br label %gkey.exit
gkey.exit: ; preds = %toi.exit.i.epil, %gkey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %gkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %toi.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 999999
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %gkey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %gkey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %gkey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %gkey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %gkey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [20 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 4, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp353 = icmp sgt i32 %0, 0
br i1 %cmp353, label %for.body4, label %for.end39
for.cond14.preheader: ; preds = %for.body4
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body16, label %for.end39
for.body4: ; preds = %for.end, %for.body4
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [1000000 x [10 x i8]], ptr @comm, i64 0, i64 %indvars.iv58
%arrayidx8 = getelementptr inbounds [1000000 x [20 x i8]], ptr @strr, i64 0, i64 %indvars.iv58
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx8)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%3 = sext i32 %2 to i64
%cmp3 = icmp slt i64 %indvars.iv.next59, %3
br i1 %cmp3, label %for.body4, label %for.cond14.preheader, !llvm.loop !13
for.body16: ; preds = %for.cond14.preheader, %for.inc37
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.inc37 ], [ 0, %for.cond14.preheader ]
%arrayidx18 = getelementptr inbounds [1000000 x [10 x i8]], ptr @comm, i64 0, i64 %indvars.iv61
%4 = load i8, ptr %arrayidx18, align 2, !tbaa !5
%cmp20 = icmp eq i8 %4, 105
%arrayidx23 = getelementptr inbounds [1000000 x [20 x i8]], ptr @strr, i64 0, i64 %indvars.iv61
br i1 %cmp20, label %if.then, label %if.else
if.then: ; preds = %for.body16
%call25 = call i32 @in(ptr noundef nonnull %arrayidx23), !range !14
br label %for.inc37
if.else: ; preds = %for.body16
%call29 = call i32 @find(ptr noundef nonnull %arrayidx23), !range !14
%cmp30.not = icmp eq i32 %call29, 0
br i1 %cmp30.not, label %if.else34, label %if.then32
if.then32: ; preds = %if.else
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc37
if.else34: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc37
for.inc37: ; preds = %if.then, %if.else34, %if.then32
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%5 = load i32, ptr %n, align 4, !tbaa !11
%6 = sext i32 %5 to i64
%cmp15 = icmp slt i64 %indvars.iv.next62, %6
br i1 %cmp15, label %for.body16, label %for.end39, !llvm.loop !15
for.end39: ; preds = %for.inc37, %for.end, %for.cond14.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !9}
!14 = !{i32 0, i32 2}
!15 = distinct !{!15, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define L 14
char H[M][L];
int getChar(char ch){
if(ch=='A') return 1;
else if(ch=='C') return 2;
else if(ch=='G') return 3;
else if(ch=='T') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum=0,p=1,i;
for(i=0;i<strlen(str);i++){
sum+=p*(getChar(str[i]));
p*=5;
}
return sum;
}
int h1(int key){
return key%M;
}
int h2(int key){
return 1+(key%(M-1));
}
int insert(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++) {
h=(h1(key)+i*h2(key))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0){
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int find(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++) {
h=(h1(key)+i*h2(key)) % M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0)return 0;
}
return 0;
}
int main(){
int i,n,h;
char str[L],com[9];
for(i=0;i<M;i++)H[i][0]=0;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%s %s",com,str);
if(com[0]=='i'){
insert(str);
}else{
if(find(str)){
printf("yes\n");
}else{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
int c2i(char c){
if(c=='A')return 1;
else if(c=='C')return 2;
else if(c=='G')return 3;
else if(c=='T')return 4;
return 0;
}
int makekey(char str[]){
long sum=0,p=1,i;
for(i=0;i<strlen(str);i++){
sum+=p*c2i(str[i]);
p*=5;
}
return sum;
}
int h1(int key){
return key%1000000;
}
int h2(int key){
return 1+(key%(1000000-1));
}
int find(char str[7],char hash[1000000][13]){
long key,i,h;
key = makekey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%1000000;
if(strcmp(hash[h],str)==0){return 1;}
else if(strlen(hash[h])==0){return 0;}
}
}
void insert(char str[7],char hash[1000000][13]){
long key,i,h;
key = makekey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%1000000;
if(strcmp(hash[h],str)==0){return;}
else if(strlen(hash[h])==0){
strcpy(hash[h],str);
return;
}
}
}
int main(void){
int n,i;
char s[7],moji[13];
char hash[1000000][13];
for(i=0;i<1000000;i++){
hash[i][0]='\0';
}
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %s",s,moji);
if(s[0]=='i'){
insert(moji,hash);
}else{
if(find(moji,hash)==1){
printf("yes\n");
}else{
printf("no\n");
}
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @c2i(i8 noundef signext %c) local_unnamed_addr #0 {
entry:
switch i8 %c, label %if.end18 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.end18: ; preds = %entry
br label %return
return: ; preds = %entry, %if.end18, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.end18 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @makekey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not = icmp eq i64 %call, 0
br i1 %cmp9.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %c2i.exit.1, %for.body.preheader.new
%i.012 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %c2i.exit.1 ]
%p.011 = phi i32 [ 1, %for.body.preheader.new ], [ %mul2.1, %c2i.exit.1 ]
%sum.010 = phi i32 [ 0, %for.body.preheader.new ], [ %add.1, %c2i.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %c2i.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.012
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end18.i [
i8 65, label %c2i.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %c2i.exit
if.then10.i: ; preds = %for.body
br label %c2i.exit
if.then15.i: ; preds = %for.body
br label %c2i.exit
if.end18.i: ; preds = %for.body
br label %c2i.exit
c2i.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.end18.i
%retval.0.i = phi i32 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.end18.i ], [ 1, %for.body ]
%mul = mul i32 %retval.0.i, %p.011
%add = add i32 %mul, %sum.010
%mul2 = mul i32 %p.011, 5
%inc = or i64 %i.012, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.1 [
i8 65, label %c2i.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %c2i.exit
br label %c2i.exit.1
if.then10.i.1: ; preds = %c2i.exit
br label %c2i.exit.1
if.then5.i.1: ; preds = %c2i.exit
br label %c2i.exit.1
if.end18.i.1: ; preds = %c2i.exit
br label %c2i.exit.1
c2i.exit.1: ; preds = %if.end18.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %c2i.exit
%retval.0.i.1 = phi i32 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.end18.i.1 ], [ 1, %c2i.exit ]
%mul.1 = mul i32 %retval.0.i.1, %mul2
%add.1 = add i32 %mul.1, %add
%mul2.1 = mul i32 %p.011, 25
%inc.1 = add nuw nsw i64 %i.012, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %c2i.exit.1, %for.body.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.1, %c2i.exit.1 ]
%i.012.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %c2i.exit.1 ]
%p.011.unr = phi i32 [ 1, %for.body.preheader ], [ %mul2.1, %c2i.exit.1 ]
%sum.010.unr = phi i32 [ 0, %for.body.preheader ], [ %add.1, %c2i.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.012.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.epil [
i8 65, label %c2i.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %c2i.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %c2i.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %c2i.exit.epil
if.end18.i.epil: ; preds = %for.body.epil
br label %c2i.exit.epil
c2i.exit.epil: ; preds = %if.end18.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i32 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.end18.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul i32 %retval.0.i.epil, %p.011.unr
%add.epil = add i32 %mul.epil, %sum.010.unr
br label %for.end
for.end: ; preds = %c2i.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %c2i.exit.epil ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str, ptr nocapture noundef readonly %hash) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not.i = icmp eq i64 %call.i, 0
br i1 %cmp9.not.i, label %makekey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %makekey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %c2i.exit.i.1, %for.body.i.preheader.new
%i.012.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %c2i.exit.i.1 ]
%p.011.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %c2i.exit.i.1 ]
%sum.010.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %c2i.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %c2i.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.012.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %c2i.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %c2i.exit.i
c2i.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.011.i
%add.i = add i32 %mul.i, %sum.010.i
%mul2.i = mul i32 %p.011.i, 5
%inc.i = or i64 %i.012.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %c2i.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.then10.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.then5.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.end18.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
c2i.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %c2i.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %c2i.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.011.i, 25
%inc.i.1 = add nuw nsw i64 %i.012.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 %makekey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
makekey.exit.loopexit.unr-lcssa: ; preds = %c2i.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %c2i.exit.i.1 ]
%i.012.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %c2i.exit.i.1 ]
%p.011.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %c2i.exit.i.1 ]
%sum.010.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %c2i.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %makekey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %makekey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.012.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %c2i.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
c2i.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.011.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.010.i.unr
br label %makekey.exit
makekey.exit: ; preds = %c2i.exit.i.epil, %makekey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %makekey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %c2i.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv3 = sext i32 %rem.i to i64
%rem.i23 = srem i32 %sum.0.lcssa.i, 999999
%add.i24 = add nsw i32 %rem.i23, 1
%conv6 = sext i32 %add.i24 to i64
%arrayidx25 = getelementptr inbounds [13 x i8], ptr %hash, i64 %conv3
%call726 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx25, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp27 = icmp eq i32 %call726, 0
br i1 %cmp27, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.028, 1
%mul = mul nsw i64 %inc, %conv6
%add = add nsw i64 %mul, %conv3
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [13 x i8], ptr %hash, i64 %rem
%call7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call7, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %makekey.exit, %for.cond
%arrayidx29 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx25, %makekey.exit ]
%i.028 = phi i64 [ %inc, %for.cond ], [ 0, %makekey.exit ]
%char0 = load i8, ptr %arrayidx29, align 1
%cmp12 = icmp eq i8 %char0, 0
br i1 %cmp12, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %makekey.exit
%retval.0 = phi i32 [ 1, %makekey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %str, ptr noundef %hash) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not.i = icmp eq i64 %call.i, 0
br i1 %cmp9.not.i, label %makekey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %makekey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %c2i.exit.i.1, %for.body.i.preheader.new
%i.012.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %c2i.exit.i.1 ]
%p.011.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %c2i.exit.i.1 ]
%sum.010.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %c2i.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %c2i.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.012.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %c2i.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %c2i.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %c2i.exit.i
c2i.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.011.i
%add.i = add i32 %mul.i, %sum.010.i
%mul2.i = mul i32 %p.011.i, 5
%inc.i = or i64 %i.012.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %c2i.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.then10.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.then5.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
if.end18.i.i.1: ; preds = %c2i.exit.i
br label %c2i.exit.i.1
c2i.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %c2i.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %c2i.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.011.i, 25
%inc.i.1 = add nuw nsw i64 %i.012.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 %makekey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
makekey.exit.loopexit.unr-lcssa: ; preds = %c2i.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %c2i.exit.i.1 ]
%i.012.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %c2i.exit.i.1 ]
%p.011.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %c2i.exit.i.1 ]
%sum.010.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %c2i.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %makekey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %makekey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.012.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %c2i.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %c2i.exit.i.epil
c2i.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.011.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.010.i.unr
br label %makekey.exit
makekey.exit: ; preds = %c2i.exit.i.epil, %makekey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %makekey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %c2i.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv3 = sext i32 %rem.i to i64
%rem.i29 = srem i32 %sum.0.lcssa.i, 999999
%add.i30 = add nsw i32 %rem.i29, 1
%conv6 = sext i32 %add.i30 to i64
%arrayidx32 = getelementptr inbounds [13 x i8], ptr %hash, i64 %conv3
%call733 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx32, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp34 = icmp eq i32 %call733, 0
br i1 %cmp34, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.035, 1
%mul = mul nsw i64 %inc, %conv6
%add = add nsw i64 %mul, %conv3
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [13 x i8], ptr %hash, i64 %rem
%call7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call7, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %makekey.exit, %for.cond
%arrayidx36 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx32, %makekey.exit ]
%i.035 = phi i64 [ %inc, %for.cond ], [ 0, %makekey.exit ]
%char0 = load i8, ptr %arrayidx36, align 1
%cmp12 = icmp eq i8 %char0, 0
br i1 %cmp12, label %if.then14, label %for.cond
if.then14: ; preds = %if.else
%call17 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx36, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %makekey.exit, %if.then14
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%s = alloca [7 x i8], align 1
%moji = alloca [13 x i8], align 1
%hash = alloca [1000000 x [13 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %s) #11
call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %moji) #11
call void @llvm.lifetime.start.p0(i64 13000000, ptr nonnull %hash) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [13 x i8]], ptr %hash, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [13 x i8]], ptr %hash, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [13 x i8]], ptr %hash, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 1, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [13 x i8]], ptr %hash, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 1, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [13 x i8]], ptr %hash, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 1, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp331 = icmp sgt i32 %0, 0
br i1 %cmp331, label %for.body4, label %for.end24
for.body4: ; preds = %for.end, %for.inc22
%i.132 = phi i32 [ %inc23, %for.inc22 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %moji)
%1 = load i8, ptr %s, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
call void @insert(ptr noundef nonnull %moji, ptr noundef nonnull %hash)
br label %for.inc22
if.else: ; preds = %for.body4
%call14 = call i32 @find(ptr noundef nonnull %moji, ptr noundef nonnull %hash), !range !13
%cmp15.not = icmp eq i32 %call14, 0
br i1 %cmp15.not, label %if.else19, label %if.then17
if.then17: ; preds = %if.else
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc22
if.else19: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc22
for.inc22: ; preds = %if.then, %if.else19, %if.then17
%inc23 = add nuw nsw i32 %i.132, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc23, %2
br i1 %cmp3, label %for.body4, label %for.end24, !llvm.loop !14
for.end24: ; preds = %for.inc22, %for.end
call void @llvm.lifetime.end.p0(i64 13000000, ptr nonnull %hash) #11
call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %moji) #11
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %s) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 1000040
const int m = 1000033;
//const int m2= 1000003;
//7069 - 60
char stack[MAX][15];
int h1(long long);
int h2(long long);
int insert(long long,int);
long long sti(char *);
int main(){
int val,i,j,n,dic=0,dicc=MAX,index2=0,vall;
char op[15],s[15];
int exist=-1,index=0;
while(scanf("%d",&n) != EOF){
dic=0,dicc=MAX;
for(i=0;i<=MAX;i++)strcpy(&stack[i][0],"not");
for(i=0;i<n;i++){
exist=-1;
scanf("%s %s",op,s);
if(op[0] == 'i'){
index=0;
while(1){
val = insert(sti(&s[0]),index);
if(strcmp(&stack[val][0],"not") == 0){
strcpy(&stack[val][0],&s[0]);
break;
}
else index++;
if(index == MAX)break;
}
}
else if(op[0] =='f'){
index2=0;
while(1){
vall=insert(sti(s),index2);
if(strcmp(stack[vall],s) == 0){
exist=1;
break;
}
else if(strcmp(&stack[vall][0],"not") == 0){
break;
}
index2++;
if(index2 == MAX)break;
}
if(exist == 1)printf("yes\n");
else printf("no\n");
}
}
}
return 0;
}
int h1(long long k){
return k%m;
}
int h2(long long k){
return 1+k%(m-1);
}
int insert(long long k,int i){
return (h1(k) + i*h2(k))%m;
}
long long sti(char *s){
long long i=0,sum=0;
while(s[i] != '\0'){
sum*=10;
sum+=s[i]-'A'+1;
i++;
}
return sum;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246748/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@m = dso_local local_unnamed_addr constant i32 1000033, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stack = dso_local global [1000040 x [15 x i8]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"not\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%op = alloca [15 x i8], align 1
%s = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %op) #8
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %s) #8
%call119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not120 = icmp eq i32 %call119, -1
br i1 %cmp.not120, label %while.end81, label %for.body
while.cond.loopexit: ; preds = %for.inc78, %for.cond4.preheader
%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.end81, label %for.body.backedge
for.cond4.preheader: ; preds = %for.body
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5117 = icmp sgt i32 %0, 0
br i1 %cmp5117, label %for.body6, label %while.cond.loopexit
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000040 x [15 x i8]], ptr @stack, i64 0, i64 %indvars.iv
store i32 7630702, ptr %arrayidx, align 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000041
br i1 %exitcond.not, label %for.cond4.preheader, label %for.body.backedge
for.body.backedge: ; preds = %for.body, %while.cond.loopexit
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.cond.loopexit ]
br label %for.body, !llvm.loop !9
for.body6: ; preds = %for.cond4.preheader, %for.inc78
%i.1118 = phi i32 [ %inc79, %for.inc78 ], [ 0, %for.cond4.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %op, ptr noundef nonnull %s)
%1 = load i8, ptr %op, align 1, !tbaa !11
switch i8 %1, label %for.inc78 [
i8 105, label %while.cond12.preheader
i8 102, label %while.cond40.preheader
]
while.cond40.preheader: ; preds = %for.body6
%2 = load i8, ptr %s, align 1, !tbaa !11
%cmp.not11.i95 = icmp eq i8 %2, 0
br label %while.cond40
while.cond12.preheader: ; preds = %for.body6
%3 = load i8, ptr %s, align 1, !tbaa !11
%cmp.not11.i = icmp eq i8 %3, 0
br label %while.cond12
while.cond12: ; preds = %while.cond12.preheader, %if.else
%index.0 = phi i32 [ %inc29, %if.else ], [ 0, %while.cond12.preheader ]
br i1 %cmp.not11.i, label %sti.exit, label %while.body.i
while.body.i: ; preds = %while.cond12, %while.body.i
%4 = phi i8 [ %5, %while.body.i ], [ %3, %while.cond12 ]
%sum.013.i = phi i64 [ %add5.i, %while.body.i ], [ 0, %while.cond12 ]
%i.012.i = phi i64 [ %inc.i, %while.body.i ], [ 0, %while.cond12 ]
%conv.i = sext i8 %4 to i64
%mul.i = mul nsw i64 %sum.013.i, 10
%add.i = add nsw i64 %conv.i, -64
%add5.i = add i64 %add.i, %mul.i
%inc.i = add nuw nsw i64 %i.012.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %s, i64 %inc.i
%5 = load i8, ptr %arrayidx.i, align 1, !tbaa !11
%cmp.not.i = icmp eq i8 %5, 0
br i1 %cmp.not.i, label %sti.exit, label %while.body.i, !llvm.loop !12
sti.exit: ; preds = %while.body.i, %while.cond12
%sum.0.lcssa.i = phi i64 [ 0, %while.cond12 ], [ %add5.i, %while.body.i ]
%rem.i.i = srem i64 %sum.0.lcssa.i, 1000033
%conv.i.i = trunc i64 %rem.i.i to i32
%rem.i3.i = srem i64 %sum.0.lcssa.i, 1000032
%6 = trunc i64 %rem.i3.i to i32
%conv.i4.i = add nsw i32 %6, 1
%mul.i93 = mul nsw i32 %conv.i4.i, %index.0
%add.i94 = add nsw i32 %mul.i93, %conv.i.i
%rem.i = srem i32 %add.i94, 1000033
%idxprom17 = sext i32 %rem.i to i64
%arrayidx18 = getelementptr inbounds [1000040 x [15 x i8]], ptr @stack, i64 0, i64 %idxprom17
%call20 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx18, ptr noundef nonnull dereferenceable(4) @.str.1) #9
%cmp21 = icmp eq i32 %call20, 0
br i1 %cmp21, label %if.then23, label %if.else
if.then23: ; preds = %sti.exit
%call28 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx18, ptr noundef nonnull dereferenceable(1) %s) #8
br label %for.inc78
if.else: ; preds = %sti.exit
%inc29 = add nuw nsw i32 %index.0, 1
%cmp30 = icmp eq i32 %inc29, 1000040
br i1 %cmp30, label %for.inc78, label %while.cond12
while.cond40: ; preds = %while.cond40.preheader, %if.else53
%index2.0 = phi i32 [ %inc63, %if.else53 ], [ 0, %while.cond40.preheader ]
br i1 %cmp.not11.i95, label %sti.exit107, label %while.body.i96
while.body.i96: ; preds = %while.cond40, %while.body.i96
%7 = phi i8 [ %8, %while.body.i96 ], [ %2, %while.cond40 ]
%sum.013.i97 = phi i64 [ %add5.i102, %while.body.i96 ], [ 0, %while.cond40 ]
%i.012.i98 = phi i64 [ %inc.i103, %while.body.i96 ], [ 0, %while.cond40 ]
%conv.i99 = sext i8 %7 to i64
%mul.i100 = mul nsw i64 %sum.013.i97, 10
%add.i101 = add nsw i64 %conv.i99, -64
%add5.i102 = add i64 %add.i101, %mul.i100
%inc.i103 = add nuw nsw i64 %i.012.i98, 1
%arrayidx.i104 = getelementptr inbounds i8, ptr %s, i64 %inc.i103
%8 = load i8, ptr %arrayidx.i104, align 1, !tbaa !11
%cmp.not.i105 = icmp eq i8 %8, 0
br i1 %cmp.not.i105, label %sti.exit107, label %while.body.i96, !llvm.loop !12
sti.exit107: ; preds = %while.body.i96, %while.cond40
%sum.0.lcssa.i106 = phi i64 [ 0, %while.cond40 ], [ %add5.i102, %while.body.i96 ]
%rem.i.i108 = srem i64 %sum.0.lcssa.i106, 1000033
%conv.i.i109 = trunc i64 %rem.i.i108 to i32
%rem.i3.i110 = srem i64 %sum.0.lcssa.i106, 1000032
%9 = trunc i64 %rem.i3.i110 to i32
%conv.i4.i111 = add nsw i32 %9, 1
%mul.i112 = mul nsw i32 %conv.i4.i111, %index2.0
%add.i113 = add nsw i32 %mul.i112, %conv.i.i109
%rem.i114 = srem i32 %add.i113, 1000033
%idxprom45 = sext i32 %rem.i114 to i64
%arrayidx46 = getelementptr inbounds [1000040 x [15 x i8]], ptr @stack, i64 0, i64 %idxprom45
%call49 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx46, ptr noundef nonnull dereferenceable(1) %s) #9
%cmp50 = icmp eq i32 %call49, 0
br i1 %cmp50, label %if.then71, label %if.else53
if.else53: ; preds = %sti.exit107
%call57 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx46, ptr noundef nonnull dereferenceable(4) @.str.1) #9
%cmp58 = icmp eq i32 %call57, 0
%inc63 = add nuw nsw i32 %index2.0, 1
%cmp64 = icmp eq i32 %inc63, 1000040
%or.cond = select i1 %cmp58, i1 true, i1 %cmp64
br i1 %or.cond, label %if.else73, label %while.cond40
if.then71: ; preds = %sti.exit107
%puts92 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %for.inc78
if.else73: ; preds = %if.else53
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc78
for.inc78: ; preds = %if.else, %for.body6, %if.then23, %if.then71, %if.else73
%inc79 = add nuw nsw i32 %i.1118, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc79, %10
br i1 %cmp5, label %for.body6, label %while.cond.loopexit, !llvm.loop !13
while.end81: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %s) #8
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %op) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn 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 @insert(i64 noundef %k, i32 noundef %i) local_unnamed_addr #4 {
entry:
%rem.i = srem i64 %k, 1000033
%conv.i = trunc i64 %rem.i to i32
%rem.i3 = srem i64 %k, 1000032
%0 = trunc i64 %rem.i3 to i32
%conv.i4 = add nsw i32 %0, 1
%mul = mul nsw i32 %conv.i4, %i
%add = add nsw i32 %mul, %conv.i
%rem = srem i32 %add, 1000033
ret i32 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @sti(ptr nocapture noundef readonly %s) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %s, align 1, !tbaa !11
%cmp.not11 = icmp eq i8 %0, 0
br i1 %cmp.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%1 = phi i8 [ %2, %while.body ], [ %0, %entry ]
%sum.013 = phi i64 [ %add5, %while.body ], [ 0, %entry ]
%i.012 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%conv = sext i8 %1 to i64
%mul = mul nsw i64 %sum.013, 10
%add = add i64 %mul, -64
%add5 = add i64 %add, %conv
%inc = add nuw nsw i64 %i.012, 1
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %inc
%2 = load i8, ptr %arrayidx, align 1, !tbaa !11
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add5, %while.body ]
ret i64 %sum.0.lcssa
}
; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i64 noundef %k) local_unnamed_addr #4 {
entry:
%rem = srem i64 %k, 1000033
%conv = trunc i64 %rem to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i64 noundef %k) local_unnamed_addr #4 {
entry:
%rem = srem i64 %k, 1000032
%0 = trunc i64 %rem to i32
%conv = add nsw i32 %0, 1
ret i32 %conv
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 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 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
#define N 1000000
#define L 14
char H[N][L];
int judge(char x);
int Key(char str[]);
int h1(int key);
int h2(int key);
int search(char str[]);
int insert(char str[]);
int main(void){
int i,n;
int h;
char com[9],str[L];
for(i = 0;i < N;i++){
H[i][0] = '\0';
}
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%s %s",com,str);
if(com[0] == 'i'){
insert(str);
} else {
if(search(str) != 0){
puts("yes");
} else {
puts("no");
}
}
}
return 0;
}
int judge(char x){
if(x == 'A'){
return 1;
} else if(x == 'C'){
return 2;
} else if(x == 'G'){
return 3;
} else if(x == 'T'){
return 4;
} else {
return 0;
}
}
int Key(char str[]){
int i;
int sum = 0;
int p = 1;
for(i = 0;i < strlen(str);i++){
sum += p*(judge(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){
return key%N;
}
int h2(int key){
return ( 1+(key%(N-1)) );
}
int search(char str[]){
int i;
int key,h;
key = Key(str);
for(i = 0;;i++)
{
h = (h1(key) + i*h2(key))%N;
if(strcmp(H[h], str) == 0){
return 1;
} else if(strlen(H[h]) == 0){
return 0;
}
}
return 0;
}
int insert(char str[]){
int i,h;
int key;
key = Key(str);
for(i = 0;;i++){
h = (h1(key) + i*h2(key))%N;
if(strcmp(H[h],str) == 0){
return 1;
} else if(strlen(H[h]) == 0){
strcpy(H[h],str);
return 0;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%com = alloca [9 x i8], align 1
%str = alloca [14 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #9
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #9
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp329 = icmp sgt i32 %0, 0
br i1 %cmp329, label %for.body4, label %for.end23
for.body4: ; preds = %for.end, %for.inc21
%i.130 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !12
br label %for.inc21
if.else: ; preds = %for.body4
%call13 = call i32 @search(ptr noundef nonnull %str), !range !12
%cmp14.not = icmp eq i32 %call13, 0
br i1 %cmp14.not, label %if.else18, label %if.then16
if.then16: ; preds = %if.else
%call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %for.inc21
if.else18: ; preds = %if.else
%call19 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %for.inc21
for.inc21: ; preds = %if.then, %if.else18, %if.then16
%inc22 = add nuw nsw i32 %i.130, 1
%2 = load i32, ptr %n, align 4, !tbaa !10
%cmp3 = icmp slt i32 %inc22, %2
br i1 %cmp3, label %for.body4, label %for.end23, !llvm.loop !13
for.end23: ; preds = %for.inc21, %for.end
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #9
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #3 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not.i = icmp eq i64 %call.i, 0
br i1 %cmp9.not.i, label %Key.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %Key.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %judge.exit.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %judge.exit.i.1 ]
%p.012.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul3.i.1, %judge.exit.i.1 ]
%sum.011.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %judge.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %judge.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %judge.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %judge.exit.i
judge.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %p.012.i
%add.i = add nuw nsw i32 %mul.i, %sum.011.i
%mul3.i = mul nsw i32 %p.012.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %judge.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.then10.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.then5.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.else16.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
judge.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %judge.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %judge.exit.i ]
%mul.i.1 = mul nsw i32 %retval.0.i.i.1, %mul3.i
%add.i.1 = add nuw nsw i32 %mul.i.1, %add.i
%mul3.i.1 = mul i32 %p.012.i, 25
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %Key.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !14
Key.exit.loopexit.unr-lcssa: ; preds = %judge.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %judge.exit.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %judge.exit.i.1 ]
%p.012.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul3.i.1, %judge.exit.i.1 ]
%sum.011.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %judge.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %Key.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %Key.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %judge.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
judge.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i32 %retval.0.i.i.epil, %p.012.i.unr
%add.i.epil = add nuw nsw i32 %mul.i.epil, %sum.011.i.unr
br label %Key.exit
Key.exit: ; preds = %judge.exit.i.epil, %Key.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %Key.exit.loopexit.unr-lcssa ], [ %add.i.epil, %judge.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%rem.i23 = srem i32 %sum.0.lcssa.i, 999999
%add.i24 = add nsw i32 %rem.i23, 1
%idxprom26 = sext i32 %rem.i to i64
%arrayidx27 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom26
%call328 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx27, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp29 = icmp eq i32 %call328, 0
br i1 %cmp29, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.030, 1
%mul = mul nsw i32 %inc, %add.i24
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000000
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call3, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %Key.exit, %for.cond
%arrayidx31 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx27, %Key.exit ]
%i.030 = phi i32 [ %inc, %for.cond ], [ 0, %Key.exit ]
%char0 = load i8, ptr %arrayidx31, align 1
%cmp8 = icmp eq i8 %char0, 0
br i1 %cmp8, label %if.then9, label %for.cond
if.then9: ; preds = %if.else
%call13 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx31, ptr noundef nonnull dereferenceable(1) %str) #9
br label %cleanup
cleanup: ; preds = %for.cond, %Key.exit, %if.then9
%retval.0 = phi i32 [ 0, %if.then9 ], [ 1, %Key.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @search(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not.i = icmp eq i64 %call.i, 0
br i1 %cmp9.not.i, label %Key.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %Key.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %judge.exit.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %judge.exit.i.1 ]
%p.012.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul3.i.1, %judge.exit.i.1 ]
%sum.011.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %judge.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %judge.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %judge.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %judge.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %judge.exit.i
judge.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %p.012.i
%add.i = add nuw nsw i32 %mul.i, %sum.011.i
%mul3.i = mul nsw i32 %p.012.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %judge.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.then10.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.then5.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
if.else16.i.i.1: ; preds = %judge.exit.i
br label %judge.exit.i.1
judge.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %judge.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %judge.exit.i ]
%mul.i.1 = mul nsw i32 %retval.0.i.i.1, %mul3.i
%add.i.1 = add nuw nsw i32 %mul.i.1, %add.i
%mul3.i.1 = mul i32 %p.012.i, 25
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %Key.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !14
Key.exit.loopexit.unr-lcssa: ; preds = %judge.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %judge.exit.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %judge.exit.i.1 ]
%p.012.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul3.i.1, %judge.exit.i.1 ]
%sum.011.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %judge.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %Key.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %Key.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %judge.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %judge.exit.i.epil
judge.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i32 %retval.0.i.i.epil, %p.012.i.unr
%add.i.epil = add nuw nsw i32 %mul.i.epil, %sum.011.i.unr
br label %Key.exit
Key.exit: ; preds = %judge.exit.i.epil, %Key.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %Key.exit.loopexit.unr-lcssa ], [ %add.i.epil, %judge.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%rem.i17 = srem i32 %sum.0.lcssa.i, 999999
%add.i18 = add nsw i32 %rem.i17, 1
%idxprom19 = sext i32 %rem.i to i64
%arrayidx20 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom19
%call321 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx20, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp22 = icmp eq i32 %call321, 0
br i1 %cmp22, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.023, 1
%mul = mul nsw i32 %inc, %add.i18
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000000
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%call3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call3, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %Key.exit, %for.cond
%arrayidx24 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx20, %Key.exit ]
%i.023 = phi i32 [ %inc, %for.cond ], [ 0, %Key.exit ]
%char0 = load i8, ptr %arrayidx24, align 1
%cmp8 = icmp eq i8 %char0, 0
br i1 %cmp8, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %Key.exit
%retval.0 = phi i32 [ 1, %Key.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @judge(i8 noundef signext %x) local_unnamed_addr #5 {
entry:
switch i8 %x, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @Key(ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not = icmp eq i64 %call, 0
br i1 %cmp9.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %judge.exit.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %judge.exit.1 ]
%p.012 = phi i32 [ 1, %for.body.preheader.new ], [ %mul3.1, %judge.exit.1 ]
%sum.011 = phi i32 [ 0, %for.body.preheader.new ], [ %add.1, %judge.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %judge.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %judge.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %judge.exit
if.then10.i: ; preds = %for.body
br label %judge.exit
if.then15.i: ; preds = %for.body
br label %judge.exit
if.else16.i: ; preds = %for.body
br label %judge.exit
judge.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i32 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i32 %retval.0.i, %p.012
%add = add nuw nsw i32 %mul, %sum.011
%mul3 = mul nsw i32 %p.012, 5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %judge.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %judge.exit
br label %judge.exit.1
if.then10.i.1: ; preds = %judge.exit
br label %judge.exit.1
if.then5.i.1: ; preds = %judge.exit
br label %judge.exit.1
if.else16.i.1: ; preds = %judge.exit
br label %judge.exit.1
judge.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %judge.exit
%retval.0.i.1 = phi i32 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %judge.exit ]
%mul.1 = mul nsw i32 %retval.0.i.1, %mul3
%add.1 = add nuw nsw i32 %mul.1, %add
%mul3.1 = mul i32 %p.012, 25
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !14
for.end.loopexit.unr-lcssa: ; preds = %judge.exit.1, %for.body.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.1, %judge.exit.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %judge.exit.1 ]
%p.012.unr = phi i32 [ 1, %for.body.preheader ], [ %mul3.1, %judge.exit.1 ]
%sum.011.unr = phi i32 [ 0, %for.body.preheader ], [ %add.1, %judge.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %judge.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %judge.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %judge.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %judge.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %judge.exit.epil
judge.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i32 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i32 %retval.0.i.epil, %p.012.unr
%add.epil = add nuw nsw i32 %mul.epil, %sum.011.unr
br label %for.end
for.end: ; preds = %judge.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %judge.exit.epil ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #5 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #5 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree 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 #6 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { 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 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{i32 0, i32 2}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + ( key % (M-1)); }
int find(char str[]){
long long key,i,h;
key = getKey(str);
i=0;
while(1){
h = (h1(key) + i*h2(key))% M;
if(strcmp(H[h],str) == 0)return 1;
else if(strlen(H[h]) == 0)return 0;
else {
i++;
}
}
return 0;
}
int insert(char str[]){
long long key,i,h;
key = getKey(str);
i=0;
while(1){
h = (h1(key) + i*h2(key))% M;
if(strcmp(H[h],str) == 0)return 1;
else if(strlen(H[h]) == 0){
strcpy(H[h],str);
return 0;
}
else{
i++;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246849/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246849/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 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 !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i22 = srem i32 %sum.0.lcssa.i, 999999
%add.i23 = add nsw i32 %rem.i22, 1
%conv5 = sext i32 %add.i23 to i64
%arrayidx24 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call625 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx24, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp26 = icmp eq i32 %call625, 0
br i1 %cmp26, label %cleanup, label %if.else
while.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.027, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx28 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx24, %getKey.exit ]
%i.027 = phi i64 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx28, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %while.cond
cleanup: ; preds = %while.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.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 %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i27 = srem i32 %sum.0.lcssa.i, 999999
%add.i28 = add nsw i32 %rem.i27, 1
%conv5 = sext i32 %add.i28 to i64
%arrayidx30 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call631 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx30, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp32 = icmp eq i32 %call631, 0
br i1 %cmp32, label %cleanup, label %if.else
while.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.033, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx34 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx30, %getKey.exit ]
%i.033 = phi i64 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx34, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %while.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx34, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %while.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %while.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1128979
#define S 20
char T[M][S];
void insert(long num ,char ch[]){
int i;
int h1 = num % M;
int h2 = 1 + (num % (M-1));
int h;
i=0;
while(i<M){
h = (h1 + i * h2)%M;
if(T[h][0]=='\0'){
strcpy(T[h],ch);
break;
}
i++;
}
}
int find(long num,char ch[]){
int i,f=0;
int h1 = num % M;
int h2 = 1 + num%(M-1);
int h;
i=0;
while(i < M){
h = (h1 + i * h2) % M;
if(strcmp(T[h],ch) == 0) return 1;
else if(strlen(T[h]) == 0) return 0;
i++;
}
return 0;
}
int main(){
int n,j,i;
long num,p;
char ch[12];
char com[7];
for(i=0; i<M; i++){
for(j=0; j<S; j++){
T[i][j]='\0';
}
}
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%s",com);
scanf("%s",ch);
num = 0;
p=1;
for(j=0; j<strlen(ch); j++){
if(ch[j] == 'A'){
num += 1*p;
}else if(ch[j] == 'C'){
num += 2*p;
}else if(ch[j] == 'G'){
num += 3*p;
}else if(ch[j] == 'T'){
num += 4*p;
}
p *= 3;
}
if(!strcmp("insert",com)){
insert(num,ch);
}else if(!strcmp("find",com)){
if(find(num,ch)){
printf("yes\n");
}else{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246942/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246942/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@T = dso_local global [1128979 x [20 x i8]] zeroinitializer, align 16
@.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 [7 x i8] c"insert\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"find\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(i64 noundef %num, ptr nocapture noundef readonly %ch) local_unnamed_addr #0 {
entry:
%rem = srem i64 %num, 1128979
%conv = trunc i64 %rem to i32
%rem1 = srem i64 %num, 1128978
%0 = trunc i64 %rem1 to i32
%conv2 = add nsw i32 %0, 1
br label %while.body
while.cond: ; preds = %while.body
%inc = or i32 %i.016, 1
%exitcond.not = icmp eq i32 %inc, 1128979
br i1 %exitcond.not, label %while.end, label %while.body.1, !llvm.loop !5
while.body.1: ; preds = %while.cond
%mul.1 = mul nsw i32 %inc, %conv2
%add4.1 = add nsw i32 %mul.1, %conv
%rem5.1 = srem i32 %add4.1, 1128979
%idxprom.1 = sext i32 %rem5.1 to i64
%arrayidx.1 = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom.1
%1 = load i8, ptr %arrayidx.1, align 4, !tbaa !7
%cmp8.1 = icmp eq i8 %1, 0
br i1 %cmp8.1, label %if.then, label %while.cond.1
while.cond.1: ; preds = %while.body.1
%inc.1 = add nuw nsw i32 %i.016, 2
br label %while.body
while.body: ; preds = %while.cond.1, %entry
%i.016 = phi i32 [ 0, %entry ], [ %inc.1, %while.cond.1 ]
%mul = mul nsw i32 %i.016, %conv2
%add4 = add nsw i32 %mul, %conv
%rem5 = srem i32 %add4, 1128979
%idxprom = sext i32 %rem5 to i64
%arrayidx = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 4, !tbaa !7
%cmp8 = icmp eq i8 %2, 0
br i1 %cmp8, label %if.then, label %while.cond
if.then: ; preds = %while.body.1, %while.body
%arrayidx.lcssa = phi ptr [ %arrayidx, %while.body ], [ %arrayidx.1, %while.body.1 ]
%call = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.lcssa, ptr noundef nonnull dereferenceable(1) %ch) #10
br label %while.end
while.end: ; preds = %while.cond, %if.then
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(i64 noundef %num, ptr nocapture noundef readonly %ch) local_unnamed_addr #3 {
entry:
%rem = srem i64 %num, 1128979
%conv = trunc i64 %rem to i32
%rem1 = srem i64 %num, 1128978
%0 = trunc i64 %rem1 to i32
%conv2 = add nsw i32 %0, 1
br label %while.body
while.body: ; preds = %if.else, %entry
%i.024 = phi i32 [ 0, %entry ], [ %inc, %if.else ]
%mul = mul nsw i32 %i.024, %conv2
%add4 = add nsw i32 %mul, %conv
%rem5 = srem i32 %add4, 1128979
%idxprom = sext i32 %rem5 to i64
%arrayidx = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %ch) #11
%cmp6 = icmp eq i32 %call, 0
br i1 %cmp6, label %cleanup, label %if.else
if.else: ; preds = %while.body
%char0 = load i8, ptr %arrayidx, align 4
%cmp12 = icmp eq i8 %char0, 0
%inc = add nuw nsw i32 %i.024, 1
%exitcond.not = icmp eq i32 %inc, 1128979
%or.cond = select i1 %cmp12, i1 true, i1 %exitcond.not
br i1 %or.cond, label %cleanup, label %while.body, !llvm.loop !10
cleanup: ; preds = %if.else, %while.body
%retval.0 = phi i32 [ 1, %while.body ], [ 0, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%ch = alloca [12 x i8], align 1
%com = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %ch) #10
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %com) #10
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(22579580) @T, i8 0, i64 22579580, i1 false), !tbaa !7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp10127 = icmp sgt i32 %0, 0
br i1 %cmp10127, label %for.body11, label %for.end80
for.body11: ; preds = %entry, %for.inc78
%i.1128 = phi i32 [ %inc79, %for.inc78 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com)
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %ch)
%call17 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #11
%cmp18122.not = icmp eq i64 %call17, 0
br i1 %cmp18122.not, label %for.end58, label %for.body20
for.body20: ; preds = %for.body11, %if.end54
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end54 ], [ 0, %for.body11 ]
%p.0125 = phi i64 [ %mul55, %if.end54 ], [ 1, %for.body11 ]
%num.0124 = phi i64 [ %num.1, %if.end54 ], [ 0, %for.body11 ]
%arrayidx22 = getelementptr inbounds [12 x i8], ptr %ch, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx22, align 1, !tbaa !7
switch i8 %1, label %if.end54 [
i8 65, label %if.then
i8 67, label %if.then31
i8 71, label %if.then40
i8 84, label %if.then49
]
if.then: ; preds = %for.body20
%add = add nsw i64 %p.0125, %num.0124
br label %if.end54
if.then31: ; preds = %for.body20
%mul32 = shl nuw nsw i64 %p.0125, 1
%add33 = add nsw i64 %mul32, %num.0124
br label %if.end54
if.then40: ; preds = %for.body20
%mul41 = mul nsw i64 %p.0125, 3
%add42 = add nsw i64 %mul41, %num.0124
br label %if.end54
if.then49: ; preds = %for.body20
%mul50 = shl nsw i64 %p.0125, 2
%add51 = add nsw i64 %mul50, %num.0124
br label %if.end54
if.end54: ; preds = %for.body20, %if.then31, %if.then49, %if.then40, %if.then
%num.1 = phi i64 [ %add, %if.then ], [ %add33, %if.then31 ], [ %add42, %if.then40 ], [ %add51, %if.then49 ], [ %num.0124, %for.body20 ]
%mul55 = mul nsw i64 %p.0125, 3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call17
br i1 %exitcond.not, label %for.end58, label %for.body20, !llvm.loop !13
for.end58: ; preds = %if.end54, %for.body11
%num.0.lcssa = phi i64 [ 0, %for.body11 ], [ %num.1, %if.end54 ]
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) @.str.2, ptr noundef nonnull dereferenceable(7) %com, i64 7)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.then61, label %if.else63
if.then61: ; preds = %for.end58
%rem.i = srem i64 %num.0.lcssa, 1128979
%conv.i = trunc i64 %rem.i to i32
%rem1.i = srem i64 %num.0.lcssa, 1128978
%2 = trunc i64 %rem1.i to i32
%conv2.i = add nsw i32 %2, 1
br label %while.body.i
while.cond.i: ; preds = %while.body.i
%inc.i = or i32 %i.016.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, 1128979
br i1 %exitcond.not.i, label %for.inc78, label %while.body.i.1, !llvm.loop !5
while.body.i.1: ; preds = %while.cond.i
%mul.i.1 = mul nsw i32 %inc.i, %conv2.i
%add4.i.1 = add nsw i32 %mul.i.1, %conv.i
%rem5.i.1 = srem i32 %add4.i.1, 1128979
%idxprom.i.1 = sext i32 %rem5.i.1 to i64
%arrayidx.i.1 = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom.i.1
%3 = load i8, ptr %arrayidx.i.1, align 4, !tbaa !7
%cmp8.i.1 = icmp eq i8 %3, 0
br i1 %cmp8.i.1, label %if.then.i, label %while.cond.i.1
while.cond.i.1: ; preds = %while.body.i.1
%inc.i.1 = add nuw nsw i32 %i.016.i, 2
br label %while.body.i
while.body.i: ; preds = %while.cond.i.1, %if.then61
%i.016.i = phi i32 [ 0, %if.then61 ], [ %inc.i.1, %while.cond.i.1 ]
%mul.i = mul nsw i32 %i.016.i, %conv2.i
%add4.i = add nsw i32 %mul.i, %conv.i
%rem5.i = srem i32 %add4.i, 1128979
%idxprom.i = sext i32 %rem5.i to i64
%arrayidx.i = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom.i
%4 = load i8, ptr %arrayidx.i, align 4, !tbaa !7
%cmp8.i = icmp eq i8 %4, 0
br i1 %cmp8.i, label %if.then.i, label %while.cond.i
if.then.i: ; preds = %while.body.i.1, %while.body.i
%arrayidx.i.lcssa = phi ptr [ %arrayidx.i, %while.body.i ], [ %arrayidx.i.1, %while.body.i.1 ]
%call.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i.lcssa, ptr noundef nonnull dereferenceable(1) %ch) #10
br label %for.inc78
if.else63: ; preds = %for.end58
%bcmp102 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) @.str.3, ptr noundef nonnull dereferenceable(5) %com, i64 5)
%tobool66.not = icmp eq i32 %bcmp102, 0
br i1 %tobool66.not, label %if.then67, label %for.inc78
if.then67: ; preds = %if.else63
%rem.i104 = srem i64 %num.0.lcssa, 1128979
%conv.i105 = trunc i64 %rem.i104 to i32
%rem1.i106 = srem i64 %num.0.lcssa, 1128978
%5 = trunc i64 %rem1.i106 to i32
%conv2.i107 = add nsw i32 %5, 1
br label %while.body.i108
while.body.i108: ; preds = %if.else.i, %if.then67
%i.024.i = phi i32 [ 0, %if.then67 ], [ %inc.i115, %if.else.i ]
%mul.i109 = mul nsw i32 %i.024.i, %conv2.i107
%add4.i110 = add nsw i32 %mul.i109, %conv.i105
%rem5.i111 = srem i32 %add4.i110, 1128979
%idxprom.i112 = sext i32 %rem5.i111 to i64
%arrayidx.i113 = getelementptr inbounds [1128979 x [20 x i8]], ptr @T, i64 0, i64 %idxprom.i112
%call.i114 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i113, ptr noundef nonnull dereferenceable(1) %ch) #11
%cmp6.i = icmp eq i32 %call.i114, 0
br i1 %cmp6.i, label %if.then71, label %if.else.i
if.else.i: ; preds = %while.body.i108
%char0.i = load i8, ptr %arrayidx.i113, align 4
%cmp12.i = icmp eq i8 %char0.i, 0
%inc.i115 = add nuw nsw i32 %i.024.i, 1
%exitcond.not.i116 = icmp eq i32 %inc.i115, 1128979
%or.cond.i = select i1 %cmp12.i, i1 true, i1 %exitcond.not.i116
br i1 %or.cond.i, label %if.else73, label %while.body.i108, !llvm.loop !10
if.then71: ; preds = %while.body.i108
%puts103 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc78
if.else73: ; preds = %if.else.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc78
for.inc78: ; preds = %while.cond.i, %if.then.i, %if.then71, %if.else73, %if.else63
%inc79 = add nuw nsw i32 %i.1128, 1
%6 = load i32, ptr %n, align 4, !tbaa !11
%cmp10 = icmp slt i32 %inc79, %6
br i1 %cmp10, label %for.body11, label %for.end80, !llvm.loop !14
for.end80: ; preds = %for.inc78, %entry
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %com) #10
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %ch) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
attributes #0 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind willreturn memory(argmem: read) }
attributes #8 = { nofree nounwind }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !6}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
|
#include <stdio.h>
int main(void)
{
int n;
int age;
int a_g[7] = {0};
int i;
while (1) {
scanf("%d", &n);
if (n == 0) {
break;
}
else {
for (i = 0; i < n; i++) {
scanf("%d", &age);
if ((age >= 0) && (age <= 9)) {
a_g[0]++;
}
else if ((age >= 10) && (age <= 19)) {
a_g[1]++;
}
else if ((age >= 20) && (age <= 29)) {
a_g[2]++;
}
else if ((age >= 30) && (age <= 39)) {
a_g[3]++;
}
else if ((age >= 40) && (age <= 49)) {
a_g[4]++;
}
else if ((age >= 50) && (age <= 59)) {
a_g[5]++;
}
else if (age >= 60) {
a_g[6]++;
}
}
}
printf("%d\n", a_g[0]);
a_g[0] = 0;
printf("%d\n", a_g[1]);
a_g[1] = 0;
printf("%d\n", a_g[2]);
a_g[2] = 0;
printf("%d\n", a_g[3]);
a_g[3] = 0;
printf("%d\n", a_g[4]);
a_g[4] = 0;
printf("%d\n", a_g[5]);
a_g[5] = 0;
printf("%d\n", a_g[6]);
a_g[6] = 0;
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246993/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%age = 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 %age) #3
%call109 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp110 = icmp eq i32 %0, 0
br i1 %cmp110, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end53
%1 = phi i32 [ %9, %if.end53 ], [ %0, %entry ]
%cmp194 = icmp sgt i32 %1, 0
br i1 %cmp194, label %for.body, label %if.end53
for.body: ; preds = %for.cond.preheader, %for.inc
%i.0102 = phi i32 [ %inc52, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.27.1101 = phi i32 [ %a_g.sroa.27.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.23.1100 = phi i32 [ %a_g.sroa.23.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.19.199 = phi i32 [ %a_g.sroa.19.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.15.198 = phi i32 [ %a_g.sroa.15.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.11.197 = phi i32 [ %a_g.sroa.11.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.7.196 = phi i32 [ %a_g.sroa.7.2, %for.inc ], [ 0, %for.cond.preheader ]
%a_g.sroa.0.195 = phi i32 [ %a_g.sroa.0.2, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %age)
%2 = load i32, ptr %age, align 4
%or.cond = icmp ult i32 %2, 10
br i1 %or.cond, label %if.then5, label %if.else6
if.then5: ; preds = %for.body
%inc = add nsw i32 %a_g.sroa.0.195, 1
br label %for.inc
if.else6: ; preds = %for.body
%3 = add i32 %2, -10
%or.cond75 = icmp ult i32 %3, 10
br i1 %or.cond75, label %if.then10, label %if.else13
if.then10: ; preds = %if.else6
%inc12 = add nsw i32 %a_g.sroa.7.196, 1
br label %for.inc
if.else13: ; preds = %if.else6
%4 = add i32 %2, -20
%or.cond76 = icmp ult i32 %4, 10
br i1 %or.cond76, label %if.then17, label %if.else20
if.then17: ; preds = %if.else13
%inc19 = add nsw i32 %a_g.sroa.11.197, 1
br label %for.inc
if.else20: ; preds = %if.else13
%5 = add i32 %2, -30
%or.cond77 = icmp ult i32 %5, 10
br i1 %or.cond77, label %if.then24, label %if.else27
if.then24: ; preds = %if.else20
%inc26 = add nsw i32 %a_g.sroa.15.198, 1
br label %for.inc
if.else27: ; preds = %if.else20
%6 = add i32 %2, -40
%or.cond78 = icmp ult i32 %6, 10
br i1 %or.cond78, label %if.then31, label %if.else34
if.then31: ; preds = %if.else27
%inc33 = add nsw i32 %a_g.sroa.19.199, 1
br label %for.inc
if.else34: ; preds = %if.else27
%7 = add i32 %2, -50
%or.cond79 = icmp ult i32 %7, 10
br i1 %or.cond79, label %if.then38, label %if.else41
if.then38: ; preds = %if.else34
%inc40 = add nsw i32 %a_g.sroa.23.1100, 1
br label %for.inc
if.else41: ; preds = %if.else34
%cmp42 = icmp sgt i32 %2, 59
%inc45 = zext i1 %cmp42 to i32
%spec.select = add nsw i32 %a_g.sroa.27.1101, %inc45
br label %for.inc
for.inc: ; preds = %if.else41, %if.then5, %if.then17, %if.then31, %if.then38, %if.then24, %if.then10
%a_g.sroa.0.2 = phi i32 [ %inc, %if.then5 ], [ %a_g.sroa.0.195, %if.then10 ], [ %a_g.sroa.0.195, %if.then17 ], [ %a_g.sroa.0.195, %if.then24 ], [ %a_g.sroa.0.195, %if.then31 ], [ %a_g.sroa.0.195, %if.then38 ], [ %a_g.sroa.0.195, %if.else41 ]
%a_g.sroa.7.2 = phi i32 [ %a_g.sroa.7.196, %if.then5 ], [ %inc12, %if.then10 ], [ %a_g.sroa.7.196, %if.then17 ], [ %a_g.sroa.7.196, %if.then24 ], [ %a_g.sroa.7.196, %if.then31 ], [ %a_g.sroa.7.196, %if.then38 ], [ %a_g.sroa.7.196, %if.else41 ]
%a_g.sroa.11.2 = phi i32 [ %a_g.sroa.11.197, %if.then5 ], [ %a_g.sroa.11.197, %if.then10 ], [ %inc19, %if.then17 ], [ %a_g.sroa.11.197, %if.then24 ], [ %a_g.sroa.11.197, %if.then31 ], [ %a_g.sroa.11.197, %if.then38 ], [ %a_g.sroa.11.197, %if.else41 ]
%a_g.sroa.15.2 = phi i32 [ %a_g.sroa.15.198, %if.then5 ], [ %a_g.sroa.15.198, %if.then10 ], [ %a_g.sroa.15.198, %if.then17 ], [ %inc26, %if.then24 ], [ %a_g.sroa.15.198, %if.then31 ], [ %a_g.sroa.15.198, %if.then38 ], [ %a_g.sroa.15.198, %if.else41 ]
%a_g.sroa.19.2 = phi i32 [ %a_g.sroa.19.199, %if.then5 ], [ %a_g.sroa.19.199, %if.then10 ], [ %a_g.sroa.19.199, %if.then17 ], [ %a_g.sroa.19.199, %if.then24 ], [ %inc33, %if.then31 ], [ %a_g.sroa.19.199, %if.then38 ], [ %a_g.sroa.19.199, %if.else41 ]
%a_g.sroa.23.2 = phi i32 [ %a_g.sroa.23.1100, %if.then5 ], [ %a_g.sroa.23.1100, %if.then10 ], [ %a_g.sroa.23.1100, %if.then17 ], [ %a_g.sroa.23.1100, %if.then24 ], [ %a_g.sroa.23.1100, %if.then31 ], [ %inc40, %if.then38 ], [ %a_g.sroa.23.1100, %if.else41 ]
%a_g.sroa.27.2 = phi i32 [ %a_g.sroa.27.1101, %if.then5 ], [ %a_g.sroa.27.1101, %if.then10 ], [ %a_g.sroa.27.1101, %if.then17 ], [ %a_g.sroa.27.1101, %if.then24 ], [ %a_g.sroa.27.1101, %if.then31 ], [ %a_g.sroa.27.1101, %if.then38 ], [ %spec.select, %if.else41 ]
%inc52 = add nuw nsw i32 %i.0102, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc52, %8
br i1 %cmp1, label %for.body, label %if.end53, !llvm.loop !9
if.end53: ; preds = %for.inc, %for.cond.preheader
%a_g.sroa.0.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.0.2, %for.inc ]
%a_g.sroa.7.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.7.2, %for.inc ]
%a_g.sroa.11.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.11.2, %for.inc ]
%a_g.sroa.15.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.15.2, %for.inc ]
%a_g.sroa.19.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.19.2, %for.inc ]
%a_g.sroa.23.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.23.2, %for.inc ]
%a_g.sroa.27.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a_g.sroa.27.2, %for.inc ]
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.0.1.lcssa)
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.7.1.lcssa)
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.11.1.lcssa)
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.15.1.lcssa)
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.19.1.lcssa)
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.23.1.lcssa)
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a_g.sroa.27.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end53, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %age) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int y[7];
int i,n,d;
for(;;){
scanf("%d",&n);
if(n==0)
break;
for(i=0;i<7;i++)
y[i]=0;
for(i=0;i<n;i++){
scanf("%d",&d);
d=d/10;
if(d>=7)
y[6]++;
else
y[d]++;
}
for(i=0;i<7;i++)
printf("%d\n",y[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247042/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%y = alloca [7 x i32], align 16
%n = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
br i1 %cmp40, label %for.end27, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%arrayidx9 = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 6
%arrayidx22.1.phi.trans.insert = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 1
%arrayidx22.2.phi.trans.insert = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 2
%arrayidx22.3.phi.trans.insert = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 3
%arrayidx22.4.phi.trans.insert = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 4
%arrayidx22.5.phi.trans.insert = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond18.preheader
%1 = phi i32 [ %0, %for.cond1.preheader.lr.ph ], [ %9, %for.cond18.preheader ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) %y, i8 0, i64 28, i1 false), !tbaa !5
%cmp436 = icmp sgt i32 %1, 0
br i1 %cmp436, label %for.body5, label %for.cond18.preheader
for.cond18.preheader.loopexit: ; preds = %for.inc15
%.pre = load i32, ptr %y, align 16, !tbaa !5
%.pre43 = load i32, ptr %arrayidx22.1.phi.trans.insert, align 4, !tbaa !5
%.pre44 = load i32, ptr %arrayidx22.2.phi.trans.insert, align 8, !tbaa !5
%.pre45 = load i32, ptr %arrayidx22.3.phi.trans.insert, align 4, !tbaa !5
%.pre46 = load i32, ptr %arrayidx22.4.phi.trans.insert, align 16, !tbaa !5
%.pre47 = load i32, ptr %arrayidx22.5.phi.trans.insert, align 4, !tbaa !5
%.pre48 = load i32, ptr %arrayidx9, align 8, !tbaa !5
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %for.cond1.preheader
%2 = phi i32 [ %.pre48, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%3 = phi i32 [ %.pre47, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%4 = phi i32 [ %.pre46, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%5 = phi i32 [ %.pre45, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%6 = phi i32 [ %.pre44, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%7 = phi i32 [ %.pre43, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%8 = phi i32 [ %.pre, %for.cond18.preheader.loopexit ], [ 0, %for.cond1.preheader ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
br i1 %cmp, label %for.end27, label %for.cond1.preheader
for.body5: ; preds = %for.cond1.preheader, %for.inc15
%i.137 = phi i32 [ %inc16, %for.inc15 ], [ 0, %for.cond1.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%10 = load i32, ptr %d, align 4, !tbaa !5
%div = sdiv i32 %10, 10
store i32 %div, ptr %d, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %10, 69
br i1 %cmp7, label %if.then8, label %if.else
if.then8: ; preds = %for.body5
%11 = load i32, ptr %arrayidx9, align 8, !tbaa !5
%inc10 = add nsw i32 %11, 1
store i32 %inc10, ptr %arrayidx9, align 8, !tbaa !5
br label %for.inc15
if.else: ; preds = %for.body5
%idxprom11 = sext i32 %div to i64
%arrayidx12 = getelementptr inbounds [7 x i32], ptr %y, i64 0, i64 %idxprom11
%12 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%inc13 = add nsw i32 %12, 1
store i32 %inc13, ptr %arrayidx12, align 4, !tbaa !5
br label %for.inc15
for.inc15: ; preds = %if.then8, %if.else
%inc16 = add nuw nsw i32 %i.137, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc16, %13
br i1 %cmp4, label %for.body5, label %for.cond18.preheader.loopexit, !llvm.loop !9
for.end27: ; preds = %for.cond18.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %y) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
return *(int*)a - *(int*)b;
}
int main(void){
int n;
int a[100000+5];
scanf("%d", &n);
for(int i=0; i<n; i++)scanf("%d", &a[i]);
qsort(a, n, sizeof(int), compare_int);
int ans=0;
int ptr=0;
while(ptr<n){
int num=a[ptr], cnt=0;
while(ptr<n && a[ptr]==num)ptr++, cnt++;
ans+=cnt%2;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247093/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247093/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%a = alloca [100005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400020, 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
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #5
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp230 = icmp sgt i32 %1, 0
br i1 %cmp230, label %while.body.preheader, label %while.end16
while.body.preheader: ; preds = %for.cond.cleanup
%2 = zext i32 %1 to i64
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
while.body: ; preds = %while.body.preheader, %while.end
%ptr.032 = phi i64 [ %indvars.iv36, %while.end ], [ 0, %while.body.preheader ]
%ans.031 = phi i32 [ %add, %while.end ], [ 0, %while.body.preheader ]
%sext = shl i64 %ptr.032, 32
%idxprom4 = ashr exact i64 %sext, 32
%arrayidx5 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %idxprom4
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %while.body, %while.body13
%indvars.iv36 = phi i64 [ %idxprom4, %while.body ], [ %indvars.iv.next37, %while.body13 ]
%cnt.029 = phi i32 [ 0, %while.body ], [ %inc15, %while.body13 ]
%arrayidx10 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %indvars.iv36
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %6, %5
br i1 %cmp11, label %while.body13, label %while.end
while.body13: ; preds = %land.rhs
%indvars.iv.next37 = add nsw i64 %indvars.iv36, 1
%inc15 = add nuw nsw i32 %cnt.029, 1
%cmp7 = icmp slt i64 %indvars.iv.next37, %2
br i1 %cmp7, label %land.rhs, label %while.end.thread, !llvm.loop !11
while.end.thread: ; preds = %while.body13
%rem41 = and i32 %inc15, 1
%add42 = add nuw nsw i32 %rem41, %ans.031
br label %while.end16
while.end: ; preds = %land.rhs
%7 = trunc i64 %indvars.iv36 to i32
%rem = and i32 %cnt.029, 1
%add = add nuw nsw i32 %rem, %ans.031
%cmp2 = icmp sgt i32 %1, %7
br i1 %cmp2, label %while.body, label %while.end16, !llvm.loop !12
while.end16: ; preds = %while.end, %while.end.thread, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %add42, %while.end.thread ], [ %add, %while.end ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400020, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
int asc(const void *a, const void *b){
long *A = (long *)a;
long *B = (long *)b;
if(*A > *B)
return 1;
if(*A < *B)
return -1;
return 0;
}
int main(){
int N, i, cnt=0, tag=0, ans=0;
long int a[100010];
scanf("%d", &N);
for(i=0; i<N; i++){
scanf("%ld", &a[i]);
}
qsort(a, N, sizeof(long int), asc);
for(i=0; i<N; i++){
int value = i;
int cnt=0;
for(int j=value;a[i]==a[j];j++){
cnt++;
value = j;
}
ans += cnt%2;
i = value;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247143/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247143/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
%a = alloca [100010 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 800080, 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 !9
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], 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 !9
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @asc) #5
%3 = load i32, ptr %N, align 4, !tbaa !9
%cmp343 = icmp sgt i32 %3, 0
br i1 %cmp343, label %for.body14.preheader, label %for.end21
for.body14.preheader: ; preds = %for.end, %for.cond.cleanup
%ans.045 = phi i32 [ %add, %for.cond.cleanup ], [ 0, %for.end ]
%i.144 = phi i32 [ %inc20, %for.cond.cleanup ], [ 0, %for.end ]
%idxprom8 = sext i32 %i.144 to i64
%arrayidx9 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %idxprom8
%4 = load i64, ptr %arrayidx9, align 8, !tbaa !5
br label %for.body14
for.cond.cleanup: ; preds = %for.body14
%5 = trunc i64 %indvars.iv49 to i32
%rem = and i32 %inc15, 1
%add = add nuw nsw i32 %rem, %ans.045
%inc20 = add nsw i32 %5, 1
%cmp3 = icmp slt i32 %inc20, %3
br i1 %cmp3, label %for.body14.preheader, label %for.end21, !llvm.loop !13
for.body14: ; preds = %for.body14.preheader, %for.body14
%indvars.iv49 = phi i64 [ %idxprom8, %for.body14.preheader ], [ %indvars.iv.next50, %for.body14 ]
%cnt6.039 = phi i32 [ 0, %for.body14.preheader ], [ %inc15, %for.body14 ]
%inc15 = add nuw nsw i32 %cnt6.039, 1
%indvars.iv.next50 = add i64 %indvars.iv49, 1
%arrayidx11 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv.next50
%6 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%cmp12 = icmp eq i64 %4, %6
br i1 %cmp12, label %for.body14, label %for.cond.cleanup, !llvm.loop !14
for.end21: ; preds = %for.cond.cleanup, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %for.cond.cleanup ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b){
return *(const int *)a - *(const int *)b;
}
int main(){
int N,A[100000];
int cnt,i;
cnt = 0;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
A[N]=0;
qsort(A,N,sizeof(int),cmp);
cnt = 0;
for(i=0;i<N;i++){
if(A[i]==A[i+1]){
i++;
}else{
cnt++;
}
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247194/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247194/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%A = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 400000, 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
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%idxprom2.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
%arrayidx3 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom2.pre-phi
store i32 0, ptr %arrayidx3, align 4, !tbaa !5
call void @qsort(ptr noundef nonnull %A, i64 noundef %idxprom2.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #5
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp530 = icmp sgt i32 %3, 0
br i1 %cmp530, label %for.body7, label %for.end18
for.body7: ; preds = %for.end, %for.body7
%i.132 = phi i32 [ %inc17, %for.body7 ], [ 0, %for.end ]
%cnt.031 = phi i32 [ %cnt.1, %for.body7 ], [ 0, %for.end ]
%idxprom8 = sext i32 %i.132 to i64
%arrayidx9 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom8
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add = add nsw i32 %i.132, 1
%idxprom10 = sext i32 %add to i64
%arrayidx11 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom10
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp ne i32 %4, %5
%inc15 = zext i1 %cmp12 to i32
%cnt.1 = add nuw nsw i32 %cnt.031, %inc15
%i.2 = select i1 %cmp12, i32 %i.132, i32 %add
%inc17 = add nsw i32 %i.2, 1
%cmp5 = icmp slt i32 %inc17, %3
br i1 %cmp5, label %for.body7, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.body7, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %cnt.1, %for.body7 ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int n;
int i,j;
int p;
int point;
int s[100] = {0};
for(j = 0;;j++){
point = 0;
do{
scanf("%d",&n);
}while(n % 4 != 0);
if(n == 0){break;}
for(i = 0; i < n/4; i++){
scanf("%d",&p);
point += p;
}
s[j] = point;
}
for(i = 0; i < j; i++){
printf("%d\n",s[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247237/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247237/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca i32, align 4
%s = 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 4, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %s, i8 0, i64 400, i1 false)
br label %for.cond
for.cond: ; preds = %for.end, %entry
%indvars.iv34 = phi i32 [ %indvars.iv.next35, %for.end ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.end ], [ 0, %entry ]
br label %do.body
do.body: ; preds = %do.body, %for.cond
%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, 3
%cmp.not = icmp eq i32 %1, 0
br i1 %cmp.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %do.body
%cmp1 = icmp eq i32 %0, 0
br i1 %cmp1, label %for.cond8.preheader, label %for.cond2.preheader
for.cond2.preheader: ; preds = %do.end
%cmp325 = icmp sgt i32 %0, 3
br i1 %cmp325, label %for.body, label %for.end
for.cond8.preheader: ; preds = %do.end
%2 = and i64 %indvars.iv, 4294967295
%cmp928.not = icmp eq i64 %2, 0
br i1 %cmp928.not, label %for.end16, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %indvars.iv34 to i64
br label %for.body10
for.body: ; preds = %for.cond2.preheader, %for.body
%point.027 = phi i32 [ %add, %for.body ], [ 0, %for.cond2.preheader ]
%i.026 = phi i32 [ %inc, %for.body ], [ 0, %for.cond2.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%3 = load i32, ptr %p, align 4, !tbaa !5
%add = add nsw i32 %3, %point.027
%inc = add nuw nsw i32 %i.026, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %4, 4
%cmp3 = icmp slt i32 %inc, %div
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond2.preheader
%point.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv
store i32 %point.0.lcssa, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next35 = add nuw i32 %indvars.iv34, 1
br label %for.cond
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv31 = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next32, %for.body10 ]
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv31
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%exitcond.not = icmp eq i64 %indvars.iv.next32, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body10, !llvm.loop !12
for.end16: ; preds = %for.body10, %for.cond8.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define N 4
int main(){
int i,n;
while (scanf("%d",&n)){
if (n==0)
break;
int t,cnt=0;
for (i=0;i<n/N;i++){
scanf("%d",&t);
cnt+=t;
}
printf("%d\n",cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247301/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247301/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool11 = icmp eq i32 %call10, 0
%0 = load i32, ptr %n, align 4
%cmp12 = icmp eq i32 %0, 0
%or.cond13 = select i1 %tobool11, i1 true, i1 %cmp12
br i1 %or.cond13, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%1 = phi i32 [ %4, %for.end ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%cmp17 = icmp sgt i32 %1, 3
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%cnt.09 = phi i32 [ %add, %for.body ], [ 0, %if.end ]
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%2 = load i32, ptr %t, align 4, !tbaa !5
%add = add nsw i32 %2, %cnt.09
%inc = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %3, 4
%cmp1 = icmp slt i32 %inc, %div
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %if.end
%cnt.0.lcssa = phi i32 [ 0, %if.end ], [ %add, %for.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp eq i32 %call, 0
%4 = load i32, ptr %n, align 4
%cmp = icmp eq i32 %4, 0
%or.cond = select i1 %tobool, i1 true, i1 %cmp
br i1 %or.cond, label %while.end, label %if.end, !llvm.loop !11
while.end: ; preds = %for.end, %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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare(const void *a, const void *b)
{
return *(int *)b - *(int *)a;
}
int main()
{
int na= 0;
int i;
int a[200010];
int b= 0;
printf("\n");
scanf("%d", &na);
for(i=0; i<na; i++)
{
scanf("%d", &a[i]);
}
qsort(a, na, sizeof(int), compare);
for(i=0; i<na; i++){
if(a[i]==a[i+1])
{
b++;
}
}
if(b==0)
{
printf("YES");
}
else
{
printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247345/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247345/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%na = alloca i32, align 4
%a = alloca [200010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %na) #7
store i32 0, ptr %na, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %a) #7
%putchar = tail call i32 @putchar(i32 10)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %na)
%0 = load i32, ptr %na, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre41 = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200010 x i32], ptr %a, i64 0, i64 %indvars.iv
%call2 = 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 %na, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre41, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare) #7
%3 = load i32, ptr %na, align 4, !tbaa !5
%cmp432 = icmp sgt i32 %3, 0
br i1 %cmp432, label %for.body6.preheader, label %if.end22
for.body6.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %3 to i64
%.pre = load i32, ptr %a, align 16, !tbaa !5
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body6.preheader46, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load45, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%4 = or i64 %index, 1
%5 = getelementptr inbounds [200010 x i32], ptr %a, i64 0, i64 %4
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load45 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load45, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%9 = icmp eq <4 x i32> %7, %wide.load
%10 = icmp eq <4 x i32> %8, %wide.load45
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi, %11
%14 = add <4 x i32> %vec.phi44, %12
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
%vector.recur.extract = extractelement <4 x i32> %wide.load45, i64 3
br i1 %cmp.n, label %for.end16, label %for.body6.preheader46
for.body6.preheader46: ; preds = %for.body6.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body6.preheader ]
%indvars.iv38.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body6.preheader ]
%b.034.ph = phi i32 [ %16, %middle.block ], [ 0, %for.body6.preheader ]
br label %for.body6
for.body6: ; preds = %for.body6.preheader46, %for.body6
%scalar.recur = phi i32 [ %17, %for.body6 ], [ %scalar.recur.ph, %for.body6.preheader46 ]
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.body6 ], [ %indvars.iv38.ph, %for.body6.preheader46 ]
%b.034 = phi i32 [ %spec.select, %for.body6 ], [ %b.034.ph, %for.body6.preheader46 ]
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%arrayidx10 = getelementptr inbounds [200010 x i32], ptr %a, i64 0, i64 %indvars.iv.next39
%17 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %scalar.recur, %17
%inc13 = zext i1 %cmp11 to i32
%spec.select = add nuw nsw i32 %b.034, %inc13
%exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body6, !llvm.loop !14
for.end16: ; preds = %for.body6, %middle.block
%spec.select.lcssa = phi i32 [ %16, %middle.block ], [ %spec.select, %for.body6 ]
%18 = icmp eq i32 %spec.select.lcssa, 0
%spec.select43 = select i1 %18, ptr @.str.2, ptr @.str.3
br label %if.end22
if.end22: ; preds = %for.end16, %for.end
%.str.3.sink = phi ptr [ @.str.2, %for.end ], [ %spec.select43, %for.end16 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %na) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
#include <stdlib.h>
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
int main() {
long int n;
scanf("%ld", &n);
long int num[n];
for(long int i=0; i<n; i++) {
scanf("%ld", &num[i]);
}
qsort(num, n, sizeof(long int), cmpfunc);
for(long int i=0; i<n-1; i++) {
if(num[i] == num[i+1]) {
printf("NO");
break;
}
if(i==(n-2)) {
printf("YES");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247396/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247396/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpfunc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !9
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !9
%cmp27 = icmp sgt i64 %2, 0
br i1 %cmp27, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %2, %entry ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 8, ptr noundef nonnull @cmpfunc) #6
%3 = load i64, ptr %n, align 8, !tbaa !9
%cmp430 = icmp sgt i64 %3, 1
br i1 %cmp430, label %for.body6, label %cleanup
for.body: ; preds = %entry, %for.body
%i.028 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.028
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.028, 1
%4 = load i64, ptr %n, align 8, !tbaa !9
%cmp = icmp slt i64 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.body6: ; preds = %for.cond.cleanup, %for.inc16
%5 = phi i64 [ %8, %for.inc16 ], [ %3, %for.cond.cleanup ]
%i2.031 = phi i64 [ %add, %for.inc16 ], [ 0, %for.cond.cleanup ]
%arrayidx7 = getelementptr inbounds i64, ptr %vla, i64 %i2.031
%6 = load i64, ptr %arrayidx7, align 8, !tbaa !9
%add = add nuw nsw i64 %i2.031, 1
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %add
%7 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%cmp9 = icmp eq i64 %6, %7
br i1 %cmp9, label %if.then, label %if.end
if.then: ; preds = %for.body6
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %for.body6
%sub11 = add nsw i64 %5, -2
%cmp12 = icmp eq i64 %i2.031, %sub11
br i1 %cmp12, label %if.then13, label %for.inc16
if.then13: ; preds = %if.end
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
%.pre = load i64, ptr %n, align 8, !tbaa !9
br label %for.inc16
for.inc16: ; preds = %if.end, %if.then13
%8 = phi i64 [ %5, %if.end ], [ %.pre, %if.then13 ]
%sub = add nsw i64 %8, -1
%cmp4 = icmp slt i64 %add, %sub
br i1 %cmp4, label %for.body6, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.inc16, %for.cond.cleanup, %if.then
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}
int main(){
int n;
scanf("%d",&n);
int s[n];
for(int i=0;i<n;i++){
scanf("%d",&s[i]);
}
qsort(s, n, sizeof(int), compare_int);
/*for(int i=0;i<n;i++){
printf("%d ",s[i]);
}*/
for(int i=1;i<n;i++){
if(s[i-1]==s[i]){
printf("NO");
return 0;
}
}
printf("YES");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247439/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247439/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"NO\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %3, 0
br i1 %cmp27, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre37 = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre37, %entry.for.cond.cleanup_crit_edge ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #6
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.not29 = icmp sgt i32 %4, 1
br i1 %cmp4.not29, label %for.body7.preheader, label %cleanup19
for.body7.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %4 to i64
%.pre = load i32, ptr %vla, align 16, !tbaa !5
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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.cond.cleanup, !llvm.loop !9
for.cond3: ; preds = %for.body7
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%exitcond.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count
br i1 %exitcond.not, label %cleanup19, label %for.body7, !llvm.loop !11
for.body7: ; preds = %for.body7.preheader, %for.cond3
%7 = phi i32 [ %.pre, %for.body7.preheader ], [ %8, %for.cond3 ]
%indvars.iv33 = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next34, %for.cond3 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv33
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %7, %8
br i1 %cmp12, label %cleanup19, label %for.cond3
cleanup19: ; preds = %for.cond3, %for.body7, %for.cond.cleanup
%.str.1.sink = phi ptr [ @.str.2, %for.cond.cleanup ], [ @.str.1, %for.body7 ], [ @.str.2, %for.cond3 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(void){
static char A[1000000010];
int N;
int num;
int ans;
scanf("%d",&N);
for(int i=0;i<1000000010;i++){
A[i]=0;
}
for(int i=0;i<N;i++){
scanf("%d",&num);
A[num]++;
if(A[num]>1){
printf("NO");
return 0;
}
}
printf("YES");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247482/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247482/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.A = internal unnamed_addr global [1000000010 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%num = 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 %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000010) @main.A, i8 0, i64 1000000010, i1 false), !tbaa !5
%0 = load i32, ptr %N, align 4, !tbaa !8
%cmp3.not26 = icmp sgt i32 %0, 0
br i1 %cmp3.not26, label %for.body5, label %cleanup19
for.cond2: ; preds = %for.body5
%inc16 = add nuw nsw i32 %i1.027, 1
%1 = load i32, ptr %N, align 4, !tbaa !8
%cmp3.not = icmp slt i32 %inc16, %1
br i1 %cmp3.not, label %for.body5, label %cleanup19, !llvm.loop !10
for.body5: ; preds = %entry, %for.cond2
%i1.027 = phi i32 [ %inc16, %for.cond2 ], [ 0, %entry ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%2 = load i32, ptr %num, align 4, !tbaa !8
%idxprom7 = sext i32 %2 to i64
%arrayidx8 = getelementptr inbounds [1000000010 x i8], ptr @main.A, i64 0, i64 %idxprom7
%3 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%inc9 = add i8 %3, 1
store i8 %inc9, ptr %arrayidx8, align 1, !tbaa !5
%cmp12 = icmp sgt i8 %inc9, 1
br i1 %cmp12, label %cleanup19, label %for.cond2
cleanup19: ; preds = %for.cond2, %for.body5, %entry
%.str.1.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %for.body5 ], [ @.str.2, %for.cond2 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int isPrimeNumber(int target_number);
int main ( void ) {
int target_number = 0;
int loop = 0;
int Max_number = 0;
int number_of_prime_numbers = 0;
int flag_not_prime_number = 0;
scanf ( "%d", &Max_number );
for ( loop = 0; loop < Max_number; loop++ ) {
scanf ( "%d", &target_number );
flag_not_prime_number = isPrimeNumber(target_number);
if ( flag_not_prime_number == 0 ) {
number_of_prime_numbers++;
}
}
printf("%d\n", number_of_prime_numbers);
return 0;
}
int isPrimeNumber(int target_number)
{
int flag_not_prime_number = 0;
int divisor = 2;
while ( divisor*divisor <= target_number ) {
if ( target_number % divisor == 0 ) {
flag_not_prime_number = 1;
break;
}
divisor++;
}
return flag_not_prime_number;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247532/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247532/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%target_number = alloca i32, align 4
%Max_number = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %target_number) #4
store i32 0, ptr %target_number, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Max_number) #4
store i32 0, ptr %Max_number, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Max_number)
%0 = load i32, ptr %Max_number, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %for.end
for.body: ; preds = %entry, %isPrimeNumber.exit
%number_of_prime_numbers.014 = phi i32 [ %2, %isPrimeNumber.exit ], [ 0, %entry ]
%loop.013 = phi i32 [ %inc4, %isPrimeNumber.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %target_number)
%1 = load i32, ptr %target_number, align 4, !tbaa !5
%cmp.not6.i = icmp slt i32 %1, 4
br i1 %cmp.not6.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%inc.i = add nuw nsw i32 %divisor.07.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp.not.i, label %.loopexit, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %for.body, %while.cond.i
%divisor.07.i = phi i32 [ %inc.i, %while.cond.i ], [ 2, %for.body ]
%rem.i = srem i32 %1, %divisor.07.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %isPrimeNumber.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body
%inc10 = add nsw i32 %number_of_prime_numbers.014, 1
br label %isPrimeNumber.exit
isPrimeNumber.exit: ; preds = %while.body.i, %.loopexit
%2 = phi i32 [ %inc10, %.loopexit ], [ %number_of_prime_numbers.014, %while.body.i ]
%inc4 = add nuw nsw i32 %loop.013, 1
%3 = load i32, ptr %Max_number, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %isPrimeNumber.exit, %entry
%number_of_prime_numbers.0.lcssa = phi i32 [ 0, %entry ], [ %2, %isPrimeNumber.exit ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %number_of_prime_numbers.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Max_number) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %target_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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrimeNumber(i32 noundef %target_number) local_unnamed_addr #3 {
entry:
%cmp.not6 = icmp slt i32 %target_number, 4
br i1 %cmp.not6, label %while.end, label %while.body
while.cond: ; preds = %while.body
%inc = add nuw nsw i32 %divisor.07, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not = icmp sgt i32 %mul, %target_number
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.body: ; preds = %entry, %while.cond
%divisor.07 = phi i32 [ %inc, %while.cond ], [ 2, %entry ]
%rem = srem i32 %target_number, %divisor.07
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %while.end, label %while.cond
while.end: ; preds = %while.cond, %while.body, %entry
%flag_not_prime_number.0 = phi i32 [ 0, %entry ], [ 1, %while.body ], [ 0, %while.cond ]
ret i32 %flag_not_prime_number.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#define MAX 10000
int main(){
int x[MAX], n, i, j;
int count = 0;
scanf("%d", &n);
for(i = 0; i < n; i++) scanf("%d", &x[i]);
for(i = 0; i < n; i++){
if((x[i] == 2 || x[i] % 2 == 1) && x[i] != 1){
for(j = 3; j <= sqrt(x[i]); j += 2){
if(x[i] % j == 0) break;
}
if(j > sqrt(x[i])) count++;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247576/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #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
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %for.end43
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end43
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.inc41
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.inc41 ], [ 0, %for.cond2.preheader ]
%count.071 = phi i32 [ %count.1, %for.inc41 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv74
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp ne i32 %4, 2
%5 = and i32 %4, -2147483647
%cmp10 = icmp ne i32 %5, 1
%or.cond.not60 = and i1 %cmp7, %cmp10
%cmp13.not = icmp eq i32 %4, 1
%or.cond59 = or i1 %cmp13.not, %or.cond.not60
br i1 %or.cond59, label %for.inc41, label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.body4
%conv1763 = sitofp i32 %4 to double
%call1864 = call double @sqrt(double noundef %conv1763) #4
%cmp1965 = fcmp ult double %call1864, 3.000000e+00
br i1 %cmp1965, label %for.end29, label %for.body21.preheader
for.body21.preheader: ; preds = %for.cond14.preheader
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem2478 = srem i32 %6, 3
%cmp2579 = icmp eq i32 %rem2478, 0
br i1 %cmp2579, label %for.end29, label %for.cond14
for.cond14: ; preds = %for.body21.preheader, %for.body21
%7 = phi i32 [ %8, %for.body21 ], [ %6, %for.body21.preheader ]
%j.06680 = phi i32 [ %add, %for.body21 ], [ 3, %for.body21.preheader ]
%add = add nuw nsw i32 %j.06680, 2
%conv = sitofp i32 %add to double
%conv17 = sitofp i32 %7 to double
%call18 = call double @sqrt(double noundef %conv17) #4
%cmp19 = fcmp ult double %call18, %conv
br i1 %cmp19, label %for.end29, label %for.body21, !llvm.loop !11
for.body21: ; preds = %for.cond14
%8 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem24 = srem i32 %8, %add
%cmp25 = icmp eq i32 %rem24, 0
br i1 %cmp25, label %for.end29, label %for.cond14, !llvm.loop !11
for.end29: ; preds = %for.body21, %for.cond14, %for.body21.preheader, %for.cond14.preheader
%conv.lcssa = phi double [ 3.000000e+00, %for.cond14.preheader ], [ 3.000000e+00, %for.body21.preheader ], [ %conv, %for.cond14 ], [ %conv, %for.body21 ]
%9 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%conv33 = sitofp i32 %9 to double
%call34 = call double @sqrt(double noundef %conv33) #4
%cmp35 = fcmp olt double %call34, %conv.lcssa
br i1 %cmp35, label %if.then37, label %for.inc41
if.then37: ; preds = %for.end29
%inc38 = add nsw i32 %count.071, 1
br label %for.inc41
for.inc41: ; preds = %for.body4, %if.then37, %for.end29
%count.1 = phi i32 [ %inc38, %if.then37 ], [ %count.071, %for.end29 ], [ %count.071, %for.body4 ]
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp3 = icmp slt i64 %indvars.iv.next75, %11
br i1 %cmp3, label %for.body4, label %for.end43, !llvm.loop !12
for.end43: ; preds = %for.inc41, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1, %for.inc41 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int num[10000];
int main( void )
{
int n;
scanf( "%d", &n );
int i, j;
int cnt = n;
for( i=0; i<n; i++ ) {
scanf( "%d", &num[i] );
}
for( i=0; i<n; i++ ) {
if( 2 == *(num+i) ) { continue; }
if( 0 == *(num+i)%2 ) {
cnt--;
} else {
int max = sqrt( num[i] );
for( j=3; j<=max; j+=2 ) {
if( 0 == *(num+i)%j ) {
cnt--;
break;
}
}
}
}
printf( "%d\n", cnt );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@num = dso_local global [10000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.end31
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end31
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.inc29
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.inc29 ], [ 0, %for.cond2.preheader ]
%cnt.050 = phi i32 [ %cnt.2, %for.inc29 ], [ %0, %for.cond2.preheader ]
%add.ptr = getelementptr inbounds i32, ptr @num, i64 %indvars.iv53
%4 = load i32, ptr %add.ptr, align 4, !tbaa !5
%cmp5 = icmp eq i32 %4, 2
br i1 %cmp5, label %for.inc29, label %if.end
if.end: ; preds = %for.body4
%5 = and i32 %4, 1
%cmp8 = icmp eq i32 %5, 0
br i1 %cmp8, label %if.then9, label %if.else
if.then9: ; preds = %if.end
%dec = add nsw i32 %cnt.050, -1
br label %for.inc29
if.else: ; preds = %if.end
%conv = sitofp i32 %4 to double
%call12 = call double @sqrt(double noundef %conv) #4
%conv13 = fptosi double %call12 to i32
%cmp15.not47 = icmp slt i32 %conv13, 3
br i1 %cmp15.not47, label %for.inc29, label %for.body17.lr.ph
for.body17.lr.ph: ; preds = %if.else
%6 = load i32, ptr %add.ptr, align 4, !tbaa !5
br label %for.body17
for.cond14: ; preds = %for.body17
%add = add nuw nsw i32 %j.048, 2
%cmp15.not = icmp sgt i32 %add, %conv13
br i1 %cmp15.not, label %for.inc29, label %for.body17, !llvm.loop !11
for.body17: ; preds = %for.body17.lr.ph, %for.cond14
%j.048 = phi i32 [ 3, %for.body17.lr.ph ], [ %add, %for.cond14 ]
%rem20 = srem i32 %6, %j.048
%cmp21 = icmp eq i32 %rem20, 0
br i1 %cmp21, label %if.then23, label %for.cond14
if.then23: ; preds = %for.body17
%dec24 = add nsw i32 %cnt.050, -1
br label %for.inc29
for.inc29: ; preds = %for.cond14, %if.else, %if.then23, %if.then9, %for.body4
%cnt.2 = phi i32 [ %cnt.050, %for.body4 ], [ %dec, %if.then9 ], [ %dec24, %if.then23 ], [ %cnt.050, %if.else ], [ %cnt.050, %for.cond14 ]
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next54, %8
br i1 %cmp3, label %for.body4, label %for.end31, !llvm.loop !12
for.end31: ; preds = %for.inc29, %entry, %for.cond2.preheader
%cnt.0.lcssa = phi i32 [ %0, %for.cond2.preheader ], [ %0, %entry ], [ %cnt.2, %for.inc29 ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
#define false 0
#define true 1
int isprime(int);
static const int N = 10000;
int main(){
int n, i, j, count=0;
int A[N];
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &A[i]);
}
for(i=0;i<n;i++){
if(isprime(A[i])== 1) count++;
}
printf("%d\n", count);
return 0;
}
int isprime(int x){
int i = 3;
if (x == 2) return true;
if (x < 2 || x%2 == 0)return false;
while( i <= sqrt(x)) {
if( x%i == 0) return false;
i = i + 2;
}
return true;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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) #6
%0 = tail call ptr @llvm.stacksave.p0()
%vla20 = alloca [10000 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %1, 0
br i1 %cmp24, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%2 = icmp sgt i32 %3, 0
br i1 %2, 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 %vla20, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.cond2
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.cond2 ], [ 0, %for.cond2.preheader ]
%count.028 = phi i32 [ %6, %for.cond2 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla20, i64 %indvars.iv30
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp.i = icmp eq i32 %5, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body4
%cmp1.i = icmp slt i32 %5, 2
%rem.i = and i32 %5, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond2, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %5 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #6
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #6
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %while.body.i, !llvm.loop !11
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %5, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond2, label %while.cond.i
isprime.exit.thread: ; preds = %while.cond.i, %for.body4, %while.cond.preheader.i
%inc923 = add nsw i32 %count.028, 1
br label %for.cond2
for.cond2: ; preds = %while.body.i, %if.end.i, %isprime.exit.thread
%6 = phi i32 [ %inc923, %isprime.exit.thread ], [ %count.028, %if.end.i ], [ %count.028, %while.body.i ]
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.cond2, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %6, %for.cond2 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #4 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #6
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #6
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
int gcd(int);
int main() {
int i, n, pn[10000], count = 0;
scanf("%d", &n);
for(i = 0;i < n;i++) {
scanf("%d",&pn[i]);
if(pn[i] == 2) count++;
else if(pn[i] % 2 == 0) continue;
else count += gcd(pn[i]);
}
printf("%d\n",count);
return 0;
}
int gcd(int n) {
int i;
for(i = 3;i <= sqrt(n);i+=2) {
if(n % i == 0) return 0;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%pn = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %pn) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%count.025 = phi i32 [ %count.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %pn, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp eq i32 %1, 2
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %count.025, 1
br label %for.inc
if.else: ; preds = %for.body
%2 = and i32 %1, 1
%cmp7 = icmp eq i32 %2, 0
br i1 %cmp7, label %for.inc, label %if.else9
if.else9: ; preds = %if.else
%conv1.i = sitofp i32 %1 to double
%call8.i = call double @sqrt(double noundef %conv1.i) #5
%cmp9.i = fcmp ult double %call8.i, 3.000000e+00
br i1 %cmp9.i, label %gcd.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.010.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv1.i) #5
%cmp.i = fcmp ult double %call.i, %conv.i
br i1 %cmp.i, label %gcd.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %if.else9, %for.cond.i
%i.010.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %if.else9 ]
%rem.i = srem i32 %1, %i.010.i
%cmp3.i = icmp eq i32 %rem.i, 0
br i1 %cmp3.i, label %gcd.exit, label %for.cond.i
gcd.exit: ; preds = %for.cond.i, %for.body.i, %if.else9
%retval.0.i = phi i32 [ 1, %if.else9 ], [ 0, %for.body.i ], [ 1, %for.cond.i ]
%add = add nsw i32 %retval.0.i, %count.025
br label %for.inc
for.inc: ; preds = %if.then, %gcd.exit, %if.else
%count.1 = phi i32 [ %inc, %if.then ], [ %count.025, %if.else ], [ %add, %gcd.exit ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %for.inc ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %pn) #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 memory(write) uwtable
define dso_local i32 @gcd(i32 noundef %n) local_unnamed_addr #3 {
entry:
%conv1 = sitofp i32 %n to double
%call8 = tail call double @sqrt(double noundef %conv1) #5
%cmp9 = fcmp ult double %call8, 3.000000e+00
br i1 %cmp9, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.010, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv1) #5
%cmp = fcmp ult double %call, %conv
br i1 %cmp, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%i.010 = phi i32 [ %add, %for.cond ], [ 3, %entry ]
%rem = srem i32 %n, %i.010
%cmp3 = icmp eq i32 %rem, 0
br i1 %cmp3, label %cleanup, label %for.cond
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
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
int x[10000000];
int main(){
int n,i,j,count=0,f=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<n;i++){
if(x[i]==1) continue;
if(x[i]==2){
count++;
continue;
}
if(x[i]%2==0) continue;
else {
for(j=2;j<=sqrt(x[i]);j++){
if((x[i]%j)==0) {
f=1;
break;
}
}
if(f==0) {
count++;
}
f=0;
// printf("count: %d\n",count);
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247813/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@x = dso_local global [10000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %for.end44
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end44
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000000 x i32], ptr @x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.inc42
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.inc42 ], [ 0, %for.cond2.preheader ]
%count.067 = phi i32 [ %count.2, %for.inc42 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000000 x i32], ptr @x, i64 0, i64 %indvars.iv69
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
switch i32 %4, label %if.end13 [
i32 1, label %for.inc42
i32 2, label %if.then11
]
if.then11: ; preds = %for.body4
%inc12 = add nsw i32 %count.067, 1
br label %for.inc42
if.end13: ; preds = %for.body4
%5 = and i32 %4, 1
%cmp16 = icmp eq i32 %5, 0
br i1 %cmp16, label %for.inc42, label %for.cond18.preheader
for.cond18.preheader: ; preds = %if.end13
%conv2161 = sitofp i32 %4 to double
%call2262 = call double @sqrt(double noundef %conv2161) #4
%cmp2363 = fcmp ult double %call2262, 2.000000e+00
br i1 %cmp2363, label %if.then38, label %for.body25
for.cond18: ; preds = %for.body25
%inc34 = add nuw nsw i32 %j.064, 1
%conv = sitofp i32 %inc34 to double
%conv21 = sitofp i32 %6 to double
%call22 = call double @sqrt(double noundef %conv21) #4
%cmp23 = fcmp ult double %call22, %conv
br i1 %cmp23, label %if.then38, label %for.body25, !llvm.loop !11
for.body25: ; preds = %for.cond18.preheader, %for.cond18
%j.064 = phi i32 [ %inc34, %for.cond18 ], [ 2, %for.cond18.preheader ]
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem28 = srem i32 %6, %j.064
%cmp29 = icmp eq i32 %rem28, 0
br i1 %cmp29, label %for.inc42, label %for.cond18
if.then38: ; preds = %for.cond18, %for.cond18.preheader
%inc39 = add nsw i32 %count.067, 1
br label %for.inc42
for.inc42: ; preds = %for.body25, %if.then38, %for.body4, %if.end13, %if.then11
%count.2 = phi i32 [ %count.067, %for.body4 ], [ %inc12, %if.then11 ], [ %count.067, %if.end13 ], [ %inc39, %if.then38 ], [ %count.067, %for.body25 ]
%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
%cmp3 = icmp slt i64 %indvars.iv.next70, %8
br i1 %cmp3, label %for.body4, label %for.end44, !llvm.loop !12
for.end44: ; preds = %for.inc42, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.2, %for.inc42 ]
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <math.h>
#include <stdio.h>
int isprime(long x){
int i;
if(x==2) return 1;
if(x<2 || (x%2)==0) return 0;
for(i=3; i<=sqrt(x); i+=2){
if(x%i==0)return 0;
}
return 1;
}
int main(void){
long x;
int n;
int i,cnt=0;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%ld",&x);
if(isprime(x)==1) cnt++;
}
printf("%d\n",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247857/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247857/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isprime(i64 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i64 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i64 %x, 2
%rem = and i64 %x, 1
%cmp2 = icmp eq i64 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%conv5 = sitofp i64 %x to double
%call20 = tail call double @sqrt(double noundef %conv5) #5
%cmp621 = fcmp ult double %call20, 3.000000e+00
br i1 %cmp621, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%0 = trunc i64 %indvars.iv.next to i32
%conv = sitofp i32 %0 to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 3, %for.cond.preheader ]
%rem9 = srem i64 %x, %indvars.iv
%cmp10 = icmp eq i64 %rem9, 0
br i1 %cmp10, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%x = alloca i64, align 8
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #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 !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%cnt.013 = phi i32 [ %3, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i64, ptr %x, align 8, !tbaa !11
%cmp.i = icmp eq i64 %1, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i64 %1, 2
%rem.i = and i64 %1, 1
%cmp2.i = icmp eq i64 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i64 %1 to double
%call20.i = call double @sqrt(double noundef %conv5.i) #5
%cmp621.i = fcmp ult double %call20.i, 3.000000e+00
br i1 %cmp621.i, label %isprime.exit.thread, label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 2
%2 = trunc i64 %indvars.iv.next.i to i32
%conv.i = sitofp i32 %2 to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem9.i = srem i64 %1, %indvars.iv.i
%cmp10.i = icmp eq i64 %rem9.i, 0
br i1 %cmp10.i, label %for.cond, label %for.cond.i
isprime.exit.thread: ; preds = %for.cond.i, %for.body, %for.cond.preheader.i
%inc10 = add nsw i32 %cnt.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end.i, %isprime.exit.thread
%3 = phi i32 [ %inc10, %isprime.exit.thread ], [ %cnt.013, %if.end.i ], [ %cnt.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%4 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc4, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.cond, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = distinct !{!13, !6}
|
#include<stdio.h>
int main()
{
int a,b,c,i,k;
scanf("%d%d%d",&a,&b,&c);
for(i=a;i>=0;i--)
{
if(b>=(2*i) && c>=(4*i)){
k=7*i;
break;
}
}
printf("%d\n",k);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24790/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%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
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i32 [ %0, %entry ], [ %dec, %for.cond ]
%cmp = icmp sgt i32 %i.0, -1
call void @llvm.assume(i1 %cmp)
%mul = shl nuw nsw i32 %i.0, 1
%cmp1.not = icmp slt i32 %1, %mul
%mul2 = shl nsw i32 %i.0, 2
%cmp3.not = icmp slt i32 %2, %mul2
%or.cond = select i1 %cmp1.not, i1 true, i1 %cmp3.not
%dec = add nsw i32 %i.0, -1
br i1 %or.cond, label %for.cond, label %if.then, !llvm.loop !9
if.then: ; preds = %for.cond
%mul4 = mul nsw i32 %i.0, 7
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int isprime(int);
int main()
{
int n, i, j, count=0, p[10000];
scanf("%d",&n);
for( i=0 ; i<n ; i++ ){
scanf("%d",&p[i]);
count += isprime(p[i]);
}
printf("%d\n",count);
return 0;
}
int isprime(int x)
{
int i;
if(x==2) return 1;
if(x<2 || x%2==0) return 0;
i=3;
while(i<=sqrt(x)){
if(x%i==0) return 0;
i = i+2;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247943/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247943/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %p) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %isprime.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %isprime.exit ], [ 0, %entry ]
%count.012 = phi i32 [ %add, %isprime.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %isprime.exit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %isprime.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isprime.exit, label %while.cond.i
isprime.exit: ; preds = %while.cond.i, %while.body.i, %for.body, %if.end.i, %while.cond.preheader.i
%retval.0.i = phi i32 [ 1, %for.body ], [ 0, %if.end.i ], [ 1, %while.cond.preheader.i ], [ 1, %while.cond.i ], [ 0, %while.body.i ]
%add = add nuw nsw i32 %retval.0.i, %count.012
%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 !11
for.end: ; preds = %isprime.exit, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %add, %isprime.exit ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int main () {
int a[10000], b=0, n, i, j, m=0, z;
scanf("%d", &n);
for(i = 0 ; i < n ; i++) {
scanf("%d", &a[i]);
}
for(i = 0 ; i < n ; i++) {
z = (double)sqrt(a[i]);
for(j = 2 ; j <= z ; j++) {
if(a[i] % j == 0) {
b++;
break;
}
}
if(b == 0) m++;
b = 0;
}
printf("%d\n", m);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247987/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247987/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%a = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, 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
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end28
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end28
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw 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.end20
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.end20 ], [ 0, %for.cond2.preheader ]
%m.048 = phi i32 [ %spec.select, %for.end20 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv51
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%conv = sitofp i32 %4 to double
%call7 = call double @sqrt(double noundef %conv) #4
%conv8 = fptosi double %call7 to i32
%cmp10.not42 = icmp slt i32 %conv8, 2
br i1 %cmp10.not42, label %for.end20, label %for.body12.lr.ph
for.body12.lr.ph: ; preds = %for.body4
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%6 = and i32 %5, 1
%cmp1556 = icmp eq i32 %6, 0
br i1 %cmp1556, label %for.end20, label %for.cond9
for.cond9: ; preds = %for.body12.lr.ph, %for.body12
%j.04357 = phi i32 [ %inc19, %for.body12 ], [ 2, %for.body12.lr.ph ]
%exitcond = icmp eq i32 %j.04357, %conv8
br i1 %exitcond, label %for.end20.loopexit, label %for.body12, !llvm.loop !11
for.body12: ; preds = %for.cond9
%inc19 = add nuw i32 %j.04357, 1
%rem = srem i32 %5, %inc19
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %for.end20.loopexit, label %for.cond9, !llvm.loop !11
for.end20.loopexit: ; preds = %for.cond9, %for.body12
%cmp10.not.le = icmp sge i32 %j.04357, %conv8
br label %for.end20
for.end20: ; preds = %for.end20.loopexit, %for.body12.lr.ph, %for.body4
%cmp10.not.lcssa = phi i1 [ true, %for.body4 ], [ false, %for.body12.lr.ph ], [ %cmp10.not.le, %for.end20.loopexit ]
%inc24 = zext i1 %cmp10.not.lcssa to i32
%spec.select = add nuw nsw i32 %m.048, %inc24
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next52, %8
br i1 %cmp3, label %for.body4, label %for.end28, !llvm.loop !12
for.end28: ; preds = %for.end20, %entry, %for.cond2.preheader
%m.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select, %for.end20 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int isprime(int);
int main(){
int n, a, i, b;
int count=0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a);
b = isprime(a);
if(b == 1)
count++;
}
printf("%d\n", count);
return 0;
}
int isprime(int x){
int i;
if(x == 2)
return 1;
if(x < 2 || x % 2 == 0)
return 0;
i = 3;
while(i <= sqrt((double)x)){
if(x % i == 0)
return 0;
i = i +2;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248036/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248036/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, 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
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.013 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
isprime.exit.thread: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc10 = add nsw i32 %count.013, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.end.i, %isprime.exit.thread
%2 = phi i32 [ %inc10, %isprime.exit.thread ], [ %count.013, %if.end.i ], [ %count.013, %while.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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 memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int a,b,c,p,q,r,d;
scanf("%d%d%d",&a,&b,&c);
p=a;
q=b/2;
r=c/4;
if(p<=q)
{
if(p<=r)
d=p;
else
d=r;
}
if(q<=p)
{
if(q<=r)
d=q;
else
d=r;
}
int e=d+d*2+d*4;
printf("%d",e);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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 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
%div = sdiv i32 %1, 2
%2 = load i32, ptr %c, align 4, !tbaa !5
%div1 = sdiv i32 %2, 4
%cmp.not = icmp sgt i32 %0, %div
%div1. = call i32 @llvm.smin.i32(i32 %0, i32 %div1)
%d.0 = select i1 %cmp.not, i32 undef, i32 %div1.
%cmp5.not = icmp sgt i32 %div, %0
%div1.div = call i32 @llvm.smin.i32(i32 %div, i32 %div1)
%d.1 = select i1 %cmp5.not, i32 %d.0, i32 %div1.div
%add13 = mul nsw i32 %d.1, 7
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add13)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int i,j,t,m,k,count=0;
for(i=0; i<n; i++)
{
scanf("%d",&j);
m=sqrt(j);
k=1;
for( t= 2; t<=m; t++)
if(j%t==0)
k=0;
if(k==1)
{
count++;
}
}
printf("%d\n",count);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248122/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%j = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not33 = icmp eq i32 %call32, -1
br i1 %cmp.not33, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end18
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp128 = icmp sgt i32 %0, 0
br i1 %cmp128, label %for.body, label %for.end18
for.body: ; preds = %while.body, %for.end
%count.030 = phi i32 [ %spec.select24, %for.end ], [ 0, %while.body ]
%i.029 = phi i32 [ %inc17, %for.end ], [ 0, %while.body ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%1 = load i32, ptr %j, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%call3 = call double @sqrt(double noundef %conv) #4
%conv4 = fptosi double %call3 to i32
%cmp6.not25 = icmp slt i32 %conv4, 2
br i1 %cmp6.not25, label %for.end, label %for.body8.lr.ph
for.body8.lr.ph: ; preds = %for.body
%2 = load i32, ptr %j, align 4, !tbaa !5
%3 = add i32 %conv4, -1
%xtraiter = and i32 %3, 1
%4 = icmp eq i32 %conv4, 2
br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body8.lr.ph.new
for.body8.lr.ph.new: ; preds = %for.body8.lr.ph
%unroll_iter = and i32 %3, -2
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.lr.ph.new
%k.027 = phi i32 [ 1, %for.body8.lr.ph.new ], [ %spec.select.1, %for.body8 ]
%t.026 = phi i32 [ 2, %for.body8.lr.ph.new ], [ %inc.1, %for.body8 ]
%niter = phi i32 [ 0, %for.body8.lr.ph.new ], [ %niter.next.1, %for.body8 ]
%rem = srem i32 %2, %t.026
%cmp9 = icmp eq i32 %rem, 0
%inc = or i32 %t.026, 1
%rem.1 = srem i32 %2, %inc
%cmp9.1 = icmp eq i32 %rem.1, 0
%5 = or i1 %cmp9.1, %cmp9
%spec.select.1 = select i1 %5, i32 0, i32 %k.027
%inc.1 = add nuw i32 %t.026, 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.body8, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body8.lr.ph ], [ %spec.select.1, %for.body8 ]
%k.027.unr = phi i32 [ 1, %for.body8.lr.ph ], [ %spec.select.1, %for.body8 ]
%t.026.unr = phi i32 [ 2, %for.body8.lr.ph ], [ %inc.1, %for.body8 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body8.epil
for.body8.epil: ; preds = %for.end.loopexit.unr-lcssa
%rem.epil = srem i32 %2, %t.026.unr
%cmp9.epil = icmp eq i32 %rem.epil, 0
%spec.select.epil = select i1 %cmp9.epil, i32 0, i32 %k.027.unr
br label %for.end
for.end: ; preds = %for.body8.epil, %for.end.loopexit.unr-lcssa, %for.body
%k.0.lcssa = phi i32 [ 1, %for.body ], [ %spec.select.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body8.epil ]
%cmp11 = icmp eq i32 %k.0.lcssa, 1
%inc14 = zext i1 %cmp11 to i32
%spec.select24 = add nuw nsw i32 %count.030, %inc14
%inc17 = add nuw nsw i32 %i.029, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc17, %6
br i1 %cmp1, label %for.body, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.end, %while.body
%count.0.lcssa = phi i32 [ 0, %while.body ], [ %spec.select24, %for.end ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #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 %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.end18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
int isPrime(int x)
{
if(x == 2) {
return 1;
}
if(x < 2 || x % 2 == 0) {
return 0;
}
int i = 3;
while(i <= sqrt(x)) {
if(x % i == 0) {
return 0;
}
i = i + 2;
}
return 1;
}
int main(void){
int i, n, p;
int count = 0;
scanf("%d\n", &n);
for(i = 0; i < n; i++) {
scanf("%d\n", &p);
if(isPrime(p)) {
count++;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248173/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248173/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %return, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %return, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %return, label %while.body, !llvm.loop !5
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %return, label %while.cond
return: ; preds = %while.cond, %while.body, %while.cond.preheader, %if.end, %entry
%retval.1 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 1, %while.cond ], [ 0, %while.body ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%1 = load i32, ptr %p, align 4, !tbaa !7
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %isPrime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isPrime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isPrime.exit.thread, label %while.body.i, !llvm.loop !5
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
isPrime.exit.thread: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc9 = add nsw i32 %count.012, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.end.i, %isPrime.exit.thread
%2 = phi i32 [ %inc9, %isPrime.exit.thread ], [ %count.012, %if.end.i ], [ %count.012, %while.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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>
#include<stdlib.h>
int IsPrime(int);
int main() {
int i,count=0,n,*sosu;
scanf("%d",&n);
sosu = (int *)malloc(n * sizeof (int));
for(i=n-1;i>=0;i--){
scanf("%d",&sosu[i]);
if(IsPrime(sosu[i]) == 1) count++;
}
printf("%d\n",count);
return 0;
}
int IsPrime(int n){
int i;
if (n < 2)
return 0;
else if (n == 2)
return 1;
if (n % 2 == 0)
return 0;
for (i = 3; i <= n / i; i += 2)
if (n % i == 0)
return 0;
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248216/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%count.020 = phi i32 [ 0, %for.body.preheader ], [ %3, %for.cond ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom = and i64 %indvars.iv.next, 4294967295
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %idxprom
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp slt i32 %2, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %2, 2
br i1 %cmp1.i, label %IsPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %2, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not20.i = icmp ult i32 %2, 9
br i1 %cmp7.not20.i, label %IsPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%div.i = sdiv i32 %2, %add.i
%cmp7.not.i = icmp sgt i32 %add.i, %div.i
br i1 %cmp7.not.i, label %IsPrime.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.021.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %2, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
IsPrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %count.020, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %IsPrime.exit
%3 = phi i32 [ %inc, %IsPrime.exit ], [ %count.020, %for.body ], [ %count.020, %if.end3.i ], [ %count.020, %for.body.i ]
%cmp = icmp sgt i64 %indvars.iv, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.cond ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @IsPrime(i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %n, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %n, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not20 = icmp ult i32 %n, 9
br i1 %cmp7.not20, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.021, 2
%div = sdiv i32 %n, %add
%cmp7.not = icmp sgt i32 %add, %div
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.021 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %n, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(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 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include<math.h>
int main() {
static long long a,b,x,y,n,v;
double t,mint;
scanf("%lld%lld%lld",&a,&b,&n);
mint = 1000000009;
while(n--){
scanf("%lld%lld%lld",&x,&y,&v);
t= sqrt((a-x)*(a-x)+(b-y)*(b-y))/v;
if(t<mint)
mint = t;
}
printf("%lf",mint);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24826/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.a = internal global i64 0, align 8
@main.b = internal global i64 0, align 8
@main.x = internal global i64 0, align 8
@main.y = internal global i64 0, align 8
@main.n = internal global i64 0, align 8
@main.v = internal global i64 0, align 8
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\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 @main.a, ptr noundef nonnull @main.b, ptr noundef nonnull @main.n)
%0 = load i64, ptr @main.n, align 8, !tbaa !5
%dec12 = add nsw i64 %0, -1
store i64 %dec12, ptr @main.n, align 8, !tbaa !5
%tobool.not13 = icmp eq i64 %0, 0
br i1 %tobool.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%mint.014 = phi double [ %mint.1, %while.body ], [ 0x41CDCD6504800000, %entry ]
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @main.x, ptr noundef nonnull @main.y, ptr noundef nonnull @main.v)
%1 = load i64, ptr @main.a, align 8, !tbaa !5
%2 = load i64, ptr @main.x, align 8, !tbaa !5
%sub = sub nsw i64 %1, %2
%mul = mul nsw i64 %sub, %sub
%3 = load i64, ptr @main.b, align 8, !tbaa !5
%4 = load i64, ptr @main.y, align 8, !tbaa !5
%sub3 = sub nsw i64 %3, %4
%mul5 = mul nsw i64 %sub3, %sub3
%add = add nuw nsw i64 %mul5, %mul
%conv = sitofp i64 %add to double
%call6 = tail call double @sqrt(double noundef %conv) #3
%5 = load i64, ptr @main.v, align 8, !tbaa !5
%conv7 = sitofp i64 %5 to double
%div = fdiv double %call6, %conv7
%cmp = fcmp olt double %div, %mint.014
%mint.1 = select i1 %cmp, double %div, double %mint.014
%6 = load i64, ptr @main.n, align 8, !tbaa !5
%dec = add nsw i64 %6, -1
store i64 %dec, ptr @main.n, align 8, !tbaa !5
%tobool.not = icmp eq i64 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%mint.0.lcssa = phi double [ 0x41CDCD6504800000, %entry ], [ %mint.1, %while.body ]
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mint.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
double f= 1000000000,x,y,kx,ky,v,t;
int main(){
scanf("%lf%lf",&x,&y);
int n;
scanf("%d",&n);
while(n--){
scanf("%lf%lf%lf",&kx,&ky,&v);
t=(sqrt((kx-x)*(kx-x) + (ky-y)*(ky-y)))/v;
if(t<f) f=t;
}
printf("%lf",f);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24831/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24831/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@f = dso_local local_unnamed_addr global double 1.000000e+09, align 8
@.str = private unnamed_addr constant [7 x i8] c"%lf%lf\00", align 1
@x = dso_local global double 0.000000e+00, align 8
@y = dso_local global double 0.000000e+00, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%lf%lf%lf\00", align 1
@kx = dso_local global double 0.000000e+00, align 8
@ky = dso_local global double 0.000000e+00, align 8
@v = dso_local global double 0.000000e+00, align 8
@t = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@.str.3 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec9 = add nsw i32 %0, -1
store i32 %dec9, ptr %n, align 4, !tbaa !5
%tobool.not10 = icmp eq i32 %0, 0
br i1 %tobool.not10, label %entry.while.end_crit_edge, label %while.body
entry.while.end_crit_edge: ; preds = %entry
%.pre = load double, ptr @f, align 8, !tbaa !9
br label %while.end
while.body: ; preds = %entry, %if.end
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @kx, ptr noundef nonnull @ky, ptr noundef nonnull @v)
%1 = load double, ptr @kx, align 8, !tbaa !9
%2 = load double, ptr @x, align 8, !tbaa !9
%sub = fsub double %1, %2
%3 = load double, ptr @ky, align 8, !tbaa !9
%4 = load double, ptr @y, align 8, !tbaa !9
%sub4 = fsub double %3, %4
%mul6 = fmul double %sub4, %sub4
%5 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul6)
%sqrt = call double @llvm.sqrt.f64(double %5)
%6 = load double, ptr @v, align 8, !tbaa !9
%div = fdiv double %sqrt, %6
store double %div, ptr @t, align 8, !tbaa !9
%7 = load double, ptr @f, align 8, !tbaa !9
%cmp = fcmp olt double %div, %7
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %while.body
store double %div, ptr @f, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %while.body
%8 = phi double [ %div, %if.then ], [ %7, %while.body ]
%9 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry.while.end_crit_edge
%10 = phi double [ %.pre, %entry.while.end_crit_edge ], [ %8, %if.end ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (){
int x[10000],N,i,j,num;
scanf("%d",&N);
if(N<1 || N>10000){
printf("Please type 1 to 10000.");
exit(1);
}
num = N;
for(i=0;i<N;i++){
scanf("%d",&x[i]);
if(x[i]>100000000 || x[i] < 2){
printf("Please type 2 to 100000000.");
exit(2);
}
}
for(i=0;i<N;i++){
for(j=2;j<=(int)sqrt(x[i]);j++){
if(x[i] % j == 0){
num--;
break;
}
}
}printf("%d\n",num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248360/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248360/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [24 x i8] c"Please type 1 to 10000.\00", align 1
@.str.2 = private unnamed_addr constant [28 x i8] c"Please type 2 to 100000000.\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [10000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4
%1 = add i32 %0, -10001
%or.cond = icmp ult i32 %1, -10000
br i1 %or.cond, label %if.then, label %for.body
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
call void @exit(i32 noundef 1) #6
unreachable
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp3, label %for.body, label %for.cond15.preheader, !llvm.loop !9
for.cond15.preheader: ; preds = %for.cond
%4 = icmp sgt i32 %2, 0
br i1 %4, label %for.cond18.preheader, label %for.end37
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%6 = add i32 %5, -100000001
%or.cond51 = icmp ult i32 %6, -99999999
br i1 %or.cond51, label %if.then12, label %for.cond
if.then12: ; preds = %for.body
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 2) #6
unreachable
for.cond18.preheader: ; preds = %for.cond15.preheader, %for.inc35
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc35 ], [ 0, %for.cond15.preheader ]
%num.061 = phi i32 [ %num.1, %for.inc35 ], [ %0, %for.cond15.preheader ]
%arrayidx20 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv63
%7 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%conv54 = sitofp i32 %7 to double
%call2155 = call double @sqrt(double noundef %conv54) #5
%conv2256 = fptosi double %call2155 to i32
%cmp23.not57 = icmp slt i32 %conv2256, 2
br i1 %cmp23.not57, label %for.inc35, label %for.body25
for.cond18: ; preds = %for.body25
%inc33 = add nuw nsw i32 %j.058, 1
%conv = sitofp i32 %8 to double
%call21 = call double @sqrt(double noundef %conv) #5
%conv22 = fptosi double %call21 to i32
%cmp23.not.not = icmp slt i32 %j.058, %conv22
br i1 %cmp23.not.not, label %for.body25, label %for.inc35, !llvm.loop !11
for.body25: ; preds = %for.cond18.preheader, %for.cond18
%j.058 = phi i32 [ %inc33, %for.cond18 ], [ 2, %for.cond18.preheader ]
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%rem = srem i32 %8, %j.058
%cmp28 = icmp eq i32 %rem, 0
br i1 %cmp28, label %if.then30, label %for.cond18
if.then30: ; preds = %for.body25
%dec = add nsw i32 %num.061, -1
br label %for.inc35
for.inc35: ; preds = %for.cond18, %for.cond18.preheader, %if.then30
%num.1 = phi i32 [ %dec, %if.then30 ], [ %num.061, %for.cond18.preheader ], [ %num.061, %for.cond18 ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp16 = icmp slt i64 %indvars.iv.next64, %10
br i1 %cmp16, label %for.cond18.preheader, label %for.end37, !llvm.loop !12
for.end37: ; preds = %for.inc35, %for.cond15.preheader
%num.0.lcssa = phi i32 [ %0, %for.cond15.preheader ], [ %num.1, %for.inc35 ]
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %num.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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}
|
#include <stdio.h>
#include <math.h>
int main(){
int i,j,count=0,number,n;
scanf("%d",&n);
count=n;
for(i=0;i<n;i++){
scanf("%d",&number);
if(number>2&&number%2==0 ) count--;
else{
for(j=3;j<=sqrt(number);j+=2){
if(number%j==0){
count--;
break;
}
}
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248403/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248403/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%number = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #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
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end17
for.body: ; preds = %entry, %for.inc16
%count.030 = phi i32 [ %count.1, %for.inc16 ], [ %0, %entry ]
%i.029 = phi i32 [ %inc, %for.inc16 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%1 = load i32, ptr %number, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %1, 2
%rem = and i32 %1, 1
%cmp3 = icmp eq i32 %rem, 0
%or.cond = and i1 %cmp2, %cmp3
br i1 %or.cond, label %if.then, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body
%conv524 = sitofp i32 %1 to double
%call625 = call double @sqrt(double noundef %conv524) #4
%cmp726 = fcmp ult double %call625, 3.000000e+00
br i1 %cmp726, label %for.inc16, label %for.body9
if.then: ; preds = %for.body
%dec = add nsw i32 %count.030, -1
br label %for.inc16
for.cond4: ; preds = %for.body9
%add = add nuw nsw i32 %j.027, 2
%conv = sitofp i32 %add to double
%conv5 = sitofp i32 %2 to double
%call6 = call double @sqrt(double noundef %conv5) #4
%cmp7 = fcmp ult double %call6, %conv
br i1 %cmp7, label %for.inc16, label %for.body9, !llvm.loop !9
for.body9: ; preds = %for.cond4.preheader, %for.cond4
%j.027 = phi i32 [ %add, %for.cond4 ], [ 3, %for.cond4.preheader ]
%2 = load i32, ptr %number, align 4, !tbaa !5
%rem10 = srem i32 %2, %j.027
%cmp11 = icmp eq i32 %rem10, 0
br i1 %cmp11, label %if.then13, label %for.cond4
if.then13: ; preds = %for.body9
%dec14 = add nsw i32 %count.030, -1
br label %for.inc16
for.inc16: ; preds = %for.cond4, %for.cond4.preheader, %if.then, %if.then13
%count.1 = phi i32 [ %dec, %if.then ], [ %dec14, %if.then13 ], [ %count.030, %for.cond4.preheader ], [ %count.030, %for.cond4 ]
%inc = add nuw nsw i32 %i.029, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.inc16, %entry
%count.0.lcssa = phi i32 [ %0, %entry ], [ %count.1, %for.inc16 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int FuncBePrime(int n)
{
int i;
if(n < 2)
return 0;
else if(n == 2)
return 1;
if(n % 2 == 0)
return 0;
for(i = 3; i * i <= n; i += 2)
if(n % i == 0)
return 0;
return 1;
}
int main(void)
{
int n;
int buf;
int count = 0;
int i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &buf);
if (FuncBePrime(buf) == 1) count++;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248447/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248447/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @FuncBePrime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %n, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %n, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %n, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %n
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %n, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%buf = 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 %buf) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%i.013 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%count.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%1 = load i32, ptr %buf, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %FuncBePrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %FuncBePrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %FuncBePrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
FuncBePrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %count.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %FuncBePrime.exit
%2 = phi i32 [ %inc, %FuncBePrime.exit ], [ %count.012, %for.body ], [ %count.012, %if.end3.i ], [ %count.012, %for.body.i ]
%inc4 = add nuw nsw i32 %i.013, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc4, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %buf) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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>
#include <math.h>
#define N 10000
void prime(int);
int main()
{
int n,i;
int array[N];
int count=0,f,k=0,j;
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%d", &array[i]);
}
for(j=0;j<n;j++){
k=0;
for(i=2;i<=sqrt(array[j]);i++){
f=array[j]%i;
if(f==0){
k=1;
}
}
if(k==0){
count++;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248490/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248490/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%array = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %array) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.end27
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.cond5.preheader, label %for.end27
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %array, 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.cond5.preheader: ; preds = %for.cond2.preheader, %for.end19
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.end19 ], [ 0, %for.cond2.preheader ]
%count.047 = phi i32 [ %spec.select38, %for.end19 ], [ 0, %for.cond2.preheader ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %array, i64 0, i64 %indvars.iv51
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%conv841 = sitofp i32 %4 to double
%call942 = call double @sqrt(double noundef %conv841) #4
%cmp1043 = fcmp ult double %call942, 2.000000e+00
br i1 %cmp1043, label %for.end19, label %for.body12
for.body12: ; preds = %for.cond5.preheader, %for.body12
%k.045 = phi i32 [ %spec.select, %for.body12 ], [ 0, %for.cond5.preheader ]
%i.144 = phi i32 [ %inc18, %for.body12 ], [ 2, %for.cond5.preheader ]
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%rem = srem i32 %5, %i.144
%cmp15 = icmp eq i32 %rem, 0
%spec.select = select i1 %cmp15, i32 1, i32 %k.045
%inc18 = add nuw nsw i32 %i.144, 1
%conv = sitofp i32 %inc18 to double
%conv8 = sitofp i32 %5 to double
%call9 = call double @sqrt(double noundef %conv8) #4
%cmp10 = fcmp ult double %call9, %conv
br i1 %cmp10, label %for.end19, label %for.body12, !llvm.loop !11
for.end19: ; preds = %for.body12, %for.cond5.preheader
%k.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %spec.select, %for.body12 ]
%cmp20 = icmp eq i32 %k.0.lcssa, 0
%inc23 = zext i1 %cmp20 to i32
%spec.select38 = add nuw nsw i32 %count.047, %inc23
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next52, %7
br i1 %cmp3, label %for.cond5.preheader, label %for.end27, !llvm.loop !12
for.end27: ; preds = %for.end19, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select38, %for.end19 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %array) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
#define T 1
#define F -1
int Prime(int x)
{
if(x==2) return T;
if(x<2||x%2==0)return F;
int i=3;
while(i<=sqrt(x))
{
if(x%i==0)return F;
i += 2;
}
return T;
}
int main()
{
int cnt=0,n,x;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(Prime(x)==T)cnt+=1;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @Prime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %return, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %return, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %return, label %while.body, !llvm.loop !5
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %return, label %while.cond
return: ; preds = %while.cond, %while.body, %while.cond.preheader, %if.end, %entry
%retval.1 = phi i32 [ 1, %entry ], [ -1, %if.end ], [ 1, %while.cond.preheader ], [ 1, %while.cond ], [ -1, %while.body ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %Prime.exit, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %Prime.exit ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %Prime.exit
%i.013 = phi i32 [ %inc, %Prime.exit ], [ 0, %entry ]
%cnt.012 = phi i32 [ %2, %Prime.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %Prime.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %.loopexit, label %while.body.i, !llvm.loop !5
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %Prime.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%add9 = add nsw i32 %cnt.012, 1
br label %Prime.exit
Prime.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%2 = phi i32 [ %add9, %.loopexit ], [ %cnt.012, %if.end.i ], [ %cnt.012, %while.body.i ]
%inc = add nuw nsw i32 %i.013, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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>
#include <math.h>
#define N_MAX 10000
int isPrime(int x)
{
int i;
if (x <= 3) {
return 1;
} else if (x % 2 == 0) {
return 0;
} else {
for (i = 3; i <= sqrt(x); i = i + 2) {
if (x % i == 0) {
return 0;
}
}
return 1;
}
}
int main(int argc, char *argv[])
{
int i, j, n, x;
int answer = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
if(i < n)break;
}
for (i = 0; i < n; i++) {
scanf("%d", &x);
answer = answer + isPrime(x);
}
printf("%d\n", answer);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248599/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 4
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%rem = and i32 %x, 1
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else
%conv4 = sitofp i32 %x to double
%call16 = tail call double @sqrt(double noundef %conv4) #5
%cmp517 = fcmp ult double %call16, 3.000000e+00
br i1 %cmp517, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.018, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv4) #5
%cmp5 = fcmp ult double %call, %conv
br i1 %cmp5, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.018 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem7 = srem i32 %x, %i.018
%cmp8 = icmp eq i32 %rem7, 0
br i1 %cmp8, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp316 = icmp sgt i32 %0, 0
br i1 %cmp316, label %for.body4, label %for.end9
for.body4: ; preds = %entry, %isPrime.exit
%answer.018 = phi i32 [ %add, %isPrime.exit ], [ 0, %entry ]
%i.117 = phi i32 [ %inc8, %isPrime.exit ], [ 0, %entry ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 4
br i1 %cmp.i, label %isPrime.exit, label %if.else.i
if.else.i: ; preds = %for.body4
%rem.i = and i32 %1, 1
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %isPrime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else.i
%conv4.i = sitofp i32 %1 to double
%call16.i = call double @sqrt(double noundef %conv4.i) #5
%cmp517.i = fcmp ult double %call16.i, 3.000000e+00
br i1 %cmp517.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.018.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv4.i) #5
%cmp5.i = fcmp ult double %call.i, %conv.i
br i1 %cmp5.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.018.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem7.i = srem i32 %1, %i.018.i
%cmp8.i = icmp eq i32 %rem7.i, 0
br i1 %cmp8.i, label %isPrime.exit, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %for.body.i, %for.body4, %if.else.i, %for.cond.preheader.i
%retval.0.i = phi i32 [ 1, %for.body4 ], [ 0, %if.else.i ], [ 1, %for.cond.preheader.i ], [ 1, %for.cond.i ], [ 0, %for.body.i ]
%add = add nuw nsw i32 %retval.0.i, %answer.018
%inc8 = add nuw nsw i32 %i.117, 1
%2 = load i32, ptr %n, align 4, !tbaa !7
%cmp3 = icmp slt i32 %inc8, %2
br i1 %cmp3, label %for.body4, label %for.end9, !llvm.loop !11
for.end9: ; preds = %isPrime.exit, %entry
%answer.0.lcssa = phi i32 [ 0, %entry ], [ %add, %isPrime.exit ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %answer.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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 isPrime(int x){
int i;
if ( x == 2 ) return 1;
else if ( x < 2 || (x % 2 == 0)) return 0;
for ( i = 3; i*i <= x; i++){
if ( x % i == 0 ) return 0;
}
return 1;
}
int main(){
int x, t, status;
int d = 0;
while(1){
status = scanf("%d", &x);
if(status != 1) break;
t = isPrime(x);
d += t;
}
printf("%d\n", d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248641/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else
%cmp5.not17 = icmp ult i32 %x, 9
br i1 %cmp5.not17, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.018, 1
%mul = mul nsw i32 %inc, %inc
%cmp5.not = icmp sgt i32 %mul, %x
br i1 %cmp5.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.018 = phi i32 [ %inc, %for.cond ], [ 3, %for.cond.preheader ]
%rem6 = srem i32 %x, %i.018
%cmp7 = icmp eq i32 %rem6, 0
br i1 %cmp7, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not5 = icmp eq i32 %call4, 1
br i1 %cmp.not5, label %if.end, label %while.end
if.end: ; preds = %entry, %isPrime.exit
%d.06 = phi i32 [ %add, %isPrime.exit ], [ 0, %entry ]
%0 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp eq i32 %0, 2
br i1 %cmp.i, label %isPrime.exit, label %if.else.i
if.else.i: ; preds = %if.end
%cmp1.i = icmp slt i32 %0, 2
%rem.i = and i32 %0, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %isPrime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else.i
%cmp5.not17.i = icmp ult i32 %0, 9
br i1 %cmp5.not17.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.018.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp5.not.i = icmp sgt i32 %mul.i, %0
br i1 %cmp5.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.018.i = phi i32 [ %inc.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem6.i = srem i32 %0, %i.018.i
%cmp7.i = icmp eq i32 %rem6.i, 0
br i1 %cmp7.i, label %isPrime.exit, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %for.body.i, %if.end, %if.else.i, %for.cond.preheader.i
%retval.0.i = phi i32 [ 1, %if.end ], [ 0, %if.else.i ], [ 1, %for.cond.preheader.i ], [ 1, %for.cond.i ], [ 0, %for.body.i ]
%add = add nuw nsw i32 %retval.0.i, %d.06
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, 1
br i1 %cmp.not, label %if.end, label %while.end
while.end: ; preds = %isPrime.exit, %entry
%d.0.lcssa = phi i32 [ 0, %entry ], [ %add, %isPrime.exit ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int PrimeJudge(int);
#define N 10000
int main(){
int i,n,flg,prime=0,num[N];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&num[i]);
flg=PrimeJudge(num[i]);
if(flg==0) prime++;
}
printf("%d\n",prime);
return 0;
}
int PrimeJudge(int data){
int i=3;
if(data==2) return 0;
if(data<2 || data%2==0) return -1;
while(i<=sqrt(data)){
if(data%i==0) return -1;
i=i+2;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248685/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248685/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%num = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %PrimeJudge.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %PrimeJudge.exit ], [ 0, %entry ]
%prime.018 = phi i32 [ %2, %PrimeJudge.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %PrimeJudge.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %.loopexit, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %PrimeJudge.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc14 = add nsw i32 %prime.018, 1
br label %PrimeJudge.exit
PrimeJudge.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%2 = phi i32 [ %inc14, %.loopexit ], [ %prime.018, %if.end.i ], [ %prime.018, %while.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %PrimeJudge.exit, %entry
%prime.0.lcssa = phi i32 [ 0, %entry ], [ %2, %PrimeJudge.exit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %prime.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %num) #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 memory(write) uwtable
define dso_local i32 @PrimeJudge(i32 noundef %data) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %data, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %data, 2
%rem = and i32 %data, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %data to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %data, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ -1, %if.end ], [ 0, %while.cond.preheader ], [ -1, %while.body ], [ 0, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
int P_num(int);
int main(){
int x,i,num,count=0;
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%d",&num);
if(P_num(num))count++;
}
printf("%d\n",count);
return 0;
}
int P_num(int x){
int i;
for(i=2;i<=sqrt(x);i++){
if(i==x)break;
if(x%i==0)return 0;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248728/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%1 = load i32, ptr %num, align 4, !tbaa !5
%conv1.i = sitofp i32 %1 to double
%call14.i = call double @sqrt(double noundef %conv1.i) #5
%cmp15.i = fcmp ult double %call14.i, 2.000000e+00
%cmp316.i = icmp eq i32 %1, 2
%or.cond17.i = or i1 %cmp316.i, %cmp15.i
br i1 %or.cond17.i, label %P_num.exit.thread, label %if.end.i
for.cond.i: ; preds = %if.end.i
%inc.i = add nuw nsw i32 %i.018.i, 1
%conv.i = sitofp i32 %inc.i to double
%call.i = call double @sqrt(double noundef %conv1.i) #5
%cmp.i = fcmp ult double %call.i, %conv.i
%cmp3.i = icmp eq i32 %inc.i, %1
%or.cond.i = or i1 %cmp3.i, %cmp.i
br i1 %or.cond.i, label %P_num.exit.thread, label %if.end.i, !llvm.loop !9
if.end.i: ; preds = %for.body, %for.cond.i
%i.018.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body ]
%rem.i = srem i32 %1, %i.018.i
%cmp5.i = icmp eq i32 %rem.i, 0
br i1 %cmp5.i, label %for.cond, label %for.cond.i
P_num.exit.thread: ; preds = %for.cond.i, %for.body
%inc9 = add nsw i32 %count.012, 1
br label %for.cond
for.cond: ; preds = %if.end.i, %P_num.exit.thread
%2 = phi i32 [ %inc9, %P_num.exit.thread ], [ %count.012, %if.end.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%3 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @P_num(i32 noundef %x) local_unnamed_addr #3 {
entry:
%conv1 = sitofp i32 %x to double
%call14 = tail call double @sqrt(double noundef %conv1) #5
%cmp15 = fcmp ult double %call14, 2.000000e+00
%cmp316 = icmp eq i32 %x, 2
%or.cond17 = or i1 %cmp316, %cmp15
br i1 %or.cond17, label %cleanup, label %if.end
for.cond: ; preds = %if.end
%inc = add nuw nsw i32 %i.018, 1
%conv = sitofp i32 %inc to double
%call = tail call double @sqrt(double noundef %conv1) #5
%cmp = fcmp ult double %call, %conv
%cmp3 = icmp eq i32 %inc, %x
%or.cond = or i1 %cmp3, %cmp
br i1 %or.cond, label %cleanup, label %if.end, !llvm.loop !9
if.end: ; preds = %entry, %for.cond
%i.018 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %x, %i.018
%cmp5 = icmp eq i32 %rem, 0
br i1 %cmp5, label %cleanup, label %for.cond
cleanup: ; preds = %if.end, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main() {
int n;
scanf("%d",&n);
int ans=0;
while(n) {
int x,i;
scanf("%d",&x);
for(i=2; i*i<=x; i++) {
if(x%i==0) break;
}
if(i*i>x) ans++;
n--;
}
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248771/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248771/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%x = 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)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%tobool.not19 = icmp eq i32 %.pr, 0
br i1 %tobool.not19, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%ans.020 = phi i32 [ %spec.select, %for.end ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 4
br i1 %cmp.not15, label %for.end, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.016, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not = icmp sgt i32 %mul, %0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !9
for.body: ; preds = %while.body, %for.cond
%i.016 = phi i32 [ %inc, %for.cond ], [ 2, %while.body ]
%rem = srem i32 %0, %i.016
%cmp2.not = icmp eq i32 %rem, 0
br i1 %cmp2.not, label %for.end, label %for.cond
for.end: ; preds = %for.cond, %for.body, %while.body
%cmp.not.lcssa = phi i32 [ 1, %while.body ], [ 1, %for.cond ], [ 0, %for.body ]
%spec.select = add nuw nsw i32 %ans.020, %cmp.not.lcssa
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
%tobool.not = icmp eq i32 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.end ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#define FALSE 0
#define TRUE 1
int isPrime(int x)
{
if (x <= 1) {
return FALSE;
}
int end = sqrt(x);
for(int i = 2; i <= end; i++) {
if (x % i == 0)
return FALSE;
}
return TRUE;
}
int main(void)
{
int n, x, count;
scanf("%d", &n);
count = 0;
for (int i=0; i<n; i++){
scanf("%d", &x);
if (isPrime(x) == TRUE)
count++;
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248814/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248814/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%conv = sitofp i32 %x to double
%call = tail call double @sqrt(double noundef %conv) #5
%conv1 = fptosi double %call to i32
%cmp2.not13 = icmp slt i32 %conv1, 2
br i1 %cmp2.not13, label %return, label %for.body.preheader
for.body.preheader: ; preds = %if.end
%0 = and i32 %x, 1
%cmp418 = icmp eq i32 %0, 0
br i1 %cmp418, label %return, label %for.cond
for.cond: ; preds = %for.body.preheader, %for.body
%i.01419 = phi i32 [ %inc, %for.body ], [ 2, %for.body.preheader ]
%exitcond = icmp eq i32 %i.01419, %conv1
br i1 %exitcond, label %cleanup.loopexit.loopexit, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond
%inc = add nuw i32 %i.01419, 1
%rem = srem i32 %x, %inc
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup.loopexit.loopexit, label %for.cond, !llvm.loop !5
cleanup.loopexit.loopexit: ; preds = %for.body, %for.cond
%cmp2.not.le = icmp sge i32 %i.01419, %conv1
%1 = zext i1 %cmp2.not.le to i32
br label %return
return: ; preds = %for.body.preheader, %cleanup.loopexit.loopexit, %if.end, %entry
%retval.2 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %for.body.preheader ], [ %1, %cleanup.loopexit.loopexit ]
ret i32 %retval.2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.cond
%i.023 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%count.022 = phi i32 [ %3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %isPrime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%conv.i = sitofp i32 %1 to double
%call.i = call double @sqrt(double noundef %conv.i) #5
%conv1.i = fptosi double %call.i to i32
%cmp2.not13.i = icmp slt i32 %conv1.i, 2
br i1 %cmp2.not13.i, label %isPrime.exit.thread12, label %for.body.i.preheader
for.body.i.preheader: ; preds = %if.end.i
%2 = and i32 %1, 1
%cmp4.i18 = icmp eq i32 %2, 0
br i1 %cmp4.i18, label %isPrime.exit.thread, label %for.cond.i
isPrime.exit.thread12: ; preds = %if.end.i
%inc15 = add nsw i32 %count.022, 1
br label %for.cond
for.cond.i: ; preds = %for.body.i.preheader, %for.body.i
%i.014.i19 = phi i32 [ %inc.i, %for.body.i ], [ 2, %for.body.i.preheader ]
%exitcond.i = icmp eq i32 %i.014.i19, %conv1.i
br i1 %exitcond.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.i
%inc.i = add nuw i32 %i.014.i19, 1
%rem.i = srem i32 %1, %inc.i
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %isPrime.exit, label %for.cond.i, !llvm.loop !5
isPrime.exit: ; preds = %for.body.i, %for.cond.i
%cmp2.not.i.le = icmp sge i32 %i.014.i19, %conv1.i
%cmp2.not.lcssa.ph.i.fr = freeze i1 %cmp2.not.i.le
%inc = add nsw i32 %count.022, 1
br i1 %cmp2.not.lcssa.ph.i.fr, label %for.cond, label %isPrime.exit.thread
isPrime.exit.thread: ; preds = %for.body.i.preheader, %for.body, %isPrime.exit
br label %for.cond
for.cond: ; preds = %isPrime.exit.thread12, %isPrime.exit, %isPrime.exit.thread
%3 = phi i32 [ %count.022, %isPrime.exit.thread ], [ %inc, %isPrime.exit ], [ %inc15, %isPrime.exit.thread12 ]
%inc4 = add nuw nsw i32 %i.023, 1
%4 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc4, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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>
#include<math.h>
int main(){
int n;
int counter = 0;
scanf("%d\n",&n);
for(int i=0;i<n;i++){
int num;
scanf("%d\n",&num);
//sqrtはfloatを返す。1で割っても同じ
int end = sqrt(num)+1;
if(num==2 || num==3){
counter ++;
}else{
for(int j=2; j<end; j++){
if(num%j==0){
break;
}
if(j==end-1){
counter ++;
}
}
}
}
printf("%d\n", counter);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248865/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248865/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end22, %entry
%counter.0.lcssa = phi i32 [ 0, %entry ], [ %counter.3, %if.end22 ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %counter.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %if.end22
%counter.041 = phi i32 [ %counter.3, %if.end22 ], [ 0, %entry ]
%i.040 = phi i32 [ %inc24, %if.end22 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%1 = load i32, ptr %num, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%call2 = call double @sqrt(double noundef %conv) #4
%add = fadd double %call2, 1.000000e+00
%conv3 = fptosi double %add to i32
%2 = load i32, ptr %num, align 4
%3 = and i32 %2, -2
%or.cond = icmp eq i32 %3, 2
br i1 %or.cond, label %if.then, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body
%cmp935 = icmp sgt i32 %conv3, 2
br i1 %cmp935, label %for.body12.lr.ph, label %if.end22
for.body12.lr.ph: ; preds = %for.cond8.preheader
%sub = add nsw i32 %conv3, -1
br label %for.body12
if.then: ; preds = %for.body
%inc = add nsw i32 %counter.041, 1
br label %if.end22
for.body12: ; preds = %for.body12.lr.ph, %if.end
%j.037 = phi i32 [ 2, %for.body12.lr.ph ], [ %inc21, %if.end ]
%counter.136 = phi i32 [ %counter.041, %for.body12.lr.ph ], [ %spec.select, %if.end ]
%rem = srem i32 %2, %j.037
%cmp13 = icmp eq i32 %rem, 0
br i1 %cmp13, label %if.end22, label %if.end
if.end: ; preds = %for.body12
%cmp16 = icmp eq i32 %j.037, %sub
%inc19 = zext i1 %cmp16 to i32
%spec.select = add nsw i32 %counter.136, %inc19
%inc21 = add nuw nsw i32 %j.037, 1
%exitcond.not = icmp eq i32 %inc21, %conv3
br i1 %exitcond.not, label %if.end22, label %for.body12, !llvm.loop !9
if.end22: ; preds = %for.body12, %if.end, %for.cond8.preheader, %if.then
%counter.3 = phi i32 [ %inc, %if.then ], [ %counter.041, %for.cond8.preheader ], [ %counter.136, %for.body12 ], [ %spec.select, %if.end ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
%inc24 = add nuw nsw i32 %i.040, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc24, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#define N 10000
int hantei (int);
int main(){
int a[N];
int i=0,j,l,num=0,count=0;
while(i<N){
if(scanf("%d",&a[i])==EOF)break;
i++;
num++;
}
for(j=0;j<num;j++){
l=hantei(a[j]);
if(l==1)count++;
}
printf("%d\n",count);
return 0;
}
int hantei (int x){
int k;
if(x==2)return 1;
if(x<2 || x%2==0)return 0;
k=3;
while(k<=sqrt((double)x)){
if(x%k == 0)return 0;
k=k+2;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%a = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #5
br label %while.body
while.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp1 = icmp eq i32 %call, -1
br i1 %cmp1, label %while.end, label %if.end
if.end: ; preds = %while.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10000
br i1 %exitcond.not, label %for.body.preheader, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body
%0 = and i64 %indvars.iv, 4294967295
%cmp324.not = icmp eq i64 %0, 0
br i1 %cmp324.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %if.end, %while.end
%num.0.lcssa36 = phi i64 [ %indvars.iv, %while.end ], [ 10000, %if.end ]
%wide.trip.count = and i64 %num.0.lcssa36, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv30 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next31, %for.cond ]
%count.026 = phi i32 [ 0, %for.body.preheader ], [ %2, %for.cond ]
%arrayidx5 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv30
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !7
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %hantei.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %hantei.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %k.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %hantei.exit.thread, label %while.body.i, !llvm.loop !11
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%k.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %k.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
hantei.exit.thread: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc921 = add nsw i32 %count.026, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.end.i, %hantei.exit.thread
%2 = phi i32 [ %inc921, %hantei.exit.thread ], [ %count.026, %if.end.i ], [ %count.026, %while.body.i ]
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%exitcond33.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count
br i1 %exitcond33.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.cond, %while.end
%count.0.lcssa = phi i32 [ 0, %while.end ], [ %2, %for.cond ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #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 memory(write) uwtable
define dso_local i32 @hantei(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %k.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%k.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %k.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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}
|
#include <stdio.h>
int prime(int);
int main()
{
int num,in,t=0,i,j,judg;
scanf("%d",&num);
for(i = 0;i < num;i++)
{
scanf("%d",&in);
judg = prime(in);
if(judg == 1) t++;
}
printf("%d\n",t);
return 0;
}
int prime(int num)
{
int i;
if(num <= 3 && num > 1) return 1;
else if(num % 2 ==0 || num % 3 == 0) return 0;
else for(i = 5;i * i <= num;i+=6)
{
if(num % i == 0 || num % (i + 2) == 0)
{
return 0;
}
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248973/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%in = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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 %for.end
for.body: ; preds = %entry, %for.cond
%t.013 = phi i32 [ %4, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%1 = load i32, ptr %in, align 4, !tbaa !5
%2 = and i32 %1, -2
%or.cond.i = icmp eq i32 %2, 2
br i1 %or.cond.i, label %prime.exit, label %if.else.i
if.else.i: ; preds = %for.body
%3 = and i32 %1, 1
%cmp2.i = icmp eq i32 %3, 0
%rem3.i = srem i32 %1, 3
%cmp4.i = icmp eq i32 %rem3.i, 0
%or.cond27.i = or i1 %cmp2.i, %cmp4.i
br i1 %or.cond27.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else.i
%cmp7.not28.i = icmp slt i32 %1, 25
br i1 %cmp7.not28.i, label %prime.exit, label %for.body.i
for.cond.i: ; preds = %lor.lhs.false10.i
%add14.i = add nuw nsw i32 %i.029.i, 6
%mul.i = mul nsw i32 %add14.i, %add14.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %prime.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.029.i = phi i32 [ %add14.i, %for.cond.i ], [ 5, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.029.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %lor.lhs.false10.i
lor.lhs.false10.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.029.i, 2
%rem11.i = srem i32 %1, %add.i
%cmp12.i = icmp eq i32 %rem11.i, 0
br i1 %cmp12.i, label %for.cond, label %for.cond.i
prime.exit: ; preds = %for.cond.i, %for.body, %for.cond.preheader.i
%inc = add nsw i32 %t.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %lor.lhs.false10.i, %if.else.i, %prime.exit
%4 = phi i32 [ %inc, %prime.exit ], [ %t.013, %if.else.i ], [ %t.013, %lor.lhs.false10.i ], [ %t.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%5 = load i32, ptr %num, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%t.0.lcssa = phi i32 [ 0, %entry ], [ %4, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %t.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in) #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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @prime(i32 noundef %num) local_unnamed_addr #3 {
entry:
%0 = and i32 %num, -2
%or.cond = icmp eq i32 %0, 2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
%1 = and i32 %num, 1
%cmp2 = icmp eq i32 %1, 0
%rem3 = srem i32 %num, 3
%cmp4 = icmp eq i32 %rem3, 0
%or.cond27 = or i1 %cmp2, %cmp4
br i1 %or.cond27, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else
%cmp7.not28 = icmp slt i32 %num, 25
br i1 %cmp7.not28, label %cleanup, label %for.body
for.cond: ; preds = %lor.lhs.false10
%add14 = add nuw nsw i32 %i.029, 6
%mul = mul nsw i32 %add14, %add14
%cmp7.not = icmp sgt i32 %mul, %num
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.029 = phi i32 [ %add14, %for.cond ], [ 5, %for.cond.preheader ]
%rem8 = srem i32 %num, %i.029
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %lor.lhs.false10
lor.lhs.false10: ; preds = %for.body
%add = add nuw nsw i32 %i.029, 2
%rem11 = srem i32 %num, %add
%cmp12 = icmp eq i32 %rem11, 0
br i1 %cmp12, label %cleanup, label %for.cond
cleanup: ; preds = %lor.lhs.false10, %for.body, %for.cond, %for.cond.preheader, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %for.cond.preheader ], [ 0, %lor.lhs.false10 ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#define N 10000
int main(){
int num[N],n,i,j=3,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&num[i]);
for(i=0;i<n;i++){
if(num[i]==2)count+=1;
else if(num[i]>2&&num[i]%2!=0){
while(j<=sqrt(num[i])){
if(num[i]%j==0){
count-=1;
break;
}
else j+=2;
}
count+=1;
j=3;
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %num) #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
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.end34
for.cond2.preheader: ; preds = %for.body
%cmp356 = icmp sgt i32 %1, 0
br i1 %cmp356, label %for.body4, label %for.end34
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc32
%3 = phi i32 [ %6, %for.inc32 ], [ %1, %for.cond2.preheader ]
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc32 ], [ 0, %for.cond2.preheader ]
%count.058 = phi i32 [ %count.2, %for.inc32 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv60
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %4, 2
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %for.body4
%add = add nsw i32 %count.058, 1
br label %for.inc32
if.else: ; preds = %for.body4
%cmp10 = icmp slt i32 %4, 3
%rem = and i32 %4, 1
%cmp13.not = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp10, %cmp13.not
br i1 %or.cond, label %for.inc32, label %while.cond.preheader
while.cond.preheader: ; preds = %if.else
%conv1752 = sitofp i32 %4 to double
%call1853 = call double @sqrt(double noundef %conv1752) #4
%cmp1954 = fcmp ult double %call1853, 3.000000e+00
br i1 %cmp1954, label %while.end, label %while.body
while.cond: ; preds = %while.body
%add28 = add nuw nsw i32 %j.155, 2
%conv = sitofp i32 %add28 to double
%conv17 = sitofp i32 %5 to double
%call18 = call double @sqrt(double noundef %conv17) #4
%cmp19 = fcmp ult double %call18, %conv
br i1 %cmp19, label %while.end, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%j.155 = phi i32 [ %add28, %while.cond ], [ 3, %while.cond.preheader ]
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem23 = srem i32 %5, %j.155
%cmp24 = icmp eq i32 %rem23, 0
br i1 %cmp24, label %if.then26, label %while.cond
if.then26: ; preds = %while.body
%sub = add nsw i32 %count.058, -1
br label %while.end
while.end: ; preds = %while.cond, %while.cond.preheader, %if.then26
%count.1 = phi i32 [ %sub, %if.then26 ], [ %count.058, %while.cond.preheader ], [ %count.058, %while.cond ]
%add29 = add nsw i32 %count.1, 1
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc32
for.inc32: ; preds = %if.then, %while.end, %if.else
%6 = phi i32 [ %3, %if.then ], [ %.pre, %while.end ], [ %3, %if.else ]
%count.2 = phi i32 [ %add, %if.then ], [ %add29, %while.end ], [ %count.058, %if.else ]
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next61, %7
br i1 %cmp3, label %for.body4, label %for.end34, !llvm.loop !12
for.end34: ; preds = %for.inc32, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.2, %for.inc32 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 40000, 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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int isPrime(int);
int count;
int main(void){
int i,j,m,a;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&a);
isPrime(a);
}
printf("%d\n",count);
return 0;
}
int isPrime(int d){
int i;
if(d==2){count++;return 0;}
if(d>2&&d%2==0)return 0;
for(i=3;i<=sqrt(d);i+=2)
if(d%i==0)return 0;
count++;
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249059/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249059/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@count = 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:
%m = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %isPrime.exit
%i.06 = phi i32 [ %inc, %isPrime.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %cleanup.sink.split.i, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp sgt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = and i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %isPrime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call20.i = call double @sqrt(double noundef %conv5.i) #5
%cmp621.i = fcmp ult double %call20.i, 3.000000e+00
br i1 %cmp621.i, label %cleanup.sink.split.i, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.022.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %cleanup.sink.split.i, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.022.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.022.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isPrime.exit, label %for.cond.i
cleanup.sink.split.i: ; preds = %for.cond.i, %for.cond.preheader.i, %for.body
%2 = load i32, ptr @count, align 4, !tbaa !5
%inc13.i = add nsw i32 %2, 1
store i32 %inc13.i, ptr @count, align 4, !tbaa !5
br label %isPrime.exit
isPrime.exit: ; preds = %for.body.i, %if.end.i, %cleanup.sink.split.i
%inc = add nuw nsw i32 %i.06, 1
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %isPrime.exit, %entry
%4 = load i32, ptr @count, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local i32 @isPrime(i32 noundef %d) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %d, 2
br i1 %cmp, label %cleanup.sink.split, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp sgt i32 %d, 2
%rem = and i32 %d, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = and i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %d to double
%call20 = tail call double @sqrt(double noundef %conv5) #5
%cmp621 = fcmp ult double %call20, 3.000000e+00
br i1 %cmp621, label %cleanup.sink.split, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.022, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup.sink.split, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.022 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %d, %i.022
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup.sink.split: ; preds = %for.cond, %for.cond.preheader, %entry
%0 = load i32, ptr @count, align 4, !tbaa !5
%inc13 = add nsw i32 %0, 1
store i32 %inc13, ptr @count, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %for.body, %cleanup.sink.split, %if.end
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int isPrime(int x){
int i;
if(x < 2) return 0;
else if(x == 2) return 1;
if(x % 2 == 0) return 0;
for(i = 3; i * i <= x; i += 2){
if(x % i == 0) return 0;
}
return 1;
}
int main(){
int n, x, i;
int cnt = 0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &x);
if(isPrime(x)) cnt++;
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249101/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249101/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %x, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = 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 %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%cnt.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %cnt.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %isPrime.exit
%2 = phi i32 [ %inc, %isPrime.exit ], [ %cnt.012, %for.body ], [ %cnt.012, %if.end3.i ], [ %cnt.012, %for.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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}
|
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 2000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1000000
#define M_MAX 200000
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
// double distance (sll x1, sll y1, sll x2, sll y2) {
// double xdist2, ydist2, origindist, dist;
// xdist2 = (x1 - x2) * (x1 - x2);
// ydist2 = (y1 - y2) * (y1 - y2);
// return sqrt(xdist2 + ydist2);
// }
int32_t pullcomp (const void *left, const void *right) {
ull l = *(ull*)left;
ull r = *(ull*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t psllcomp (const void *left, const void *right) {
sll l = *(sll*)left;
sll r = *(sll*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pcharcomp (const void *left, const void *right) {
char l = *(char*)left;
char r = *(char*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pdoublecomp (const void *left, const void *right) {
double l = *(double*)left;
double r = *(double*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
int32_t phwllABcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
return 0;
}
int32_t phwllREVcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
return 0;
}
int32_t ptriplecomp (const void *left, const void *right) {
hwllc l = *(hwllc*)left;
hwllc r = *(hwllc*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.c < r.c) {
return -1;
}
if (l.c > r.c) {
return +1;
}
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX];
// sll a[3001][3001];
sll b[N_MAX];
// sll b[3001][3001];
sll c[N_MAX];
// sll d[N_MAX];
// sll e[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
// hwll xy[N_MAX];
// sll table[1000][1000];
typedef ull mat[100][100];
ull parent[N_MAX];
ull rank[N_MAX];
void uf_init(ull n) {
for (ull i = 0; i < n; i++) {
parent[i] = i;
rank[i] = 0;
}
}
ull uf_find(ull x) {
if (parent[x] == x) return x;
return parent[x] = uf_find(parent[x]);
}
bool uf_union(ull a, ull b) {
a = uf_find(a);
b = uf_find(b);
if (a == b) return false;
if (rank[b] > rank[a]) {
b ^= a;
a ^= b;
b ^= a;
}
parent[b] = a;
if (rank[a] == rank[b]) {
rank[a]++;
}
return true;
}
ull mergeteq(sll a[], ull n) {
if (n == 1) return 0;
ull l = n / 2;
ull r = n - l;
ull ret = mergeteq(a, l) + mergeteq(a + l, r);
ull tmp[n];
ull i = 0, j = 0;
while (i < l || j < r) {
if (i == l) {
tmp[i + j] = a[l + j];
j++;
} else if (j == r) {
tmp[i + j] = a[i];
i++;
} else if (a[i] < a[l + j]) {
ret += (l - i);
tmp[i + j] = a[l + j];
j++;
} else {
tmp[i + j] = a[i];
i++;
}
}
// printf("[%llu]%llu...\n", n, ret);
for (i = 0; i < n; i++) {
a[i] = tmp[i];
}
return ret;
}
ull isok (sll x) {
sll i;
b[0] = 0;
for (i = 0; i < n; i++) {
b[i + 1] = b[i];
if (a[i] <= x) {
b[i + 1]++;
} else {
b[i + 1]--;
}
// printf("%lld ", b[i + 1]);
}
return mergeteq(b, n + 1);
}
ull solve () {
sll i, j, ki, li;
ull result = 0;
// sll result = 0;
double dresult = 0;
// ull maybe = 0;
sll maybe = 0;
// ull sum = 0;
sll sum = 0;
sll item;
ull *dpcell;
result = BIG;
for (i = 0; i + k <= n; i++) {
if (a[i + k - 1] <= 0) {
maybe = -a[i];
} else if (a[i] >= 0) {
maybe = a[i + k - 1];
} else {
maybe = a[i + k - 1] - a[i] + smin(-a[i], a[i + k - 1]);
}
result = smin(result, maybe);
}
printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
// puts("YES");
puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Yay!");
return 0;
fail:
// puts("NO");
puts("No");
// puts("0");
// puts("-1");
// puts("-1 -1 -1");
// puts(":(");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
scanf("%llu", &n, &m);
scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu", &ua, &ub, &uc, &ud);
// scanf("%llu", &q);
// scanf("%s", s);
// scanf("%s", t);
for (i = 0; i < n; i++) {
// scanf("%lld%lld", &xy[i].a, &xy[i].b);
scanf("%lld", &a[i]);
// scanf("%lld", &b[i]);
// scanf("%lld", &c[i]);
// scanf("%lld", &d[i]);
// a[i]--;
// b[i]--;
// c[i]--;
}
// scanf("%llu", &m, &k);
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// scanf("%lld", &b[i]);
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%llu", &table[i][j]);
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", &s[i]);
// }
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249152/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249152/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@parent = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@rank = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@b = dso_local global [1000000 x i64] zeroinitializer, align 16
@n = dso_local global i64 0, align 8
@a = dso_local global [1000000 x i64] zeroinitializer, align 16
@k = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@m = dso_local global i64 0, align 8
@.str.4 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
@ua = dso_local local_unnamed_addr global i64 0, align 8
@ub = dso_local local_unnamed_addr global i64 0, align 8
@uc = dso_local local_unnamed_addr global i64 0, align 8
@ud = dso_local local_unnamed_addr global i64 0, align 8
@ue = dso_local local_unnamed_addr global i64 0, align 8
@uf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@c = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%tobool.not12 = icmp eq i64 %x, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.015, %a.addr.014
%rem = urem i64 %mul, %modulo
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ]
%div11 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.014, %a.addr.014
%rem3 = urem i64 %mul2, %modulo
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !12
%1 = load i8, ptr %right, align 1, !tbaa !12
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load double, ptr %left, align 8, !tbaa !13
%1 = load double, ptr %right, align 8, !tbaa !13
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp ogt double %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !15
%1 = load ptr, ptr %right, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @uf_init(i64 noundef %n) local_unnamed_addr #6 {
entry:
%cmp6.not = icmp eq i64 %n, 0
br i1 %cmp6.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = shl nuw i64 %n, 3
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @rank, i8 0, i64 %0, i1 false), !tbaa !8
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%1 = getelementptr inbounds [1000000 x i64], ptr @parent, i64 0, i64 %index
store <2 x i64> %vec.ind, ptr %1, align 16, !tbaa !8
%2 = getelementptr inbounds i64, ptr %1, i64 2
store <2 x i64> %step.add, ptr %2, align 16, !tbaa !8
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
ret void
for.body: ; preds = %for.body.preheader9, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @parent, i64 0, i64 %i.07
store i64 %i.07, ptr %arrayidx, align 8, !tbaa !8
%inc = add nuw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !23
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @uf_find(i64 noundef %x) local_unnamed_addr #7 {
entry:
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @parent, i64 0, i64 %x
%0 = load i64, ptr %arrayidx, align 8, !tbaa !8
%cmp = icmp eq i64 %0, %x
br i1 %cmp, label %common.ret7, label %if.end
common.ret7: ; preds = %entry, %if.end
%common.ret7.op = phi i64 [ %call, %if.end ], [ %x, %entry ]
ret i64 %common.ret7.op
if.end: ; preds = %entry
%call = tail call i64 @uf_find(i64 noundef %0)
store i64 %call, ptr %arrayidx, align 8, !tbaa !8
br label %common.ret7
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @uf_union(i64 noundef %a, i64 noundef %b) local_unnamed_addr #8 {
entry:
%call = tail call i64 @uf_find(i64 noundef %a)
%call1 = tail call i64 @uf_find(i64 noundef %b)
%cmp = icmp ne i64 %call, %call1
br i1 %cmp, label %if.end, label %return
if.end: ; preds = %entry
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @rank, i64 0, i64 %call1
%0 = load i64, ptr %arrayidx, align 8, !tbaa !8
%arrayidx2 = getelementptr inbounds [1000000 x i64], ptr @rank, i64 0, i64 %call
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !8
%cmp3 = icmp ugt i64 %0, %1
%spec.select = select i1 %cmp3, i64 %call1, i64 %call
%spec.select30 = select i1 %cmp3, i64 %call, i64 %call1
%arrayidx8 = getelementptr inbounds [1000000 x i64], ptr @parent, i64 0, i64 %spec.select30
store i64 %spec.select, ptr %arrayidx8, align 8, !tbaa !8
%arrayidx9 = getelementptr inbounds [1000000 x i64], ptr @rank, i64 0, i64 %spec.select
%2 = load i64, ptr %arrayidx9, align 8, !tbaa !8
%arrayidx10 = getelementptr inbounds [1000000 x i64], ptr @rank, i64 0, i64 %spec.select30
%3 = load i64, ptr %arrayidx10, align 8, !tbaa !8
%cmp11 = icmp eq i64 %2, %3
br i1 %cmp11, label %if.then12, label %return
if.then12: ; preds = %if.end
%inc = add i64 %2, 1
store i64 %inc, ptr %arrayidx9, align 8, !tbaa !8
br label %return
return: ; preds = %if.end, %if.then12, %entry
ret i1 %cmp
}
; Function Attrs: nofree nosync nounwind uwtable
define dso_local i64 @mergeteq(ptr noundef %a, i64 noundef %n) local_unnamed_addr #9 {
entry:
%cmp = icmp eq i64 %n, 1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%div89 = lshr i64 %n, 1
%sub = sub i64 %n, %div89
%call = tail call i64 @mergeteq(ptr noundef %a, i64 noundef %div89)
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %div89
%call1 = tail call i64 @mergeteq(ptr noundef %add.ptr, i64 noundef %sub)
%add = add i64 %call1, %call
%0 = tail call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %n, align 16
%cmp290.not = icmp eq i64 %n, 0
br i1 %cmp290.not, label %for.end, label %while.body.preheader
while.body.preheader: ; preds = %if.end
%invariant.gep = getelementptr i64, ptr %vla, i64 %sub
%1 = getelementptr i64, ptr %vla, i64 %div89
br label %while.body
for.cond.preheader: ; preds = %if.end35
br i1 %cmp290.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%2 = shl nuw i64 %n, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %a, ptr nonnull align 16 %vla, i64 %2, i1 false), !tbaa !8
br label %for.end
while.body: ; preds = %while.body.preheader, %if.end35
%j.094 = phi i64 [ %j.1, %if.end35 ], [ 0, %while.body.preheader ]
%i.093 = phi i64 [ %i.1, %if.end35 ], [ 0, %while.body.preheader ]
%ret.092 = phi i64 [ %ret.1, %if.end35 ], [ %add, %while.body.preheader ]
%cmp4 = icmp eq i64 %i.093, %div89
br i1 %cmp4, label %if.then5, label %if.else
if.then5: ; preds = %while.body
%arrayidx = getelementptr i64, ptr %add.ptr, i64 %j.094
%3 = load i64, ptr %arrayidx, align 8, !tbaa !8
%arrayidx8 = getelementptr i64, ptr %1, i64 %j.094
store i64 %3, ptr %arrayidx8, align 8, !tbaa !8
%inc = add i64 %j.094, 1
br label %if.end35
if.else: ; preds = %while.body
%cmp9 = icmp eq i64 %j.094, %sub
%arrayidx11 = getelementptr inbounds i64, ptr %a, i64 %i.093
%4 = load i64, ptr %arrayidx11, align 8, !tbaa !8
br i1 %cmp9, label %if.then10, label %if.else15
if.then10: ; preds = %if.else
%gep = getelementptr i64, ptr %invariant.gep, i64 %i.093
store i64 %4, ptr %gep, align 8, !tbaa !8
%inc14 = add i64 %i.093, 1
br label %if.end35
if.else15: ; preds = %if.else
%arrayidx18 = getelementptr i64, ptr %add.ptr, i64 %j.094
%5 = load i64, ptr %arrayidx18, align 8, !tbaa !8
%cmp19 = icmp slt i64 %4, %5
br i1 %cmp19, label %if.then20, label %if.else28
if.then20: ; preds = %if.else15
%sub21 = add i64 %ret.092, %div89
%add22 = sub i64 %sub21, %i.093
%6 = getelementptr i64, ptr %vla, i64 %i.093
%arrayidx26 = getelementptr i64, ptr %6, i64 %j.094
store i64 %5, ptr %arrayidx26, align 8, !tbaa !8
%inc27 = add i64 %j.094, 1
br label %if.end35
if.else28: ; preds = %if.else15
%7 = getelementptr i64, ptr %vla, i64 %i.093
%arrayidx31 = getelementptr i64, ptr %7, i64 %j.094
store i64 %4, ptr %arrayidx31, align 8, !tbaa !8
%inc32 = add i64 %i.093, 1
br label %if.end35
if.end35: ; preds = %if.then10, %if.else28, %if.then20, %if.then5
%ret.1 = phi i64 [ %ret.092, %if.then5 ], [ %ret.092, %if.then10 ], [ %add22, %if.then20 ], [ %ret.092, %if.else28 ]
%i.1 = phi i64 [ %div89, %if.then5 ], [ %inc14, %if.then10 ], [ %i.093, %if.then20 ], [ %inc32, %if.else28 ]
%j.1 = phi i64 [ %inc, %if.then5 ], [ %sub, %if.then10 ], [ %inc27, %if.then20 ], [ %j.094, %if.else28 ]
%cmp2 = icmp ult i64 %i.1, %div89
%cmp3 = icmp ult i64 %j.1, %sub
%8 = select i1 %cmp2, i1 true, i1 %cmp3
br i1 %8, label %while.body, label %for.cond.preheader, !llvm.loop !24
for.end: ; preds = %if.end, %for.body.preheader, %for.cond.preheader
%ret.0.lcssa98 = phi i64 [ %ret.1, %for.body.preheader ], [ %ret.1, %for.cond.preheader ], [ %add, %if.end ]
tail call void @llvm.stackrestore.p0(ptr %0)
br label %return
return: ; preds = %entry, %for.end
%retval.0 = phi i64 [ %ret.0.lcssa98, %for.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #10
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #10
; Function Attrs: nofree nosync nounwind uwtable
define dso_local i64 @isok(i64 noundef %x) local_unnamed_addr #9 {
entry:
store i64 0, ptr @b, align 16, !tbaa !8
%0 = load i64, ptr @n, align 8, !tbaa !8
%cmp16.not = icmp eq i64 %0, 0
br i1 %cmp16.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %0, 1
%1 = icmp eq i64 %0, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%2 = phi i64 [ 0, %for.body.preheader.new ], [ %storemerge.1, %for.body ]
%i.017 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%add = or i64 %i.017, 1
%arrayidx1 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %add
%arrayidx2 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.017
%3 = load i64, ptr %arrayidx2, align 16, !tbaa !8
%cmp3.not = icmp sgt i64 %3, %x
%storemerge.v = select i1 %cmp3.not, i64 -1, i64 1
%storemerge = add nsw i64 %storemerge.v, %2
store i64 %storemerge, ptr %arrayidx1, align 8, !tbaa !8
%add.1 = add nuw nsw i64 %i.017, 2
%arrayidx1.1 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %add.1
%arrayidx2.1 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %add
%4 = load i64, ptr %arrayidx2.1, align 8, !tbaa !8
%cmp3.not.1 = icmp sgt i64 %4, %x
%storemerge.v.1 = select i1 %cmp3.not.1, i64 -1, i64 1
%storemerge.1 = add nsw i64 %storemerge.v.1, %storemerge
store i64 %storemerge.1, ptr %arrayidx1.1, align 16, !tbaa !8
%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 !25
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%.unr = phi i64 [ 0, %for.body.preheader ], [ %storemerge.1, %for.body ]
%i.017.unr = phi i64 [ 0, %for.body.preheader ], [ %add.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
%add.epil = add nuw nsw i64 %i.017.unr, 1
%arrayidx1.epil = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %add.epil
%arrayidx2.epil = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.017.unr
%5 = load i64, ptr %arrayidx2.epil, align 8, !tbaa !8
%cmp3.not.epil = icmp sgt i64 %5, %x
%storemerge.v.epil = select i1 %cmp3.not.epil, i64 -1, i64 1
%storemerge.epil = add nsw i64 %storemerge.v.epil, %.unr
store i64 %storemerge.epil, ptr %arrayidx1.epil, align 8, !tbaa !8
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%add9 = add i64 %0, 1
%call = tail call i64 @mergeteq(ptr noundef nonnull @b, i64 noundef %add9)
ret i64 %call
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #11 {
entry:
%0 = load i64, ptr @k, align 8, !tbaa !8
%1 = load i64, ptr @n, align 8, !tbaa !8
%cmp.not49 = icmp ugt i64 %0, %1
br i1 %cmp.not49, label %for.end, label %for.body
for.body: ; preds = %entry, %if.end23
%add52 = phi i64 [ %add, %if.end23 ], [ %0, %entry ]
%i.051 = phi i64 [ %inc, %if.end23 ], [ 0, %entry ]
%result.050 = phi i64 [ %cond.i48, %if.end23 ], [ 2000000007, %entry ]
%sub = add i64 %add52, -1
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %sub
%2 = load i64, ptr %arrayidx, align 8, !tbaa !8
%cmp2 = icmp slt i64 %2, 1
%arrayidx3 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.051
%3 = load i64, ptr %arrayidx3, align 8, !tbaa !8
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%sub4 = sub nsw i64 0, %3
br label %if.end23
if.else: ; preds = %for.body
%cmp6 = icmp sgt i64 %3, -1
br i1 %cmp6, label %if.end23, label %if.else11
if.else11: ; preds = %if.else
%sub18 = sub i64 0, %3
%sub16 = sub i64 %2, %3
%cond.i = tail call i64 @llvm.smin.i64(i64 %sub18, i64 %2)
%add22 = add nuw nsw i64 %sub16, %cond.i
br label %if.end23
if.end23: ; preds = %if.else, %if.else11, %if.then
%maybe.0 = phi i64 [ %sub4, %if.then ], [ %add22, %if.else11 ], [ %2, %if.else ]
%cond.i48 = tail call i64 @llvm.smin.i64(i64 %result.050, i64 %maybe.0)
%inc = add nuw nsw i64 %i.051, 1
%add = add i64 %0, %inc
%cmp.not = icmp ugt i64 %add, %1
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !26
for.end: ; preds = %if.end23, %entry
%result.0.lcssa = phi i64 [ 2000000007, %entry ], [ %cond.i48, %if.end23 ]
%call25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.0.lcssa)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #12
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #11 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @k, ptr noundef nonnull @n, ptr noundef nonnull @m)
%0 = load i64, ptr @n, align 8, !tbaa !8
%cmp7.not = icmp eq i64 %0, 0
br i1 %cmp7.not, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%1 = load i64, ptr @n, align 8, !tbaa !8
%cmp = icmp ugt i64 %1, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !27
for.end: ; preds = %for.body, %entry
%.lcssa = phi i64 [ 0, %entry ], [ %1, %for.body ]
%2 = load i64, ptr @k, align 8, !tbaa !8
%cmp.not49.i = icmp ugt i64 %2, %.lcssa
br i1 %cmp.not49.i, label %solve.exit, label %for.body.i
for.body.i: ; preds = %for.end, %if.end23.i
%add52.i = phi i64 [ %add.i, %if.end23.i ], [ %2, %for.end ]
%i.051.i = phi i64 [ %inc.i, %if.end23.i ], [ 0, %for.end ]
%result.050.i = phi i64 [ %cond.i48.i, %if.end23.i ], [ 2000000007, %for.end ]
%sub.i = add i64 %add52.i, -1
%arrayidx.i = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %sub.i
%3 = load i64, ptr %arrayidx.i, align 8, !tbaa !8
%cmp2.i = icmp slt i64 %3, 1
%arrayidx3.i = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.051.i
%4 = load i64, ptr %arrayidx3.i, align 8, !tbaa !8
%sub4.i = sub i64 0, %4
br i1 %cmp2.i, label %if.end23.i, label %if.else.i
if.else.i: ; preds = %for.body.i
%cmp6.i = icmp sgt i64 %4, -1
br i1 %cmp6.i, label %if.end23.i, label %if.else11.i
if.else11.i: ; preds = %if.else.i
%sub16.i = sub i64 %3, %4
%cond.i.i = tail call i64 @llvm.smin.i64(i64 %sub4.i, i64 %3)
%add22.i = add nuw nsw i64 %sub16.i, %cond.i.i
br label %if.end23.i
if.end23.i: ; preds = %for.body.i, %if.else11.i, %if.else.i
%maybe.0.i = phi i64 [ %add22.i, %if.else11.i ], [ %3, %if.else.i ], [ %sub4.i, %for.body.i ]
%cond.i48.i = tail call i64 @llvm.smin.i64(i64 %result.050.i, i64 %maybe.0.i)
%inc.i = add nuw nsw i64 %i.051.i, 1
%add.i = add i64 %inc.i, %2
%cmp.not.i = icmp ugt i64 %add.i, %.lcssa
br i1 %cmp.not.i, label %solve.exit, label %for.body.i, !llvm.loop !26
solve.exit: ; preds = %if.end23.i, %for.end
%result.0.lcssa.i = phi i64 [ 2000000007, %for.end ], [ %cond.i48.i, %if.end23.i ]
%call25.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.0.lcssa.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.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.smax.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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #14
; 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) #15
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nosync nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #15 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #16 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = distinct !{!20, !6, !21, !22}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !6, !22, !21}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !6}
!27 = distinct !{!27, !6}
|
#include<stdio.h>
int main(){
int n,a,b,i,k[20]={0};
char c[20];
scanf("%d %d %d",&a,&b,&n);
for(i=10;i>-1;i--){
c[i]=a%10-k[i]-b%10+'0';
if(c[i]<'0'){
c[i]+=10;
k[i-1]=1;
}
a/=10;
b/=10;
}
for(i=0;i<10;i++){
if(k[i]&&n&&c[i]-'9'){
c[i]++;
n--;
}
}//*/
for(i=0;c[i]=='0';i++);
printf("%s\n",c+i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249196/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249196/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%k = alloca [20 x i32], align 16
%c = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %k) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %k, i8 0, i64 80, i1 false)
call void @llvm.lifetime.start.p0(i64 20, 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 %n)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
br label %for.body
for.cond19.preheader: ; preds = %if.end
store i32 %div, ptr %a, align 4, !tbaa !5
store i32 %div18, ptr %b, align 4, !tbaa !5
%n.promoted = load i32, ptr %n, align 4
%0 = load i32, ptr %k, align 16, !tbaa !5
%tobool = icmp ne i32 %0, 0
%tobool25 = icmp ne i32 %n.promoted, 0
%or.cond = select i1 %tobool, i1 %tobool25, i1 false
br i1 %or.cond, label %land.lhs.true26, label %for.inc37
for.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ 10, %entry ], [ %indvars.iv.next.pre-phi, %if.end ]
%div6669 = phi i32 [ %a.promoted, %entry ], [ %div, %if.end ]
%div186768 = phi i32 [ %b.promoted, %entry ], [ %div18, %if.end ]
%rem = srem i32 %div6669, 10
%div = sdiv i32 %div6669, 10
%arrayidx = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%rem1 = srem i32 %div186768, 10
%div18 = sdiv i32 %div186768, 10
%2 = add i32 %1, %rem1
%sub2 = sub i32 %rem, %2
%3 = trunc i32 %sub2 to i8
%conv = add i8 %3, 48
%arrayidx4 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx4, align 1, !tbaa !9
%cmp8 = icmp ugt i8 %3, 79
br i1 %cmp8, label %if.then, label %for.body.if.end_crit_edge
for.body.if.end_crit_edge: ; preds = %for.body
%.pre = add nsw i64 %indvars.iv, -1
br label %if.end
if.then: ; preds = %for.body
%add13 = add i8 %3, 58
store i8 %add13, ptr %arrayidx4, align 1, !tbaa !9
%4 = add nsw i64 %indvars.iv, -1
%arrayidx17 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 %4
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %for.body.if.end_crit_edge, %if.then
%indvars.iv.next.pre-phi = phi i64 [ %.pre, %for.body.if.end_crit_edge ], [ %4, %if.then ]
%cmp.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp.not, label %for.cond19.preheader, label %for.body, !llvm.loop !10
land.lhs.true26: ; preds = %for.cond19.preheader
%5 = load i8, ptr %c, align 16, !tbaa !9
%tobool31.not = icmp eq i8 %5, 57
br i1 %tobool31.not, label %for.inc37, label %if.then32
if.then32: ; preds = %land.lhs.true26
%inc = add i8 %5, 1
store i8 %inc, ptr %c, align 16, !tbaa !9
%dec35 = add nsw i32 %n.promoted, -1
store i32 %dec35, ptr %n, align 4, !tbaa !5
br label %for.inc37
for.inc37: ; preds = %for.cond19.preheader, %land.lhs.true26, %if.then32
%6 = phi i32 [ %n.promoted, %for.cond19.preheader ], [ %n.promoted, %land.lhs.true26 ], [ %dec35, %if.then32 ]
%arrayidx24.1 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 1
%7 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%tobool.1 = icmp ne i32 %7, 0
%tobool25.1 = icmp ne i32 %6, 0
%or.cond.1 = select i1 %tobool.1, i1 %tobool25.1, i1 false
br i1 %or.cond.1, label %land.lhs.true26.1, label %for.inc37.1
land.lhs.true26.1: ; preds = %for.inc37
%arrayidx28.1 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 1
%8 = load i8, ptr %arrayidx28.1, align 1, !tbaa !9
%tobool31.not.1 = icmp eq i8 %8, 57
br i1 %tobool31.not.1, label %for.inc37.1, label %if.then32.1
if.then32.1: ; preds = %land.lhs.true26.1
%inc.1 = add i8 %8, 1
store i8 %inc.1, ptr %arrayidx28.1, align 1, !tbaa !9
%dec35.1 = add nsw i32 %6, -1
store i32 %dec35.1, ptr %n, align 4, !tbaa !5
br label %for.inc37.1
for.inc37.1: ; preds = %if.then32.1, %land.lhs.true26.1, %for.inc37
%9 = phi i32 [ %6, %for.inc37 ], [ %6, %land.lhs.true26.1 ], [ %dec35.1, %if.then32.1 ]
%arrayidx24.2 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 2
%10 = load i32, ptr %arrayidx24.2, align 8, !tbaa !5
%tobool.2 = icmp ne i32 %10, 0
%tobool25.2 = icmp ne i32 %9, 0
%or.cond.2 = select i1 %tobool.2, i1 %tobool25.2, i1 false
br i1 %or.cond.2, label %land.lhs.true26.2, label %for.inc37.2
land.lhs.true26.2: ; preds = %for.inc37.1
%arrayidx28.2 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 2
%11 = load i8, ptr %arrayidx28.2, align 2, !tbaa !9
%tobool31.not.2 = icmp eq i8 %11, 57
br i1 %tobool31.not.2, label %for.inc37.2, label %if.then32.2
if.then32.2: ; preds = %land.lhs.true26.2
%inc.2 = add i8 %11, 1
store i8 %inc.2, ptr %arrayidx28.2, align 2, !tbaa !9
%dec35.2 = add nsw i32 %9, -1
store i32 %dec35.2, ptr %n, align 4, !tbaa !5
br label %for.inc37.2
for.inc37.2: ; preds = %if.then32.2, %land.lhs.true26.2, %for.inc37.1
%12 = phi i32 [ %9, %for.inc37.1 ], [ %9, %land.lhs.true26.2 ], [ %dec35.2, %if.then32.2 ]
%arrayidx24.3 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 3
%13 = load i32, ptr %arrayidx24.3, align 4, !tbaa !5
%tobool.3 = icmp ne i32 %13, 0
%tobool25.3 = icmp ne i32 %12, 0
%or.cond.3 = select i1 %tobool.3, i1 %tobool25.3, i1 false
br i1 %or.cond.3, label %land.lhs.true26.3, label %for.inc37.3
land.lhs.true26.3: ; preds = %for.inc37.2
%arrayidx28.3 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 3
%14 = load i8, ptr %arrayidx28.3, align 1, !tbaa !9
%tobool31.not.3 = icmp eq i8 %14, 57
br i1 %tobool31.not.3, label %for.inc37.3, label %if.then32.3
if.then32.3: ; preds = %land.lhs.true26.3
%inc.3 = add i8 %14, 1
store i8 %inc.3, ptr %arrayidx28.3, align 1, !tbaa !9
%dec35.3 = add nsw i32 %12, -1
store i32 %dec35.3, ptr %n, align 4, !tbaa !5
br label %for.inc37.3
for.inc37.3: ; preds = %if.then32.3, %land.lhs.true26.3, %for.inc37.2
%15 = phi i32 [ %12, %for.inc37.2 ], [ %12, %land.lhs.true26.3 ], [ %dec35.3, %if.then32.3 ]
%arrayidx24.4 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 4
%16 = load i32, ptr %arrayidx24.4, align 16, !tbaa !5
%tobool.4 = icmp ne i32 %16, 0
%tobool25.4 = icmp ne i32 %15, 0
%or.cond.4 = select i1 %tobool.4, i1 %tobool25.4, i1 false
br i1 %or.cond.4, label %land.lhs.true26.4, label %for.inc37.4
land.lhs.true26.4: ; preds = %for.inc37.3
%arrayidx28.4 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 4
%17 = load i8, ptr %arrayidx28.4, align 4, !tbaa !9
%tobool31.not.4 = icmp eq i8 %17, 57
br i1 %tobool31.not.4, label %for.inc37.4, label %if.then32.4
if.then32.4: ; preds = %land.lhs.true26.4
%inc.4 = add i8 %17, 1
store i8 %inc.4, ptr %arrayidx28.4, align 4, !tbaa !9
%dec35.4 = add nsw i32 %15, -1
store i32 %dec35.4, ptr %n, align 4, !tbaa !5
br label %for.inc37.4
for.inc37.4: ; preds = %if.then32.4, %land.lhs.true26.4, %for.inc37.3
%18 = phi i32 [ %15, %for.inc37.3 ], [ %15, %land.lhs.true26.4 ], [ %dec35.4, %if.then32.4 ]
%arrayidx24.5 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 5
%19 = load i32, ptr %arrayidx24.5, align 4, !tbaa !5
%tobool.5 = icmp ne i32 %19, 0
%tobool25.5 = icmp ne i32 %18, 0
%or.cond.5 = select i1 %tobool.5, i1 %tobool25.5, i1 false
br i1 %or.cond.5, label %land.lhs.true26.5, label %for.inc37.5
land.lhs.true26.5: ; preds = %for.inc37.4
%arrayidx28.5 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 5
%20 = load i8, ptr %arrayidx28.5, align 1, !tbaa !9
%tobool31.not.5 = icmp eq i8 %20, 57
br i1 %tobool31.not.5, label %for.inc37.5, label %if.then32.5
if.then32.5: ; preds = %land.lhs.true26.5
%inc.5 = add i8 %20, 1
store i8 %inc.5, ptr %arrayidx28.5, align 1, !tbaa !9
%dec35.5 = add nsw i32 %18, -1
store i32 %dec35.5, ptr %n, align 4, !tbaa !5
br label %for.inc37.5
for.inc37.5: ; preds = %if.then32.5, %land.lhs.true26.5, %for.inc37.4
%21 = phi i32 [ %18, %for.inc37.4 ], [ %18, %land.lhs.true26.5 ], [ %dec35.5, %if.then32.5 ]
%arrayidx24.6 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 6
%22 = load i32, ptr %arrayidx24.6, align 8, !tbaa !5
%tobool.6 = icmp ne i32 %22, 0
%tobool25.6 = icmp ne i32 %21, 0
%or.cond.6 = select i1 %tobool.6, i1 %tobool25.6, i1 false
br i1 %or.cond.6, label %land.lhs.true26.6, label %for.inc37.6
land.lhs.true26.6: ; preds = %for.inc37.5
%arrayidx28.6 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 6
%23 = load i8, ptr %arrayidx28.6, align 2, !tbaa !9
%tobool31.not.6 = icmp eq i8 %23, 57
br i1 %tobool31.not.6, label %for.inc37.6, label %if.then32.6
if.then32.6: ; preds = %land.lhs.true26.6
%inc.6 = add i8 %23, 1
store i8 %inc.6, ptr %arrayidx28.6, align 2, !tbaa !9
%dec35.6 = add nsw i32 %21, -1
store i32 %dec35.6, ptr %n, align 4, !tbaa !5
br label %for.inc37.6
for.inc37.6: ; preds = %if.then32.6, %land.lhs.true26.6, %for.inc37.5
%24 = phi i32 [ %21, %for.inc37.5 ], [ %21, %land.lhs.true26.6 ], [ %dec35.6, %if.then32.6 ]
%arrayidx24.7 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 7
%25 = load i32, ptr %arrayidx24.7, align 4, !tbaa !5
%tobool.7 = icmp ne i32 %25, 0
%tobool25.7 = icmp ne i32 %24, 0
%or.cond.7 = select i1 %tobool.7, i1 %tobool25.7, i1 false
br i1 %or.cond.7, label %land.lhs.true26.7, label %for.inc37.7
land.lhs.true26.7: ; preds = %for.inc37.6
%arrayidx28.7 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 7
%26 = load i8, ptr %arrayidx28.7, align 1, !tbaa !9
%tobool31.not.7 = icmp eq i8 %26, 57
br i1 %tobool31.not.7, label %for.inc37.7, label %if.then32.7
if.then32.7: ; preds = %land.lhs.true26.7
%inc.7 = add i8 %26, 1
store i8 %inc.7, ptr %arrayidx28.7, align 1, !tbaa !9
%dec35.7 = add nsw i32 %24, -1
store i32 %dec35.7, ptr %n, align 4, !tbaa !5
br label %for.inc37.7
for.inc37.7: ; preds = %if.then32.7, %land.lhs.true26.7, %for.inc37.6
%27 = phi i32 [ %24, %for.inc37.6 ], [ %24, %land.lhs.true26.7 ], [ %dec35.7, %if.then32.7 ]
%arrayidx24.8 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 8
%28 = load i32, ptr %arrayidx24.8, align 16, !tbaa !5
%tobool.8 = icmp ne i32 %28, 0
%tobool25.8 = icmp ne i32 %27, 0
%or.cond.8 = select i1 %tobool.8, i1 %tobool25.8, i1 false
br i1 %or.cond.8, label %land.lhs.true26.8, label %for.inc37.8
land.lhs.true26.8: ; preds = %for.inc37.7
%arrayidx28.8 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 8
%29 = load i8, ptr %arrayidx28.8, align 8, !tbaa !9
%tobool31.not.8 = icmp eq i8 %29, 57
br i1 %tobool31.not.8, label %for.inc37.8, label %if.then32.8
if.then32.8: ; preds = %land.lhs.true26.8
%inc.8 = add i8 %29, 1
store i8 %inc.8, ptr %arrayidx28.8, align 8, !tbaa !9
%dec35.8 = add nsw i32 %27, -1
store i32 %dec35.8, ptr %n, align 4, !tbaa !5
br label %for.inc37.8
for.inc37.8: ; preds = %if.then32.8, %land.lhs.true26.8, %for.inc37.7
%30 = phi i32 [ %27, %for.inc37.7 ], [ %27, %land.lhs.true26.8 ], [ %dec35.8, %if.then32.8 ]
%arrayidx24.9 = getelementptr inbounds [20 x i32], ptr %k, i64 0, i64 9
%31 = load i32, ptr %arrayidx24.9, align 4, !tbaa !5
%tobool.9 = icmp ne i32 %31, 0
%tobool25.9 = icmp ne i32 %30, 0
%or.cond.9 = select i1 %tobool.9, i1 %tobool25.9, i1 false
br i1 %or.cond.9, label %land.lhs.true26.9, label %for.cond40.preheader
land.lhs.true26.9: ; preds = %for.inc37.8
%arrayidx28.9 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 9
%32 = load i8, ptr %arrayidx28.9, align 1, !tbaa !9
%tobool31.not.9 = icmp eq i8 %32, 57
br i1 %tobool31.not.9, label %for.cond40.preheader, label %if.then32.9
if.then32.9: ; preds = %land.lhs.true26.9
%inc.9 = add i8 %32, 1
store i8 %inc.9, ptr %arrayidx28.9, align 1, !tbaa !9
%dec35.9 = add nsw i32 %30, -1
store i32 %dec35.9, ptr %n, align 4, !tbaa !5
br label %for.cond40.preheader
for.cond40.preheader: ; preds = %if.then32.9, %land.lhs.true26.9, %for.inc37.8
br label %for.cond40
for.cond40: ; preds = %for.cond40.preheader, %for.cond40
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.cond40 ], [ 0, %for.cond40.preheader ]
%arrayidx42 = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 %indvars.iv77
%33 = load i8, ptr %arrayidx42, align 1, !tbaa !9
%cmp44 = icmp eq i8 %33, 48
%indvars.iv.next78 = add nuw i64 %indvars.iv77, 1
br i1 %cmp44, label %for.cond40, label %for.end49, !llvm.loop !12
for.end49: ; preds = %for.cond40
%arrayidx42.le = getelementptr inbounds [20 x i8], ptr %c, i64 0, i64 %indvars.iv77
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx42.le)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %k) #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 %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#include<string.h>
#define maxn 100010
char s[maxn];
int n, ans[maxn], nxtL[maxn], preR[maxn];
int main()
{
scanf("%s", s);
n = strlen(s);
int i;
for (i = 1; i < n; ++i)
if (s[i] == 'R')
preR[i] = i;
else preR[i] = preR[i - 1];
for (i = n - 1; i >= 0; --i)
if (s[i] == 'L')
nxtL[i] = i;
else nxtL[i] = nxtL[i + 1];
int step;
for (i = 0; i < n; ++i) {
if (s[i] == 'R') {
step = (nxtL[i] - i) & 1;
++ans[nxtL[i] - step];
} else {
step = (i - preR[i]) & 1;
++ans[preR[i] + step];
}
}
for (i = 0; i < n; ++i)
printf("%d ", ans[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249239/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249239/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@s = dso_local global [100010 x i8] zeroinitializer, align 16
@n = dso_local local_unnamed_addr global i32 0, align 4
@preR = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@nxtL = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@ans = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #3
%conv = trunc i64 %call1 to i32
store i32 %conv, ptr @n, align 4, !tbaa !5
%cmp103 = icmp sgt i32 %conv, 1
br i1 %cmp103, label %for.body.preheader, label %for.cond13.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call1, 4294967295
%0 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %0, 1
%1 = icmp eq i64 %wide.trip.count, 2
br i1 %1, label %for.cond13.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, -2
br label %for.body
for.cond13.preheader.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond13.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond13.preheader.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp4.epil = icmp eq i8 %2, 82
br i1 %cmp4.epil, label %if.then.epil, label %if.else.epil
if.else.epil: ; preds = %for.body.epil
%3 = add nsw i64 %indvars.iv.unr, -1
%arrayidx9.epil = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %3
%4 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
br label %for.inc.epil
if.then.epil: ; preds = %for.body.epil
%5 = trunc i64 %indvars.iv.unr to i32
br label %for.inc.epil
for.inc.epil: ; preds = %if.then.epil, %if.else.epil
%.sink.epil = phi i32 [ %5, %if.then.epil ], [ %4, %if.else.epil ]
%6 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %indvars.iv.unr
store i32 %.sink.epil, ptr %6, align 4
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.inc.epil, %for.cond13.preheader.loopexit.unr-lcssa, %entry
%cmp14106 = icmp sgt i32 %conv, 0
br i1 %cmp14106, label %for.body16.preheader, label %for.end76
for.body16.preheader: ; preds = %for.cond13.preheader
%7 = and i64 %call1, 4294967295
%xtraiter131 = and i64 %call1, 1
%lcmp.mod132.not = icmp eq i64 %xtraiter131, 0
br i1 %lcmp.mod132.not, label %for.body16.prol.loopexit, label %for.body16.prol
for.body16.prol: ; preds = %for.body16.preheader
%indvars.iv.next116.prol = add nsw i64 %7, -1
%idxprom17.prol = and i64 %indvars.iv.next116.prol, 4294967295
%arrayidx18.prol = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom17.prol
%8 = load i8, ptr %arrayidx18.prol, align 1, !tbaa !9
%cmp20.prol = icmp eq i8 %8, 76
br i1 %cmp20.prol, label %if.then22.prol, label %if.else25.prol
if.else25.prol: ; preds = %for.body16.prol
%arrayidx27.prol = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %7
%9 = load i32, ptr %arrayidx27.prol, align 4, !tbaa !5
br label %for.inc31.prol
if.then22.prol: ; preds = %for.body16.prol
%indvars.prol = trunc i64 %indvars.iv.next116.prol to i32
br label %for.inc31.prol
for.inc31.prol: ; preds = %if.then22.prol, %if.else25.prol
%.sink128.prol = phi i32 [ %indvars.prol, %if.then22.prol ], [ %9, %if.else25.prol ]
%10 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %idxprom17.prol
store i32 %.sink128.prol, ptr %10, align 4
br label %for.body16.prol.loopexit
for.body16.prol.loopexit: ; preds = %for.inc31.prol, %for.body16.preheader
%indvars.iv115.unr = phi i64 [ %7, %for.body16.preheader ], [ %indvars.iv.next116.prol, %for.inc31.prol ]
%11 = icmp eq i64 %7, 1
br i1 %11, label %for.cond33.preheader, label %for.body16
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv
%12 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp4 = icmp eq i8 %12, 82
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%13 = trunc i64 %indvars.iv to i32
br label %for.inc
if.else: ; preds = %for.body
%14 = add nsw i64 %indvars.iv, -1
%arrayidx9 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %14
%15 = load i32, ptr %arrayidx9, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%.sink = phi i32 [ %13, %if.then ], [ %15, %if.else ]
%16 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %16, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%17 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp4.1 = icmp eq i8 %17, 82
br i1 %cmp4.1, label %if.then.1, label %if.else.1
if.else.1: ; preds = %for.inc
%arrayidx9.1 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %indvars.iv
%18 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
br label %for.inc.1
if.then.1: ; preds = %for.inc
%19 = trunc i64 %indvars.iv.next to i32
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.else.1
%.sink.1 = phi i32 [ %19, %if.then.1 ], [ %18, %if.else.1 ]
%20 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %indvars.iv.next
store i32 %.sink.1, ptr %20, align 4
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond13.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.cond33.preheader: ; preds = %for.inc31.1, %for.body16.prol.loopexit
br i1 %cmp14106, label %for.body36.preheader, label %for.end76
for.body36.preheader: ; preds = %for.cond33.preheader
%wide.trip.count122 = and i64 %call1, 4294967295
br label %for.body36
for.body16: ; preds = %for.body16.prol.loopexit, %for.inc31.1
%indvars.iv115 = phi i64 [ %indvars.iv.next116.1, %for.inc31.1 ], [ %indvars.iv115.unr, %for.body16.prol.loopexit ]
%indvars.iv.next116 = add nsw i64 %indvars.iv115, -1
%idxprom17 = and i64 %indvars.iv.next116, 4294967295
%arrayidx18 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom17
%21 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%cmp20 = icmp eq i8 %21, 76
br i1 %cmp20, label %if.then22, label %if.else25
if.then22: ; preds = %for.body16
%indvars = trunc i64 %indvars.iv.next116 to i32
br label %for.inc31
if.else25: ; preds = %for.body16
%arrayidx27 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %indvars.iv115
%22 = load i32, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc31
for.inc31: ; preds = %if.then22, %if.else25
%.sink128 = phi i32 [ %indvars, %if.then22 ], [ %22, %if.else25 ]
%23 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %idxprom17
store i32 %.sink128, ptr %23, align 4
%indvars.iv.next116.1 = add nsw i64 %indvars.iv115, -2
%idxprom17.1 = and i64 %indvars.iv.next116.1, 4294967295
%arrayidx18.1 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom17.1
%24 = load i8, ptr %arrayidx18.1, align 1, !tbaa !9
%cmp20.1 = icmp eq i8 %24, 76
br i1 %cmp20.1, label %if.then22.1, label %if.else25.1
if.else25.1: ; preds = %for.inc31
%arrayidx27.1 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %indvars.iv.next116
%25 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
br label %for.inc31.1
if.then22.1: ; preds = %for.inc31
%indvars.1 = trunc i64 %indvars.iv.next116.1 to i32
br label %for.inc31.1
for.inc31.1: ; preds = %if.then22.1, %if.else25.1
%.sink128.1 = phi i32 [ %indvars.1, %if.then22.1 ], [ %25, %if.else25.1 ]
%26 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %idxprom17.1
store i32 %.sink128.1, ptr %26, align 4
%cmp14.1 = icmp ugt i64 %indvars.iv.next116, 1
br i1 %cmp14.1, label %for.body16, label %for.cond33.preheader, !llvm.loop !12
for.cond67.preheader: ; preds = %for.inc64
br i1 %cmp14106, label %for.body70, label %for.end76
for.body36: ; preds = %for.body36.preheader, %for.inc64
%indvars.iv118 = phi i64 [ 0, %for.body36.preheader ], [ %indvars.iv.next119, %for.inc64 ]
%arrayidx38 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv118
%27 = load i8, ptr %arrayidx38, align 1, !tbaa !9
%cmp40 = icmp eq i8 %27, 82
%28 = trunc i64 %indvars.iv118 to i32
br i1 %cmp40, label %if.then42, label %if.else52
if.then42: ; preds = %for.body36
%arrayidx44 = getelementptr inbounds [100010 x i32], ptr @nxtL, i64 0, i64 %indvars.iv118
%29 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%sub45 = sub nsw i32 %29, %28
%and = and i32 %sub45, 1
%sub48 = sub nsw i32 %29, %and
br label %for.inc64
if.else52: ; preds = %for.body36
%arrayidx54 = getelementptr inbounds [100010 x i32], ptr @preR, i64 0, i64 %indvars.iv118
%30 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%sub55 = sub nsw i32 %28, %30
%and56 = and i32 %sub55, 1
%add59 = add nsw i32 %and56, %30
br label %for.inc64
for.inc64: ; preds = %if.then42, %if.else52
%sub48.sink = phi i32 [ %sub48, %if.then42 ], [ %add59, %if.else52 ]
%idxprom49 = sext i32 %sub48.sink to i64
%arrayidx50 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %idxprom49
%31 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%inc51 = add nsw i32 %31, 1
store i32 %inc51, ptr %arrayidx50, align 4, !tbaa !5
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond123.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count122
br i1 %exitcond123.not, label %for.cond67.preheader, label %for.body36, !llvm.loop !13
for.body70: ; preds = %for.cond67.preheader, %for.body70
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.body70 ], [ 0, %for.cond67.preheader ]
%arrayidx72 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv124
%32 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %32)
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%33 = load i32, ptr @n, align 4, !tbaa !5
%34 = sext i32 %33 to i64
%cmp68 = icmp slt i64 %indvars.iv.next125, %34
br i1 %cmp68, label %for.body70, label %for.end76, !llvm.loop !14
for.end76: ; preds = %for.body70, %for.cond13.preheader, %for.cond33.preheader, %for.cond67.preheader
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; 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" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
|
#include <stdio.h>
#include <string.h>
int main()
{
char str[81];
int i,j,l;
while(fgets(str,sizeof(str),stdin) != NULL){
l = strlen(str);
for(i = 0; i < 26; i++){
if(strstr(str,"the") != '\0' || strstr(str,"this") != '\0' || strstr(str, "that") != '\0')
break;
else{
for(j = 0; j < l; j++){
if(('a' <= str[j] && str[j] <= 'y') || ('A' <= str[j] && str[j] <= 'Y'))
str[j]++;
else if(str[j] == 'z')
str[j] = 'a';
else if(str[j] == 'Z')
str[j] = 'A';
}
}
}
printf("%s", str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249332/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249332/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c"the\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"this\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"that\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [81 x i8], align 16
call void @llvm.lifetime.start.p0(i64 81, ptr nonnull %str) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call90 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 81, ptr noundef %0)
%cmp.not91 = icmp eq ptr %call90, null
br i1 %cmp.not91, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end69
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%call2.fr = freeze i64 %call2
%conv = trunc i64 %call2.fr to i32
%cmp1985 = icmp sgt i32 %conv, 0
br i1 %cmp1985, label %for.body.us.preheader, label %for.end69
for.body.us.preheader: ; preds = %while.body
%wide.trip.count = and i64 %call2.fr, 4294967295
%xtraiter = and i64 %call2.fr, 1
%1 = icmp eq i64 %wide.trip.count, 1
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond18.for.inc67_crit_edge.us
%i.087.us = phi i32 [ %inc68.us, %for.cond18.for.inc67_crit_edge.us ], [ 0, %for.body.us.preheader ]
%call6.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str) #5
%cmp7.not.us = icmp eq ptr %call6.us, null
br i1 %cmp7.not.us, label %lor.lhs.false.us, label %for.end69
lor.lhs.false.us: ; preds = %for.body.us
%call10.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #5
%cmp11.not.us = icmp eq ptr %call10.us, null
br i1 %cmp11.not.us, label %lor.lhs.false13.us, label %for.end69
lor.lhs.false13.us: ; preds = %lor.lhs.false.us
%call15.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.2) #5
%cmp16.not.us = icmp eq ptr %call15.us, null
br i1 %cmp16.not.us, label %for.body21.us.preheader, label %for.end69
for.body21.us.preheader: ; preds = %lor.lhs.false13.us
br i1 %1, label %for.cond18.for.inc67_crit_edge.us.unr-lcssa, label %for.body21.us
for.body21.us: ; preds = %for.body21.us.preheader, %for.inc.us.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us.1 ], [ 0, %for.body21.us.preheader ]
%niter = phi i64 [ %niter.next.1, %for.inc.us.1 ], [ 0, %for.body21.us.preheader ]
%arrayidx.us = getelementptr inbounds [81 x i8], ptr %str, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx.us, align 2, !tbaa !9
%3 = and i8 %2, -33
%4 = add i8 %3, -65
%or.cond84.us = icmp ult i8 %4, 25
br i1 %or.cond84.us, label %if.then42.us, label %if.else45.us
if.else45.us: ; preds = %for.body21.us
switch i8 %2, label %for.inc.us [
i8 122, label %if.then51.us
i8 90, label %for.inc.us.sink.split
]
if.then51.us: ; preds = %if.else45.us
br label %for.inc.us.sink.split
if.then42.us: ; preds = %for.body21.us
%inc.us = add nuw nsw i8 %2, 1
br label %for.inc.us.sink.split
for.inc.us.sink.split: ; preds = %if.else45.us, %if.then51.us, %if.then42.us
%inc.us.sink = phi i8 [ %inc.us, %if.then42.us ], [ 97, %if.then51.us ], [ 65, %if.else45.us ]
store i8 %inc.us.sink, ptr %arrayidx.us, align 2, !tbaa !9
br label %for.inc.us
for.inc.us: ; preds = %for.inc.us.sink.split, %if.else45.us
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.us.1 = getelementptr inbounds [81 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx.us.1, align 1, !tbaa !9
%6 = and i8 %5, -33
%7 = add i8 %6, -65
%or.cond84.us.1 = icmp ult i8 %7, 25
br i1 %or.cond84.us.1, label %if.then42.us.1, label %if.else45.us.1
if.else45.us.1: ; preds = %for.inc.us
switch i8 %5, label %for.inc.us.1 [
i8 122, label %if.then51.us.1
i8 90, label %for.inc.us.sink.split.1
]
if.then51.us.1: ; preds = %if.else45.us.1
br label %for.inc.us.sink.split.1
if.then42.us.1: ; preds = %for.inc.us
%inc.us.1 = add nuw nsw i8 %5, 1
br label %for.inc.us.sink.split.1
for.inc.us.sink.split.1: ; preds = %if.then42.us.1, %if.then51.us.1, %if.else45.us.1
%inc.us.sink.1 = phi i8 [ %inc.us.1, %if.then42.us.1 ], [ 97, %if.then51.us.1 ], [ 65, %if.else45.us.1 ]
store i8 %inc.us.sink.1, ptr %arrayidx.us.1, align 1, !tbaa !9
br label %for.inc.us.1
for.inc.us.1: ; preds = %for.inc.us.sink.split.1, %if.else45.us.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond18.for.inc67_crit_edge.us.unr-lcssa, label %for.body21.us, !llvm.loop !10
for.cond18.for.inc67_crit_edge.us.unr-lcssa: ; preds = %for.inc.us.1, %for.body21.us.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next.1, %for.inc.us.1 ]
br i1 %lcmp.mod.not, label %for.cond18.for.inc67_crit_edge.us, label %for.body21.us.epil
for.body21.us.epil: ; preds = %for.cond18.for.inc67_crit_edge.us.unr-lcssa
%arrayidx.us.epil = getelementptr inbounds [81 x i8], ptr %str, i64 0, i64 %indvars.iv.unr
%8 = load i8, ptr %arrayidx.us.epil, align 1, !tbaa !9
%9 = and i8 %8, -33
%10 = add i8 %9, -65
%or.cond84.us.epil = icmp ult i8 %10, 25
br i1 %or.cond84.us.epil, label %if.then42.us.epil, label %if.else45.us.epil
if.else45.us.epil: ; preds = %for.body21.us.epil
switch i8 %8, label %for.cond18.for.inc67_crit_edge.us [
i8 122, label %if.then51.us.epil
i8 90, label %for.inc.us.sink.split.epil
]
if.then51.us.epil: ; preds = %if.else45.us.epil
br label %for.inc.us.sink.split.epil
if.then42.us.epil: ; preds = %for.body21.us.epil
%inc.us.epil = add nuw nsw i8 %8, 1
br label %for.inc.us.sink.split.epil
for.inc.us.sink.split.epil: ; preds = %if.then42.us.epil, %if.then51.us.epil, %if.else45.us.epil
%inc.us.sink.epil = phi i8 [ %inc.us.epil, %if.then42.us.epil ], [ 97, %if.then51.us.epil ], [ 65, %if.else45.us.epil ]
store i8 %inc.us.sink.epil, ptr %arrayidx.us.epil, align 1, !tbaa !9
br label %for.cond18.for.inc67_crit_edge.us
for.cond18.for.inc67_crit_edge.us: ; preds = %if.else45.us.epil, %for.inc.us.sink.split.epil, %for.cond18.for.inc67_crit_edge.us.unr-lcssa
%inc68.us = add nuw nsw i32 %i.087.us, 1
%exitcond94.not = icmp eq i32 %inc68.us, 26
br i1 %exitcond94.not, label %for.end69, label %for.body.us, !llvm.loop !12
for.end69: ; preds = %for.body.us, %lor.lhs.false.us, %lor.lhs.false13.us, %for.cond18.for.inc67_crit_edge.us, %while.body
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %str)
%11 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 81, ptr noundef %11)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %for.end69, %entry
call void @llvm.lifetime.end.p0(i64 81, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void){
int i,j,f;
char s[1030];
char t[3][5]={"the","this","that"};
while(fgets(s,1030,stdin)){
for(i=0;i<26;i++){
for(j=0;j<strlen(s);j++){
if(isalpha(s[j])){
if(s[j]=='z')s[j]='a';
else s[j]=(char)((int)s[j]+1);
}
}
f=0;
for(j=0;j<3;j++){
if(strstr(s,t[j])){
f=1;
break;
}
}
if(f){
printf("%s",s);
break;
}
}
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249390/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249390/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.t = private unnamed_addr constant [3 x [5 x i8]] [[5 x i8] c"the\00\00", [5 x i8] c"this\00", [5 x i8] c"that\00"], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1030 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1030, ptr nonnull %s) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call67 = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 1030, ptr noundef %0)
%tobool.not68 = icmp eq ptr %call67, null
br i1 %tobool.not68, label %while.end, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader.backedge
%i.066 = phi i32 [ %i.066.be, %for.cond1.preheader.backedge ], [ 0, %entry ]
%char0 = load i8, ptr %s, align 16
%cmp462.not = icmp eq i8 %char0, 0
br i1 %cmp462.not, label %for.cond28.preheader, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond1.preheader
%call7 = tail call ptr @__ctype_b_loc() #6
br label %for.body6
for.cond28.preheader: ; preds = %for.inc, %for.cond1.preheader
%call36 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) @__const.main.t) #7
%tobool37.not = icmp eq ptr %call36, null
br i1 %tobool37.not, label %for.cond28, label %if.then44
for.body6: ; preds = %for.body6.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body6.lr.ph ], [ %indvars.iv.next, %for.inc ]
%1 = load ptr, ptr %call7, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [1030 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%idxprom9 = sext i8 %2 to i64
%arrayidx10 = getelementptr inbounds i16, ptr %1, i64 %idxprom9
%3 = load i16, ptr %arrayidx10, align 2, !tbaa !10
%4 = and i16 %3, 1024
%tobool12.not = icmp eq i16 %4, 0
br i1 %tobool12.not, label %for.inc, label %if.then
if.then: ; preds = %for.body6
%cmp16 = icmp eq i8 %2, 122
%add = add i8 %2, 1
%add.sink = select i1 %cmp16, i8 97, i8 %add
store i8 %add.sink, ptr %arrayidx, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %if.then, %for.body6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%cmp4 = icmp ugt i64 %call3, %indvars.iv.next
br i1 %cmp4, label %for.body6, label %for.cond28.preheader, !llvm.loop !12
for.cond28: ; preds = %for.cond28.preheader
%call36.1 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([3 x [5 x i8]], ptr @__const.main.t, i64 0, i64 1)) #7
%tobool37.not.1 = icmp eq ptr %call36.1, null
br i1 %tobool37.not.1, label %for.cond28.1, label %if.then44
for.cond28.1: ; preds = %for.cond28
%call36.2 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([3 x [5 x i8]], ptr @__const.main.t, i64 0, i64 2)) #7
%tobool37.not.2 = icmp eq ptr %call36.2, null
br i1 %tobool37.not.2, label %for.cond28.2, label %if.then44
for.cond28.2: ; preds = %for.cond28.1
%inc49 = add nuw nsw i32 %i.066, 1
%exitcond.not = icmp eq i32 %inc49, 26
br i1 %exitcond.not, label %for.end50, label %for.cond1.preheader.backedge
for.cond1.preheader.backedge: ; preds = %for.cond28.2, %for.end50
%i.066.be = phi i32 [ %inc49, %for.cond28.2 ], [ 0, %for.end50 ]
br label %for.cond1.preheader, !llvm.loop !14
if.then44: ; preds = %for.cond28.1, %for.cond28, %for.cond28.preheader
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %s)
br label %for.end50
for.end50: ; preds = %for.cond28.2, %if.then44
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 1030, ptr noundef %5)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %while.end, label %for.cond1.preheader.backedge
while.end: ; preds = %for.end50, %entry
call void @llvm.lifetime.end.p0(i64 1030, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include<stdio.h>
#include<string.h>
char a[100];
int flag;
void shift(){
int i=0;
while(a[i]!='\0'){
if(a[i]>='a' && a[i]<='y')
a[i]++;
else if(a[i]=='z')
a[i]='a';
i++;
}
}
void match(int x){
char b1[5];
char b2[4];
char m1[2][5]={"that","this"};
char m2[4]={"the"};
int i;
for(i=0;i<4;i++){
b1[i]=a[x+i];
if(i!=3)
b2[i]=a[x+i];
}
b1[4]='\0';
b2[3]='\0';
if(strcmp(b1,m1[0])==0||
strcmp(b1,m1[1])==0||
strcmp(b2,m2)==0)
flag=0;
}
int main(){
int i,len;
while(fgets(a,100,stdin)!=NULL){
flag=1;
len=strlen(a);
while(flag){
shift();
for(i=0;i<len-4;i++){
match(i);
if(!flag)
break;
}
match(len-4);
}
fputs(a,stdout);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249477/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249477/source.c"
target datalayout = "e-m:e-p270: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 [100 x i8] zeroinitializer, align 16
@__const.match.m1 = private unnamed_addr constant [2 x [5 x i8]] [[5 x i8] c"that\00", [5 x i8] c"this\00"], align 1
@__const.match.m2 = private unnamed_addr constant [4 x i8] c"the\00", align 1
@flag = dso_local local_unnamed_addr global i32 0, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @shift() local_unnamed_addr #0 {
entry:
%0 = load i8, ptr @a, align 16, !tbaa !5
%cmp.not30 = icmp eq i8 %0, 0
br i1 %cmp.not30, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end22
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end22 ], [ 0, %entry ]
%1 = phi i8 [ %3, %if.end22 ], [ %0, %entry ]
%arrayidx32 = phi ptr [ %arrayidx, %if.end22 ], [ @a, %entry ]
%2 = add i8 %1, -97
%or.cond = icmp ult i8 %2, 25
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc = add nuw nsw i8 %1, 1
br label %if.end22.sink.split
if.else: ; preds = %while.body
%cmp17 = icmp eq i8 %1, 122
br i1 %cmp17, label %if.end22.sink.split, label %if.end22
if.end22.sink.split: ; preds = %if.else, %if.then
%.sink = phi i8 [ %inc, %if.then ], [ 97, %if.else ]
store i8 %.sink, ptr %arrayidx32, align 1, !tbaa !5
br label %if.end22
if.end22: ; preds = %if.end22.sink.split, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100 x i8], ptr @a, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %3, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8
while.end: ; preds = %if.end22, %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: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @match(i32 noundef %x) local_unnamed_addr #2 {
for.inc.3:
%b1 = alloca [5 x i8], align 4
%b2 = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %b1) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2) #7
%0 = sext i32 %x to i64
%scevgep = getelementptr i8, ptr @a, i64 %0
%1 = load i32, ptr %scevgep, align 1, !tbaa !5
store i32 %1, ptr %b1, align 4, !tbaa !5
%2 = load i8, ptr %scevgep, align 1, !tbaa !5
store i8 %2, ptr %b2, align 1, !tbaa !5
%3 = add nsw i64 %0, 1
%arrayidx.1 = getelementptr inbounds [100 x i8], ptr @a, i64 0, i64 %3
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx8.1 = getelementptr inbounds [4 x i8], ptr %b2, i64 0, i64 1
store i8 %4, ptr %arrayidx8.1, align 1, !tbaa !5
%5 = add nsw i64 %0, 2
%arrayidx.2 = getelementptr inbounds [100 x i8], ptr @a, i64 0, i64 %5
%6 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%arrayidx8.2 = getelementptr inbounds [4 x i8], ptr %b2, i64 0, i64 2
store i8 %6, ptr %arrayidx8.2, align 1, !tbaa !5
%arrayidx9 = getelementptr inbounds [5 x i8], ptr %b1, i64 0, i64 4
store i8 0, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx10 = getelementptr inbounds [4 x i8], ptr %b2, i64 0, i64 3
store i8 0, ptr %arrayidx10, align 1, !tbaa !5
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1, ptr noundef nonnull dereferenceable(5) @__const.match.m1, i64 5)
%cmp13 = icmp eq i32 %bcmp, 0
br i1 %cmp13, label %if.then24, label %lor.lhs.false
lor.lhs.false: ; preds = %for.inc.3
%bcmp33 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1, ptr noundef nonnull dereferenceable(5) getelementptr inbounds ([2 x [5 x i8]], ptr @__const.match.m1, i64 0, i64 1), i64 5)
%cmp18 = icmp eq i32 %bcmp33, 0
br i1 %cmp18, label %if.then24, label %lor.lhs.false19
lor.lhs.false19: ; preds = %lor.lhs.false
%bcmp34 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %b2, ptr noundef nonnull dereferenceable(4) @__const.match.m2, i64 4)
%cmp23 = icmp eq i32 %bcmp34, 0
br i1 %cmp23, label %if.then24, label %if.end25
if.then24: ; preds = %lor.lhs.false19, %lor.lhs.false, %for.inc.3
store i32 0, ptr @flag, align 4, !tbaa !10
br label %if.end25
if.end25: ; preds = %if.then24, %lor.lhs.false19
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b1) #7
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%b1.i13 = alloca [5 x i8], align 4
%b2.i14 = alloca [4 x i8], align 1
%b1.i = alloca [5 x i8], align 4
%b2.i = alloca [4 x i8], align 1
%0 = load ptr, ptr @stdin, align 8, !tbaa !12
%call44 = tail call ptr @fgets(ptr noundef nonnull @a, i32 noundef 100, ptr noundef %0)
%cmp.not45 = icmp eq ptr %call44, null
br i1 %cmp.not45, label %while.end9, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx8.1.i17 = getelementptr inbounds [4 x i8], ptr %b2.i14, i64 0, i64 1
%arrayidx8.2.i19 = getelementptr inbounds [4 x i8], ptr %b2.i14, i64 0, i64 2
%arrayidx9.i20 = getelementptr inbounds [5 x i8], ptr %b1.i13, i64 0, i64 4
%arrayidx10.i21 = getelementptr inbounds [4 x i8], ptr %b2.i14, i64 0, i64 3
%arrayidx8.1.i = getelementptr inbounds [4 x i8], ptr %b2.i, i64 0, i64 1
%arrayidx8.2.i = getelementptr inbounds [4 x i8], ptr %b2.i, i64 0, i64 2
%arrayidx9.i = getelementptr inbounds [5 x i8], ptr %b1.i, i64 0, i64 4
%arrayidx10.i = getelementptr inbounds [4 x i8], ptr %b2.i, i64 0, i64 3
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.end
store i32 1, ptr @flag, align 4, !tbaa !10
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @a) #8
%conv = trunc i64 %call1 to i32
%sub = add i32 %conv, -4
%cmp436 = icmp sgt i32 %conv, 4
%1 = sext i32 %sub to i64
%scevgep.i15 = getelementptr i8, ptr @a, i64 %1
%wide.trip.count = zext i32 %sub to i64
br label %while.body3
while.body3: ; preds = %while.body, %match.exit31
%.pr324243 = phi i32 [ 1, %while.body ], [ %.pr3241, %match.exit31 ]
%2 = load i8, ptr @a, align 16, !tbaa !5
%cmp.not30.i = icmp eq i8 %2, 0
br i1 %cmp.not30.i, label %shift.exit, label %while.body.i
while.body.i: ; preds = %while.body3, %if.end22.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end22.i ], [ 0, %while.body3 ]
%3 = phi i8 [ %5, %if.end22.i ], [ %2, %while.body3 ]
%arrayidx32.i = phi ptr [ %arrayidx.i, %if.end22.i ], [ @a, %while.body3 ]
%4 = add i8 %3, -97
%or.cond.i = icmp ult i8 %4, 25
br i1 %or.cond.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%inc.i = add nuw nsw i8 %3, 1
br label %if.end22.sink.split.i
if.else.i: ; preds = %while.body.i
%cmp17.i = icmp eq i8 %3, 122
br i1 %cmp17.i, label %if.end22.sink.split.i, label %if.end22.i
if.end22.sink.split.i: ; preds = %if.else.i, %if.then.i
%.sink.i = phi i8 [ %inc.i, %if.then.i ], [ 97, %if.else.i ]
store i8 %.sink.i, ptr %arrayidx32.i, align 1, !tbaa !5
br label %if.end22.i
if.end22.i: ; preds = %if.end22.sink.split.i, %if.else.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [100 x i8], ptr @a, i64 0, i64 %indvars.iv.next.i
%5 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp.not.i = icmp eq i8 %5, 0
br i1 %cmp.not.i, label %shift.exit, label %while.body.i, !llvm.loop !8
shift.exit: ; preds = %if.end22.i, %while.body3
br i1 %cmp436, label %for.body, label %for.end
for.body: ; preds = %shift.exit, %match.exit
%indvars.iv = phi i64 [ %8, %match.exit ], [ 0, %shift.exit ]
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %b1.i) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2.i) #7
%scevgep.i = getelementptr i8, ptr @a, i64 %indvars.iv
%6 = load i32, ptr %scevgep.i, align 1
store i32 %6, ptr %b1.i, align 4, !tbaa !5
%7 = trunc i32 %6 to i8
store i8 %7, ptr %b2.i, align 1, !tbaa !5
%8 = add nuw nsw i64 %indvars.iv, 1
%9 = lshr i32 %6, 8
%10 = trunc i32 %9 to i8
store i8 %10, ptr %arrayidx8.1.i, align 1, !tbaa !5
%11 = lshr i32 %6, 16
%12 = trunc i32 %11 to i8
store i8 %12, ptr %arrayidx8.2.i, align 1, !tbaa !5
store i8 0, ptr %arrayidx9.i, align 4, !tbaa !5
store i8 0, ptr %arrayidx10.i, align 1, !tbaa !5
%bcmp.i = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1.i, ptr noundef nonnull dereferenceable(5) @__const.match.m1, i64 5)
%cmp13.i = icmp eq i32 %bcmp.i, 0
br i1 %cmp13.i, label %match.exit.thread, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %for.body
%bcmp33.i = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1.i, ptr noundef nonnull dereferenceable(5) getelementptr inbounds ([2 x [5 x i8]], ptr @__const.match.m1, i64 0, i64 1), i64 5)
%cmp18.i = icmp eq i32 %bcmp33.i, 0
br i1 %cmp18.i, label %match.exit.thread, label %lor.lhs.false19.i
lor.lhs.false19.i: ; preds = %lor.lhs.false.i
%bcmp34.i = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %b2.i, ptr noundef nonnull dereferenceable(4) @__const.match.m2, i64 4)
%cmp23.i = icmp eq i32 %bcmp34.i, 0
br i1 %cmp23.i, label %match.exit.thread, label %match.exit
match.exit.thread: ; preds = %lor.lhs.false19.i, %lor.lhs.false.i, %for.body
store i32 0, ptr @flag, align 4, !tbaa !10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2.i) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b1.i) #7
br label %for.end
match.exit: ; preds = %lor.lhs.false19.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2.i) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b1.i) #7
%exitcond.not = icmp eq i64 %8, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %match.exit, %shift.exit, %match.exit.thread
%.pr3241 = phi i32 [ 0, %match.exit.thread ], [ %.pr324243, %shift.exit ], [ %.pr324243, %match.exit ]
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %b1.i13) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2.i14) #7
%13 = load i32, ptr %scevgep.i15, align 1
store i32 %13, ptr %b1.i13, align 4, !tbaa !5
%14 = trunc i32 %13 to i8
store i8 %14, ptr %b2.i14, align 1, !tbaa !5
%15 = lshr i32 %13, 8
%16 = trunc i32 %15 to i8
store i8 %16, ptr %arrayidx8.1.i17, align 1, !tbaa !5
%17 = lshr i32 %13, 16
%18 = trunc i32 %17 to i8
store i8 %18, ptr %arrayidx8.2.i19, align 1, !tbaa !5
store i8 0, ptr %arrayidx9.i20, align 4, !tbaa !5
store i8 0, ptr %arrayidx10.i21, align 1, !tbaa !5
%bcmp.i22 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1.i13, ptr noundef nonnull dereferenceable(5) @__const.match.m1, i64 5)
%cmp13.i23 = icmp eq i32 %bcmp.i22, 0
br i1 %cmp13.i23, label %match.exit31.thread, label %lor.lhs.false.i24
lor.lhs.false.i24: ; preds = %for.end
%bcmp33.i25 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %b1.i13, ptr noundef nonnull dereferenceable(5) getelementptr inbounds ([2 x [5 x i8]], ptr @__const.match.m1, i64 0, i64 1), i64 5)
%cmp18.i26 = icmp eq i32 %bcmp33.i25, 0
br i1 %cmp18.i26, label %match.exit31.thread, label %lor.lhs.false19.i27
lor.lhs.false19.i27: ; preds = %lor.lhs.false.i24
%bcmp34.i28 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %b2.i14, ptr noundef nonnull dereferenceable(4) @__const.match.m2, i64 4)
%cmp23.i29 = icmp eq i32 %bcmp34.i28, 0
br i1 %cmp23.i29, label %match.exit31.thread, label %match.exit31
match.exit31.thread: ; preds = %for.end, %lor.lhs.false.i24, %lor.lhs.false19.i27
store i32 0, ptr @flag, align 4, !tbaa !10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2.i14) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b1.i13) #7
br label %while.end
match.exit31: ; preds = %lor.lhs.false19.i27
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2.i14) #7
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b1.i13) #7
%tobool.not = icmp eq i32 %.pr3241, 0
br i1 %tobool.not, label %while.end, label %while.body3, !llvm.loop !15
while.end: ; preds = %match.exit31, %match.exit31.thread
%19 = load ptr, ptr @stdout, align 8, !tbaa !12
%call8 = tail call i32 @fputs(ptr noundef nonnull @a, ptr noundef %19)
%20 = load ptr, ptr @stdin, align 8, !tbaa !12
%call = tail call ptr @fgets(ptr noundef nonnull @a, i32 noundef 100, ptr noundef %20)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end9, label %while.body, !llvm.loop !16
while.end9: ; preds = %while.end, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 willreturn memory(argmem: read) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
!16 = distinct !{!16, !9}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[80];
int i, len;
//int num1, num2, num3;
char *num1;
char *num2;
char *num3;
/*fgets(str, sizeof(str), stdin);
len = strlen(str);*/
//printf("%s\n", str);
while(fgets(str, sizeof(str), stdin) != 0){
len = strlen(str);
while (1){
for (i = 0; i < len; i++){
if (str[i] == ' ' || str[i] == 46 || str[i] == 13){
continue;
}
str[i] += 1;
if (str[i] == 123){
str[i] -= 26;
}
}
//printf("%s\n", str);
num1 = strstr(str, "the");
num2 = strstr(str, "this");
num3 = strstr(str, "that");
if (num1 != NULL || num2 != NULL || num3 != NULL){
break;
}
}
printf("%s\n", str);
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249527/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249527/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c"the\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"this\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"that\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [80 x i8], align 16
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %str) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call65 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 80, ptr noundef %0)
%cmp.not66 = icmp eq ptr %call65, null
br i1 %cmp.not66, label %while.end54, label %while.body
while.body: ; preds = %entry, %while.end
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6
%conv = trunc i64 %call2 to i32
%cmp563 = icmp sgt i32 %conv, 0
br i1 %cmp563, label %while.cond3.us.preheader, label %while.body.split
while.cond3.us.preheader: ; preds = %while.body
%wide.trip.count = and i64 %call2, 4294967295
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %while.cond3.us.preheader
%indvars.iv = phi i64 [ 0, %while.cond3.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%arrayidx.us = getelementptr inbounds [80 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx.us, align 1, !tbaa !9
switch i8 %1, label %if.end.us [
i8 32, label %for.inc.us
i8 46, label %for.inc.us
i8 13, label %for.inc.us
]
if.end.us: ; preds = %for.body.us
%add.us = add i8 %1, 1
%cmp28.us = icmp eq i8 %add.us, 123
%spec.store.select.us = select i1 %cmp28.us, i8 97, i8 %add.us
store i8 %spec.store.select.us, ptr %arrayidx.us, align 1
br label %for.inc.us
for.inc.us: ; preds = %if.end.us, %for.body.us, %for.body.us, %for.body.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.for.end_crit_edge.us, label %for.body.us.backedge
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.for.end_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ 0, %for.cond.for.end_crit_edge.us ]
br label %for.body.us, !llvm.loop !10
for.cond.for.end_crit_edge.us: ; preds = %for.inc.us
%call37.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str) #6
%call39.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #6
%call41.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.2) #6
%cmp42.us = icmp ne ptr %call37.us, null
%cmp45.us = icmp ne ptr %call39.us, null
%or.cond.us = select i1 %cmp42.us, i1 true, i1 %cmp45.us
%cmp48.us = icmp ne ptr %call41.us, null
%or.cond55.us = select i1 %or.cond.us, i1 true, i1 %cmp48.us
br i1 %or.cond55.us, label %while.end, label %for.body.us.backedge
while.body.split: ; preds = %while.body
%call37 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str) #6
%call39 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #6
%call41 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.2) #6
%cmp42 = icmp ne ptr %call37, null
%cmp45 = icmp ne ptr %call39, null
%or.cond = select i1 %cmp42, i1 true, i1 %cmp45
%cmp48 = icmp ne ptr %call41, null
%or.cond55 = select i1 %or.cond, i1 true, i1 %cmp48
br i1 %or.cond55, label %while.end, label %while.cond3
while.cond3: ; preds = %while.body.split, %while.cond3
br label %while.cond3
while.end: ; preds = %for.cond.for.end_crit_edge.us, %while.body.split
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 80, ptr noundef %2)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end54, label %while.body, !llvm.loop !12
while.end54: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr 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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
#include <stdlib.h>
#define N 100
#define M 1000
#define INT(X) \
( *( (const int *)(X) ) )
int comparator (
const void * a,
const void * b
)
{
return ( INT( b ) - INT( a ) );
}
/** Application main entry point. */
int main (
int argc,
char * argv[ ]
)
{
int i;
for ( ; ; )
{
struct tagD
{
int h;
int p;
int q;
} d[ M ];
int n, m, a;
scanf ( "%d%d%d", &n, &m, &a );
if ( !( n | m | a ) ) break ;
for ( i = 0; i < m; ++i )
{
scanf ( "%d%d%d", &d[ i ].h, &d[ i ].p, &d[ i ].q );
}
qsort ( d, m, sizeof ( struct tagD ), comparator );
for ( i = 0; i < m; ++i )
{
if ( d[ i ].p == a )
{
a = d[ i ].q;
}
else if ( d[ i ].q == a )
{
a = d[ i ].p;
}
}
printf ( "%d\n", a );
}
return ( 0 );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249570/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249570/source.c"
target datalayout = "e-m:e-p270: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.tagD = type { i32, i32, i32 }
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comparator(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%d = alloca [1000 x %struct.tagD], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 12000, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = or i32 %0, %2
%or161 = or i32 %3, %1
%tobool.not62 = icmp eq i32 %or161, 0
br i1 %tobool.not62, label %for.end39, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %cleanup
%4 = phi i32 [ %20, %cleanup ], [ %1, %entry ]
%cmp55 = icmp sgt i32 %4, 0
br i1 %cmp55, label %for.body, label %for.cond2.preheader.for.end_crit_edge
for.cond2.preheader.for.end_crit_edge: ; preds = %for.cond2.preheader
%.pre = sext i32 %4 to i64
br label %for.end
for.body: ; preds = %for.cond2.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond2.preheader ]
%arrayidx = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv
%p = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv, i32 1
%q = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv, i32 2
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %p, ptr noundef nonnull %q)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %m, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond2.preheader.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end_crit_edge ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %d, i64 noundef %conv.pre-phi, i64 noundef 12, ptr noundef nonnull @comparator) #5
%7 = load i32, ptr %m, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%cmp957 = icmp sgt i32 %7, 0
br i1 %cmp957, label %for.body11.preheader, label %cleanup
for.body11.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %7, 1
br i1 %8, label %cleanup.loopexit.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body11
for.body11: ; preds = %for.inc32.1, %for.body11.preheader.new
%indvars.iv65 = phi i64 [ 0, %for.body11.preheader.new ], [ %indvars.iv.next66.1, %for.inc32.1 ]
%9 = phi i32 [ %a.promoted, %for.body11.preheader.new ], [ %15, %for.inc32.1 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.1, %for.inc32.1 ]
%p14 = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv65, i32 1
%10 = load i32, ptr %p14, align 4, !tbaa !11
%cmp15 = icmp eq i32 %10, %9
%q20 = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv65, i32 2
%11 = load i32, ptr %q20, align 8, !tbaa !13
br i1 %cmp15, label %if.then17, label %if.else
if.then17: ; preds = %for.body11
store i32 %11, ptr %a, align 4, !tbaa !5
br label %for.inc32
if.else: ; preds = %for.body11
%cmp24 = icmp eq i32 %11, %9
br i1 %cmp24, label %if.then26, label %for.inc32
if.then26: ; preds = %if.else
store i32 %10, ptr %a, align 4, !tbaa !5
br label %for.inc32
for.inc32: ; preds = %if.then17, %if.then26, %if.else
%12 = phi i32 [ %11, %if.then17 ], [ %10, %if.then26 ], [ %9, %if.else ]
%indvars.iv.next66 = or i64 %indvars.iv65, 1
%p14.1 = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv.next66, i32 1
%13 = load i32, ptr %p14.1, align 8, !tbaa !11
%cmp15.1 = icmp eq i32 %13, %12
%q20.1 = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv.next66, i32 2
%14 = load i32, ptr %q20.1, align 4, !tbaa !13
br i1 %cmp15.1, label %if.then17.1, label %if.else.1
if.else.1: ; preds = %for.inc32
%cmp24.1 = icmp eq i32 %14, %12
br i1 %cmp24.1, label %if.then26.1, label %for.inc32.1
if.then26.1: ; preds = %if.else.1
store i32 %13, ptr %a, align 4, !tbaa !5
br label %for.inc32.1
if.then17.1: ; preds = %for.inc32
store i32 %14, ptr %a, align 4, !tbaa !5
br label %for.inc32.1
for.inc32.1: ; preds = %if.then17.1, %if.then26.1, %if.else.1
%15 = phi i32 [ %14, %if.then17.1 ], [ %13, %if.then26.1 ], [ %12, %if.else.1 ]
%indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65, 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 %cleanup.loopexit.unr-lcssa, label %for.body11, !llvm.loop !14
cleanup.loopexit.unr-lcssa: ; preds = %for.inc32.1, %for.body11.preheader
%.lcssa70.ph = phi i32 [ undef, %for.body11.preheader ], [ %15, %for.inc32.1 ]
%indvars.iv65.unr = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next66.1, %for.inc32.1 ]
%.unr = phi i32 [ %a.promoted, %for.body11.preheader ], [ %15, %for.inc32.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cleanup, label %for.body11.epil
for.body11.epil: ; preds = %cleanup.loopexit.unr-lcssa
%p14.epil = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv65.unr, i32 1
%16 = load i32, ptr %p14.epil, align 4, !tbaa !11
%cmp15.epil = icmp eq i32 %16, %.unr
%q20.epil = getelementptr inbounds [1000 x %struct.tagD], ptr %d, i64 0, i64 %indvars.iv65.unr, i32 2
%17 = load i32, ptr %q20.epil, align 4, !tbaa !13
br i1 %cmp15.epil, label %if.then17.epil, label %if.else.epil
if.else.epil: ; preds = %for.body11.epil
%cmp24.epil = icmp eq i32 %17, %.unr
br i1 %cmp24.epil, label %if.then26.epil, label %cleanup
if.then26.epil: ; preds = %if.else.epil
store i32 %16, ptr %a, align 4, !tbaa !5
br label %cleanup
if.then17.epil: ; preds = %for.body11.epil
store i32 %17, ptr %a, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %cleanup.loopexit.unr-lcssa, %if.then17.epil, %if.then26.epil, %if.else.epil, %for.end
%18 = phi i32 [ %a.promoted, %for.end ], [ %.lcssa70.ph, %cleanup.loopexit.unr-lcssa ], [ %17, %if.then17.epil ], [ %16, %if.then26.epil ], [ %.unr, %if.else.epil ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 12000, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 12000, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a)
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = load i32, ptr %m, align 4, !tbaa !5
%21 = load i32, ptr %a, align 4, !tbaa !5
%22 = or i32 %19, %21
%or1 = or i32 %22, %20
%tobool.not = icmp eq i32 %or1, 0
br i1 %tobool.not, label %for.end39, label %for.cond2.preheader
for.end39: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 12000, ptr nonnull %d) #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
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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 = !{!"tagD", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<string.h>
int main() {
long long int n,max=0,a[200000],b[200000],number;
scanf("%lld", &n);
for (int i = 1; i <= n; i++) {
scanf("%lld%lld", &a[i],&b[i]);
if (max < a[i]) { number = b[i];max=a[i]; }
}
printf("%lld", max+number);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249613/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249613/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%lld%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [200000 x i64], align 16
%b = alloca [200000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not21 = icmp sgt i64 %0, 0
call void @llvm.assume(i1 %cmp.not21)
br label %for.body
for.cond.cleanup.loopexit: ; preds = %for.inc
%1 = add nsw i64 %number.1, %max.1
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %1)
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%number.023 = phi i64 [ %number.1, %for.inc ], [ undef, %entry ]
%max.022 = phi i64 [ %max.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i64], ptr %a, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [200000 x i64], ptr %b, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp7 = icmp slt i64 %max.022, %2
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.body
%3 = load i64, ptr %arrayidx3, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%max.1 = phi i64 [ %2, %if.then ], [ %max.022, %for.body ]
%number.1 = phi i64 [ %3, %if.then ], [ %number.023, %for.body ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not = icmp slt i64 %4, %indvars.iv.next
br i1 %cmp.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
unsigned int n;
int count = 0;
unsigned int bit = 1;
scanf("%d", &n);
for (; n / 2; n /=2) {
if (!(n % 2)) bit = 0;
count++;
}
printf("%d\n", count + bit);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249664/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249664/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%tobool.not7 = icmp ult i32 %.pr, 2
br i1 %tobool.not7, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.09 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%count.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%0 = phi i32 [ %div26, %for.body ], [ %.pr, %entry ]
%rem = and i32 %0, 1
%tobool1.not = icmp eq i32 %rem, 0
%spec.select = select i1 %tobool1.not, i32 0, i32 %bit.09
%inc = add nuw nsw i32 %count.08, 1
%div26 = lshr i32 %0, 1
%tobool.not = icmp ult i32 %0, 4
br i1 %tobool.not, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !9
for.cond.for.end_crit_edge: ; preds = %for.body
store i32 %div26, ptr %n, align 4, !tbaa !5
%1 = add i32 %spec.select, %inc
br label %for.end
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
%add = phi i32 [ %1, %for.cond.for.end_crit_edge ], [ 1, %entry ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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>
#define N 1000000
int a[N+1];
int dp[N+1];
int min(int a, int b){
if(b>a)return a;
else return b;
}
int abs(int a){
if(a<0)return -1*a;
else return a;
}
int main(){
int i,j, n, k;
scanf("%d %d", &n, &k);
for(i=0;i<n;i++)scanf("%d", &a[i]);
for(i=0;i<n;i++)dp[i]=1e10;
dp[0]=0;
for(i=0;i<n;i++){
for(j=1;j<k+1;j++){
dp[i+j]=min(dp[i+j], dp[i]+abs(a[i]-a[i+j]));
}
}
printf("%d\n", dp[n-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249707/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249707/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global [1000001 x i32] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [1000001 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %b, i32 %a)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %a) local_unnamed_addr #1 {
entry:
%retval.0 = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %for.cond2.preheader.thread
for.cond2.preheader.thread: ; preds = %entry
store i32 0, ptr @dp, align 16, !tbaa !5
br label %for.end36
for.cond2.preheader: ; preds = %for.body
store i32 0, ptr @dp, align 16, !tbaa !5
%cmp1161 = icmp sgt i32 %1, 0
br i1 %cmp1161, label %for.cond13.preheader.lr.ph, label %for.end36
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000001 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.cond2.preheader, !llvm.loop !9
for.cond13.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp14.not59 = icmp slt i32 %3, 1
br i1 %cmp14.not59, label %for.end36, label %for.cond13.preheader.preheader
for.cond13.preheader.preheader: ; preds = %for.cond13.preheader.lr.ph
%4 = add nuw i32 %3, 1
%wide.trip.count73 = zext i32 %1 to i64
%wide.trip.count = zext i32 %4 to i64
%5 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %3, 8
%n.vec = and i64 %5, -8
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %5, %n.vec
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %for.cond13.for.inc34_crit_edge
%indvars.iv70 = phi i64 [ 0, %for.cond13.preheader.preheader ], [ %indvars.iv.next71, %for.cond13.for.inc34_crit_edge ]
%arrayidx20 = getelementptr inbounds [1000001 x i32], ptr @dp, i64 0, i64 %indvars.iv70
%arrayidx22 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv70
%6 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%.pre = load i32, ptr %arrayidx20, align 4, !tbaa !5
br i1 %min.iters.check, label %for.body15.preheader, label %vector.ph
vector.ph: ; preds = %for.cond13.preheader
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert81 = insertelement <4 x i32> poison, i32 %.pre, i64 0
%broadcast.splat82 = shufflevector <4 x i32> %broadcast.splatinsert81, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%7 = add nuw nsw i64 %offset.idx, %indvars.iv70
%8 = getelementptr inbounds [1000001 x i32], ptr @dp, i64 0, i64 %7
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load78 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %7
%wide.load79 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load80 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = sub nsw <4 x i32> %broadcast.splat, %wide.load79
%13 = sub nsw <4 x i32> %broadcast.splat, %wide.load80
%14 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %12, i1 true)
%15 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %13, i1 true)
%16 = add nsw <4 x i32> %14, %broadcast.splat82
%17 = add nsw <4 x i32> %15, %broadcast.splat82
%18 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %16, <4 x i32> %wide.load)
%19 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %17, <4 x i32> %wide.load78)
store <4 x i32> %18, ptr %8, align 4, !tbaa !5
store <4 x i32> %19, ptr %9, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond13.for.inc34_crit_edge, label %for.body15.preheader
for.body15.preheader: ; preds = %for.cond13.preheader, %middle.block
%indvars.iv66.ph = phi i64 [ 1, %for.cond13.preheader ], [ %ind.end, %middle.block ]
br label %for.body15
for.body15: ; preds = %for.body15.preheader, %for.body15
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body15 ], [ %indvars.iv66.ph, %for.body15.preheader ]
%21 = add nuw nsw i64 %indvars.iv66, %indvars.iv70
%arrayidx18 = getelementptr inbounds [1000001 x i32], ptr @dp, i64 0, i64 %21
%22 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%arrayidx25 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %21
%23 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%sub = sub nsw i32 %6, %23
%24 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%add26 = add nsw i32 %24, %.pre
%a.b.i = call i32 @llvm.smin.i32(i32 %add26, i32 %22)
store i32 %a.b.i, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %for.cond13.for.inc34_crit_edge, label %for.body15, !llvm.loop !14
for.cond13.for.inc34_crit_edge: ; preds = %for.body15, %middle.block
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
br i1 %exitcond74.not, label %for.end36, label %for.cond13.preheader, !llvm.loop !15
for.end36: ; preds = %for.cond13.for.inc34_crit_edge, %for.cond13.preheader.lr.ph, %for.cond2.preheader.thread, %for.cond2.preheader
%.lcssa77 = phi i32 [ %0, %for.cond2.preheader.thread ], [ %1, %for.cond2.preheader ], [ %1, %for.cond13.preheader.lr.ph ], [ %1, %for.cond13.for.inc34_crit_edge ]
%sub37 = add nsw i32 %.lcssa77, -1
%idxprom38 = sext i32 %sub37 to i64
%arrayidx39 = getelementptr inbounds [1000001 x i32], ptr @dp, i64 0, i64 %idxprom38
%25 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #6
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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define MAXN 100000
int A[MAXN+1];
int DP[MAXN+1];
int flog (int n, int k)
{
int i,tmp,j;
int min;
DP[1] = 0;
for ( i = 2; i <= k; i++ ) {
min = DP[1] + abs(A[1]-A[i]);
for ( j = 1; j < i; j++ ) {
tmp = DP[j] + abs(A[i]-A[j]);
if ( min > tmp ) min = tmp;
}
DP[i] = min;
}
for ( i = k+1; i <= n; i++ ) {
min = DP[i-k] + abs(A[i-k]-A[i]);
for ( j = i-k; j < i; j++ ) {
tmp = DP[j] + abs(A[j]-A[i]);
if ( tmp < min ) min = tmp;
}
DP[i] = min;
}
return DP[n];
}
int main(void)
{
int i,n,k;
scanf("%d", &n); scanf("%d", &k);
for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
printf("%d", flog(n,k));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249758/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249758/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@DP = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@A = dso_local global [100001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @flog(i32 noundef %n, i32 noundef %k) local_unnamed_addr #0 {
entry:
store i32 0, ptr getelementptr inbounds ([100001 x i32], ptr @DP, i64 0, i64 1), align 4, !tbaa !5
%cmp.not92 = icmp slt i32 %k, 2
br i1 %cmp.not92, label %for.cond19.preheader, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%0 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @A, i64 0, i64 1), align 4, !tbaa !5
%1 = add nuw i32 %k, 1
%wide.trip.count105 = zext i32 %1 to i64
br label %for.body
for.cond19.preheader: ; preds = %for.end, %entry
%cmp20.not.not98 = icmp slt i32 %k, %n
br i1 %cmp20.not.not98, label %for.body21.preheader, label %for.cond19.preheader.for.end54_crit_edge
for.cond19.preheader.for.end54_crit_edge: ; preds = %for.cond19.preheader
%.pre = sext i32 %n to i64
br label %for.end54
for.body21.preheader: ; preds = %for.cond19.preheader
%2 = sext i32 %k to i64
%wide.trip.count = sext i32 %n to i64
%3 = add i32 %k, -1
%4 = zext i32 %3 to i64
%5 = add nuw nsw i64 %4, 1
%min.iters.check126 = icmp ult i32 %3, 7
%n.vec129 = and i64 %5, 8589934584
%cmp.n132 = icmp eq i64 %5, %n.vec129
br label %for.body21
for.body: ; preds = %for.body.lr.ph, %for.end
%indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.end ]
%indvars.iv102 = phi i64 [ 2, %for.body.lr.ph ], [ %indvars.iv.next103, %for.end ]
%6 = add i64 %indvar, 1
%7 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @DP, i64 0, i64 1), align 4, !tbaa !5
%arrayidx = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %indvars.iv102
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = sub nsw i32 %0, %8
%9 = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%add = add nsw i32 %9, %7
%min.iters.check = icmp ult i64 %6, 8
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.body
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 1
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %8, 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 i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %20, %vector.body ]
%vec.phi120 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %21, %vector.body ]
%offset.idx = or i64 %index, 1
%10 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load121 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %offset.idx
%wide.load122 = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load123 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = sub nsw <4 x i32> %broadcast.splat, %wide.load122
%15 = sub nsw <4 x i32> %broadcast.splat, %wide.load123
%16 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %14, i1 true)
%17 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %15, i1 true)
%18 = add nsw <4 x i32> %16, %wide.load
%19 = add nsw <4 x i32> %17, %wide.load121
%20 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %18)
%21 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi120, <4 x i32> %19)
%index.next = add nuw i64 %index, 8
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %20, <4 x i32> %21)
%23 = tail call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end, label %for.body3.preheader
for.body3.preheader: ; preds = %for.body, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body ], [ %ind.end, %middle.block ]
%min.091.ph = phi i32 [ %add, %for.body ], [ %23, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ %indvars.iv.ph, %for.body3.preheader ]
%min.091 = phi i32 [ %spec.select, %for.body3 ], [ %min.091.ph, %for.body3.preheader ]
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %indvars.iv
%24 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%arrayidx9 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %indvars.iv
%25 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub10 = sub nsw i32 %8, %25
%26 = tail call i32 @llvm.abs.i32(i32 %sub10, i1 true)
%add11 = add nsw i32 %26, %24
%spec.select = tail call i32 @llvm.smin.i32(i32 %min.091, i32 %add11)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv102
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !13
for.end: ; preds = %for.body3, %middle.block
%spec.select.lcssa = phi i32 [ %23, %middle.block ], [ %spec.select, %for.body3 ]
%arrayidx14 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %indvars.iv102
store i32 %spec.select.lcssa, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105
%indvar.next = add i64 %indvar, 1
br i1 %exitcond106.not, label %for.cond19.preheader, label %for.body, !llvm.loop !14
for.body21: ; preds = %for.body21.preheader, %for.end49
%indvars.iv115 = phi i64 [ %2, %for.body21.preheader ], [ %indvars.iv.next116, %for.end49 ]
%indvars.iv112.in = phi i32 [ %k, %for.body21.preheader ], [ %indvars.iv112, %for.end49 ]
%indvars.iv107 = phi i32 [ 1, %for.body21.preheader ], [ %indvars.iv.next108, %for.end49 ]
%indvars.iv112 = add i32 %indvars.iv112.in, 1
%indvars.iv.next116 = add nsw i64 %indvars.iv115, 1
%27 = sub nsw i64 %indvars.iv.next116, %2
%arrayidx24 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %27
%28 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx27 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %27
%29 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx29 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %indvars.iv.next116
%30 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%sub30 = sub nsw i32 %29, %30
%31 = tail call i32 @llvm.abs.i32(i32 %sub30, i1 true)
%add31 = add nsw i32 %31, %28
%cmp34.not94 = icmp sgt i64 %27, %indvars.iv115
br i1 %cmp34.not94, label %for.end49, label %for.body35.preheader
for.body35.preheader: ; preds = %for.body21
%32 = sext i32 %indvars.iv107 to i64
br i1 %min.iters.check126, label %for.body35.preheader149, label %vector.ph127
vector.ph127: ; preds = %for.body35.preheader
%ind.end130 = add nsw i64 %n.vec129, %32
%minmax.ident.splatinsert137 = insertelement <4 x i32> poison, i32 %add31, i64 0
%minmax.ident.splat138 = shufflevector <4 x i32> %minmax.ident.splatinsert137, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert144 = insertelement <4 x i32> poison, i32 %30, i64 0
%broadcast.splat145 = shufflevector <4 x i32> %broadcast.splatinsert144, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body133
vector.body133: ; preds = %vector.body133, %vector.ph127
%index134 = phi i64 [ 0, %vector.ph127 ], [ %index.next146, %vector.body133 ]
%vec.phi135 = phi <4 x i32> [ %minmax.ident.splat138, %vector.ph127 ], [ %43, %vector.body133 ]
%vec.phi136 = phi <4 x i32> [ %minmax.ident.splat138, %vector.ph127 ], [ %44, %vector.body133 ]
%offset.idx139 = add i64 %index134, %32
%33 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %offset.idx139
%wide.load140 = load <4 x i32>, ptr %33, align 4, !tbaa !5
%34 = getelementptr inbounds i32, ptr %33, i64 4
%wide.load141 = load <4 x i32>, ptr %34, align 4, !tbaa !5
%35 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %offset.idx139
%wide.load142 = load <4 x i32>, ptr %35, align 4, !tbaa !5
%36 = getelementptr inbounds i32, ptr %35, i64 4
%wide.load143 = load <4 x i32>, ptr %36, align 4, !tbaa !5
%37 = sub nsw <4 x i32> %wide.load142, %broadcast.splat145
%38 = sub nsw <4 x i32> %wide.load143, %broadcast.splat145
%39 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %37, i1 true)
%40 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %38, i1 true)
%41 = add nsw <4 x i32> %39, %wide.load140
%42 = add nsw <4 x i32> %40, %wide.load141
%43 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %41, <4 x i32> %vec.phi135)
%44 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %42, <4 x i32> %vec.phi136)
%index.next146 = add nuw i64 %index134, 8
%45 = icmp eq i64 %index.next146, %n.vec129
br i1 %45, label %middle.block124, label %vector.body133, !llvm.loop !15
middle.block124: ; preds = %vector.body133
%rdx.minmax147 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %43, <4 x i32> %44)
%46 = tail call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax147)
br i1 %cmp.n132, label %for.end49, label %for.body35.preheader149
for.body35.preheader149: ; preds = %for.body35.preheader, %middle.block124
%indvars.iv109.ph = phi i64 [ %32, %for.body35.preheader ], [ %ind.end130, %middle.block124 ]
%min.296.ph = phi i32 [ %add31, %for.body35.preheader ], [ %46, %middle.block124 ]
br label %for.body35
for.body35: ; preds = %for.body35.preheader149, %for.body35
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.body35 ], [ %indvars.iv109.ph, %for.body35.preheader149 ]
%min.296 = phi i32 [ %spec.select89, %for.body35 ], [ %min.296.ph, %for.body35.preheader149 ]
%arrayidx37 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %indvars.iv109
%47 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%arrayidx39 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %indvars.iv109
%48 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%sub42 = sub nsw i32 %48, %30
%49 = tail call i32 @llvm.abs.i32(i32 %sub42, i1 true)
%add43 = add nsw i32 %49, %47
%spec.select89 = tail call i32 @llvm.smin.i32(i32 %add43, i32 %min.296)
%indvars.iv.next110 = add nsw i64 %indvars.iv109, 1
%lftr.wideiv = trunc i64 %indvars.iv.next110 to i32
%exitcond114.not = icmp eq i32 %indvars.iv112, %lftr.wideiv
br i1 %exitcond114.not, label %for.end49, label %for.body35, !llvm.loop !16
for.end49: ; preds = %for.body35, %middle.block124, %for.body21
%min.2.lcssa = phi i32 [ %add31, %for.body21 ], [ %46, %middle.block124 ], [ %spec.select89, %for.body35 ]
%arrayidx51 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %indvars.iv.next116
store i32 %min.2.lcssa, ptr %arrayidx51, align 4, !tbaa !5
%indvars.iv.next108 = add i32 %indvars.iv107, 1
%exitcond119.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count
br i1 %exitcond119.not, label %for.end54, label %for.body21, !llvm.loop !17
for.end54: ; preds = %for.end49, %for.cond19.preheader.for.end54_crit_edge
%idxprom55.pre-phi = phi i64 [ %.pre, %for.cond19.preheader.for.end54_crit_edge ], [ %wide.trip.count, %for.end49 ]
%arrayidx56 = getelementptr inbounds [100001 x i32], ptr @DP, i64 0, i64 %idxprom55.pre-phi
%50 = load i32, ptr %arrayidx56, align 4, !tbaa !5
ret i32 %50
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, 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 [100001 x i32], ptr @A, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.end, !llvm.loop !18
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%3 = load i32, ptr %k, align 4, !tbaa !5
%call3 = call i32 @flog(i32 noundef %.lcssa, i32 noundef %3)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
#define MAX 111111
long abso(long x) {
return (x > 0) ? x : (-1 * x);
}
int min(int x, int y) {
return (x < y) ? x : y;
}
int max(int x, int y) {
return (x > y) ? x : y;
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
int dp[MAX], nums[MAX];
dp[0] = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &nums[i]);
}
for (int i = 1; i < n; i++) {
dp[i] = dp[max(0, i - k)] + abso(nums[i] - nums[max(0, i - k)]);
int m = max(0, i - k);
if (m == 0) {
for (int a = 1; a < i; a++) dp[i] = min(dp[i], dp[a] + abso(nums[i] - nums[a]));
} else {
for (int a = m; a < i; a++) dp[i] = min(dp[i], dp[a] + abso(nums[i] - nums[a]));
}
}
printf("%d\n", dp[n - 1]);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249800/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249800/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @abso(i64 noundef %x) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %x, i1 true)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%dp = alloca [111111 x i32], align 16
%nums = alloca [111111 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 444444, ptr nonnull %dp) #5
call void @llvm.lifetime.start.p0(i64 444444, ptr nonnull %nums) #5
store i32 0, ptr %dp, align 16, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp116 = icmp sgt i32 %0, 0
br i1 %cmp116, label %for.body, label %for.cond.cleanup6
for.cond4.preheader: ; preds = %for.body
%cmp5125 = icmp sgt i32 %3, 1
br i1 %cmp5125, label %for.body7.lr.ph, label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond4.preheader
%1 = load i32, ptr %k, align 4, !tbaa !5
%2 = sub i32 1, %1
%wide.trip.count142 = zext i32 %3 to i64
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx1 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond.cleanup6: ; preds = %if.end, %entry, %for.cond4.preheader
%.lcssa146 = phi i32 [ %3, %for.cond4.preheader ], [ %0, %entry ], [ %3, %if.end ]
%sub81 = add nsw i32 %.lcssa146, -1
%idxprom82 = sext i32 %sub81 to i64
%arrayidx83 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %idxprom82
%5 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 444444, ptr nonnull %nums) #5
call void @llvm.lifetime.end.p0(i64 444444, ptr nonnull %dp) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body7: ; preds = %for.body7.lr.ph, %if.end
%indvar = phi i64 [ 0, %for.body7.lr.ph ], [ %indvar.next, %if.end ]
%indvars.iv139 = phi i64 [ 1, %for.body7.lr.ph ], [ %indvars.iv.next140, %if.end ]
%indvars.iv131 = phi i32 [ %2, %for.body7.lr.ph ], [ %indvars.iv.next132, %if.end ]
%smax150 = call i32 @llvm.smax.i32(i32 %indvars.iv131, i32 0)
%6 = zext i32 %smax150 to i64
%7 = sub nsw i64 %indvars.iv139, %6
%indvars141 = trunc i64 %indvars.iv139 to i32
%sub = sub nsw i32 %indvars141, %1
%cond.i = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%idxprom9 = zext i32 %cond.i to i64
%arrayidx10 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %idxprom9
%8 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv139
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %idxprom9
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%sub17 = sub nsw i32 %9, %10
%11 = call i32 @llvm.abs.i32(i32 %sub17, i1 false)
%conv20 = add i32 %11, %8
%arrayidx22 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv139
store i32 %conv20, ptr %arrayidx22, align 4, !tbaa !5
%cmp25 = icmp slt i32 %sub, 1
br i1 %cmp25, label %for.cond27.preheader, label %for.cond53.preheader
for.cond53.preheader: ; preds = %for.body7
%cmp54118 = icmp ugt i64 %indvars.iv139, %idxprom9
br i1 %cmp54118, label %for.body57.preheader, label %if.end
for.body57.preheader: ; preds = %for.cond53.preheader
%smax = call i32 @llvm.smax.i32(i32 %indvars.iv131, i32 0)
%12 = zext i32 %smax to i64
%xtraiter = and i64 %7, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body57.prol.loopexit, label %for.body57.prol
for.body57.prol: ; preds = %for.body57.preheader
%arrayidx61.prol = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %12
%13 = load i32, ptr %arrayidx61.prol, align 4, !tbaa !5
%arrayidx66.prol = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %12
%14 = load i32, ptr %arrayidx66.prol, align 4, !tbaa !5
%sub67.prol = sub nsw i32 %9, %14
%15 = call i32 @llvm.abs.i32(i32 %sub67.prol, i1 false)
%conv71.prol = add i32 %15, %13
%cond.i114.prol = call i32 @llvm.smin.i32(i32 %conv20, i32 %conv71.prol)
store i32 %cond.i114.prol, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next134.prol = add nuw nsw i64 %12, 1
br label %for.body57.prol.loopexit
for.body57.prol.loopexit: ; preds = %for.body57.prol, %for.body57.preheader
%indvars.iv133.unr = phi i64 [ %12, %for.body57.preheader ], [ %indvars.iv.next134.prol, %for.body57.prol ]
%cond.i114120.unr = phi i32 [ %conv20, %for.body57.preheader ], [ %cond.i114.prol, %for.body57.prol ]
%16 = icmp eq i64 %indvar, %6
br i1 %16, label %if.end, label %for.body57
for.cond27.preheader: ; preds = %for.body7
%cmp28121 = icmp ugt i64 %indvars.iv139, 1
br i1 %cmp28121, label %for.body31.preheader, label %if.end
for.body31.preheader: ; preds = %for.cond27.preheader
%xtraiter151 = and i64 %indvar, 1
%17 = icmp eq i64 %indvar, 1
br i1 %17, label %if.end.loopexit.unr-lcssa, label %for.body31.preheader.new
for.body31.preheader.new: ; preds = %for.body31.preheader
%unroll_iter = and i64 %indvar, -2
br label %for.body31
for.body31: ; preds = %for.body31, %for.body31.preheader.new
%indvars.iv136 = phi i64 [ 1, %for.body31.preheader.new ], [ %indvars.iv.next137.1, %for.body31 ]
%cond.i112124 = phi i32 [ %conv20, %for.body31.preheader.new ], [ %cond.i112.1, %for.body31 ]
%niter = phi i64 [ 0, %for.body31.preheader.new ], [ %niter.next.1, %for.body31 ]
%arrayidx35 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv136
%18 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%arrayidx40 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv136
%19 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%sub41 = sub nsw i32 %9, %19
%20 = call i32 @llvm.abs.i32(i32 %sub41, i1 false)
%conv45 = add i32 %20, %18
%cond.i112 = call i32 @llvm.smin.i32(i32 %cond.i112124, i32 %conv45)
store i32 %cond.i112, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%arrayidx35.1 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv.next137
%21 = load i32, ptr %arrayidx35.1, align 4, !tbaa !5
%arrayidx40.1 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv.next137
%22 = load i32, ptr %arrayidx40.1, align 4, !tbaa !5
%sub41.1 = sub nsw i32 %9, %22
%23 = call i32 @llvm.abs.i32(i32 %sub41.1, i1 false)
%conv45.1 = add i32 %23, %21
%cond.i112.1 = call i32 @llvm.smin.i32(i32 %cond.i112, i32 %conv45.1)
store i32 %cond.i112.1, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next137.1 = add nuw nsw i64 %indvars.iv136, 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 %if.end.loopexit.unr-lcssa, label %for.body31, !llvm.loop !11
for.body57: ; preds = %for.body57.prol.loopexit, %for.body57
%indvars.iv133 = phi i64 [ %indvars.iv.next134.1, %for.body57 ], [ %indvars.iv133.unr, %for.body57.prol.loopexit ]
%cond.i114120 = phi i32 [ %cond.i114.1, %for.body57 ], [ %cond.i114120.unr, %for.body57.prol.loopexit ]
%arrayidx61 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv133
%24 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%arrayidx66 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv133
%25 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%sub67 = sub nsw i32 %9, %25
%26 = call i32 @llvm.abs.i32(i32 %sub67, i1 false)
%conv71 = add i32 %26, %24
%cond.i114 = call i32 @llvm.smin.i32(i32 %cond.i114120, i32 %conv71)
store i32 %cond.i114, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%arrayidx61.1 = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv.next134
%27 = load i32, ptr %arrayidx61.1, align 4, !tbaa !5
%arrayidx66.1 = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv.next134
%28 = load i32, ptr %arrayidx66.1, align 4, !tbaa !5
%sub67.1 = sub nsw i32 %9, %28
%29 = call i32 @llvm.abs.i32(i32 %sub67.1, i1 false)
%conv71.1 = add i32 %29, %27
%cond.i114.1 = call i32 @llvm.smin.i32(i32 %cond.i114, i32 %conv71.1)
store i32 %cond.i114.1, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next134.1 = add nuw nsw i64 %indvars.iv133, 2
%cmp54.1 = icmp ult i64 %indvars.iv.next134.1, %indvars.iv139
br i1 %cmp54.1, label %for.body57, label %if.end, !llvm.loop !12
if.end.loopexit.unr-lcssa: ; preds = %for.body31, %for.body31.preheader
%indvars.iv136.unr = phi i64 [ 1, %for.body31.preheader ], [ %indvars.iv.next137.1, %for.body31 ]
%cond.i112124.unr = phi i32 [ %conv20, %for.body31.preheader ], [ %cond.i112.1, %for.body31 ]
%lcmp.mod152.not = icmp eq i64 %xtraiter151, 0
br i1 %lcmp.mod152.not, label %if.end, label %for.body31.epil
for.body31.epil: ; preds = %if.end.loopexit.unr-lcssa
%arrayidx35.epil = getelementptr inbounds [111111 x i32], ptr %dp, i64 0, i64 %indvars.iv136.unr
%30 = load i32, ptr %arrayidx35.epil, align 4, !tbaa !5
%arrayidx40.epil = getelementptr inbounds [111111 x i32], ptr %nums, i64 0, i64 %indvars.iv136.unr
%31 = load i32, ptr %arrayidx40.epil, align 4, !tbaa !5
%sub41.epil = sub nsw i32 %9, %31
%32 = call i32 @llvm.abs.i32(i32 %sub41.epil, i1 false)
%conv45.epil = add i32 %32, %30
%cond.i112.epil = call i32 @llvm.smin.i32(i32 %cond.i112124.unr, i32 %conv45.epil)
store i32 %cond.i112.epil, ptr %arrayidx22, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %for.body57.prol.loopexit, %for.body57, %for.body31.epil, %if.end.loopexit.unr-lcssa, %for.cond53.preheader, %for.cond27.preheader
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%indvars.iv.next132 = add i32 %indvars.iv131, 1
%exitcond143.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count142
%indvar.next = add i64 %indvar, 1
br i1 %exitcond143.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main() {
long *wp,w;
long N,i;
int K,*hp,k;
scanf("%ld %d",&N,&K);
wp=(long *)malloc((K+1)*sizeof(long));
hp=(int *)malloc((K+1)*sizeof(int));
scanf("%d",&hp[0]);
wp[0]=0;
for(i=1;i<=N-1;i++) {
k=K;
if(i<K) k=i;
for(;k>=1;k--) {
hp[k]=hp[k-1];
wp[k]=wp[k-1];
}
scanf("%d",&hp[0]);
for(k=1;k<=K;k++) {
if(i<k) break;
if(hp[0]>hp[k]) w=wp[k]+hp[0]-hp[k];
else w=wp[k]+hp[k]-hp[0];
if(k==1 || wp[0]>w) wp[0]=w;
}
}
printf("%ld\n",wp[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249844/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249844/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%ld %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %K, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%call1150 = ptrtoint ptr %call1 to i64
%mul4 = shl nsw i64 %conv, 2
%call5 = call noalias ptr @malloc(i64 noundef %mul4) #6
%call5149 = ptrtoint ptr %call5 to i64
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call5)
store i64 0, ptr %call1, align 8, !tbaa !9
%1 = load i64, ptr %N, align 8, !tbaa !9
%cmp.not.not118 = icmp sgt i64 %1, 1
br i1 %cmp.not.not118, label %for.body.preheader, label %for.end74
for.body.preheader: ; preds = %entry
%.pre = load i32, ptr %K, align 4, !tbaa !5
%arrayidx39.peel = getelementptr inbounds i32, ptr %call5, i64 1
%invariant.gep = getelementptr i32, ptr %call5, i64 -1
%invariant.gep157 = getelementptr i32, ptr %call5, i64 -1
%invariant.gep159 = getelementptr i64, ptr %call1, i64 -1
%invariant.gep161 = getelementptr i64, ptr %call1, i64 -1
%arrayidx44.peel.arrayidx53.peel = getelementptr inbounds i64, ptr %call1, i64 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc72
%2 = phi i32 [ %.pre, %for.body.preheader ], [ %44, %for.inc72 ]
%indvars.iv125 = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next126, %for.inc72 ]
%i.0119 = phi i64 [ 1, %for.body.preheader ], [ %inc73, %for.inc72 ]
%conv9 = sext i32 %2 to i64
%cmp10 = icmp slt i64 %i.0119, %conv9
%conv12 = trunc i64 %i.0119 to i32
%spec.select = select i1 %cmp10, i32 %conv12, i32 %2
%cmp14114 = icmp sgt i32 %spec.select, 0
br i1 %cmp14114, label %for.body16.preheader, label %for.end
for.body16.preheader: ; preds = %for.body
%3 = zext i32 %spec.select to i64
%min.iters.check = icmp ult i32 %spec.select, 74
br i1 %min.iters.check, label %for.body16.preheader156, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body16.preheader
%4 = add nsw i64 %3, -1
%5 = add i32 %spec.select, -1
%6 = trunc i64 %4 to i32
%7 = icmp ult i32 %5, %6
%8 = icmp ugt i64 %4, 4294967295
%9 = or i1 %7, %8
%10 = shl nuw nsw i64 %3, 2
%scevgep = getelementptr i8, ptr %call5, i64 %10
%mul.result135.neg = mul nsw i64 %4, -4
%11 = getelementptr i8, ptr %scevgep, i64 %mul.result135.neg
%12 = icmp ugt ptr %11, %scevgep
%13 = zext i32 %5 to i64
%14 = shl nuw nsw i64 %13, 2
%scevgep137 = getelementptr i8, ptr %call5, i64 %14
%mul.result139.neg = mul nsw i64 %4, -4
%15 = getelementptr i8, ptr %scevgep137, i64 %mul.result139.neg
%16 = icmp ugt ptr %15, %scevgep137
%17 = shl nuw nsw i64 %3, 3
%scevgep141 = getelementptr i8, ptr %call1, i64 %17
%mul.result143.neg = mul nsw i64 %4, -8
%18 = getelementptr i8, ptr %scevgep141, i64 %mul.result143.neg
%19 = icmp ugt ptr %18, %scevgep141
%20 = shl nuw nsw i64 %13, 3
%scevgep145 = getelementptr i8, ptr %call1, i64 %20
%mul.result147.neg = mul nsw i64 %4, -8
%21 = getelementptr i8, ptr %scevgep145, i64 %mul.result147.neg
%22 = icmp ugt ptr %21, %scevgep145
%23 = or i1 %12, %9
%24 = or i1 %16, %23
%25 = or i1 %19, %24
%26 = or i1 %22, %25
br i1 %26, label %for.body16.preheader156, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%27 = add i32 %spec.select, -1
%28 = zext i32 %27 to i64
%29 = shl nuw nsw i64 %28, 2
%30 = add i64 %29, %call5149
%31 = shl nuw nsw i64 %3, 2
%32 = add i64 %31, %call5149
%33 = sub i64 %30, %32
%diff.check = icmp ult i64 %33, 8
%34 = shl nuw nsw i64 %28, 3
%35 = add i64 %34, %call1150
%36 = shl nuw nsw i64 %3, 3
%37 = add i64 %36, %call1150
%38 = sub i64 %35, %37
%diff.check151 = icmp ult i64 %38, 16
%conflict.rdx = or i1 %diff.check, %diff.check151
br i1 %conflict.rdx, label %for.body16.preheader156, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %3, 4294967294
%ind.end = and i64 %3, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = sub i64 %3, %index
%39 = add i64 %offset.idx, 4294967295
%40 = and i64 %39, 4294967295
%gep = getelementptr i32, ptr %invariant.gep, i64 %40
%wide.load = load <2 x i32>, ptr %gep, align 4, !tbaa !5
%gep158 = getelementptr i32, ptr %invariant.gep157, i64 %offset.idx
store <2 x i32> %wide.load, ptr %gep158, align 4, !tbaa !5
%gep160 = getelementptr i64, ptr %invariant.gep159, i64 %40
%wide.load153 = load <2 x i64>, ptr %gep160, align 8, !tbaa !9
%gep162 = getelementptr i64, ptr %invariant.gep161, i64 %offset.idx
store <2 x i64> %wide.load153, ptr %gep162, align 8, !tbaa !9
%index.next = add nuw i64 %index, 2
%41 = icmp eq i64 %index.next, %n.vec
br i1 %41, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %3
br i1 %cmp.n, label %for.end, label %for.body16.preheader156
for.body16.preheader156: ; preds = %vector.memcheck, %vector.scevcheck, %for.body16.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %3, %vector.memcheck ], [ %3, %vector.scevcheck ], [ %3, %for.body16.preheader ], [ %ind.end, %middle.block ]
br label %for.body16
for.body16: ; preds = %for.body16.preheader156, %for.body16
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body16 ], [ %indvars.iv.ph, %for.body16.preheader156 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom = and i64 %indvars.iv.next, 4294967295
%arrayidx18 = getelementptr inbounds i32, ptr %call5, i64 %idxprom
%42 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%arrayidx20 = getelementptr inbounds i32, ptr %call5, i64 %indvars.iv
store i32 %42, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i64, ptr %call1, i64 %idxprom
%43 = load i64, ptr %arrayidx23, align 8, !tbaa !9
%arrayidx25 = getelementptr inbounds i64, ptr %call1, i64 %indvars.iv
store i64 %43, ptr %arrayidx25, align 8, !tbaa !9
%cmp14 = icmp ugt i64 %indvars.iv, 1
br i1 %cmp14, label %for.body16, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body16, %middle.block, %for.body
%call27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call5)
%44 = load i32, ptr %K, align 4, !tbaa !5
%cmp29.not116 = icmp slt i32 %44, 1
br i1 %cmp29.not116, label %for.inc72, label %if.end36.peel
if.end36.peel: ; preds = %for.end
%45 = add nuw i32 %44, 1
%wide.trip.count = zext i32 %45 to i64
%46 = load i32, ptr %call5, align 4, !tbaa !5
%47 = load i32, ptr %arrayidx39.peel, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %46, i32 %47)
%.132 = call i32 @llvm.smin.i32(i32 %46, i32 %47)
%48 = load i64, ptr %arrayidx44.peel.arrayidx53.peel, align 8, !tbaa !9
%conv46.peel = sext i32 %. to i64
%conv50.peel = sext i32 %.132 to i64
%add47.peel = sub nsw i64 %conv46.peel, %conv50.peel
%sub51.peel = add i64 %add47.peel, %48
store i64 %sub51.peel, ptr %call1, align 8, !tbaa !9
%exitcond127.peel.not = icmp eq i32 %45, 2
br i1 %exitcond127.peel.not, label %for.inc72, label %for.body31.peel.next
for.body31.peel.next: ; preds = %if.end36.peel
%conv59 = sext i32 %46 to i64
%conv46 = sext i32 %46 to i64
br label %for.body31
for.body31: ; preds = %for.body31.peel.next, %for.inc70
%49 = phi i64 [ %sub51.peel, %for.body31.peel.next ], [ %52, %for.inc70 ]
%indvars.iv121 = phi i64 [ 2, %for.body31.peel.next ], [ %indvars.iv.next122, %for.inc70 ]
%exitcond = icmp eq i64 %indvars.iv121, %indvars.iv125
br i1 %exitcond, label %for.inc72, label %if.end36
if.end36: ; preds = %for.body31
%arrayidx39 = getelementptr inbounds i32, ptr %call5, i64 %indvars.iv121
%50 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %46, %50
%arrayidx44 = getelementptr inbounds i64, ptr %call1, i64 %indvars.iv121
%51 = load i64, ptr %arrayidx44, align 8, !tbaa !9
%conv50 = sext i32 %50 to i64
%add47 = sub nsw i64 %conv46, %conv50
%add57 = sub nsw i64 %conv50, %conv59
%add47.sink = select i1 %cmp40, i64 %add47, i64 %add57
%sub51 = add i64 %add47.sink, %51
%cmp65 = icmp sgt i64 %49, %sub51
br i1 %cmp65, label %if.then67, label %for.inc70
if.then67: ; preds = %if.end36
store i64 %sub51, ptr %call1, align 8, !tbaa !9
br label %for.inc70
for.inc70: ; preds = %if.end36, %if.then67
%52 = phi i64 [ %49, %if.end36 ], [ %sub51, %if.then67 ]
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%exitcond127.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count
br i1 %exitcond127.not, label %for.inc72, label %for.body31, !llvm.loop !16
for.inc72: ; preds = %for.body31, %for.inc70, %if.end36.peel, %for.end
%inc73 = add nuw nsw i64 %i.0119, 1
%53 = load i64, ptr %N, align 8, !tbaa !9
%cmp.not.not = icmp slt i64 %inc73, %53
%indvars.iv.next126 = add nuw i64 %indvars.iv125, 1
br i1 %cmp.not.not, label %for.body, label %for.end74.loopexit, !llvm.loop !18
for.end74.loopexit: ; preds = %for.inc72
%.pre129 = load i64, ptr %call1, align 8, !tbaa !9
br label %for.end74
for.end74: ; preds = %for.end74.loopexit, %entry
%54 = phi i64 [ %.pre129, %for.end74.loopexit ], [ 0, %entry ]
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %54)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !13}
!16 = distinct !{!16, !12, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <math.h>
int main() {
double x1,y1,x2,y2;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
printf("%.8lf\n",hypot(x1-x2,y1-y2));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249895/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249895/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%.8lf\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub1 = fsub double %2, %3
%call2 = call double @hypot(double noundef %sub, double noundef %sub1) #4
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind
declare double @hypot(double noundef, double 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
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main( void )
{
double x1,y1;
double x2,y2;
double distance;
scanf( "%lf%lf%lf%lf", &x1, &y1, &x2, &y2 );
x1=(x1-x2);
x1 = (x1 < 0)? -1*(x1): x1;
y1=(y1-y2);
y1 = (y1 < 0)? -1*(y1): y1;
distance = sqrt( pow( x1, 2 )+pow( y1, 2 ) );
printf( "%.8lf\n", distance );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249938/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249938/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%.8lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fcmp olt <2 x double> %8, zeroinitializer
%10 = fneg <2 x double> %8
%11 = select <2 x i1> %9, <2 x double> %10, <2 x double> %8
%12 = extractelement <2 x double> %11, i64 0
store double %12, ptr %x1, align 8, !tbaa !5
%13 = extractelement <2 x double> %11, i64 1
store double %13, ptr %y1, align 8, !tbaa !5
%14 = fmul <2 x double> %11, %11
%shift = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%15 = fadd <2 x double> %14, %shift
%add = extractelement <2 x double> %15, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void){
double x1,y1,x2,y2;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
printf("%.8lf\n",(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249989/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249989/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%.8lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
long long a[200000];
int cmp ( const void *a , const void *b ){
return *(long long *)a - *(long long *)b;
}
int main()
{
int i, j, n;
scanf("%d", &n);
for(i = 1; i <= n; i++)
scanf("%lld", &a[i]);
qsort(&a[1], n, sizeof(a[1]), cmp);
if(n % 2 != 0) printf("%d\n", n / 2);
else printf("%d\n", n / 2 - 1);
i = 1; j = n;
while(i <= j){
if(i != j) printf("%lld %lld ", a[j], a[i]);
else printf("%lld ", a[i]);
i ++;
j --;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25003/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@a = dso_local global [200000 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [11 x i8] c"%lld %lld \00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld \00", align 1
; 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) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp.not33 = icmp slt i32 %0, 1
br i1 %cmp.not33, label %entry.for.end_crit_edge, label %for.body
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [200000 x i64], 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 !9
%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 !11
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull getelementptr inbounds ([200000 x i64], ptr @a, i64 0, i64 1), i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp) #5
%3 = load i32, ptr %n, align 4, !tbaa !9
%4 = and i32 %3, 1
%div5 = sdiv i32 %3, 2
%sext = add nsw i32 %4, -1
%sub.sink = add nsw i32 %div5, %sext
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub.sink)
%5 = load i32, ptr %n, align 4, !tbaa !9
%cmp7.not35 = icmp slt i32 %5, 1
br i1 %cmp7.not35, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.end
%6 = zext i32 %5 to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end21
%indvars.iv42 = phi i64 [ 1, %while.body.preheader ], [ %indvars.iv.next43, %if.end21 ]
%indvars.iv40 = phi i64 [ %6, %while.body.preheader ], [ %indvars.iv.next41, %if.end21 ]
%cmp9.not = icmp eq i64 %indvars.iv42, %indvars.iv40
br i1 %cmp9.not, label %if.else17, label %if.then11
if.then11: ; preds = %while.body
%arrayidx13 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv40
%7 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%arrayidx15 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv42
%8 = load i64, ptr %arrayidx15, align 8, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %7, i64 noundef %8)
br label %if.end21
if.else17: ; preds = %while.body
%arrayidx19 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv42
%9 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %9)
br label %if.end21
if.end21: ; preds = %if.else17, %if.then11
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%indvars.iv.next41 = add nsw i64 %indvars.iv40, -1
%cmp7.not.not = icmp slt i64 %indvars.iv42, %indvars.iv.next41
br i1 %cmp7.not.not, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %if.end21, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
#include <math.h>
int main(){
double x1,y1,x2,y2,xx,yy,result;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
xx=pow(x1-x2, 2);
yy=pow(y1-y2, 2);
printf("%lf\n",sqrt(xx+yy));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250073/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250073/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h> //math.h?????????????????????????????????????????????????????¨??????-lm???????????§???\\
??????????????????????????????
int main(void){
double x1,y1,x2,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
double l;
l = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
printf("%lf\n",l);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250116/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250116/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(){
double x1,y1,x2,y2;
double i,j,k;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
i = pow((x2-x1),2.0);
j = pow((y2-y1),2.0);
k = sqrt(i+j);
printf("%f\n",k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250167/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250167/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(){
int n;
scanf("%d",&n);
int i,en[n],con=1;
int fre[n+1];
int va[n+1];
memset(fre, 0, sizeof fre);
for(i=0;i<n;i++){
scanf("%d",&en[i]);
en[i]=n-en[i];
fre[en[i]]++;
}
for(i=0;i<n;i++)if(fre[en[i]]%en[i])break;
if(i<n)printf("Impossible\n");
else{
printf("Possible\n");
for(i=0;i<n;i++){
if(fre[en[i]]%en[i]==0){
va[en[i]]=con++;
}
printf("%d",va[en[i]]);
fre[en[i]]--;
if(i<n-1)printf(" ");
else printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25021/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25021/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Possible\00", align 1
@str.5 = private unnamed_addr constant [11 x i8] c"Impossible\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
%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
%add = add nsw i32 %3, 1
%4 = zext i32 %add to i64
%vla1 = alloca i32, i64 %4, align 16
%vla3 = alloca i32, i64 %4, align 16
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla1, i8 0, i64 %5, i1 false)
%cmp88 = icmp sgt i32 %3, 0
br i1 %cmp88, label %for.body, label %if.else
for.cond14.preheader: ; preds = %for.body
%cmp1590 = icmp sgt i32 %6, 0
br i1 %cmp1590, label %for.body16.preheader, label %if.else
for.body16.preheader: ; preds = %for.cond14.preheader
%wide.trip.count = zext i32 %6 to i64
br label %for.body16
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
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = sub nsw i32 %6, %7
store i32 %sub, ptr %arrayidx, align 4, !tbaa !5
%idxprom11 = sext i32 %sub to i64
%arrayidx12 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom11
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%inc = add nsw i32 %8, 1
store i32 %inc, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond14.preheader, !llvm.loop !9
for.cond14: ; preds = %for.body16
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%exitcond.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count
br i1 %exitcond.not, label %if.else, label %for.body16, !llvm.loop !11
for.body16: ; preds = %for.body16.preheader, %for.cond14
%indvars.iv97 = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next98, %for.cond14 ]
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv97
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%idxprom19 = sext i32 %10 to i64
%arrayidx20 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom19
%11 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%rem = srem i32 %11, %10
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %for.cond14, label %if.then27
if.then27: ; preds = %for.body16
%puts87 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end67
if.else: ; preds = %for.cond14, %entry, %for.cond14.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp3192 = icmp sgt i32 %12, 0
br i1 %cmp3192, label %for.body32, label %if.end67
for.body32: ; preds = %if.else, %if.end47
%indvars.iv100 = phi i64 [ %indvars.iv.next101, %if.end47 ], [ 0, %if.else ]
%con.093 = phi i32 [ %con.1, %if.end47 ], [ 1, %if.else ]
%arrayidx34 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv100
%13 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%idxprom35 = sext i32 %13 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom35
%14 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%rem39 = srem i32 %14, %13
%cmp40 = icmp eq i32 %rem39, 0
br i1 %cmp40, label %if.then41, label %for.body32.if.end47_crit_edge
for.body32.if.end47_crit_edge: ; preds = %for.body32
%arrayidx51.phi.trans.insert = getelementptr inbounds i32, ptr %vla3, i64 %idxprom35
%.pre = load i32, ptr %arrayidx51.phi.trans.insert, align 4, !tbaa !5
br label %if.end47
if.then41: ; preds = %for.body32
%inc42 = add nsw i32 %con.093, 1
%arrayidx46 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom35
store i32 %con.093, ptr %arrayidx46, align 4, !tbaa !5
br label %if.end47
if.end47: ; preds = %for.body32.if.end47_crit_edge, %if.then41
%15 = phi i32 [ %con.093, %if.then41 ], [ %.pre, %for.body32.if.end47_crit_edge ]
%con.1 = phi i32 [ %inc42, %if.then41 ], [ %con.093, %for.body32.if.end47_crit_edge ]
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%16 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%idxprom55 = sext i32 %16 to i64
%arrayidx56 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom55
%17 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%dec = add nsw i32 %17, -1
store i32 %dec, ptr %arrayidx56, align 4, !tbaa !5
%18 = load i32, ptr %n, align 4, !tbaa !5
%sub57 = add nsw i32 %18, -1
%19 = sext i32 %sub57 to i64
%cmp58 = icmp slt i64 %indvars.iv100, %19
%. = select i1 %cmp58, i32 32, i32 10
%putchar86 = call i32 @putchar(i32 %.)
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp31 = icmp slt i64 %indvars.iv.next101, %21
br i1 %cmp31, label %for.body32, label %if.end67, !llvm.loop !12
if.end67: ; preds = %if.end47, %if.else, %if.then27
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: 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 nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int main(void){
double x1,x2,y1,y2;
double ans;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
ans = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
printf("%lf\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250260/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250260/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main (int argc, char * argv[])
{
double x1,x2,y1,y2;
double dis=0;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
dis = sqrt(pow(x2 - x1,2)+(pow(y2 - y1,2)));
printf("%f\n",dis);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250303/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250303/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
double dis(double x1, double y1, double x2, double y2)
{
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main()
{
double x1, y1, x2, y2, d;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
d = dis(x1, y1, x2, y2);
printf("%.6lf\n", d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250347/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250347/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%.6lf\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @dis(double noundef %x1, double noundef %y1, double noundef %x2, double noundef %y2) local_unnamed_addr #0 {
entry:
%sub = fsub double %x1, %x2
%sub2 = fsub double %y1, %y2
%mul4 = fmul double %sub2, %sub2
%0 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = tail call double @llvm.sqrt.f64(double %0)
ret double %sqrt
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %y1, align 8, !tbaa !5
%2 = load double, ptr %x2, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub.i = fsub double %0, %2
%sub2.i = fsub double %1, %3
%mul4.i = fmul double %sub2.i, %sub2.i
%4 = call double @llvm.fmuladd.f64(double %sub.i, double %sub.i, double %mul4.i)
%sqrt.i = call double @llvm.sqrt.f64(double %4)
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include<math.h>
int main(void) {
double a,b,c,d;
double e;
scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
e=(a-c)*(a-c)+(b-d)*(b-d);
e=sqrt(e);
printf("%f",e);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250390/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250390/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
//ITP1-10-A: Distance
//2019.05.20
#include <stdio.h>
#include <math.h>
int main(void){
double x1, y1, x2, y2;
double distance;
scanf("%lf %lf %lf %lf\n", &x1, &y1, &x2, &y2);
distance = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2));
printf("%lf\n", distance);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250433/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250433/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [17 x i8] c"%lf %lf %lf %lf\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(){
double a,b,c,d;
scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
printf("%lf\n",sqrt(pow(c-a,2.0)+pow(d-b,2.0)));
return 0; }
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250477/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250477/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load double, ptr %c, align 8, !tbaa !5
%1 = load double, ptr %a, align 8, !tbaa !5
%2 = load double, ptr %d, align 8, !tbaa !5
%3 = load double, ptr %b, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int l[10], v[2], all, i;
double t;
while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v[0], &v[1]) != EOF){
all = 0;
for(i = 0; i < 10; i++){
all += l[i];
}
t = (double)all / (double)(v[0]+v[1]);
t *= v[0];
i = 0;
while(t > 0){
t -= (double)l[i];
i++;
}
printf("%d\n", i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250527/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250527/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [36 x i8] c"%d,%d,%d,%d,%d,%d,%d,%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 [10 x i32], align 16
%v = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #4
%arrayidx1 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 4
%arrayidx5 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 5
%arrayidx6 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 6
%arrayidx7 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 7
%arrayidx8 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 8
%arrayidx9 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 9
%arrayidx11 = getelementptr inbounds [2 x i32], ptr %v, i64 0, i64 1
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %v, ptr noundef nonnull %arrayidx11)
%cmp.not44 = icmp eq i32 %call43, -1
br i1 %cmp.not44, label %while.end29, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %while.end
%0 = load <8 x i32>, ptr %l, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%3 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %0)
%op.rdx = add i32 %3, %1
%op.rdx47 = add i32 %op.rdx, %2
%conv = sitofp i32 %op.rdx47 to double
%4 = load i32, ptr %v, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add16 = add nsw i32 %5, %4
%conv17 = sitofp i32 %add16 to double
%div = fdiv double %conv, %conv17
%conv19 = sitofp i32 %4 to double
%mul = fmul double %div, %conv19
%cmp2140 = fcmp ogt double %mul, 0.000000e+00
br i1 %cmp2140, label %while.body23, label %while.end
while.body23: ; preds = %for.cond.preheader, %while.body23
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body23 ], [ 0, %for.cond.preheader ]
%t.042 = phi double [ %sub, %while.body23 ], [ %mul, %for.cond.preheader ]
%arrayidx25 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%conv26 = sitofp i32 %6 to double
%sub = fsub double %t.042, %conv26
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp21 = fcmp ogt double %sub, 0.000000e+00
br i1 %cmp21, label %while.body23, label %while.end.loopexit, !llvm.loop !9
while.end.loopexit: ; preds = %while.body23
%7 = trunc i64 %indvars.iv.next to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.cond.preheader
%i.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %7, %while.end.loopexit ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %v, ptr noundef nonnull %arrayidx11)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end29, label %for.cond.preheader, !llvm.loop !11
while.end29: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 40, 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.vector.reduce.add.v8i32(<8 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}
|
// AOJ Volume 0 Problem 0034
#include <stdio.h>
int main(void)
{
int l[10];
int sum_l;
float l1;
int l12;
int v1, v2;
int i;
while (scanf("%d,", &l[0]) != EOF){
for (i = 1; i < 10; i++){
scanf("%d,", &l[i]);
}
scanf("%d,%d", &v1, &v2);
sum_l = 0;
for (i = 0; i < 10; i++){
sum_l += l[i];
}
l1 = ((float)v1 * sum_l / (v1 + v2) + 0.9999);
l12 = ((float)v1 * sum_l / (v1 + v2) + 0.9999);
// printf("l1=%f, %d\n", l1, l12);
i = 0;
while (l12 > 0){
l12 -= l[i];
i++;
}
// printf("l1=%f, %d\n", l1, l12);
printf("%d\n", i);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = alloca [10 x i32], align 16
%v1 = alloca i32, align 4
%v2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v2) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%cmp.not55 = icmp eq i32 %call54, -1
br i1 %cmp.not55, label %while.end36, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 1
%arrayidx2.1 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 2
%arrayidx2.2 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 3
%arrayidx2.3 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 4
%arrayidx2.4 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 5
%arrayidx2.5 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 6
%arrayidx2.6 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 7
%arrayidx2.7 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 8
%arrayidx2.8 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 9
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %while.end
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2)
%call3.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.1)
%call3.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.2)
%call3.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.3)
%call3.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.4)
%call3.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.5)
%call3.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.6)
%call3.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.7)
%call3.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2.8)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v1, ptr noundef nonnull %v2)
%0 = load <8 x i32>, ptr %l, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx2.7, align 16, !tbaa !5
%2 = load i32, ptr %arrayidx2.8, align 4, !tbaa !5
%3 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %0)
%op.rdx = add i32 %3, %1
%op.rdx59 = add i32 %op.rdx, %2
%4 = load i32, ptr %v1, align 4, !tbaa !5
%conv = sitofp i32 %4 to float
%conv13 = sitofp i32 %op.rdx59 to float
%mul = fmul float %conv13, %conv
%5 = load i32, ptr %v2, align 4, !tbaa !5
%add14 = add nsw i32 %5, %4
%conv15 = sitofp i32 %add14 to float
%div = fdiv float %mul, %conv15
%conv16 = fpext float %div to double
%add17 = fadd double %conv16, 9.999000e-01
%conv27 = fptosi double %add17 to i32
%cmp2951 = icmp sgt i32 %conv27, 0
br i1 %cmp2951, label %while.body31, label %while.end
while.body31: ; preds = %for.cond.preheader, %while.body31
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body31 ], [ 0, %for.cond.preheader ]
%l12.052 = phi i32 [ %sub, %while.body31 ], [ %conv27, %for.cond.preheader ]
%arrayidx33 = getelementptr inbounds [10 x i32], ptr %l, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%sub = sub nsw i32 %l12.052, %6
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp29 = icmp sgt i32 %sub, 0
br i1 %cmp29, label %while.body31, label %while.end.loopexit, !llvm.loop !9
while.end.loopexit: ; preds = %while.body31
%7 = trunc i64 %indvars.iv.next to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.cond.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %7, %while.end.loopexit ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.2.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end36, label %for.cond.preheader, !llvm.loop !11
while.end36: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v1) #4
call void @llvm.lifetime.end.p0(i64 40, 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.vector.reduce.add.v8i32(<8 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}
|
#include <stdio.h>
int main(void)
{
int a, b;
double pos;
int railWays[10];
int railLength;
int i;
while (~scanf("%d,", railWays)){
for (i = 1; i < 10; i++){
scanf("%d,", railWays + i);
}
scanf("%d,%d", &a, &b);
// input phase end
railLength = 0;
for (i = 0; i < 10; i++){
railLength += railWays[i];
}
pos = railLength * (1. * a / (a + b));
for (i = 0; i < 10; i++){
if (pos <= railWays[i]){
break;
}
pos -= railWays[i];
}
printf("%d\n", i + 1);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250620/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%railWays = alloca [10 x i32], align 16
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 40, ptr nonnull %railWays) #3
%call48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %railWays)
%tobool.not49 = icmp eq i32 %call48, -1
br i1 %tobool.not49, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%add.ptr = getelementptr inbounds i32, ptr %railWays, i64 1
%add.ptr.1 = getelementptr inbounds i32, ptr %railWays, i64 2
%add.ptr.2 = getelementptr inbounds i32, ptr %railWays, i64 3
%add.ptr.3 = getelementptr inbounds i32, ptr %railWays, i64 4
%add.ptr.4 = getelementptr inbounds i32, ptr %railWays, i64 5
%add.ptr.5 = getelementptr inbounds i32, ptr %railWays, i64 6
%add.ptr.6 = getelementptr inbounds i32, ptr %railWays, i64 7
%add.ptr.7 = getelementptr inbounds i32, ptr %railWays, i64 8
%add.ptr.8 = getelementptr inbounds i32, ptr %railWays, i64 9
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %for.end28
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%call2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.1)
%call2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.2)
%call2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.3)
%call2.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.4)
%call2.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.5)
%call2.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.6)
%call2.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.7)
%call2.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.8)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %railWays, align 16, !tbaa !5
%1 = load i32, ptr %add.ptr, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%2 = load i32, ptr %add.ptr.1, align 8, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%3 = load i32, ptr %add.ptr.2, align 4, !tbaa !5
%add.3 = add nsw i32 %3, %add.2
%4 = load i32, ptr %add.ptr.3, align 16, !tbaa !5
%add.4 = add nsw i32 %4, %add.3
%5 = load i32, ptr %add.ptr.4, align 4, !tbaa !5
%add.5 = add nsw i32 %5, %add.4
%6 = load i32, ptr %add.ptr.5, align 8, !tbaa !5
%add.6 = add nsw i32 %6, %add.5
%7 = load i32, ptr %add.ptr.6, align 4, !tbaa !5
%add.7 = add nsw i32 %7, %add.6
%8 = load i32, ptr %add.ptr.7, align 16, !tbaa !5
%add.8 = add nsw i32 %8, %add.7
%9 = load i32, ptr %add.ptr.8, align 4, !tbaa !5
%add.9 = add nsw i32 %9, %add.8
%conv = sitofp i32 %add.9 to double
%10 = load i32, ptr %a, align 4, !tbaa !5
%conv10 = sitofp i32 %10 to double
%11 = load i32, ptr %b, align 4, !tbaa !5
%add11 = add nsw i32 %11, %10
%conv12 = sitofp i32 %add11 to double
%div = fdiv double %conv10, %conv12
%mul13 = fmul double %div, %conv
%conv20 = sitofp i32 %0 to double
%cmp21 = fcmp ugt double %mul13, %conv20
br i1 %cmp21, label %if.end, label %for.end28
if.end: ; preds = %for.cond.preheader
%sub = fsub double %mul13, %conv20
%conv20.1 = sitofp i32 %1 to double
%cmp21.1 = fcmp ugt double %sub, %conv20.1
br i1 %cmp21.1, label %if.end.1, label %for.end28
if.end.1: ; preds = %if.end
%sub.1 = fsub double %sub, %conv20.1
%conv20.2 = sitofp i32 %2 to double
%cmp21.2 = fcmp ugt double %sub.1, %conv20.2
br i1 %cmp21.2, label %if.end.2, label %for.end28
if.end.2: ; preds = %if.end.1
%sub.2 = fsub double %sub.1, %conv20.2
%conv20.3 = sitofp i32 %3 to double
%cmp21.3 = fcmp ugt double %sub.2, %conv20.3
br i1 %cmp21.3, label %if.end.3, label %for.end28
if.end.3: ; preds = %if.end.2
%sub.3 = fsub double %sub.2, %conv20.3
%conv20.4 = sitofp i32 %4 to double
%cmp21.4 = fcmp ugt double %sub.3, %conv20.4
br i1 %cmp21.4, label %if.end.4, label %for.end28
if.end.4: ; preds = %if.end.3
%sub.4 = fsub double %sub.3, %conv20.4
%conv20.5 = sitofp i32 %5 to double
%cmp21.5 = fcmp ugt double %sub.4, %conv20.5
br i1 %cmp21.5, label %if.end.5, label %for.end28
if.end.5: ; preds = %if.end.4
%sub.5 = fsub double %sub.4, %conv20.5
%conv20.6 = sitofp i32 %6 to double
%cmp21.6 = fcmp ugt double %sub.5, %conv20.6
br i1 %cmp21.6, label %if.end.6, label %for.end28
if.end.6: ; preds = %if.end.5
%sub.6 = fsub double %sub.5, %conv20.6
%conv20.7 = sitofp i32 %7 to double
%cmp21.7 = fcmp ugt double %sub.6, %conv20.7
br i1 %cmp21.7, label %if.end.7, label %for.end28
if.end.7: ; preds = %if.end.6
%sub.7 = fsub double %sub.6, %conv20.7
%conv20.8 = sitofp i32 %8 to double
%cmp21.8 = fcmp ugt double %sub.7, %conv20.8
br i1 %cmp21.8, label %if.end.8, label %for.end28
if.end.8: ; preds = %if.end.7
%sub.8 = fsub double %sub.7, %conv20.8
%conv20.9 = sitofp i32 %9 to double
%cmp21.9 = fcmp ugt double %sub.8, %conv20.9
br i1 %cmp21.9, label %if.end.9, label %for.end28
if.end.9: ; preds = %if.end.8
br label %for.end28
for.end28: ; preds = %if.end.9, %if.end.8, %if.end.7, %if.end.6, %if.end.5, %if.end.4, %if.end.3, %if.end.2, %if.end.1, %if.end, %for.cond.preheader
%i.2.lcssa = phi i32 [ 1, %for.cond.preheader ], [ 2, %if.end ], [ 3, %if.end.1 ], [ 4, %if.end.2 ], [ 5, %if.end.3 ], [ 6, %if.end.4 ], [ 7, %if.end.5 ], [ 8, %if.end.6 ], [ 9, %if.end.7 ], [ 10, %if.end.8 ], [ 11, %if.end.9 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.2.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %railWays)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.end28, %entry
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %railWays) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
long long n;
scanf("%lld",&n);
long long ans[n+1];
for(long long i=1;i<=n;i++)ans[i]=0;
for(long long a=1;a<=100;a++){
for(long long b=a;b<=100;b++){
for(long long c=b;c<=100;c++){
if((a+b)*(a+b)+(c+b)*(c+b)+(a+c)*(a+c)<=2*n){
if(a==c){
ans[((a+b)*(a+b)+(c+b)*(c+b)+(a+c)*(a+c))/2]+=1;
}else if(a==b || b==c){
ans[((a+b)*(a+b)+(c+b)*(c+b)+(a+c)*(a+c))/2]+=3;
}else{
ans[((a+b)*(a+b)+(c+b)*(c+b)+(a+c)*(a+c))/2]+=6;
}
}
}
}
}
for(long long i=1;i<=n-1;i++){
printf("%lld\n",ans[i]);
}
printf("%lld",ans[n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250664/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250664/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not162 = icmp slt i64 %2, 1
br i1 %cmp.not162, label %for.cond1.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%scevgep = getelementptr i8, ptr %vla, i64 8
%3 = shl nuw i64 %2, 3
call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %3, i1 false), !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.body.preheader, %entry
%mul23 = shl nsw i64 %2, 1
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond.cleanup7
%a.0166 = phi i64 [ 1, %for.cond1.preheader ], [ %inc81, %for.cond.cleanup7 ]
br label %for.cond9.preheader
for.cond84.preheader: ; preds = %for.cond.cleanup7
%cmp85.not.not167 = icmp sgt i64 %2, 1
br i1 %cmp85.not.not167, label %for.body87, label %for.cond.cleanup86
for.cond9.preheader: ; preds = %for.cond5.preheader, %for.cond.cleanup11
%b.0165 = phi i64 [ %a.0166, %for.cond5.preheader ], [ %inc78, %for.cond.cleanup11 ]
%add13 = add nuw nsw i64 %b.0165, %a.0166
%mul = mul nsw i64 %add13, %add13
%cmp40 = icmp eq i64 %a.0166, %b.0165
%cmp40.fr = freeze i1 %cmp40
br i1 %cmp40.fr, label %for.body12.us, label %for.body12
for.body12.us: ; preds = %for.cond9.preheader, %for.inc74.us
%c.0164.us = phi i64 [ %inc75.us, %for.inc74.us ], [ %b.0165, %for.cond9.preheader ]
%add15.us = add nuw nsw i64 %c.0164.us, %b.0165
%mul17.us = mul nsw i64 %add15.us, %add15.us
%add18.us = add nuw nsw i64 %mul17.us, %mul
%add19.us = add nuw nsw i64 %c.0164.us, %a.0166
%mul21.us = mul nsw i64 %add19.us, %add19.us
%add22.us = add nuw nsw i64 %add18.us, %mul21.us
%cmp24.not.us = icmp sgt i64 %add22.us, %mul23
br i1 %cmp24.not.us, label %for.inc74.us, label %if.then.us
if.then.us: ; preds = %for.body12.us
%cmp25.us = icmp eq i64 %a.0166, %c.0164.us
%div160.us = lshr i64 %add22.us, 1
%arrayidx38.us = getelementptr inbounds i64, ptr %vla, i64 %div160.us
%4 = load i64, ptr %arrayidx38.us, align 8, !tbaa !5
%. = select i1 %cmp25.us, i64 1, i64 3
%add39.us = add nsw i64 %4, %.
store i64 %add39.us, ptr %arrayidx38.us, align 8, !tbaa !5
br label %for.inc74.us
for.inc74.us: ; preds = %if.then.us, %for.body12.us
%inc75.us = add nuw nsw i64 %c.0164.us, 1
%cmp10.us = icmp ult i64 %c.0164.us, 100
br i1 %cmp10.us, label %for.body12.us, label %for.cond.cleanup11, !llvm.loop !9
for.cond.cleanup7: ; preds = %for.cond.cleanup11
%inc81 = add nuw nsw i64 %a.0166, 1
%exitcond.not = icmp eq i64 %inc81, 101
br i1 %exitcond.not, label %for.cond84.preheader, label %for.cond5.preheader, !llvm.loop !11
for.cond.cleanup11: ; preds = %for.inc74, %for.inc74.us
%inc78 = add nuw nsw i64 %b.0165, 1
%cmp6 = icmp ult i64 %b.0165, 100
br i1 %cmp6, label %for.cond9.preheader, label %for.cond.cleanup7, !llvm.loop !12
for.body12: ; preds = %for.cond9.preheader, %for.inc74
%c.0164 = phi i64 [ %inc75, %for.inc74 ], [ %b.0165, %for.cond9.preheader ]
%add15 = add nuw nsw i64 %c.0164, %b.0165
%mul17 = mul nsw i64 %add15, %add15
%add18 = add nuw nsw i64 %mul17, %mul
%add19 = add nuw nsw i64 %c.0164, %a.0166
%mul21 = mul nsw i64 %add19, %add19
%add22 = add nuw nsw i64 %add18, %mul21
%cmp24.not = icmp sgt i64 %add22, %mul23
br i1 %cmp24.not, label %for.inc74, label %if.then
if.then: ; preds = %for.body12
%cmp25 = icmp eq i64 %a.0166, %c.0164
br i1 %cmp25, label %if.then26, label %if.else
if.then26: ; preds = %if.then
%div160 = lshr i64 %add22, 1
%arrayidx38 = getelementptr inbounds i64, ptr %vla, i64 %div160
%5 = load i64, ptr %arrayidx38, align 8, !tbaa !5
%add39 = add nsw i64 %5, 1
store i64 %add39, ptr %arrayidx38, align 8, !tbaa !5
br label %for.inc74
if.else: ; preds = %if.then
%cmp41 = icmp eq i64 %b.0165, %c.0164
%div54159 = lshr i64 %add22, 1
%arrayidx55 = getelementptr inbounds i64, ptr %vla, i64 %div54159
%6 = load i64, ptr %arrayidx55, align 8, !tbaa !5
br i1 %cmp41, label %if.then42, label %if.else57
if.then42: ; preds = %if.else
%add56 = add nsw i64 %6, 3
store i64 %add56, ptr %arrayidx55, align 8, !tbaa !5
br label %for.inc74
if.else57: ; preds = %if.else
%add71 = add nsw i64 %6, 6
store i64 %add71, ptr %arrayidx55, align 8, !tbaa !5
br label %for.inc74
for.inc74: ; preds = %for.body12, %if.then42, %if.else57, %if.then26
%inc75 = add nuw nsw i64 %c.0164, 1
%cmp10 = icmp ult i64 %c.0164, 100
br i1 %cmp10, label %for.body12, label %for.cond.cleanup11, !llvm.loop !9
for.cond.cleanup86: ; preds = %for.body87, %for.cond84.preheader
%.lcssa = phi i64 [ %2, %for.cond84.preheader ], [ %9, %for.body87 ]
%arrayidx93 = getelementptr inbounds i64, ptr %vla, i64 %.lcssa
%7 = load i64, ptr %arrayidx93, align 8, !tbaa !5
%call94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %7)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
for.body87: ; preds = %for.cond84.preheader, %for.body87
%i83.0168 = phi i64 [ %inc91, %for.body87 ], [ 1, %for.cond84.preheader ]
%arrayidx88 = getelementptr inbounds i64, ptr %vla, i64 %i83.0168
%8 = load i64, ptr %arrayidx88, align 8, !tbaa !5
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %8)
%inc91 = add nuw nsw i64 %i83.0168, 1
%9 = load i64, ptr %n, align 8, !tbaa !5
%cmp85.not.not = icmp slt i64 %inc91, %9
br i1 %cmp85.not.not, label %for.body87, label %for.cond.cleanup86, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
//C - XYZ Triplets
//Hiia
#include <stdio.h>
#include <stdlib.h>//rannsuu, zettaichi(absolute)
#include <time.h>
//srand((unsigned int) time(0));
#include <math.h>//koudona keisann
#include <string.h>//hairetsu
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
typedef long long ll;
//#define N 998244353
#define pi 3.1415926535897932384626433832
int gcd(int m,int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
int lcm(int m,int n){if((0==m)||(0==n))return 0;return(m*n/gcd(m, n));}
int fact(int x){if(x==1) return(x);else return(x*fact(x-1));}//Kaijou x!
int ruijou(int base,int exponent){int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent
long long int llgcd(long long int m,long long int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
long long int lllcm(long long int m,long long int n){if((0==m)||(0==n))return 0;return(m*n/llgcd(m, n));}
long long int llfact(long long int x){if(x==1) return(x);else return(x*llfact(x-1));}//Kaijou
int llruijou(long long int base,long long int exponent){long long int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent
int main()
{
int n,x,y,z;
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
int ans=0;
for(z = 1; z < sqrt(i); z++) {
for(y = 1; y < sqrt(i); y++) {
for(x = 1; x < sqrt(i); x++) {
if(x*x+y*y+z*z+x*y+y*z+z*x==i){
ans++;
break;
}
if(x*x+y*y+z*z+x*y+y*z+z*x>i){
break;
}
}
}
}
printf("%d\n", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250721/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250721/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %m, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %m, 0
%cmp1 = icmp eq i32 %n, 0
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%cmp2.not16 = icmp eq i32 %m, %n
br i1 %cmp2.not16, label %return, label %while.body
while.body: ; preds = %while.cond.preheader, %while.body
%n.addr.018 = phi i32 [ %n.addr.1, %while.body ], [ %n, %while.cond.preheader ]
%m.addr.017 = phi i32 [ %m.addr.1, %while.body ], [ %m, %while.cond.preheader ]
%cmp3 = icmp sgt i32 %m.addr.017, %n.addr.018
%sub = select i1 %cmp3, i32 %n.addr.018, i32 0
%m.addr.1 = sub nsw i32 %m.addr.017, %sub
%sub5 = select i1 %cmp3, i32 0, i32 %m.addr.017
%n.addr.1 = sub nsw i32 %n.addr.018, %sub5
%cmp2.not = icmp eq i32 %m.addr.1, %n.addr.1
br i1 %cmp2.not, label %return, label %while.body, !llvm.loop !5
return: ; preds = %while.body, %while.cond.preheader, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %m, %while.cond.preheader ], [ %m.addr.1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %m, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %m, 0
%cmp1 = icmp eq i32 %n, 0
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %entry
%mul = mul nsw i32 %n, %m
%cmp2.not16.i = icmp eq i32 %m, %n
br i1 %cmp2.not16.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %while.cond.preheader.i, %while.body.i
%n.addr.018.i = phi i32 [ %n.addr.1.i, %while.body.i ], [ %n, %while.cond.preheader.i ]
%m.addr.017.i = phi i32 [ %m.addr.1.i, %while.body.i ], [ %m, %while.cond.preheader.i ]
%cmp3.i = icmp sgt i32 %m.addr.017.i, %n.addr.018.i
%sub.i = select i1 %cmp3.i, i32 %n.addr.018.i, i32 0
%m.addr.1.i = sub nsw i32 %m.addr.017.i, %sub.i
%sub5.i = select i1 %cmp3.i, i32 0, i32 %m.addr.017.i
%n.addr.1.i = sub nsw i32 %n.addr.018.i, %sub5.i
%cmp2.not.i = icmp eq i32 %m.addr.1.i, %n.addr.1.i
br i1 %cmp2.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %while.cond.preheader.i
%retval.0.i = phi i32 [ %m, %while.cond.preheader.i ], [ %m.addr.1.i, %while.body.i ]
%div = sdiv i32 %mul, %retval.0.i
br label %return
return: ; preds = %entry, %gcd.exit
%retval.0 = phi i32 [ %div, %gcd.exit ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i32 %x, 1
br i1 %cmp4, label %return, label %if.else.preheader
if.else.preheader: ; preds = %entry
%0 = add i32 %x, -1
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %if.else.preheader9, label %vector.ph
vector.ph: ; preds = %if.else.preheader
%n.vec = and i32 %0, -8
%ind.end = sub i32 %x, %n.vec
%.splatinsert = insertelement <4 x i32> poison, i32 %x, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 -1, i32 -2, i32 -3>
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.phi8 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %2, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 -4, i32 -4, i32 -4, i32 -4>
%1 = mul <4 x i32> %vec.ind, %vec.phi
%2 = mul <4 x i32> %step.add, %vec.phi8
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 -8, i32 -8, i32 -8, i32 -8>
%3 = icmp eq i32 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !7
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %2, %1
%4 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %0, %n.vec
br i1 %cmp.n, label %return, label %if.else.preheader9
if.else.preheader9: ; preds = %if.else.preheader, %middle.block
%x.tr6.ph = phi i32 [ %x, %if.else.preheader ], [ %ind.end, %middle.block ]
%accumulator.tr5.ph = phi i32 [ 1, %if.else.preheader ], [ %4, %middle.block ]
br label %if.else
if.else: ; preds = %if.else.preheader9, %if.else
%x.tr6 = phi i32 [ %sub, %if.else ], [ %x.tr6.ph, %if.else.preheader9 ]
%accumulator.tr5 = phi i32 [ %mul, %if.else ], [ %accumulator.tr5.ph, %if.else.preheader9 ]
%sub = add nsw i32 %x.tr6, -1
%mul = mul nsw i32 %x.tr6, %accumulator.tr5
%cmp = icmp eq i32 %sub, 1
br i1 %cmp, label %return, label %if.else, !llvm.loop !10
return: ; preds = %if.else, %middle.block, %entry
%accumulator.tr.lcssa = phi i32 [ 1, %entry ], [ %4, %middle.block ], [ %mul, %if.else ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ruijou(i32 noundef %base, i32 noundef %exponent) local_unnamed_addr #0 {
entry:
%cmp.not3 = icmp eq i32 %exponent, 0
br i1 %cmp.not3, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %exponent, 8
br i1 %min.iters.check, label %while.body.preheader7, label %vector.ph
vector.ph: ; preds = %while.body.preheader
%n.vec = and i32 %exponent, -8
%ind.end = and i32 %exponent, 7
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %base, 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 !11
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, %exponent
br i1 %cmp.n, label %while.end, label %while.body.preheader7
while.body.preheader7: ; preds = %while.body.preheader, %middle.block
%answer.05.ph = phi i32 [ 1, %while.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ %exponent, %while.body.preheader ], [ %ind.end, %middle.block ]
br label %while.body
while.body: ; preds = %while.body.preheader7, %while.body
%answer.05 = phi i32 [ %mul, %while.body ], [ %answer.05.ph, %while.body.preheader7 ]
%i.04 = phi i32 [ %dec, %while.body ], [ %i.04.ph, %while.body.preheader7 ]
%mul = mul nsw i32 %answer.05, %base
%dec = add nsw i32 %i.04, -1
%cmp.not = icmp eq i32 %dec, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %while.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %m, i64 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i64 %m, 0
%cmp1 = icmp eq i64 %n, 0
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%cmp2.not16 = icmp eq i64 %m, %n
br i1 %cmp2.not16, label %return, label %while.body
while.body: ; preds = %while.cond.preheader, %while.body
%n.addr.018 = phi i64 [ %n.addr.1, %while.body ], [ %n, %while.cond.preheader ]
%m.addr.017 = phi i64 [ %m.addr.1, %while.body ], [ %m, %while.cond.preheader ]
%cmp3 = icmp sgt i64 %m.addr.017, %n.addr.018
%sub = select i1 %cmp3, i64 %n.addr.018, i64 0
%m.addr.1 = sub nsw i64 %m.addr.017, %sub
%sub5 = select i1 %cmp3, i64 0, i64 %m.addr.017
%n.addr.1 = sub nsw i64 %n.addr.018, %sub5
%cmp2.not = icmp eq i64 %m.addr.1, %n.addr.1
br i1 %cmp2.not, label %return, label %while.body, !llvm.loop !13
return: ; preds = %while.body, %while.cond.preheader, %entry
%retval.0 = phi i64 [ 0, %entry ], [ %m, %while.cond.preheader ], [ %m.addr.1, %while.body ]
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %m, i64 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i64 %m, 0
%cmp1 = icmp eq i64 %n, 0
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %entry
%mul = mul nsw i64 %n, %m
%cmp2.not16.i = icmp eq i64 %m, %n
br i1 %cmp2.not16.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %while.cond.preheader.i, %while.body.i
%n.addr.018.i = phi i64 [ %n.addr.1.i, %while.body.i ], [ %n, %while.cond.preheader.i ]
%m.addr.017.i = phi i64 [ %m.addr.1.i, %while.body.i ], [ %m, %while.cond.preheader.i ]
%cmp3.i = icmp sgt i64 %m.addr.017.i, %n.addr.018.i
%sub.i = select i1 %cmp3.i, i64 %n.addr.018.i, i64 0
%m.addr.1.i = sub nsw i64 %m.addr.017.i, %sub.i
%sub5.i = select i1 %cmp3.i, i64 0, i64 %m.addr.017.i
%n.addr.1.i = sub nsw i64 %n.addr.018.i, %sub5.i
%cmp2.not.i = icmp eq i64 %m.addr.1.i, %n.addr.1.i
br i1 %cmp2.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !13
llgcd.exit: ; preds = %while.body.i, %while.cond.preheader.i
%retval.0.i = phi i64 [ %m, %while.cond.preheader.i ], [ %m.addr.1.i, %while.body.i ]
%div = sdiv i64 %mul, %retval.0.i
br label %return
return: ; preds = %entry, %llgcd.exit
%retval.0 = phi i64 [ %div, %llgcd.exit ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %x) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %x, 1
br i1 %cmp4, label %return, label %if.else.preheader
if.else.preheader: ; preds = %entry
%0 = add i64 %x, -1
%1 = add i64 %x, -2
%xtraiter = and i64 %0, 7
%2 = icmp ult i64 %1, 7
br i1 %2, label %return.loopexit.unr-lcssa, label %if.else.preheader.new
if.else.preheader.new: ; preds = %if.else.preheader
%unroll_iter = and i64 %0, -8
br label %if.else
if.else: ; preds = %if.else, %if.else.preheader.new
%x.tr6 = phi i64 [ %x, %if.else.preheader.new ], [ %sub.7, %if.else ]
%accumulator.tr5 = phi i64 [ 1, %if.else.preheader.new ], [ %mul.7, %if.else ]
%niter = phi i64 [ 0, %if.else.preheader.new ], [ %niter.next.7, %if.else ]
%sub = add nsw i64 %x.tr6, -1
%mul = mul nsw i64 %x.tr6, %accumulator.tr5
%sub.1 = add nsw i64 %x.tr6, -2
%mul.1 = mul nsw i64 %sub, %mul
%sub.2 = add nsw i64 %x.tr6, -3
%mul.2 = mul nsw i64 %sub.1, %mul.1
%sub.3 = add nsw i64 %x.tr6, -4
%mul.3 = mul nsw i64 %sub.2, %mul.2
%sub.4 = add nsw i64 %x.tr6, -5
%mul.4 = mul nsw i64 %sub.3, %mul.3
%sub.5 = add nsw i64 %x.tr6, -6
%mul.5 = mul nsw i64 %sub.4, %mul.4
%sub.6 = add nsw i64 %x.tr6, -7
%mul.6 = mul nsw i64 %sub.5, %mul.5
%sub.7 = add nsw i64 %x.tr6, -8
%mul.7 = mul nsw i64 %sub.6, %mul.6
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %return.loopexit.unr-lcssa, label %if.else
return.loopexit.unr-lcssa: ; preds = %if.else, %if.else.preheader
%mul.lcssa.ph = phi i64 [ undef, %if.else.preheader ], [ %mul.7, %if.else ]
%x.tr6.unr = phi i64 [ %x, %if.else.preheader ], [ %sub.7, %if.else ]
%accumulator.tr5.unr = phi i64 [ 1, %if.else.preheader ], [ %mul.7, %if.else ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %return, label %if.else.epil
if.else.epil: ; preds = %return.loopexit.unr-lcssa, %if.else.epil
%x.tr6.epil = phi i64 [ %sub.epil, %if.else.epil ], [ %x.tr6.unr, %return.loopexit.unr-lcssa ]
%accumulator.tr5.epil = phi i64 [ %mul.epil, %if.else.epil ], [ %accumulator.tr5.unr, %return.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %if.else.epil ], [ 0, %return.loopexit.unr-lcssa ]
%sub.epil = add nsw i64 %x.tr6.epil, -1
%mul.epil = mul nsw i64 %x.tr6.epil, %accumulator.tr5.epil
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %return, label %if.else.epil, !llvm.loop !14
return: ; preds = %return.loopexit.unr-lcssa, %if.else.epil, %entry
%accumulator.tr.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %return.loopexit.unr-lcssa ], [ %mul.epil, %if.else.epil ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @llruijou(i64 noundef %base, i64 noundef %exponent) local_unnamed_addr #0 {
entry:
%cmp.not3 = icmp eq i64 %exponent, 0
br i1 %cmp.not3, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%xtraiter = and i64 %exponent, 7
%0 = icmp ult i64 %exponent, 8
br i1 %0, label %while.end.loopexit.unr-lcssa, label %while.body.preheader.new
while.body.preheader.new: ; preds = %while.body.preheader
%unroll_iter = and i64 %exponent, -8
br label %while.body
while.body: ; preds = %while.body, %while.body.preheader.new
%answer.05 = phi i64 [ 1, %while.body.preheader.new ], [ %mul.7, %while.body ]
%niter = phi i64 [ 0, %while.body.preheader.new ], [ %niter.next.7, %while.body ]
%mul = mul nsw i64 %answer.05, %base
%mul.1 = mul nsw i64 %mul, %base
%mul.2 = mul nsw i64 %mul.1, %base
%mul.3 = mul nsw i64 %mul.2, %base
%mul.4 = mul nsw i64 %mul.3, %base
%mul.5 = mul nsw i64 %mul.4, %base
%mul.6 = mul nsw i64 %mul.5, %base
%mul.7 = mul nsw i64 %mul.6, %base
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %while.end.loopexit.unr-lcssa, label %while.body, !llvm.loop !16
while.end.loopexit.unr-lcssa: ; preds = %while.body, %while.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %while.body.preheader ], [ %mul.7, %while.body ]
%answer.05.unr = phi i64 [ 1, %while.body.preheader ], [ %mul.7, %while.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end.loopexit, label %while.body.epil
while.body.epil: ; preds = %while.end.loopexit.unr-lcssa, %while.body.epil
%answer.05.epil = phi i64 [ %mul.epil, %while.body.epil ], [ %answer.05.unr, %while.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %while.body.epil ], [ 0, %while.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %answer.05.epil, %base
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %while.end.loopexit, label %while.body.epil, !llvm.loop !17
while.end.loopexit: ; preds = %while.body.epil, %while.end.loopexit.unr-lcssa
%mul.lcssa = phi i64 [ %mul.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %mul.epil, %while.body.epil ]
%1 = trunc i64 %mul.lcssa to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%answer.0.lcssa = phi i32 [ 1, %entry ], [ %1, %while.end.loopexit ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp.not108 = icmp slt i32 %0, 1
br i1 %cmp.not108, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end53
%i.0109 = phi i32 [ %inc56, %for.end53 ], [ 1, %entry ]
%conv2 = sitofp i32 %i.0109 to double
%call3103 = call double @sqrt(double noundef %conv2) #6
%cmp4104 = fcmp ogt double %call3103, 1.000000e+00
br i1 %cmp4104, label %for.cond7.preheader, label %for.end53
for.cond.cleanup: ; preds = %for.end53, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.cond7.preheader: ; preds = %for.cond1.preheader, %for.inc51
%ans.0106 = phi i32 [ %ans.1.lcssa, %for.inc51 ], [ 0, %for.cond1.preheader ]
%z.0105 = phi i32 [ %inc52, %for.inc51 ], [ 1, %for.cond1.preheader ]
%call1098 = call double @sqrt(double noundef %conv2) #6
%cmp1199 = fcmp ogt double %call1098, 1.000000e+00
br i1 %cmp1199, label %for.cond14.preheader.lr.ph, label %for.inc51
for.cond14.preheader.lr.ph: ; preds = %for.cond7.preheader
%mul22 = mul nsw i32 %z.0105, %z.0105
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.lr.ph, %for.inc48
%ans.1102 = phi i32 [ %ans.0106, %for.cond14.preheader.lr.ph ], [ %ans.2, %for.inc48 ]
%y.0100 = phi i32 [ 1, %for.cond14.preheader.lr.ph ], [ %inc49, %for.inc48 ]
%call1795 = call double @sqrt(double noundef %conv2) #6
%cmp1896 = fcmp ogt double %call1795, 1.000000e+00
br i1 %cmp1896, label %for.body20.lr.ph, label %for.inc48
for.body20.lr.ph: ; preds = %for.cond14.preheader
%reass.add = add nuw i32 %y.0100, %z.0105
%reass.mul94 = mul i32 %reass.add, %y.0100
%add27 = add i32 %reass.mul94, %mul22
br label %for.body20
for.cond14: ; preds = %if.end
%inc47 = add nuw nsw i32 %x.097, 1
%conv15 = sitofp i32 %inc47 to double
%call17 = call double @sqrt(double noundef %conv2) #6
%cmp18 = fcmp ogt double %call17, %conv15
br i1 %cmp18, label %for.body20, label %for.inc48, !llvm.loop !22
for.body20: ; preds = %for.body20.lr.ph, %for.cond14
%x.097 = phi i32 [ 1, %for.body20.lr.ph ], [ %inc47, %for.cond14 ]
%reass.add92 = add i32 %reass.add, %x.097
%reass.mul = mul i32 %reass.add92, %x.097
%add29 = add i32 %add27, %reass.mul
%cmp30 = icmp eq i32 %add29, %i.0109
br i1 %cmp30, label %if.then, label %if.end
if.then: ; preds = %for.body20
%inc = add nsw i32 %ans.1102, 1
br label %for.inc48
if.end: ; preds = %for.body20
%cmp43 = icmp ugt i32 %add29, %i.0109
br i1 %cmp43, label %for.inc48, label %for.cond14
for.inc48: ; preds = %if.end, %for.cond14, %for.cond14.preheader, %if.then
%ans.2 = phi i32 [ %inc, %if.then ], [ %ans.1102, %for.cond14.preheader ], [ %ans.1102, %for.cond14 ], [ %ans.1102, %if.end ]
%inc49 = add nuw nsw i32 %y.0100, 1
%conv8 = sitofp i32 %inc49 to double
%call10 = call double @sqrt(double noundef %conv2) #6
%cmp11 = fcmp ogt double %call10, %conv8
br i1 %cmp11, label %for.cond14.preheader, label %for.inc51, !llvm.loop !23
for.inc51: ; preds = %for.inc48, %for.cond7.preheader
%ans.1.lcssa = phi i32 [ %ans.0106, %for.cond7.preheader ], [ %ans.2, %for.inc48 ]
%inc52 = add nuw nsw i32 %z.0105, 1
%conv = sitofp i32 %inc52 to double
%call3 = call double @sqrt(double noundef %conv2) #6
%cmp4 = fcmp ogt double %call3, %conv
br i1 %cmp4, label %for.cond7.preheader, label %for.end53, !llvm.loop !24
for.end53: ; preds = %for.inc51, %for.cond1.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %ans.1.lcssa, %for.inc51 ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
%inc56 = add nuw nsw i32 %i.0109, 1
%1 = load i32, ptr %n, align 4, !tbaa !18
%cmp.not.not = icmp slt i32 %i.0109, %1
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond.cleanup, !llvm.loop !25
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
!11 = distinct !{!11, !6, !8, !9}
!12 = distinct !{!12, !6, !9, !8}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !20, i64 0}
!20 = !{!"omnipotent char", !21, i64 0}
!21 = !{!"Simple C/C++ TBAA"}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !6}
|
#include <stdio.h>
#include <math.h>
int main(){
int N, count = 0;
scanf("%d", &N);
for(int n=1;n<=N;n++){
count = 0;
for(int x=1;x<=(int)sqrt(n)+2;x++){
for(int y=x;y<=(int)sqrt(n)+2;y++){
for(int z=y;z<=(int)sqrt(n)+2;z++){
if(x*x+y*y+z*z+x*y+y*z+z*x==n){
if(x==y && y==z){
count += 1;
}else if((x!=y && y==z) || (x==y && y!=z) || (x==z && x!=y)){
count += 3;
}else{
count += 6;
}
}
}
}
}
printf("%d\n", count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250765/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250765/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not145 = icmp slt i32 %0, 1
br i1 %cmp.not145, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond.cleanup6
%n.0146 = phi i32 [ %inc74, %for.cond.cleanup6 ], [ 1, %entry ]
%conv = sitofp i32 %n.0146 to double
%call2138 = call double @sqrt(double noundef %conv) #4
%conv3139 = fptosi double %call2138 to i32
%cmp4.not141 = icmp slt i32 %conv3139, -1
br i1 %cmp4.not141, label %for.cond.cleanup6, label %for.cond8.preheader
for.cond.cleanup: ; preds = %for.cond.cleanup6, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.cond8.preheader: ; preds = %for.cond1.preheader, %for.cond.cleanup15
%x.0143 = phi i32 [ %inc70, %for.cond.cleanup15 ], [ 1, %for.cond1.preheader ]
%count.0142 = phi i32 [ %count.1.lcssa, %for.cond.cleanup15 ], [ 0, %for.cond1.preheader ]
%call10130 = call double @sqrt(double noundef %conv) #4
%conv11131 = fptosi double %call10130 to i32
%add12132 = add nsw i32 %conv11131, 2
%cmp13.not133 = icmp sgt i32 %x.0143, %add12132
br i1 %cmp13.not133, label %for.cond.cleanup15, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond8.preheader
%mul = mul nsw i32 %x.0143, %x.0143
br label %for.cond17.preheader
for.cond.cleanup6: ; preds = %for.cond.cleanup15, %for.cond1.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %count.1.lcssa, %for.cond.cleanup15 ]
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
%inc74 = add nuw nsw i32 %n.0146, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %n.0146, %1
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond.cleanup, !llvm.loop !9
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.cond.cleanup24
%y.0135 = phi i32 [ %x.0143, %for.cond17.preheader.lr.ph ], [ %inc67, %for.cond.cleanup24 ]
%count.1134 = phi i32 [ %count.0142, %for.cond17.preheader.lr.ph ], [ %count.2.lcssa, %for.cond.cleanup24 ]
%call19124 = call double @sqrt(double noundef %conv) #4
%conv20125 = fptosi double %call19124 to i32
%add21126 = add nsw i32 %conv20125, 2
%cmp22.not127 = icmp sgt i32 %y.0135, %add21126
br i1 %cmp22.not127, label %for.cond.cleanup24, label %for.body25.lr.ph
for.body25.lr.ph: ; preds = %for.cond17.preheader
%reass.add = add nuw i32 %y.0135, %x.0143
%reass.mul123 = mul i32 %reass.add, %y.0135
%add33 = add i32 %reass.mul123, %mul
%cmp38 = icmp eq i32 %x.0143, %y.0135
%cmp38.fr = freeze i1 %cmp38
br i1 %cmp38.fr, label %for.body25, label %for.body25.us
for.body25.us: ; preds = %for.body25.lr.ph, %for.inc.us
%z.0129.us = phi i32 [ %inc.us, %for.inc.us ], [ %y.0135, %for.body25.lr.ph ]
%count.2128.us = phi i32 [ %count.3.us, %for.inc.us ], [ %count.1134, %for.body25.lr.ph ]
%reass.add121.us = add i32 %reass.add, %z.0129.us
%reass.mul.us = mul i32 %reass.add121.us, %z.0129.us
%add35.us = add i32 %add33, %reass.mul.us
%cmp36.us = icmp eq i32 %add35.us, %n.0146
br i1 %cmp36.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body25.us
%cmp40.us = icmp ne i32 %y.0135, %z.0129.us
%cmp55.us = icmp ne i32 %x.0143, %z.0129.us
%or.cond120.us = and i1 %cmp40.us, %cmp55.us
br i1 %or.cond120.us, label %if.else62.us, label %if.then60.us
if.then60.us: ; preds = %if.then.us
%add61.us = add nsw i32 %count.2128.us, 3
br label %for.inc.us
if.else62.us: ; preds = %if.then.us
%add63.us = add nsw i32 %count.2128.us, 6
br label %for.inc.us
for.inc.us: ; preds = %if.else62.us, %if.then60.us, %for.body25.us
%count.3.us = phi i32 [ %add61.us, %if.then60.us ], [ %add63.us, %if.else62.us ], [ %count.2128.us, %for.body25.us ]
%inc.us = add nuw nsw i32 %z.0129.us, 1
%call19.us = call double @sqrt(double noundef %conv) #4
%conv20.us = fptosi double %call19.us to i32
%add21.us = add nsw i32 %conv20.us, 2
%cmp22.not.us.not = icmp slt i32 %z.0129.us, %add21.us
br i1 %cmp22.not.us.not, label %for.body25.us, label %for.cond.cleanup24, !llvm.loop !11
for.cond.cleanup15: ; preds = %for.cond.cleanup24, %for.cond8.preheader
%count.1.lcssa = phi i32 [ %count.0142, %for.cond8.preheader ], [ %count.2.lcssa, %for.cond.cleanup24 ]
%inc70 = add nuw nsw i32 %x.0143, 1
%call2 = call double @sqrt(double noundef %conv) #4
%conv3 = fptosi double %call2 to i32
%add = add nsw i32 %conv3, 2
%cmp4.not.not = icmp slt i32 %x.0143, %add
br i1 %cmp4.not.not, label %for.cond8.preheader, label %for.cond.cleanup6, !llvm.loop !12
for.cond.cleanup24: ; preds = %for.inc.us, %for.inc, %for.cond17.preheader
%count.2.lcssa = phi i32 [ %count.1134, %for.cond17.preheader ], [ %count.3, %for.inc ], [ %count.3.us, %for.inc.us ]
%inc67 = add nuw nsw i32 %y.0135, 1
%call10 = call double @sqrt(double noundef %conv) #4
%conv11 = fptosi double %call10 to i32
%add12 = add nsw i32 %conv11, 2
%cmp13.not.not = icmp slt i32 %y.0135, %add12
br i1 %cmp13.not.not, label %for.cond17.preheader, label %for.cond.cleanup15, !llvm.loop !13
for.body25: ; preds = %for.body25.lr.ph, %for.inc
%z.0129 = phi i32 [ %inc, %for.inc ], [ %y.0135, %for.body25.lr.ph ]
%count.2128 = phi i32 [ %count.3, %for.inc ], [ %count.1134, %for.body25.lr.ph ]
%reass.add121 = add i32 %reass.add, %z.0129
%reass.mul = mul i32 %reass.add121, %z.0129
%add35 = add i32 %add33, %reass.mul
%cmp36 = icmp eq i32 %add35, %n.0146
br i1 %cmp36, label %if.then, label %for.inc
if.then: ; preds = %for.body25
%cmp40 = icmp eq i32 %y.0135, %z.0129
br i1 %cmp40, label %if.then42, label %if.then60
if.then42: ; preds = %if.then
%add43 = add nsw i32 %count.2128, 1
br label %for.inc
if.then60: ; preds = %if.then
%add61 = add nsw i32 %count.2128, 3
br label %for.inc
for.inc: ; preds = %for.body25, %if.then60, %if.then42
%count.3 = phi i32 [ %add43, %if.then42 ], [ %add61, %if.then60 ], [ %count.2128, %for.body25 ]
%inc = add nuw nsw i32 %z.0129, 1
%call19 = call double @sqrt(double noundef %conv) #4
%conv20 = fptosi double %call19 to i32
%add21 = add nsw i32 %conv20, 2
%cmp22.not.not = icmp slt i32 %z.0129, %add21
br i1 %cmp22.not.not, label %for.body25, label %for.cond.cleanup24, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.