Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(void) {
int height = 0; scanf("%d", &height);
int width = 0; scanf("%d", &width);
while (1) {
if ((height == 0) && (width == 0)) {
break;
}
else {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if ((i == 0) || (i + 1 == height) || (j == 0) || (j + 1 == width)) {
printf("#");
}
else {
printf(".");
}
}
printf("\n");
}
printf("\n");
scanf("%d %d", &height, &width);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101306/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101306/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%height = alloca i32, align 4
%width = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %height) #4
store i32 0, ptr %height, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %height)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %width) #4
store i32 0, ptr %width, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %width)
%0 = load i32, ptr %height, align 4, !tbaa !5
%cmp42 = icmp eq i32 %0, 0
%1 = load i32, ptr %width, align 4
%cmp243 = icmp eq i32 %1, 0
%or.cond44 = select i1 %cmp42, i1 %cmp243, i1 false
br i1 %or.cond44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.cleanup
%2 = phi i32 [ %5, %for.cond.cleanup ], [ %0, %entry ]
%cmp340 = icmp sgt i32 %2, 0
br i1 %cmp340, label %for.cond4.preheader, label %for.cond.cleanup
for.cond4.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup6
%i.041 = phi i32 [ %inc21.pre-phi, %for.cond.cleanup6 ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %width, align 4, !tbaa !5
%cmp537 = icmp sgt i32 %3, 0
br i1 %cmp537, label %for.body7.lr.ph, label %for.cond4.preheader.for.cond.cleanup6_crit_edge
for.cond4.preheader.for.cond.cleanup6_crit_edge: ; preds = %for.cond4.preheader
%.pre = add nuw nsw i32 %i.041, 1
br label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond4.preheader
%cmp8 = icmp eq i32 %i.041, 0
%add = add nuw nsw i32 %i.041, 1
br i1 %cmp8, label %for.body7.us, label %for.body7
for.body7.us: ; preds = %for.body7.lr.ph, %for.body7.us
%j.038.us = phi i32 [ %inc.us, %for.body7.us ], [ 0, %for.body7.lr.ph ]
%putchar35.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.038.us, 1
%4 = load i32, ptr %width, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %inc.us, %4
br i1 %cmp5.us, label %for.body7.us, label %for.cond.cleanup6, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup6, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %height, ptr noundef nonnull %width)
%5 = load i32, ptr %height, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
%6 = load i32, ptr %width, align 4
%cmp2 = icmp eq i32 %6, 0
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
for.cond.cleanup6: ; preds = %for.body7, %for.body7.us, %for.cond4.preheader.for.cond.cleanup6_crit_edge
%inc21.pre-phi = phi i32 [ %.pre, %for.cond4.preheader.for.cond.cleanup6_crit_edge ], [ %add, %for.body7.us ], [ %add, %for.body7 ]
%putchar33 = call i32 @putchar(i32 10)
%7 = load i32, ptr %height, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc21.pre-phi, %7
br i1 %cmp3, label %for.cond4.preheader, label %for.cond.cleanup, !llvm.loop !11
for.body7: ; preds = %for.body7.lr.ph, %for.body7
%8 = phi i32 [ %10, %for.body7 ], [ %3, %for.body7.lr.ph ]
%j.038 = phi i32 [ %add13, %for.body7 ], [ 0, %for.body7.lr.ph ]
%9 = load i32, ptr %height, align 4, !tbaa !5
%cmp9 = icmp eq i32 %add, %9
%cmp11 = icmp eq i32 %j.038, 0
%or.cond26 = or i1 %cmp11, %cmp9
%add13 = add nuw nsw i32 %j.038, 1
%cmp14 = icmp eq i32 %add13, %8
%or.cond36 = select i1 %or.cond26, i1 true, i1 %cmp14
%. = select i1 %or.cond36, i32 35, i32 46
%putchar35 = call i32 @putchar(i32 %.)
%10 = load i32, ptr %width, align 4, !tbaa !5
%cmp5 = icmp slt i32 %add13, %10
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !9
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %width) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %height) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
struct ss
{
int a;
int b;
}ar[200],temp;
int main()
{
int n,i,j,k,m,sum,xz[200],st[200];
scanf("%d",&n);
m=1;k=1;
for(i=0;i<n;i++)
{
scanf("%d%d",&ar[i].a,&ar[i].b);
st[i]=0;
xz[i]=0;
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(ar[i].a>ar[j].a)
{
temp=ar[i];
ar[i]=ar[j];
ar[j]=temp;
}
}
}
for(i=0;i<n;i++)
{
if(ar[i].a<0){
st[m]=st[m-1]+ar[i].b;
m++;
}
else
{
xz[k]=xz[k-1]+ar[i].b;
k++;
}
}
if(m<k)
{
sum=st[m-1]+xz[m];
}
else if(m==k)
{
sum=st[m-1]+xz[k-1];
}
else
{
sum=st[m-1]+xz[k-1]-st[m-k-1];
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10135/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10135/source.c"
target datalayout = "e-m:e-p270: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.ss = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@ar = dso_local global [200 x %struct.ss] zeroinitializer, align 16
@temp = dso_local local_unnamed_addr global %struct.ss zeroinitializer, align 8
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%xz = alloca [200 x i32], align 16
%st = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %xz) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %st) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp136 = icmp sgt i32 %0, 0
br i1 %cmp136, label %for.body, label %if.then76
for.cond8.preheader: ; preds = %for.body
%cmp9140 = icmp sgt i32 %2, 0
br i1 %cmp9140, label %for.body10.preheader, label %if.then76
for.body10.preheader: ; preds = %for.cond8.preheader
%1 = zext i32 %2 to i64
%wide.trip.count158 = zext i32 %2 to i64
br label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv
%b = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%arrayidx5 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx5, align 4, !tbaa !5
%arrayidx7 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond8.loopexit: ; preds = %for.inc29, %for.body10
%indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
%exitcond159.not = icmp eq i64 %indvars.iv.next156, %wide.trip.count158
br i1 %exitcond159.not, label %for.cond35.preheader, label %for.body10, !llvm.loop !11
for.cond35.preheader: ; preds = %for.cond8.loopexit
br i1 %cmp9140, label %for.body37.preheader, label %if.then76
for.body37.preheader: ; preds = %for.cond35.preheader
%wide.trip.count163 = zext i32 %2 to i64
br label %for.body37
for.body10: ; preds = %for.body10.preheader, %for.cond8.loopexit
%indvars.iv155 = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next156, %for.cond8.loopexit ]
%indvars.iv150 = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next151, %for.cond8.loopexit ]
%indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
%cmp12138 = icmp ult i64 %indvars.iv.next156, %1
br i1 %cmp12138, label %for.body13.lr.ph, label %for.cond8.loopexit
for.body13.lr.ph: ; preds = %for.body10
%arrayidx15 = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv155
br label %for.body13
for.body13: ; preds = %for.body13.lr.ph, %for.inc29
%indvars.iv152 = phi i64 [ %indvars.iv150, %for.body13.lr.ph ], [ %indvars.iv.next153, %for.inc29 ]
%4 = load i32, ptr %arrayidx15, align 8, !tbaa !12
%arrayidx18 = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv152
%5 = load i32, ptr %arrayidx18, align 8, !tbaa !12
%cmp20 = icmp sgt i32 %4, %5
br i1 %cmp20, label %if.then, label %for.inc29
if.then: ; preds = %for.body13
%6 = load i64, ptr %arrayidx15, align 8
store i64 %6, ptr @temp, align 8
%7 = load i64, ptr %arrayidx18, align 8
store i64 %7, ptr %arrayidx15, align 8
store i64 %6, ptr %arrayidx18, align 8
br label %for.inc29
for.inc29: ; preds = %for.body13, %if.then
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count158
br i1 %exitcond.not, label %for.cond8.loopexit, label %for.body13, !llvm.loop !14
for.body37: ; preds = %for.body37.preheader, %for.inc63
%indvars.iv160 = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next161, %for.inc63 ]
%m.0145 = phi i32 [ 1, %for.body37.preheader ], [ %m.1, %for.inc63 ]
%k.0144 = phi i32 [ 1, %for.body37.preheader ], [ %k.1, %for.inc63 ]
%arrayidx39 = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv160
%8 = load i32, ptr %arrayidx39, align 8, !tbaa !12
%cmp41 = icmp slt i32 %8, 0
%b47 = getelementptr inbounds [200 x %struct.ss], ptr @ar, i64 0, i64 %indvars.iv160, i32 1
%9 = load i32, ptr %b47, align 4, !tbaa !15
br i1 %cmp41, label %if.then42, label %if.else
if.then42: ; preds = %for.body37
%sub = add nsw i32 %m.0145, -1
%idxprom43 = sext i32 %sub to i64
%arrayidx44 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom43
%10 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%add48 = add nsw i32 %9, %10
%idxprom49 = sext i32 %m.0145 to i64
%arrayidx50 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom49
store i32 %add48, ptr %arrayidx50, align 4, !tbaa !5
%inc51 = add nsw i32 %m.0145, 1
br label %for.inc63
if.else: ; preds = %for.body37
%sub52 = add nsw i32 %k.0144, -1
%idxprom53 = sext i32 %sub52 to i64
%arrayidx54 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %idxprom53
%11 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%add58 = add nsw i32 %9, %11
%idxprom59 = sext i32 %k.0144 to i64
%arrayidx60 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %idxprom59
store i32 %add58, ptr %arrayidx60, align 4, !tbaa !5
%inc61 = add nsw i32 %k.0144, 1
br label %for.inc63
for.inc63: ; preds = %if.then42, %if.else
%k.1 = phi i32 [ %k.0144, %if.then42 ], [ %inc61, %if.else ]
%m.1 = phi i32 [ %inc51, %if.then42 ], [ %m.0145, %if.else ]
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%exitcond164.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count163
br i1 %exitcond164.not, label %for.end65, label %for.body37, !llvm.loop !16
for.end65: ; preds = %for.inc63
%cmp66 = icmp slt i32 %m.1, %k.1
br i1 %cmp66, label %if.then67, label %if.else74
if.then67: ; preds = %for.end65
%sub68 = add nsw i32 %m.1, -1
%idxprom69 = sext i32 %sub68 to i64
%arrayidx70 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom69
%12 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%idxprom71 = sext i32 %m.1 to i64
%arrayidx72 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %idxprom71
%13 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%add73 = add nsw i32 %13, %12
br label %if.end98
if.else74: ; preds = %for.end65
%cmp75 = icmp eq i32 %m.1, %k.1
br i1 %cmp75, label %if.then76, label %if.else84
if.then76: ; preds = %for.cond35.preheader, %for.cond8.preheader, %entry, %if.else74
%k.0.lcssa174179 = phi i32 [ %k.1, %if.else74 ], [ 1, %entry ], [ 1, %for.cond8.preheader ], [ 1, %for.cond35.preheader ]
%sub77 = add nsw i32 %k.0.lcssa174179, -1
%idxprom78 = sext i32 %sub77 to i64
%arrayidx79 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom78
%14 = load i32, ptr %arrayidx79, align 4, !tbaa !5
%arrayidx82 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %idxprom78
%15 = load i32, ptr %arrayidx82, align 4, !tbaa !5
%add83 = add nsw i32 %15, %14
br label %if.end98
if.else84: ; preds = %if.else74
%sub85 = add nsw i32 %m.1, -1
%idxprom86 = sext i32 %sub85 to i64
%arrayidx87 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom86
%16 = load i32, ptr %arrayidx87, align 4, !tbaa !5
%sub88 = add nsw i32 %k.1, -1
%idxprom89 = sext i32 %sub88 to i64
%arrayidx90 = getelementptr inbounds [200 x i32], ptr %xz, i64 0, i64 %idxprom89
%17 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%add91 = add nsw i32 %17, %16
%18 = xor i32 %k.1, -1
%sub93 = add i32 %m.1, %18
%idxprom94 = sext i32 %sub93 to i64
%arrayidx95 = getelementptr inbounds [200 x i32], ptr %st, i64 0, i64 %idxprom94
%19 = load i32, ptr %arrayidx95, align 4, !tbaa !5
%sub96 = sub i32 %add91, %19
br label %if.end98
if.end98: ; preds = %if.then76, %if.else84, %if.then67
%sum.0 = phi i32 [ %add73, %if.then67 ], [ %add83, %if.then76 ], [ %sub96, %if.else84 ]
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %st) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %xz) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 0}
!13 = !{!"ss", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = !{!13, !6, i64 4}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main()
{
int i,j,k,l,m,a[1000],b[1000],n,count=0,left=0,right=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d",&a[i],&b[i]);
count+=b[i];
if(a[i]<0)
left++;
else
right++;
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i]<a[j])
{
k=a[i];
a[i]=a[j];
a[j]=k;
k=b[i];
b[i]=b[j];
b[j]=k;
}
}
}
if(left==right)
{
printf("%d\n",count);
}
else
if(left>right)
{
k=left-right-1;
for(i=0;i<k;i++)
{
count-=b[i];
}
printf("%d",count);
}
else
{
// printf("%d\n",right);
k=right-left-1;
for(i=n-k;i<n;i++)
{
//printf("111\n",i);
count-=b[i];
//printf("%d\n",b[i]);
}
printf("%d",count);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10140/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10140/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1000 x i32], align 16
%b = alloca [1000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %b) #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
%cmp121 = icmp sgt i32 %0, 0
br i1 %cmp121, label %for.body, label %if.then47
for.cond11.preheader: ; preds = %for.body
%cmp12131 = icmp sgt i32 %7, 0
br i1 %cmp12131, label %for.cond14.preheader.us.preheader, label %for.end45
for.cond14.preheader.us.preheader: ; preds = %for.cond11.preheader
%wide.trip.count150 = zext i32 %7 to i64
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.preheader.us.preheader, %for.cond14.for.inc43_crit_edge.us
%indvars.iv147 = phi i64 [ 0, %for.cond14.preheader.us.preheader ], [ %indvars.iv.next148, %for.cond14.for.inc43_crit_edge.us ]
%arrayidx18.us = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv147
%arrayidx32.us = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv147
br label %for.body16.us
for.body16.us: ; preds = %for.cond14.preheader.us, %for.inc40.us
%indvars.iv144 = phi i64 [ 0, %for.cond14.preheader.us ], [ %indvars.iv.next145, %for.inc40.us ]
%1 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%arrayidx20.us = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv144
%2 = load i32, ptr %arrayidx20.us, align 4, !tbaa !5
%cmp21.us = icmp slt i32 %1, %2
br i1 %cmp21.us, label %if.then22.us, label %for.inc40.us
if.then22.us: ; preds = %for.body16.us
store i32 %2, ptr %arrayidx18.us, align 4, !tbaa !5
store i32 %1, ptr %arrayidx20.us, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5
%arrayidx34.us = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv144
%4 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
store i32 %4, ptr %arrayidx32.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx34.us, align 4, !tbaa !5
br label %for.inc40.us
for.inc40.us: ; preds = %if.then22.us, %for.body16.us
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%exitcond.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count150
br i1 %exitcond.not, label %for.cond14.for.inc43_crit_edge.us, label %for.body16.us, !llvm.loop !9
for.cond14.for.inc43_crit_edge.us: ; preds = %for.inc40.us
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%exitcond151.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count150
br i1 %exitcond151.not, label %for.end45, label %for.cond14.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%right.0125 = phi i32 [ %right.1, %for.body ], [ 0, %entry ]
%left.0124 = phi i32 [ %left.1, %for.body ], [ 0, %entry ]
%count.0123 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%5 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%add = add nsw i32 %5, %count.0123
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %6, -1
%.lobit = lshr i32 %6, 31
%left.1 = add nuw nsw i32 %.lobit, %left.0124
%inc9 = zext i1 %cmp8 to i32
%right.1 = add nuw nsw i32 %right.0125, %inc9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !12
for.end45: ; preds = %for.cond14.for.inc43_crit_edge.us, %for.cond11.preheader
%cmp46 = icmp eq i32 %left.1, %right.1
br i1 %cmp46, label %if.then47, label %if.else49
if.then47: ; preds = %entry, %for.end45
%count.0.lcssa166175 = phi i32 [ %add, %for.end45 ], [ 0, %entry ]
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa166175)
br label %if.end78
if.else49: ; preds = %for.end45
%cmp50 = icmp ugt i32 %left.1, %right.1
br i1 %cmp50, label %if.then51, label %if.else63
if.then51: ; preds = %if.else49
%9 = xor i32 %right.1, -1
%sub52 = add nsw i32 %left.1, %9
%cmp54137 = icmp sgt i32 %sub52, 0
br i1 %cmp54137, label %for.body55.preheader, label %for.end61
for.body55.preheader: ; preds = %if.then51
%wide.trip.count159 = zext i32 %sub52 to i64
%min.iters.check181 = icmp ult i32 %sub52, 8
br i1 %min.iters.check181, label %for.body55.preheader196, label %vector.ph182
vector.ph182: ; preds = %for.body55.preheader
%n.vec184 = and i64 %wide.trip.count159, 4294967288
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add, i64 0
br label %vector.body187
vector.body187: ; preds = %vector.body187, %vector.ph182
%index188 = phi i64 [ 0, %vector.ph182 ], [ %index.next193, %vector.body187 ]
%vec.phi189 = phi <4 x i32> [ %10, %vector.ph182 ], [ %13, %vector.body187 ]
%vec.phi190 = phi <4 x i32> [ zeroinitializer, %vector.ph182 ], [ %14, %vector.body187 ]
%11 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %index188
%wide.load191 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load192 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = sub <4 x i32> %vec.phi189, %wide.load191
%14 = sub <4 x i32> %vec.phi190, %wide.load192
%index.next193 = add nuw i64 %index188, 8
%15 = icmp eq i64 %index.next193, %n.vec184
br i1 %15, label %middle.block179, label %vector.body187, !llvm.loop !13
middle.block179: ; preds = %vector.body187
%bin.rdx194 = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx194)
%cmp.n186 = icmp eq i64 %n.vec184, %wide.trip.count159
br i1 %cmp.n186, label %for.end61, label %for.body55.preheader196
for.body55.preheader196: ; preds = %for.body55.preheader, %middle.block179
%indvars.iv156.ph = phi i64 [ 0, %for.body55.preheader ], [ %n.vec184, %middle.block179 ]
%count.1139.ph = phi i32 [ %add, %for.body55.preheader ], [ %16, %middle.block179 ]
br label %for.body55
for.body55: ; preds = %for.body55.preheader196, %for.body55
%indvars.iv156 = phi i64 [ %indvars.iv.next157, %for.body55 ], [ %indvars.iv156.ph, %for.body55.preheader196 ]
%count.1139 = phi i32 [ %sub58, %for.body55 ], [ %count.1139.ph, %for.body55.preheader196 ]
%arrayidx57 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv156
%17 = load i32, ptr %arrayidx57, align 4, !tbaa !5
%sub58 = sub nsw i32 %count.1139, %17
%indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
%exitcond160.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count159
br i1 %exitcond160.not, label %for.end61, label %for.body55, !llvm.loop !16
for.end61: ; preds = %for.body55, %middle.block179, %if.then51
%count.1.lcssa = phi i32 [ %add, %if.then51 ], [ %16, %middle.block179 ], [ %sub58, %for.body55 ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.1.lcssa)
br label %if.end78
if.else63: ; preds = %if.else49
%.neg141 = add nuw i32 %left.1, 1
%sub65.neg = sub i32 %.neg141, %right.1
%sub66 = add i32 %sub65.neg, %7
%cmp68133 = icmp slt i32 %sub66, %7
br i1 %cmp68133, label %for.body69.preheader, label %for.end75
for.body69.preheader: ; preds = %if.else63
%18 = sext i32 %sub66 to i64
%19 = add nsw i32 %right.0125, -2
%20 = zext i1 %cmp8 to i32
%21 = add nsw i32 %19, %20
%22 = sub i32 %21, %left.0124
%.neg = ashr i32 %6, 31
%23 = add i32 %.neg, %22
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
%min.iters.check = icmp ult i32 %23, 7
br i1 %min.iters.check, label %for.body69.preheader198, label %vector.ph
vector.ph: ; preds = %for.body69.preheader
%n.vec = and i64 %25, 8589934584
%ind.end = add nsw i64 %n.vec, %18
%26 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add, i64 0
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> [ %26, %vector.ph ], [ %29, %vector.body ]
%vec.phi177 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %30, %vector.body ]
%offset.idx = add i64 %index, %18
%27 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %27, align 4, !tbaa !5
%28 = getelementptr inbounds i32, ptr %27, i64 4
%wide.load178 = load <4 x i32>, ptr %28, align 4, !tbaa !5
%29 = sub <4 x i32> %vec.phi, %wide.load
%30 = sub <4 x i32> %vec.phi177, %wide.load178
%index.next = add nuw i64 %index, 8
%31 = icmp eq i64 %index.next, %n.vec
br i1 %31, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %30, %29
%32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %25, %n.vec
br i1 %cmp.n, label %for.end75, label %for.body69.preheader198
for.body69.preheader198: ; preds = %for.body69.preheader, %middle.block
%indvars.iv152.ph = phi i64 [ %18, %for.body69.preheader ], [ %ind.end, %middle.block ]
%count.2135.ph = phi i32 [ %add, %for.body69.preheader ], [ %32, %middle.block ]
br label %for.body69
for.body69: ; preds = %for.body69.preheader198, %for.body69
%indvars.iv152 = phi i64 [ %indvars.iv.next153, %for.body69 ], [ %indvars.iv152.ph, %for.body69.preheader198 ]
%count.2135 = phi i32 [ %sub72, %for.body69 ], [ %count.2135.ph, %for.body69.preheader198 ]
%arrayidx71 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv152
%33 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%sub72 = sub nsw i32 %count.2135, %33
%indvars.iv.next153 = add nsw i64 %indvars.iv152, 1
%lftr.wideiv = trunc i64 %indvars.iv.next153 to i32
%exitcond155.not = icmp eq i32 %7, %lftr.wideiv
br i1 %exitcond155.not, label %for.end75, label %for.body69, !llvm.loop !18
for.end75: ; preds = %for.body69, %middle.block, %if.else63
%count.2.lcssa = phi i32 [ %add, %if.else63 ], [ %32, %middle.block ], [ %sub72, %for.body69 ]
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.2.lcssa)
br label %if.end78
if.end78: ; preds = %for.end61, %for.end75, %if.then47
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10, !14, !15}
!18 = distinct !{!18, !10, !15, !14}
|
#include <stdio.h>
int main(void){
int i,j;
int n,a,b,c,x;
int res;
int y[102];
while(scanf("%d%d%d%d%d",&n,&a,&b,&c,&x),n){
for(i=0;i<n;i++){
scanf("%d",&y[i]);
}
res = 0;
for(i=0;i<n;i++,x=(a * x + b)%c,res++){
while(y[i] != x){
x = (a * x + b) % c;
res++;
if(res > 10000){
res = -1;
break;
}
}
if(res == -1) break;
}
if(res != -1) res--;
printf("%d\n",res);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca [102 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 %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %y) #4
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not60 = icmp eq i32 %0, 0
br i1 %tobool.not60, label %while.end26, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %while.cond
%1 = phi i32 [ %9, %while.cond ], [ %0, %entry ]
%cmp48 = icmp sgt i32 %1, 0
br i1 %cmp48, label %for.body, label %while.cond
for.cond2.preheader: ; preds = %for.body
%cmp354 = icmp sgt i32 %5, 0
br i1 %cmp354, label %while.cond5.preheader.lr.ph, label %while.cond
while.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%x.promoted51 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4
%3 = load i32, ptr %b, align 4
%4 = load i32, ptr %c, align 4
%wide.trip.count = zext i32 %5 to i64
br label %while.cond5.preheader
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [102 x i32], ptr %y, 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
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
while.cond5.preheader: ; preds = %while.cond5.preheader.lr.ph, %for.inc15
%indvars.iv66 = phi i64 [ 0, %while.cond5.preheader.lr.ph ], [ %indvars.iv.next67, %for.inc15 ]
%res.057 = phi i32 [ 0, %while.cond5.preheader.lr.ph ], [ %inc20, %for.inc15 ]
%x.promoted5255 = phi i32 [ %x.promoted51, %while.cond5.preheader.lr.ph ], [ %rem19, %for.inc15 ]
%arrayidx7 = getelementptr inbounds [102 x i32], ptr %y, i64 0, i64 %indvars.iv66
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %res.057, i32 10000)
br label %while.cond5
while.cond5: ; preds = %while.cond5.preheader, %while.body9
%rem50 = phi i32 [ %rem, %while.body9 ], [ %x.promoted5255, %while.cond5.preheader ]
%res.1 = phi i32 [ %inc10, %while.body9 ], [ %res.057, %while.cond5.preheader ]
%cmp8.not = icmp eq i32 %7, %rem50
br i1 %cmp8.not, label %while.end, label %while.body9
while.body9: ; preds = %while.cond5
%mul = mul nsw i32 %2, %rem50
%add = add nsw i32 %mul, %3
%rem = srem i32 %add, %4
store i32 %rem, ptr %x, align 4, !tbaa !5
%inc10 = add i32 %res.1, 1
%exitcond = icmp eq i32 %res.1, %smax
br i1 %exitcond, label %for.end21.thread, label %while.cond5, !llvm.loop !11
while.end: ; preds = %while.cond5
%cmp12 = icmp eq i32 %res.1, -1
br i1 %cmp12, label %for.end21.thread, label %for.inc15
for.inc15: ; preds = %while.end
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%mul17 = mul nsw i32 %7, %2
%add18 = add nsw i32 %mul17, %3
%rem19 = srem i32 %add18, %4
store i32 %rem19, ptr %x, align 4, !tbaa !5
%inc20 = add nuw i32 %res.1, 1
%exitcond69.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond69.not, label %for.end21, label %while.cond5.preheader, !llvm.loop !12
for.end21: ; preds = %for.inc15
%cmp22.not = icmp eq i32 %inc20, -1
br i1 %cmp22.not, label %for.end21.thread, label %while.cond
for.end21.thread: ; preds = %while.end, %while.body9, %for.end21
br label %while.cond
while.cond: ; preds = %for.cond.preheader, %for.cond2.preheader, %for.end21, %for.end21.thread
%8 = phi i32 [ -1, %for.end21.thread ], [ %res.1, %for.end21 ], [ -1, %for.cond2.preheader ], [ -1, %for.cond.preheader ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%9 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end26, label %for.cond.preheader, !llvm.loop !13
while.end26: ; preds = %while.cond, %entry
call void @llvm.lifetime.end.p0(i64 408, 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
typedef struct List {
struct List *next;
int id, parity;
} list;
int main()
{
int i, N, u[100001], v[100001], w[100001];
scanf("%d", &N);
for (i = 1; i <= N - 1; i++) scanf("%d %d %d", &(u[i]), &(v[i]), &(w[i]));
list *inc[100001] = {}, edge[200001];
for (i = 1; i <= N - 1; i++) {
edge[(i-1)*2].id = u[i];
edge[(i-1)*2+1].id = v[i];
edge[(i-1)*2].parity = w[i] % 2;
edge[(i-1)*2+1].parity = w[i] % 2;
edge[(i-1)*2].next = inc[v[i]];
edge[(i-1)*2+1].next = inc[u[i]];
inc[v[i]] = &(edge[(i-1)*2]);
inc[u[i]] = &(edge[(i-1)*2+1]);
}
list *p, *head, *tail, vertex[100001] = {};
vertex[1].id = 1;
vertex[1].parity = 0;
vertex[1].next = NULL;
for (head = &(vertex[1]), tail = &(vertex[1]); head != NULL; head = head->next) {
for (p = inc[head->id]; p != NULL; p = p->next) {
if (vertex[p->id].id == 0) {
vertex[p->id].id = p->id;
vertex[p->id].parity = head->parity ^ p->parity;
tail->next = &(vertex[p->id]);
tail = tail->next;
}
}
}
for (i = 1; i <= N; i++) printf("%d\n", vertex[i].parity);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101551/source.c"
target datalayout = "e-m:e-p270: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.List = type { ptr, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%u = alloca [100001 x i32], align 16
%v = alloca [100001 x i32], align 16
%w = alloca [100001 x i32], align 16
%inc6 = alloca [100001 x ptr], align 16
%edge = alloca [200001 x %struct.List], align 16
%vertex = alloca [100001 x %struct.List], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %w) #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.not.not167 = icmp sgt i32 %0, 1
br i1 %cmp.not.not167, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %inc6) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800008) %inc6, i8 0, i64 800008, i1 false)
call void @llvm.lifetime.start.p0(i64 3200016, ptr nonnull %edge) #4
br label %for.end75
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %u, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100001 x i32], ptr %v, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [100001 x i32], ptr %w, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4)
%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.next, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %inc6) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800008) %inc6, i8 0, i64 800008, i1 false)
call void @llvm.lifetime.start.p0(i64 3200016, ptr nonnull %edge) #4
%cmp9.not.not169 = icmp sgt i32 %1, 1
br i1 %cmp9.not.not169, label %for.body10.preheader, label %for.end75
for.body10.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv182 = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next183, %for.body10 ]
%arrayidx12 = getelementptr inbounds [100001 x i32], ptr %u, i64 0, i64 %indvars.iv182
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%4 = shl i64 %indvars.iv182, 33
%sext = add i64 %4, -8589934592
%idxprom14 = ashr exact i64 %sext, 32
%arrayidx15 = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom14
%id = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom14, i32 1
store i32 %3, ptr %id, align 8, !tbaa !11
%arrayidx17 = getelementptr inbounds [100001 x i32], ptr %v, i64 0, i64 %indvars.iv182
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv182.tr = trunc i64 %indvars.iv182 to i32
%6 = shl i32 %indvars.iv182.tr, 1
%7 = add i32 %6, -1
%idxprom20 = sext i32 %7 to i64
%arrayidx21 = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom20
%id22 = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom20, i32 1
store i32 %5, ptr %id22, align 8, !tbaa !11
%arrayidx24 = getelementptr inbounds [100001 x i32], ptr %w, i64 0, i64 %indvars.iv182
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%rem = srem i32 %8, 2
%parity = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom14, i32 2
store i32 %rem, ptr %parity, align 4, !tbaa !14
%parity37 = getelementptr inbounds [200001 x %struct.List], ptr %edge, i64 0, i64 %idxprom20, i32 2
store i32 %rem, ptr %parity37, align 4, !tbaa !14
%idxprom40 = sext i32 %5 to i64
%arrayidx41 = getelementptr inbounds [100001 x ptr], ptr %inc6, i64 0, i64 %idxprom40
%9 = load ptr, ptr %arrayidx41, align 8, !tbaa !15
store ptr %9, ptr %arrayidx15, align 16, !tbaa !16
%idxprom48 = sext i32 %3 to i64
%arrayidx49 = getelementptr inbounds [100001 x ptr], ptr %inc6, i64 0, i64 %idxprom48
%10 = load ptr, ptr %arrayidx49, align 8, !tbaa !15
store ptr %10, ptr %arrayidx21, align 16, !tbaa !16
store ptr %arrayidx15, ptr %arrayidx41, align 8, !tbaa !15
store ptr %arrayidx21, ptr %arrayidx49, align 8, !tbaa !15
%indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
%exitcond.not = icmp eq i64 %indvars.iv.next183, %wide.trip.count
br i1 %exitcond.not, label %for.end75, label %for.body10, !llvm.loop !17
for.end75: ; preds = %for.body10, %for.end.thread, %for.end
%11 = phi i32 [ %0, %for.end.thread ], [ %1, %for.end ], [ %1, %for.body10 ]
call void @llvm.lifetime.start.p0(i64 1600016, ptr nonnull %vertex) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600016) %vertex, i8 0, i64 1600016, i1 false)
%arrayidx76 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 1
%id77 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 1, i32 1
store i32 1, ptr %id77, align 8, !tbaa !11
store ptr null, ptr %arrayidx76, align 16, !tbaa !16
br label %for.body86
for.cond120.preheader: ; preds = %for.inc117
%cmp121.not178 = icmp slt i32 %11, 1
br i1 %cmp121.not178, label %for.end129, label %for.body122
for.body86: ; preds = %for.end75, %for.inc117
%tail.0177 = phi ptr [ %arrayidx76, %for.end75 ], [ %tail.1.lcssa, %for.inc117 ]
%head.0176 = phi ptr [ %arrayidx76, %for.end75 ], [ %18, %for.inc117 ]
%id87 = getelementptr inbounds %struct.List, ptr %head.0176, i64 0, i32 1
%12 = load i32, ptr %id87, align 8, !tbaa !11
%idxprom88 = sext i32 %12 to i64
%arrayidx89 = getelementptr inbounds [100001 x ptr], ptr %inc6, i64 0, i64 %idxprom88
%p.0171 = load ptr, ptr %arrayidx89, align 8, !tbaa !15
%cmp91.not172 = icmp eq ptr %p.0171, null
br i1 %cmp91.not172, label %for.inc117, label %for.body92.lr.ph
for.body92.lr.ph: ; preds = %for.body86
%parity103 = getelementptr inbounds %struct.List, ptr %head.0176, i64 0, i32 2
br label %for.body92
for.body92: ; preds = %for.body92.lr.ph, %for.inc114
%p.0174 = phi ptr [ %p.0171, %for.body92.lr.ph ], [ %p.0, %for.inc114 ]
%tail.1173 = phi ptr [ %tail.0177, %for.body92.lr.ph ], [ %tail.2, %for.inc114 ]
%id93 = getelementptr inbounds %struct.List, ptr %p.0174, i64 0, i32 1
%13 = load i32, ptr %id93, align 8, !tbaa !11
%idxprom94 = sext i32 %13 to i64
%id96 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 %idxprom94, i32 1
%14 = load i32, ptr %id96, align 8, !tbaa !11
%cmp97 = icmp eq i32 %14, 0
br i1 %cmp97, label %if.then, label %for.inc114
if.then: ; preds = %for.body92
store i32 %13, ptr %id96, align 8, !tbaa !11
%15 = load i32, ptr %parity103, align 4, !tbaa !14
%parity104 = getelementptr inbounds %struct.List, ptr %p.0174, i64 0, i32 2
%16 = load i32, ptr %parity104, align 4, !tbaa !14
%xor = xor i32 %16, %15
%17 = load i32, ptr %id93, align 8, !tbaa !11
%idxprom106 = sext i32 %17 to i64
%parity108 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 %idxprom106, i32 2
store i32 %xor, ptr %parity108, align 4, !tbaa !14
%arrayidx111 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 %idxprom106
store ptr %arrayidx111, ptr %tail.1173, align 8, !tbaa !16
br label %for.inc114
for.inc114: ; preds = %for.body92, %if.then
%tail.2 = phi ptr [ %arrayidx111, %if.then ], [ %tail.1173, %for.body92 ]
%p.0 = load ptr, ptr %p.0174, align 8, !tbaa !15
%cmp91.not = icmp eq ptr %p.0, null
br i1 %cmp91.not, label %for.inc117, label %for.body92, !llvm.loop !18
for.inc117: ; preds = %for.inc114, %for.body86
%tail.1.lcssa = phi ptr [ %tail.0177, %for.body86 ], [ %tail.2, %for.inc114 ]
%18 = load ptr, ptr %head.0176, align 8, !tbaa !16
%cmp85.not = icmp eq ptr %18, null
br i1 %cmp85.not, label %for.cond120.preheader, label %for.body86, !llvm.loop !19
for.body122: ; preds = %for.cond120.preheader, %for.body122
%indvars.iv188 = phi i64 [ %indvars.iv.next189, %for.body122 ], [ 1, %for.cond120.preheader ]
%parity125 = getelementptr inbounds [100001 x %struct.List], ptr %vertex, i64 0, i64 %indvars.iv188, i32 2
%19 = load i32, ptr %parity125, align 4, !tbaa !14
%call126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%20 = load i32, ptr %N, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp121.not.not = icmp slt i64 %indvars.iv188, %21
br i1 %cmp121.not.not, label %for.body122, label %for.end129, !llvm.loop !20
for.end129: ; preds = %for.body122, %for.cond120.preheader
%22 = load ptr, ptr @stdout, align 8, !tbaa !15
%call130 = call i32 @fflush(ptr noundef %22)
call void @llvm.lifetime.end.p0(i64 1600016, ptr nonnull %vertex) #4
call void @llvm.lifetime.end.p0(i64 3200016, ptr nonnull %edge) #4
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %inc6) #4
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 8}
!12 = !{!"List", !13, i64 0, !6, i64 8, !6, i64 12}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !6, i64 12}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !13, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#include <math.h>
long Combination(long n, long r) {
long answer = 1;
if (n-r < r) {
r = n-r;
}
for (long i = 1; i <= r; i++) {
answer *= n+1-i;
answer /= i;
}
return answer;
}
int main(void) {
int n,p;
scanf("%d %d", &n, &p);
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
int odd = 0;
for (int i = 0; i < n; i++) {
if (a[i]%2 != 0) {
odd++;
}
}
int even = n-odd;
long answer = 0;
for (int i = 1; i <= odd; i += 2) {
answer += Combination(odd,i);
}
answer *= pow(2,even);
if (p == 0) {
answer = pow(2,n)-answer;
}
printf("%ld\n", answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101595/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101595/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @Combination(i64 noundef %n, i64 noundef %r) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %n, %r
%spec.select = tail call i64 @llvm.smin.i64(i64 %sub, i64 %r)
%cmp2.not14 = icmp slt i64 %spec.select, 1
br i1 %cmp2.not14, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %n, 1
%xtraiter = and i64 %spec.select, 1
%0 = icmp eq i64 %spec.select, 1
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %spec.select, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.016.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%answer.015.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%sub3.epil = sub i64 %add, %i.016.unr
%mul.epil = mul nsw i64 %sub3.epil, %answer.015.unr
%div.epil = sdiv i64 %mul.epil, %i.016.unr
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry
%answer.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %answer.0.lcssa
for.body: ; preds = %for.body, %for.body.lr.ph.new
%i.016 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%answer.015 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub3 = sub i64 %add, %i.016
%mul = mul nsw i64 %sub3, %answer.015
%div = sdiv i64 %mul, %i.016
%inc = add nuw i64 %i.016, 1
%sub3.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %sub3.1, %div
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.016, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !5
}
; 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
%p = 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 %p) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %p)
%0 = load i32, ptr %n, align 4, !tbaa !7
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp51 = icmp sgt i32 %3, 0
br i1 %cmp51, label %for.body, label %for.cond.cleanup17
for.cond3.preheader: ; preds = %for.body
%cmp453 = icmp sgt i32 %12, 0
br i1 %cmp453, label %for.body6.preheader, label %for.cond.cleanup17
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %12 to i64
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body6.preheader79, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi77 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%4 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !7
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load78 = load <4 x i32>, ptr %5, align 16, !tbaa !7
%6 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%7 = and <4 x i32> %wide.load78, <i32 1, i32 1, i32 1, i32 1>
%8 = add <4 x i32> %6, %vec.phi
%9 = add <4 x i32> %7, %vec.phi77
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup5, label %for.body6.preheader79
for.body6.preheader79: ; preds = %for.body6.preheader, %middle.block
%indvars.iv63.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%odd.054.ph = phi i32 [ 0, %for.body6.preheader ], [ %11, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %n, align 4, !tbaa !7
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !14
for.cond.cleanup5: ; preds = %for.body6, %middle.block
%spec.select.lcssa = phi i32 [ %11, %middle.block ], [ %spec.select, %for.body6 ]
%sub = sub nsw i32 %12, %spec.select.lcssa
%cmp16.not57 = icmp slt i32 %spec.select.lcssa, 1
br i1 %cmp16.not57, label %for.cond.cleanup17, label %for.body18.lr.ph
for.body18.lr.ph: ; preds = %for.cond.cleanup5
%conv = zext i32 %spec.select.lcssa to i64
%add.i = add nuw nsw i64 %conv, 1
br label %for.body18
for.body6: ; preds = %for.body6.preheader79, %for.body6
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.body6 ], [ %indvars.iv63.ph, %for.body6.preheader79 ]
%odd.054 = phi i32 [ %spec.select, %for.body6 ], [ %odd.054.ph, %for.body6.preheader79 ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv63
%14 = load i32, ptr %arrayidx8, align 4, !tbaa !7
%15 = and i32 %14, 1
%spec.select = add i32 %15, %odd.054
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !15
for.cond.cleanup17.loopexit: ; preds = %Combination.exit
%16 = sitofp i64 %add to double
br label %for.cond.cleanup17
for.cond.cleanup17: ; preds = %entry, %for.cond3.preheader, %for.cond.cleanup17.loopexit, %for.cond.cleanup5
%sub76 = phi i32 [ %sub, %for.cond.cleanup5 ], [ %sub, %for.cond.cleanup17.loopexit ], [ %12, %for.cond3.preheader ], [ %3, %entry ]
%answer.0.lcssa = phi double [ 0.000000e+00, %for.cond.cleanup5 ], [ %16, %for.cond.cleanup17.loopexit ], [ 0.000000e+00, %for.cond3.preheader ], [ 0.000000e+00, %entry ]
%ldexp = call double @ldexp(double 1.000000e+00, i32 %sub76) #7
%mul = fmul double %ldexp, %answer.0.lcssa
%conv27 = fptosi double %mul to i64
%17 = load i32, ptr %p, align 4, !tbaa !7
%cmp28 = icmp eq i32 %17, 0
br i1 %cmp28, label %if.then30, label %if.end36
for.body18: ; preds = %for.body18.lr.ph, %Combination.exit
%indvar = phi i64 [ 0, %for.body18.lr.ph ], [ %indvar.next, %Combination.exit ]
%indvars.iv66 = phi i64 [ 1, %for.body18.lr.ph ], [ %indvars.iv.next67, %Combination.exit ]
%answer.058 = phi i64 [ 0, %for.body18.lr.ph ], [ %add, %Combination.exit ]
%18 = shl i64 %indvar, 1
%19 = xor i64 %18, -1
%20 = add i64 %19, %conv
%smin = call i64 @llvm.smin.i64(i64 %20, i64 %indvars.iv66)
%cmp2.not14.i.not = icmp ult i64 %indvars.iv66, %conv
br i1 %cmp2.not14.i.not, label %for.body.i.preheader, label %Combination.exit
for.body.i.preheader: ; preds = %for.body18
%xtraiter = and i64 %smin, 1
%21 = icmp eq i64 %smin, 1
br i1 %21, label %Combination.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %smin, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%i.016.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%answer.015.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub3.i = sub i64 %add.i, %i.016.i
%mul.i = mul nsw i64 %sub3.i, %answer.015.i
%div.i = sdiv i64 %mul.i, %i.016.i
%inc.i = add nuw i64 %i.016.i, 1
%sub3.i.1 = sub i64 %add.i, %inc.i
%mul.i.1 = mul nsw i64 %sub3.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.016.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 %Combination.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !5
Combination.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.016.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%answer.015.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %Combination.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %Combination.exit.loopexit.unr-lcssa
%sub3.i.epil = sub i64 %add.i, %i.016.i.unr
%mul.i.epil = mul nsw i64 %sub3.i.epil, %answer.015.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.016.i.unr
br label %Combination.exit
Combination.exit: ; preds = %for.body.i.epil, %Combination.exit.loopexit.unr-lcssa, %for.body18
%answer.0.lcssa.i = phi i64 [ 1, %for.body18 ], [ %div.i.lcssa.ph, %Combination.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
%add = add nsw i64 %answer.0.lcssa.i, %answer.058
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 2
%cmp16.not = icmp ugt i64 %indvars.iv.next67, %conv
%indvar.next = add i64 %indvar, 1
br i1 %cmp16.not, label %for.cond.cleanup17.loopexit, label %for.body18, !llvm.loop !16
if.then30: ; preds = %for.cond.cleanup17
%22 = load i32, ptr %n, align 4, !tbaa !7
%ldexp50 = call double @ldexp(double 1.000000e+00, i32 %22) #7
%conv33 = sitofp i64 %conv27 to double
%sub34 = fsub double %ldexp50, %conv33
%conv35 = fptosi double %sub34 to i64
br label %if.end36
if.end36: ; preds = %if.then30, %for.cond.cleanup17
%answer.1 = phi i64 [ %conv35, %if.then30 ], [ %conv27, %for.cond.cleanup17 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %answer.1)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree willreturn }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6, !13, !12}
!16 = distinct !{!16, !6}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long
#define MAX 200000000000
#define MOD 1000000007
ll int bin(ll int);
int main(void){
ll int N,P;
scanf("%lld%lld",&N,&P);
ll int i;
ll int A[100];
ll int odd=0,even=0;
for(i=0;i<N;i++){
scanf("%d",&A[i]);
if(A[i]%2) odd++;
else even++;
}
if(odd!=0)
printf("%lld\n",bin(even)*bin(odd-1));
else
{
if(P==1) printf("0\n");
else printf("%lld\n",bin(N));
}
return 0;
}
ll int bin(ll int a){
if(a==0) return 1;
return 2*bin(a-1);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101638/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101638/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%P = alloca i64, align 8
%A = alloca [100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %P) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %P)
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %A) #5
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp25 = icmp sgt i64 %0, 0
br i1 %cmp25, label %for.body, label %if.else10
for.body: ; preds = %entry, %for.body
%even.028 = phi i64 [ %even.1, %for.body ], [ 0, %entry ]
%odd.027 = phi i64 [ %odd.1, %for.body ], [ 0, %entry ]
%i.026 = phi i64 [ %inc4, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i64], ptr %A, i64 0, i64 %i.026
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%2 = and i64 %1, 1
%odd.1 = add i64 %2, %odd.027
%3 = xor i64 %2, 1
%even.1 = add i64 %3, %even.028
%inc4 = add nuw nsw i64 %i.026, 1
%4 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp slt i64 %inc4, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp5.not = icmp eq i64 %odd.1, 0
br i1 %cmp5.not, label %if.else10, label %if.then6
if.then6: ; preds = %for.end
%call7 = call i64 @bin(i64 noundef %even.1)
%sub = add nsw i64 %odd.1, -1
%call8 = call i64 @bin(i64 noundef %sub)
%mul = mul nsw i64 %call8, %call7
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %mul)
br label %if.end18
if.else10: ; preds = %entry, %for.end
%.lcssa36 = phi i64 [ %4, %for.end ], [ %0, %entry ]
%5 = load i64, ptr %P, align 8, !tbaa !5
%cmp11 = icmp eq i64 %5, 1
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else10
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end18
if.else14: ; preds = %if.else10
%call15 = call i64 @bin(i64 noundef %.lcssa36)
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %call15)
br label %if.end18
if.end18: ; preds = %if.then12, %if.else14, %if.then6
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %P) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @bin(i64 noundef %a) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i64 %a, 0
br i1 %cmp, label %common.ret2, label %if.end
common.ret2: ; preds = %entry, %if.end
%common.ret2.op = phi i64 [ %mul, %if.end ], [ 1, %entry ]
ret i64 %common.ret2.op
if.end: ; preds = %entry
%sub = add nsw i64 %a, -1
%call = tail call i64 @bin(i64 noundef %sub)
%mul = shl nsw i64 %call, 1
br label %common.ret2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree 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 = { 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>
int main(void){
int N, i, j, total;
int d[100];
scanf("%d", &N);
total = 0;
for(i = 0; i < N; i++){
scanf("%d", &d[i]);
}
for(i = 0; i < N; i++){
for(j = 0; j < i; j++){
scanf("%d", &d[j]);
total = total + d[i] * d[j];
}
}
printf("%d", total);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101689/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101689/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%d = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp337 = icmp sgt i32 %1, 0
br i1 %cmp337, label %for.cond5.preheader, label %for.end20
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc18
%3 = phi i32 [ %6, %for.inc18 ], [ %1, %for.cond2.preheader ]
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc18 ], [ 0, %for.cond2.preheader ]
%total.039 = phi i32 [ %total.1.lcssa, %for.inc18 ], [ 0, %for.cond2.preheader ]
%cmp634.not = icmp eq i64 %indvars.iv45, 0
br i1 %cmp634.not, label %for.inc18, label %for.body7.lr.ph
for.body7.lr.ph: ; preds = %for.cond5.preheader
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv45
br label %for.body7
for.body7: ; preds = %for.body7.lr.ph, %for.body7
%indvars.iv42 = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next43, %for.body7 ]
%total.136 = phi i32 [ %total.039, %for.body7.lr.ph ], [ %add, %for.body7 ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv42
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%mul = mul nsw i32 %5, %4
%add = add nsw i32 %mul, %total.136
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %indvars.iv45
br i1 %exitcond.not, label %for.inc18.loopexit, label %for.body7, !llvm.loop !11
for.inc18.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc18
for.inc18: ; preds = %for.inc18.loopexit, %for.cond5.preheader
%6 = phi i32 [ %3, %for.cond5.preheader ], [ %.pre, %for.inc18.loopexit ]
%total.1.lcssa = phi i32 [ %total.039, %for.cond5.preheader ], [ %add, %for.inc18.loopexit ]
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next46, %7
br i1 %cmp3, label %for.cond5.preheader, label %for.end20, !llvm.loop !12
for.end20: ; preds = %for.inc18, %entry, %for.cond2.preheader
%total.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %total.1.lcssa, %for.inc18 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %total.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int n,i,x;
int sum1=0;
int sum2=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x);
sum1+=x;
sum2+=x*x;
}
printf("%d",(sum1*sum1-sum2)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%sum2.012 = phi i32 [ %add2, %for.body ], [ 0, %entry ]
%sum1.011 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%i.010 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%add = add nsw i32 %1, %sum1.011
%mul = mul nsw i32 %1, %1
%add2 = add nuw nsw i32 %mul, %sum2.012
%inc = add nuw nsw i32 %i.010, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%sum1.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%sum2.0.lcssa = phi i32 [ 0, %entry ], [ %add2, %for.body ]
%mul3 = mul nsw i32 %sum1.0.lcssa, %sum1.0.lcssa
%sub = sub nsw i32 %mul3, %sum2.0.lcssa
%div = sdiv i32 %sub, 2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int n,i,j,g=0;
scanf("%d\n",&n);
int t[n];
for(i=0;i<n;i++) scanf("%d",&t[i]);
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++)
g+=t[i]*t[j];
}
printf("%d\n",g);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %3, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %5, 1
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %5, -1
%4 = zext i32 %5 to i64
%wide.trip.count49 = zext i32 %sub to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%g.1.lcssa = phi i32 [ %g.036, %for.body4 ], [ %19, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%g.036 = phi i32 [ 0, %for.body4.preheader ], [ %g.1.lcssa, %for.cond2.loopexit ]
%7 = xor i64 %indvars.iv46, -1
%8 = add nsw i64 %7, %wide.trip.count
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %4
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %g.036, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%11 = getelementptr i32, ptr %vla, i64 %indvars.iv41
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> [ %10, %vector.ph ], [ %16, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%12 = getelementptr i32, ptr %11, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load54 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%15 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi53
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%g.133.ph = phi i32 [ %g.036, %for.body7.lr.ph ], [ %19, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%g.133 = phi i32 [ %add12, %for.body7 ], [ %g.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv43
%20 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %20, %9
%add12 = add nsw i32 %mul, %g.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%g.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %g.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %g.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
int main()
{
int n;
long long ans=0,a[55];
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
}
for(int i=1;i<=n-1;i++)
{
for(int j=i+1;j<=n;j++)
{
ans+=a[i]*a[j];
}
}
printf("%lld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [55 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.cond.cleanup5, label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp4.not.not37 = icmp sgt i32 %3, 1
br i1 %cmp4.not.not37, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%1 = add nuw i32 %3, 1
%wide.trip.count51 = zext i32 %3 to i64
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -2
br label %for.body10.lr.ph
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [55 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
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.body10, %middle.block
%add15.lcssa = phi i64 [ %15, %middle.block ], [ %add15, %for.body10 ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
%indvar.next = add i64 %indvar, 1
br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body10.lr.ph, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %add15.lcssa, %for.cond3.loopexit ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body10.lr.ph: ; preds = %for.cond3.loopexit, %for.body6.preheader
%indvar = phi i64 [ %indvar.next, %for.cond3.loopexit ], [ 0, %for.body6.preheader ]
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.cond3.loopexit ], [ 1, %for.body6.preheader ]
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.cond3.loopexit ], [ 2, %for.body6.preheader ]
%ans.038 = phi i64 [ %add15.lcssa, %for.cond3.loopexit ], [ 0, %for.body6.preheader ]
%5 = sub i64 %2, %indvar
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%arrayidx12 = getelementptr inbounds [55 x i64], ptr %a, i64 0, i64 %indvars.iv48
%6 = load i64, ptr %arrayidx12, align 8, !tbaa !12
%min.iters.check = icmp ult i64 %5, 4
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %5, -4
%ind.end = add i64 %indvars.iv43, %n.vec
%7 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %ans.038, i64 0
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %6, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 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 <2 x i64> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv43, %index
%8 = getelementptr inbounds [55 x i64], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %8, align 8, !tbaa !12
%9 = getelementptr inbounds i64, ptr %8, i64 2
%wide.load56 = load <2 x i64>, ptr %9, align 8, !tbaa !12
%10 = mul nsw <2 x i64> %wide.load, %broadcast.splat
%11 = mul nsw <2 x i64> %wide.load56, %broadcast.splat
%12 = add <2 x i64> %10, %vec.phi
%13 = add <2 x i64> %11, %vec.phi55
%index.next = add nuw i64 %index, 4
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %13, %12
%15 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%ans.134.ph = phi i64 [ %ans.038, %for.body10.lr.ph ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ]
%ans.134 = phi i64 [ %add15, %for.body10 ], [ %ans.134.ph, %for.body10.preheader ]
%arrayidx14 = getelementptr inbounds [55 x i64], ptr %a, i64 0, i64 %indvars.iv45
%16 = load i64, ptr %arrayidx14, align 8, !tbaa !12
%mul = mul nsw i64 %16, %6
%add15 = add nsw i64 %mul, %ans.134
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
|
#include<stdio.h>
int main()
{
int n,i,j,sum=0;
int a[59];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
sum+=a[i]*a[j];
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101869/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101869/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [59 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 236, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %2, 0
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
%wide.trip.count49 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [59 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.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%sum.1.lcssa = phi i32 [ %sum.037, %for.body4 ], [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%sum.037 = phi i32 [ 0, %for.body4.preheader ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%4 = xor i64 %indvars.iv46, -1
%5 = add nsw i64 %4, %wide.trip.count49
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %1
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [59 x i32], ptr %a, i64 0, i64 %indvars.iv46
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.037, i64 0
%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
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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%8 = getelementptr inbounds [59 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load54 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi53
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%sum.133.ph = phi i32 [ %sum.037, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%sum.133 = phi i32 [ %add12, %for.body7 ], [ %sum.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [59 x i32], ptr %a, i64 0, i64 %indvars.iv43
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %sum.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count49
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 236, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
//set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;}
void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
void getperm(int a[],int n){
int i,p;
for(i=0;i<n;i++){
a[i]=i;
}
for(i=n-1;i>=1;i--){
p=rand()%(i+1);
swap(&a[p],&a[i]);
}
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
void coordinate_comp(int a[],int n){
int i,c=0;
sd dat[524288];
for(i=0;i<n;i++){
dat[i].val=a[i];
dat[i].node=i;
}
qsort(dat,n,sizeof(dat[0]),sdsortfnc);
a[dat[0].node]=c;
for(i=1;i<n;i++){
if(dat[i-1].val!=dat[i].val){c++;}
a[dat[i].node]=c;
}
}
int main(void){
//srand(time(0));
int i,j,n,m,k,a[524288],b,c,h,w,r=0,l,t;
scanf("%d",&n);
t=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
r+=a[i];t+=a[i]*a[i];
}
printf("%d\n",(r*r-t)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101911/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101911/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.sd = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
store i32 %1, ptr %a, align 4, !tbaa !16
store i32 %0, ptr %b, align 4, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !20
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
store i64 %1, ptr %a, align 8, !tbaa !29
store i64 %0, ptr %b, align 8, !tbaa !29
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
store double %1, ptr %a, align 8, !tbaa !31
store double %0, ptr %b, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
store i8 %1, ptr %a, align 1, !tbaa !33
store i8 %0, ptr %b, align 1, !tbaa !33
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 {
entry:
%b = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader57, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57
for.body.preheader57: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp40, label %for.body3.preheader, label %for.end25
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader57, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !35
for.cond15.preheader: ; preds = %for.body3
br i1 %cmp40, label %for.body17.preheader, label %for.end25
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count54 = zext i32 %n to i64
br label %for.body17
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ]
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv47 to i32
%rem = srem i32 %call, %5
%indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
%idxprom4 = and i64 %indvars.iv.next48, 4294967295
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%idxprom6 = sext i32 %rem to i64
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv47, 1
br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ]
%arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !16
%idxprom20 = sext i32 %8 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20
%call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54
br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37
for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17
ret void
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !16
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nounwind uwtable
define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%cmp20 = icmp sgt i32 %n, 0
br i1 %cmp20, label %for.body.preheader, label %for.end9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader30, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds i32, ptr %a, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30
for.body.preheader30: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
%cmp222 = icmp sgt i32 %n, 1
br i1 %cmp222, label %for.body3.preheader, label %for.end9
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader30, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !42
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ]
%indvars.iv.next26 = add nsw i64 %indvars.iv25, -1
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv25 to i32
%rem = srem i32 %call, %5
%idxprom4 = sext i32 %rem to i64
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4
%idxprom6 = and i64 %indvars.iv.next26, 4294967295
%arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv25, 2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43
for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !44
%1 = load i32, ptr %b, align 4, !tbaa !44
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 {
entry:
%dat = alloca [524288 x %struct.sd], align 16
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #17
%cmp46 = icmp sgt i32 %n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = or i64 %index, 2
%1 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16
%3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index
%4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0
%interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16
%interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx2, align 8, !tbaa !44
%node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %node, align 4, !tbaa !47
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !48
for.end: ; preds = %for.body, %middle.block, %entry
%conv = sext i32 %n to i64
call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #17
%node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1
%8 = load i32, ptr %node6, align 4, !tbaa !47
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 0, ptr %arrayidx8, align 4, !tbaa !16
%cmp1048 = icmp sgt i32 %n, 1
br i1 %cmp1048, label %for.body12.preheader, label %for.end29
for.body12.preheader: ; preds = %for.end
%wide.trip.count56 = zext i32 %n to i64
%.pre = load i32, ptr %dat, align 16, !tbaa !44
%9 = add nsw i64 %wide.trip.count56, -1
%xtraiter = and i64 %9, 1
%10 = icmp eq i32 %n, 2
br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %9, -2
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ]
%indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ]
%arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52
%12 = load i32, ptr %arrayidx17, align 8, !tbaa !44
%cmp19.not = icmp ne i32 %11, %12
%inc21 = zext i1 %cmp19.not to i32
%spec.select = add nuw nsw i32 %c.050, %inc21
%node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1
%13 = load i32, ptr %node24, align 4, !tbaa !47
%idxprom25 = sext i32 %13 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25
store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53
%14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44
%cmp19.not.1 = icmp ne i32 %12, %14
%inc21.1 = zext i1 %cmp19.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1
%node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1
%15 = load i32, ptr %node24.1, align 4, !tbaa !47
%idxprom25.1 = sext i32 %15 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1
store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16
%indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49
for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ]
%indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil
for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr
%16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44
%cmp19.not.epil = icmp ne i32 %.unr, %16
%inc21.epil = zext i1 %cmp19.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil
%node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1
%17 = load i32, ptr %node24.epil, align 4, !tbaa !47
%idxprom25.epil = sext i32 %17 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil
store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16
br label %for.end29
for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #17
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #12 {
entry:
%n = alloca i32, align 4
%a = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %a) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !16
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%t.022 = phi i32 [ %add8, %for.body ], [ 0, %entry ]
%r.020 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !16
%add = add nsw i32 %1, %r.020
%mul = mul nsw i32 %1, %1
%add8 = add nuw nsw i32 %mul, %t.022
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !16
%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 !50
for.end: ; preds = %for.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%t.0.lcssa = phi i32 [ 0, %entry ], [ %add8, %for.body ]
%mul9 = mul nsw i32 %r.0.lcssa, %r.0.lcssa
%sub = sub nsw i32 %mul9, %t.0.lcssa
%div = sdiv i32 %sub, 2
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %a) #17
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree nounwind }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !18, i64 0}
!18 = !{!"omnipotent char", !19, i64 0}
!19 = !{!"Simple C/C++ TBAA"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !18, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !18, i64 0}
!33 = !{!18, !18, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = distinct !{!41, !6, !9, !10}
!42 = distinct !{!42, !6, !10, !9}
!43 = distinct !{!43, !6}
!44 = !{!45, !17, i64 0}
!45 = !{!"", !17, i64 0, !17, i64 4}
!46 = distinct !{!46, !6, !9, !10}
!47 = !{!45, !17, i64 4}
!48 = distinct !{!48, !6, !10, !9}
!49 = distinct !{!49, !6}
!50 = distinct !{!50, !6}
|
#include<stdio.h>
#define N 100
int main(void)
{
int n;//たこ焼きの個数
int a[N];//おいしさ
int sum=0;//総和
//scanf_s("%d", &n);
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
//scanf_s("%d", &a[i]);
scanf("%d", &a[i]);
}
for (int i = 0; i < n; ++i) {
for (int j = i+1; j < n; ++j) {
sum += a[i] * a[j];
//printf("%d * %d = %d\n", a[i], a[j], sum);
}
}
printf("%d\n", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101955/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101955/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp437 = icmp sgt i32 %2, 0
br i1 %cmp437, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%1 = zext i32 %2 to i64
%wide.trip.count51 = zext i32 %2 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6
%sum.1.lcssa = phi i32 [ %sum.038, %for.body6 ], [ %15, %middle.block ], [ %add15, %for.body10 ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%indvars.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.cond3.loopexit ]
%indvars.iv43 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next44, %for.cond3.loopexit ]
%sum.038 = phi i32 [ 0, %for.body6.preheader ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%4 = xor i64 %indvars.iv48, -1
%5 = add nsw i64 %4, %wide.trip.count51
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%cmp833 = icmp ult i64 %indvars.iv.next49, %1
br i1 %cmp833, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv43, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.038, i64 0
%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
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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv43, %index
%8 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load56 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load56, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi55
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%sum.134.ph = phi i32 [ %sum.038, %for.body10.lr.ph ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ]
%sum.134 = phi i32 [ %add15, %for.body10 ], [ %sum.134.ph, %for.body10.preheader ]
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv45
%16 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add15 = add nsw i32 %mul, %sum.134
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count51
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i, j, sum=0;
scanf("%d", &n);
int a[n+1];
for(i=0; i<n; i++){
scanf("%d", &a[i]);
}
for(i=0; i<n; i++){
for(j=i+1; j<n; j++){
sum+=a[i]*a[j];
}
}
printf("%d", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101999/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101999/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %3, 0
br i1 %cmp30, label %for.body, label %for.end19
for.cond2.preheader: ; preds = %for.body
%cmp336 = icmp sgt i32 %5, 0
br i1 %cmp336, label %for.body4.preheader, label %for.end19
for.body4.preheader: ; preds = %for.cond2.preheader
%4 = zext i32 %5 to i64
%wide.trip.count50 = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body8, %middle.block, %for.body4
%sum.1.lcssa = phi i32 [ %sum.037, %for.body4 ], [ %19, %middle.block ], [ %add13, %for.body8 ]
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
br i1 %exitcond51.not, label %for.end19, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv47 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next48, %for.cond2.loopexit ]
%indvars.iv42 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next43, %for.cond2.loopexit ]
%sum.037 = phi i32 [ 0, %for.body4.preheader ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%7 = xor i64 %indvars.iv47, -1
%8 = add nsw i64 %7, %wide.trip.count50
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%cmp732 = icmp ult i64 %indvars.iv.next48, %4
br i1 %cmp732, label %for.body8.lr.ph, label %for.cond2.loopexit
for.body8.lr.ph: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47
%9 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body8.lr.ph
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv42, %n.vec
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.037, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%11 = getelementptr i32, ptr %vla, i64 %indvars.iv42
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> [ %10, %vector.ph ], [ %16, %vector.body ]
%vec.phi54 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%12 = getelementptr i32, ptr %11, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load55 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%15 = mul nsw <4 x i32> %wide.load55, %broadcast.splat
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi54
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph, %middle.block
%indvars.iv44.ph = phi i64 [ %indvars.iv42, %for.body8.lr.ph ], [ %ind.end, %middle.block ]
%sum.134.ph = phi i32 [ %sum.037, %for.body8.lr.ph ], [ %19, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body8 ], [ %indvars.iv44.ph, %for.body8.preheader ]
%sum.134 = phi i32 [ %add13, %for.body8 ], [ %sum.134.ph, %for.body8.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv44
%20 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%mul = mul nsw i32 %20, %9
%add13 = add nsw i32 %mul, %sum.134
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count50
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body8, !llvm.loop !15
for.end19: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
int main(){
int n,d[51],i,j,ans=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&d[i]);
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
ans+=d[i]*d[j];
}
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102040/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102040/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = alloca [51 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %2, 1
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %2, -1
%1 = zext i32 %2 to i64
%wide.trip.count49 = zext i32 %sub to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x i32], ptr %d, 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.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%ans.1.lcssa = phi i32 [ %ans.037, %for.body4 ], [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%ans.037 = phi i32 [ 0, %for.body4.preheader ], [ %ans.1.lcssa, %for.cond2.loopexit ]
%4 = xor i64 %indvars.iv46, -1
%5 = add nsw i64 %4, %wide.trip.count
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %1
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv46
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.037, i64 0
%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
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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%8 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load54 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi53
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%ans.133.ph = phi i32 [ %ans.037, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%ans.133 = phi i32 [ %add12, %for.body7 ], [ %ans.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv43
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %ans.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
#define Max 10000
#define NIL -1
typedef struct Node{
int p, l, r;
}Node;
Node T[Max];
int n;
void preParse(int u){
if(u == NIL) return;
printf(" %d", u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL) return;
inParse(T[u].l);
printf(" %d", u);
inParse(T[u].r);
}
void postParse(int u){
if(u == NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d", u);
}
int main(){
int i, v, l, r, root;
scanf("%d", &n);
for(i = 0 ; i < n ; i++){
T[i].p = NIL;
}
for(i = 0 ; i < n ; i++){
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if(l != NIL) T[l].p = v;
if(r != NIL) T[r].p = v;
}
for(i = 0 ; i < n ; i++){
if(T[i].p == NIL) root = i;
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102084/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102084/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
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, !7, i64 4}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
int id;
int parent;
int left;
int right;
}tree;
tree *T;
void preorder(int r){
printf(" %d",r);
if(T[r].left != -1) preorder(T[r].left);
if(T[r].right != -1) preorder(T[r].right);
}
void inorder(int r){
if(T[r].left != -1) inorder(T[r].left);
printf(" %d",r);
if(T[r].right != -1) inorder(T[r].right);
}
void postorder(int r){
if(T[r].left != -1) postorder(T[r].left);
if(T[r].right != -1) postorder(T[r].right);
printf(" %d",r);
}
int main(){
int i, n, id, root;
scanf("%d",&n);
T = malloc(sizeof(tree)*n);
for(i = 0; i < n; i++) T[i].parent = -1;
for(i = 0; i < n; i++){
scanf("%d",&id);
scanf("%d%d",&T[id].left, &T[id].right);
T[T[id].left].parent = id;
T[T[id].right].parent = id;
}
for(i = 0; i < n; i++){
if(T[i].parent == -1){
root=i;
break;
}
}
printf("Preorder\n");
preorder(root);
printf("\nInorder\n");
inorder(root);
printf("\nPostorder\n");
postorder(root);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102127/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102127/source.c"
target datalayout = "e-m:e-p270: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.tree = type { i32, i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(i32 noundef %r) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%r.tr = phi i32 [ %r, %entry ], [ %3, %if.end ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %r.tr)
%0 = load ptr, ptr @T, align 8, !tbaa !5
%idxprom = sext i32 %r.tr to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder(i32 noundef %1)
%.pre = load ptr, ptr @T, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%2 = phi ptr [ %.pre, %if.then ], [ %0, %tailrecurse ]
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !12
%cmp6.not = icmp eq i32 %3, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(i32 noundef %r) local_unnamed_addr #0 {
entry:
%.pre = load ptr, ptr @T, align 8, !tbaa !5
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%0 = phi ptr [ %.pre, %entry ], [ %2, %if.end ]
%r.tr = phi i32 [ %r, %entry ], [ %3, %if.end ]
%idxprom = sext i32 %r.tr to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @inorder(i32 noundef %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %r.tr)
%2 = load ptr, ptr @T, align 8, !tbaa !5
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !12
%cmp6.not = icmp eq i32 %3, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postorder(i32 noundef %r) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @T, align 8, !tbaa !5
%idxprom = sext i32 %r to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
tail call void @postorder(i32 noundef %1)
%.pre = load ptr, ptr @T, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi ptr [ %.pre, %if.then ], [ %0, %entry ]
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !12
%cmp6.not = icmp eq i32 %3, -1
br i1 %cmp6.not, label %if.end11, label %if.then7
if.then7: ; preds = %if.end
tail call void @postorder(i32 noundef %3)
br label %if.end11
if.end11: ; preds = %if.then7, %if.end
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %r)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = 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 %id) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 4
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
store ptr %call1, ptr @T, align 8, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body.lr.ph, label %for.end39
for.body.lr.ph: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond3.preheader.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%indvars.iv.unr = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%parent.epil = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv.epil, i32 1
store i32 -1, ptr %parent.epil, align 4, !tbaa !14
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !15
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp56, label %for.body6, label %for.end39
for.body: ; preds = %for.body, %for.body.lr.ph.new
%indvars.iv = phi i64 [ 0, %for.body.lr.ph.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%parent = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv, i32 1
store i32 -1, ptr %parent, align 4, !tbaa !14
%indvars.iv.next = or i64 %indvars.iv, 1
%parent.1 = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv.next, i32 1
store i32 -1, ptr %parent.1, align 4, !tbaa !14
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%parent.2 = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv.next.1, i32 1
store i32 -1, ptr %parent.2, align 4, !tbaa !14
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%parent.3 = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv.next.2, i32 1
store i32 -1, ptr %parent.3, align 4, !tbaa !14
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !17
for.cond28.preheader: ; preds = %for.body6
%cmp2960 = icmp sgt i32 %9, 0
br i1 %cmp2960, label %for.body31.lr.ph, label %for.end39
for.body31.lr.ph: ; preds = %for.cond28.preheader
%wide.trip.count69 = zext i32 %9 to i64
br label %for.body31
for.body6: ; preds = %for.cond3.preheader, %for.body6
%i.159 = phi i32 [ %inc26, %for.body6 ], [ 0, %for.cond3.preheader ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id)
%2 = load ptr, ptr @T, align 8, !tbaa !5
%3 = load i32, ptr %id, align 4, !tbaa !13
%idxprom8 = sext i32 %3 to i64
%left = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom8, i32 2
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom8, i32 3
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %id, align 4, !tbaa !13
%5 = load ptr, ptr @T, align 8, !tbaa !5
%idxprom13 = sext i32 %4 to i64
%left15 = getelementptr inbounds %struct.tree, ptr %5, i64 %idxprom13, i32 2
%6 = load i32, ptr %left15, align 4, !tbaa !9
%idxprom16 = sext i32 %6 to i64
%parent18 = getelementptr inbounds %struct.tree, ptr %5, i64 %idxprom16, i32 1
store i32 %4, ptr %parent18, align 4, !tbaa !14
%7 = load i32, ptr %id, align 4, !tbaa !13
%idxprom19 = sext i32 %7 to i64
%right21 = getelementptr inbounds %struct.tree, ptr %5, i64 %idxprom19, i32 3
%8 = load i32, ptr %right21, align 4, !tbaa !12
%idxprom22 = sext i32 %8 to i64
%parent24 = getelementptr inbounds %struct.tree, ptr %5, i64 %idxprom22, i32 1
store i32 %7, ptr %parent24, align 4, !tbaa !14
%inc26 = add nuw nsw i32 %i.159, 1
%9 = load i32, ptr %n, align 4, !tbaa !13
%cmp4 = icmp slt i32 %inc26, %9
br i1 %cmp4, label %for.body6, label %for.cond28.preheader, !llvm.loop !19
for.body31: ; preds = %for.body31.lr.ph, %for.inc37
%indvars.iv66 = phi i64 [ 0, %for.body31.lr.ph ], [ %indvars.iv.next67, %for.inc37 ]
%parent34 = getelementptr inbounds %struct.tree, ptr %5, i64 %indvars.iv66, i32 1
%10 = load i32, ptr %parent34, align 4, !tbaa !14
%cmp35 = icmp eq i32 %10, -1
br i1 %cmp35, label %for.end39.loopexit.split.loop.exit, label %for.inc37
for.inc37: ; preds = %for.body31
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end39, label %for.body31, !llvm.loop !20
for.end39.loopexit.split.loop.exit: ; preds = %for.body31
%11 = trunc i64 %indvars.iv66 to i32
br label %for.end39
for.end39: ; preds = %for.inc37, %for.end39.loopexit.split.loop.exit, %entry, %for.cond3.preheader, %for.cond28.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond28.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %11, %for.end39.loopexit.split.loop.exit ], [ %9, %for.inc37 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preorder(i32 noundef %i.2.lcssa)
%puts54 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inorder(i32 noundef %i.2.lcssa)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postorder(i32 noundef %i.2.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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 #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int p,l,r;
};
struct Node T[MAX];
int n;
void preParse(int);
void inParse(int);
void postParse(int);
int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i=0;i<n;i++)
T[i].p = NIL;
for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l = l;
T[v].r = r;
if(l != NIL)T[l].p = v;
if(r != NIL)T[r].p = v;
}
for(i=0;i<n;i++)
if(T[i].p == NIL)root = i;
printf("Preorder\n");
preParse(root);
printf("\nInorder\n");
inParse(root);
printf("\nPostorder\n");
postParse(root);
printf("\n");
return 0;
}
void preParse(int u){
if(u == NIL)return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL)return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}
void postParse(int u){
if(u == NIL)return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102178/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102178/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%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.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp53, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond24.preheader: ; preds = %for.inc21
%cmp2557 = icmp sgt i32 %6, 0
br i1 %cmp2557, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count66 = zext i32 %6 to i64
%xtraiter70 = and i64 %wide.trip.count66, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter74 = and i64 %wide.trip.count66, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.156 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !15
%5 = load i32, ptr %r, align 4, !tbaa !5
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.156, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv63 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter75 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter75.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv63
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !9
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv63 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.059
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !9
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next64 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next64.1 = or i64 %indvars.iv63, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !9
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next64.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next64.2 = or i64 %indvars.iv63, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !9
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next64.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
%niter75.next.3 = add i64 %niter75, 4
%niter75.ncmp.3 = icmp eq i64 %niter75.next.3, %unroll_iter74
br i1 %niter75.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv63.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod72.not = icmp eq i64 %xtraiter70, 0
br i1 %lcmp.mod72.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body26.epil ], [ %indvars.iv63.unr, %for.end35.loopexit.unr-lcssa ]
%root.059.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter71 = phi i64 [ %epil.iter71.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv63.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !9
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv63.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.059.epil
%indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1
%epil.iter71.next = add i64 %epil.iter71, 1
%epil.iter71.cmp.not = icmp eq i64 %epil.iter71.next, %xtraiter70
br i1 %epil.iter71.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include <stdio.h>
#define MAX 100000
typedef struct{
int parent;
int left;
int right;
}Node;
void Preorder(int);
void Inorder(int);
void Postorder(int);
Node T[MAX];
int c[2];
int n;
int main(){
int l, m, i, j;
scanf("%d", &n);
for(i = 0; i < n; i++){
T[i].parent = -1;
T[i].left = -1;
T[i].right = -1;
}
for(i = 0; i < n; i++){
scanf("%d", &l);
for(j = 0; j < 2; j++){
scanf("%d", &c[j]);
if(c[j] != -1){
T[c[j]].parent = l;
if(j == 0) T[l].left = c[j];
else T[l].right = c[j];
}
}
}
for(i = 0; i < n; i++) if(T[i].parent == -1) m = i;
printf("Preorder\n");
Preorder(m);
printf("\n");
printf("Inorder\n");
Inorder(m);
printf("\n");
printf("Postorder\n");
Postorder(m);
printf("\n");
return 0;
}
void Preorder(int u){
if(u == -1) return;
printf(" %d", u);
Preorder(T[u].left);
Preorder(T[u].right);
}
void Inorder(int u){
if(u == -1) return;
Inorder(T[u].left);
printf(" %d", u);
Inorder(T[u].right);
}
void Postorder(int u){
if(u == -1) return;
Postorder(T[u].left);
Postorder(T[u].right);
printf(" %d", u);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102228/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102228/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [100000 x %struct.Node] zeroinitializer, align 16
@c = dso_local global [2 x i32] zeroinitializer, align 4
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.6 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.7 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body7.preheader, label %for.end53
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond42.preheader: ; preds = %for.inc36.1
%cmp4388 = icmp sgt i32 %8, 0
br i1 %cmp4388, label %for.body44.preheader, label %for.end53
for.body44.preheader: ; preds = %for.cond42.preheader
%wide.trip.count = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %8, 4
br i1 %3, label %for.end53.loopexit.unr-lcssa, label %for.body44.preheader.new
for.body44.preheader.new: ; preds = %for.body44.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body44
for.body7: ; preds = %for.body7.preheader, %for.inc36.1
%i.187 = phi i32 [ %inc40, %for.inc36.1 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @c)
%4 = load i32, ptr @c, align 4, !tbaa !5
%cmp17.not = icmp eq i32 %4, -1
br i1 %cmp17.not, label %for.inc36, label %if.then24
if.then24: ; preds = %for.body7
%5 = load i32, ptr %l, align 4, !tbaa !5
%idxprom20 = sext i32 %4 to i64
%arrayidx21 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom20
store i32 %5, ptr %arrayidx21, align 4, !tbaa !9
%idxprom27 = sext i32 %5 to i64
%left29 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom27, i32 1
store i32 %4, ptr %left29, align 4, !tbaa !11
br label %for.inc36
for.inc36: ; preds = %for.body7, %if.then24
%call14.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([2 x i32], ptr @c, i64 0, i64 1))
%6 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @c, i64 0, i64 1), align 4, !tbaa !5
%cmp17.not.1 = icmp eq i32 %6, -1
br i1 %cmp17.not.1, label %for.inc36.1, label %if.else.1
if.else.1: ; preds = %for.inc36
%7 = load i32, ptr %l, align 4, !tbaa !5
%idxprom20.1 = sext i32 %6 to i64
%arrayidx21.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom20.1
store i32 %7, ptr %arrayidx21.1, align 4, !tbaa !9
%idxprom32.1 = sext i32 %7 to i64
%right34.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom32.1, i32 2
store i32 %6, ptr %right34.1, align 4, !tbaa !12
br label %for.inc36.1
for.inc36.1: ; preds = %if.else.1, %for.inc36
%inc40 = add nuw nsw i32 %i.187, 1
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc40, %8
br i1 %cmp6, label %for.body7, label %for.cond42.preheader, !llvm.loop !13
for.body44: ; preds = %for.body44, %for.body44.preheader.new
%indvars.iv = phi i64 [ 0, %for.body44.preheader.new ], [ %indvars.iv.next.3, %for.body44 ]
%m.089 = phi i32 [ undef, %for.body44.preheader.new ], [ %spec.select.3, %for.body44 ]
%niter = phi i64 [ 0, %for.body44.preheader.new ], [ %niter.next.3, %for.body44 ]
%arrayidx46 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx46, align 16, !tbaa !9
%cmp48 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp48, i32 %10, i32 %m.089
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx46.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
%11 = load i32, ptr %arrayidx46.1, align 4, !tbaa !9
%cmp48.1 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp48.1, i32 %12, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx46.2 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
%13 = load i32, ptr %arrayidx46.2, align 8, !tbaa !9
%cmp48.2 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp48.2, i32 %14, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx46.3 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
%15 = load i32, ptr %arrayidx46.3, align 4, !tbaa !9
%cmp48.3 = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp48.3, i32 %16, i32 %spec.select.2
%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.end53.loopexit.unr-lcssa, label %for.body44, !llvm.loop !15
for.end53.loopexit.unr-lcssa: ; preds = %for.body44, %for.body44.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body44.preheader ], [ %indvars.iv.next.3, %for.body44 ]
%m.089.unr = phi i32 [ undef, %for.body44.preheader ], [ %spec.select.3, %for.body44 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end53, label %for.body44.epil
for.body44.epil: ; preds = %for.end53.loopexit.unr-lcssa, %for.body44.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body44.epil ], [ %indvars.iv.unr, %for.end53.loopexit.unr-lcssa ]
%m.089.epil = phi i32 [ %spec.select.epil, %for.body44.epil ], [ %m.089.unr, %for.end53.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body44.epil ], [ 0, %for.end53.loopexit.unr-lcssa ]
%arrayidx46.epil = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
%17 = load i32, ptr %arrayidx46.epil, align 4, !tbaa !9
%cmp48.epil = icmp eq i32 %17, -1
%18 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp48.epil, i32 %18, i32 %m.089.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end53, label %for.body44.epil, !llvm.loop !16
for.end53: ; preds = %for.end53.loopexit.unr-lcssa, %for.body44.epil, %entry, %for.cond42.preheader
%m.0.lcssa = phi i32 [ undef, %for.cond42.preheader ], [ undef, %entry ], [ %m.089.unr, %for.end53.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body44.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %m.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts79 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @Inorder(i32 noundef %m.0.lcssa)
%putchar80 = call i32 @putchar(i32 10)
%puts81 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Postorder(i32 noundef %m.0.lcssa)
%putchar82 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
tail call void @Preorder(i32 noundef %0)
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !12
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
tail call void @Inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %u.tr7)
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !12
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
tail call void @Postorder(i32 noundef %0)
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !12
tail call void @Postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#define MAX 10000
#define NIL -1
typedef struct{
int l,r,p;
}Node;
Node Tree[MAX];
int n;
void Preorder(int u){
if(u==NIL) return;
printf(" %d",u);
Preorder(Tree[u].l);
Preorder(Tree[u].r);
}
void Inorder(int u){
if(u==NIL)return;
Inorder(Tree[u].l);
printf(" %d",u);
Inorder(Tree[u].r);
}
void Postorder(int u){
if(u==NIL)return;
Postorder(Tree[u].l);
Postorder(Tree[u].r);
printf(" %d",u);
}
int main(){
int i,id,left,right,root;
scanf("%d",&n);
for(i=0;i<n;i++) Tree[i].p=NIL;
for(i=0;i<n;i++){
scanf("%d %d %d",&id,&left,&right);
Tree[id].l=left;
Tree[id].r=right;
if(left!=NIL)Tree[left].p=id;
if(right!=NIL)Tree[right].p=id;
}
for(i=0;i<n;i++)
if(Tree[i].p==NIL) root=i;
printf("Preorder\n");
Preorder(root);
printf("\n");
printf("Inorder\n");
Inorder(root);
printf("\n");
printf("Postorder\n");
Postorder(root);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102286/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102286/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@Tree = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
tail call void @Preorder(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
tail call void @Inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
tail call void @Postorder(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @Postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%id = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body.preheader, label %for.end33
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%p.epil = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.epil, i32 2
store i32 -1, ptr %p.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp55, label %for.body3, label %for.end33
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%p = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv, i32 2
store i32 -1, ptr %p, align 8, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%p.1 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next, i32 2
store i32 -1, ptr %p.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%p.2 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next.1, i32 2
store i32 -1, ptr %p.2, align 16, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%p.3 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next.2, i32 2
store i32 -1, ptr %p.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond22.preheader: ; preds = %for.inc19
%cmp2359 = icmp sgt i32 %6, 0
br i1 %cmp2359, label %for.body24.preheader, label %for.end33
for.body24.preheader: ; preds = %for.cond22.preheader
%wide.trip.count68 = zext i32 %6 to i64
%xtraiter72 = and i64 %wide.trip.count68, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end33.loopexit.unr-lcssa, label %for.body24.preheader.new
for.body24.preheader.new: ; preds = %for.body24.preheader
%unroll_iter76 = and i64 %wide.trip.count68, 4294967292
br label %for.body24
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.158 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%3 = load i32, ptr %left, align 4, !tbaa !11
%4 = load i32, ptr %id, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%arrayidx6 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5
store i32 %3, ptr %arrayidx6, align 4, !tbaa !5
%5 = load i32, ptr %right, align 4, !tbaa !11
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 1
store i32 %5, ptr %r, align 4, !tbaa !10
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %3 to i64
%p12 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom10, i32 2
store i32 %4, ptr %p12, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %5, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %5 to i64
%p17 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom15, i32 2
store i32 %4, ptr %p17, align 4, !tbaa !12
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.158, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc20, %6
br i1 %cmp2, label %for.body3, label %for.cond22.preheader, !llvm.loop !17
for.body24: ; preds = %for.body24, %for.body24.preheader.new
%indvars.iv65 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next66.3, %for.body24 ]
%root.061 = phi i32 [ undef, %for.body24.preheader.new ], [ %spec.select.3, %for.body24 ]
%niter77 = phi i64 [ 0, %for.body24.preheader.new ], [ %niter77.next.3, %for.body24 ]
%p27 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv65, i32 2
%7 = load i32, ptr %p27, align 8, !tbaa !12
%cmp28 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv65 to i32
%spec.select = select i1 %cmp28, i32 %8, i32 %root.061
%indvars.iv.next66 = or i64 %indvars.iv65, 1
%p27.1 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66, i32 2
%9 = load i32, ptr %p27.1, align 4, !tbaa !12
%cmp28.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next66 to i32
%spec.select.1 = select i1 %cmp28.1, i32 %10, i32 %spec.select
%indvars.iv.next66.1 = or i64 %indvars.iv65, 2
%p27.2 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66.1, i32 2
%11 = load i32, ptr %p27.2, align 16, !tbaa !12
%cmp28.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next66.1 to i32
%spec.select.2 = select i1 %cmp28.2, i32 %12, i32 %spec.select.1
%indvars.iv.next66.2 = or i64 %indvars.iv65, 3
%p27.3 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66.2, i32 2
%13 = load i32, ptr %p27.3, align 4, !tbaa !12
%cmp28.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next66.2 to i32
%spec.select.3 = select i1 %cmp28.3, i32 %14, i32 %spec.select.2
%indvars.iv.next66.3 = add nuw nsw i64 %indvars.iv65, 4
%niter77.next.3 = add i64 %niter77, 4
%niter77.ncmp.3 = icmp eq i64 %niter77.next.3, %unroll_iter76
br i1 %niter77.ncmp.3, label %for.end33.loopexit.unr-lcssa, label %for.body24, !llvm.loop !18
for.end33.loopexit.unr-lcssa: ; preds = %for.body24, %for.body24.preheader
%indvars.iv65.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next66.3, %for.body24 ]
%root.061.unr = phi i32 [ undef, %for.body24.preheader ], [ %spec.select.3, %for.body24 ]
%lcmp.mod74.not = icmp eq i64 %xtraiter72, 0
br i1 %lcmp.mod74.not, label %for.end33, label %for.body24.epil
for.body24.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil
%indvars.iv65.epil = phi i64 [ %indvars.iv.next66.epil, %for.body24.epil ], [ %indvars.iv65.unr, %for.end33.loopexit.unr-lcssa ]
%root.061.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %root.061.unr, %for.end33.loopexit.unr-lcssa ]
%epil.iter73 = phi i64 [ %epil.iter73.next, %for.body24.epil ], [ 0, %for.end33.loopexit.unr-lcssa ]
%p27.epil = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv65.epil, i32 2
%15 = load i32, ptr %p27.epil, align 4, !tbaa !12
%cmp28.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv65.epil to i32
%spec.select.epil = select i1 %cmp28.epil, i32 %16, i32 %root.061.epil
%indvars.iv.next66.epil = add nuw nsw i64 %indvars.iv65.epil, 1
%epil.iter73.next = add i64 %epil.iter73, 1
%epil.iter73.cmp.not = icmp eq i64 %epil.iter73.next, %xtraiter72
br i1 %epil.iter73.cmp.not, label %for.end33, label %for.body24.epil, !llvm.loop !19
for.end33: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil, %entry, %for.cond1.preheader, %for.cond22.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond22.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.061.unr, %for.end33.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body24.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %root.0.lcssa)
%putchar52 = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define MAX 10000
#define NO -1
struct tree { int p, l, r;};
struct tree T[MAX];
int n;
void Preorder ( int u ) {
if ( u == NO ) return;
printf(" %d", u);
Preorder(T[u].l);
Preorder(T[u].r);
}
void Inorder ( int u ) {
if ( u == NO ) return;
Inorder(T[u].l);
printf(" %d", u);
Inorder(T[u].r);
}
void Postorder ( int u ) {
if ( u == NO ) return;
Postorder(T[u].l);
Postorder(T[u].r);
printf(" %d", u);
}
int main(void) {
int i, v, l, r, f, root;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
T[i].p = NO;
}
for ( i = 0; i < n; i++ ) {
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if ( l != NO ) T[l].p = v;
if ( r != NO ) T[r].p = v;
}
for ( i = 0; i < n; i++ ) {
if ( T[i].p == NO ) root = i;
}
printf("Preorder\n");
Preorder(root);
printf("\nInorder\n");
Inorder(root);
printf("\nPostorder\n");
Postorder(root);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102329/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102329/source.c"
target datalayout = "e-m:e-p270: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.tree = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.tree] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @Preorder(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @Inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @Postorder(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @Postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp53, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2557 = icmp sgt i32 %6, 0
br i1 %cmp2557, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count66 = zext i32 %6 to i64
%xtraiter70 = and i64 %wide.trip.count66, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter74 = and i64 %wide.trip.count66, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.156 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.156, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv63 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter75 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter75.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv63
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv63 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.059
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next64
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next64 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next64.1 = or i64 %indvars.iv63, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next64.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next64.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next64.2 = or i64 %indvars.iv63, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv.next64.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next64.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
%niter75.next.3 = add i64 %niter75, 4
%niter75.ncmp.3 = icmp eq i64 %niter75.next.3, %unroll_iter74
br i1 %niter75.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv63.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod72.not = icmp eq i64 %xtraiter70, 0
br i1 %lcmp.mod72.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body26.epil ], [ %indvars.iv63.unr, %for.end35.loopexit.unr-lcssa ]
%root.059.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter71 = phi i64 [ %epil.iter71.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.tree], ptr @T, i64 0, i64 %indvars.iv63.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv63.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.059.epil
%indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1
%epil.iter71.next = add i64 %epil.iter71, 1
%epil.iter71.cmp.not = icmp eq i64 %epil.iter71.next, %xtraiter70
br i1 %epil.iter71.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %root.0.lcssa)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %root.0.lcssa)
%puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
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, !7, i64 4}
!6 = !{!"tree", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
int main()
{
int n,m,num,i;
scanf("%d",&n);
if(n %2 == 0)
m = n/2+1;
else
m = (n+1)/2;
printf("%d\n",m);
num = 0;
for(i = 1; i <= m; i ++)
{
if(num == n)
break;
printf("%d %d\n",1,i);
num ++;
}
for(i = 2; i <= m; i ++)
{
if(num == n)
break;
printf("%d %d\n",i,m);
num ++;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = sdiv i32 %0, 2
%add = add nsw i32 %div, 1
br label %if.end
if.else: ; preds = %entry
%add1 = add nsw i32 %0, 1
%div2 = sdiv i32 %add1, 2
br label %if.end
if.end: ; preds = %if.else, %if.then
%m.0 = phi i32 [ %add, %if.then ], [ %div2, %if.else ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0)
%cmp4.not33 = icmp slt i32 %m.0, 1
%2 = load i32, ptr %n, align 4
%cmp534 = icmp eq i32 %2, 0
%or.cond35 = select i1 %cmp4.not33, i1 true, i1 %cmp534
br i1 %or.cond35, label %for.cond10.preheader, label %if.end7
for.cond10.preheader: ; preds = %if.end7, %if.end
%3 = phi i32 [ %2, %if.end ], [ %4, %if.end7 ]
%num.0.lcssa = phi i32 [ 0, %if.end ], [ %inc, %if.end7 ]
%cmp11.not38 = icmp slt i32 %m.0, 2
%cmp1339 = icmp eq i32 %num.0.lcssa, %3
%or.cond3240 = select i1 %cmp11.not38, i1 true, i1 %cmp1339
br i1 %or.cond3240, label %for.end20, label %if.end15
if.end7: ; preds = %if.end, %if.end7
%i.037 = phi i32 [ %inc9, %if.end7 ], [ 1, %if.end ]
%num.036 = phi i32 [ %inc, %if.end7 ], [ 0, %if.end ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1, i32 noundef %i.037)
%inc = add nuw nsw i32 %num.036, 1
%inc9 = add nuw nsw i32 %i.037, 1
%cmp4.not = icmp sge i32 %i.037, %m.0
%4 = load i32, ptr %n, align 4
%cmp5 = icmp eq i32 %inc, %4
%or.cond = select i1 %cmp4.not, i1 true, i1 %cmp5
br i1 %or.cond, label %for.cond10.preheader, label %if.end7, !llvm.loop !9
if.end15: ; preds = %for.cond10.preheader, %if.end15
%i.142 = phi i32 [ %inc19, %if.end15 ], [ 2, %for.cond10.preheader ]
%num.141 = phi i32 [ %inc17, %if.end15 ], [ %num.0.lcssa, %for.cond10.preheader ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.142, i32 noundef %m.0)
%inc17 = add nuw nsw i32 %num.141, 1
%inc19 = add nuw nsw i32 %i.142, 1
%cmp11.not = icmp sge i32 %i.142, %m.0
%5 = load i32, ptr %n, align 4
%cmp13 = icmp eq i32 %inc17, %5
%or.cond32 = select i1 %cmp11.not, i1 true, i1 %cmp13
br i1 %or.cond32, label %for.end20, label %if.end15, !llvm.loop !11
for.end20: ; preds = %if.end15, %for.cond10.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int x,y,z;
char ans;
scanf("%d %d %d",&x,&y,&z);
if(z==0)ans=x>y?'+':x==y?'0':'-';
else if(x>y){
ans=x-y>z?'+':'?';
}
else if(x<y){
ans=y-x>z?'-':'?';
}
else ans='?';
printf("%c",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 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 %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %z, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %y, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %1, %2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%cmp2 = icmp eq i32 %1, %2
%3 = select i1 %cmp2, i32 48, i32 45
%cond3 = select i1 %cmp1, i32 43, i32 %3
br label %if.end22
if.else: ; preds = %entry
br i1 %cmp1, label %if.then6, label %if.else11
if.then6: ; preds = %if.else
%sub = sub nsw i32 %1, %2
%cmp7 = icmp sgt i32 %sub, %0
%conv10 = select i1 %cmp7, i32 43, i32 63
br label %if.end22
if.else11: ; preds = %if.else
%cmp12 = icmp slt i32 %1, %2
br i1 %cmp12, label %if.then14, label %if.end22
if.then14: ; preds = %if.else11
%sub15 = sub nsw i32 %2, %1
%cmp16 = icmp sgt i32 %sub15, %0
%conv19 = select i1 %cmp16, i32 45, i32 63
br label %if.end22
if.end22: ; preds = %if.else11, %if.then6, %if.then14, %if.then
%ans.0 = phi i32 [ %cond3, %if.then ], [ %conv10, %if.then6 ], [ %conv19, %if.then14 ], [ 63, %if.else11 ]
%putchar = call i32 @putchar(i32 %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node {int p,l,r;};
struct Node Ttw[MAX];
int n;
void preParse(int u){
if(u==NIL)return;
printf(" %d",u);
preParse(Ttw[u].l);
preParse(Ttw[u].r);
}
void inParse(int u){
if(u==NIL)return;
inParse(Ttw[u].l);
printf(" %d",u);
inParse(Ttw[u].r);
}
void postParse(int u){
if(u==NIL)return;
postParse(Ttw[u].l);
postParse(Ttw[u].r);
printf(" %d",u);
}
int main(){
int i,vtw,l,r,roottw;
scanf("%d",&n);
for(i=0;i<n;i++){
Ttw[i].p=NIL;
}
for(i=0;i<n;i++){
scanf("%d %d %d",&vtw,&l,&r);
Ttw[vtw].l=l;
Ttw[vtw].r=r;
if(l!=NIL)Ttw[l].p=vtw;
if(r!=NIL)Ttw[r].p=vtw;
}
for(i=0;i<n;i++)if(Ttw[i].p==NIL)roottw=i;
printf("Preorder\n");
preParse(roottw);
printf("\n");
printf("Inorder\n");
inParse(roottw);
printf("\n");
printf("Postorder\n");
postParse(roottw);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102480/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@Ttw = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%vtw = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vtw) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %vtw, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %vtw, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%roottw.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %roottw.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%roottw.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%roottw.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %roottw.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @Ttw, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %roottw.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%roottw.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %roottw.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %roottw.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %roottw.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %roottw.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vtw) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
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, !7, i64 4}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define MAX 100000
#define N -1
typedef struct{
int p,l,r;
}Node;
Node T[MAX];
int a;
void pre(int);
void in(int);
void post(int);
int main()
{
int i,b,c,left,right;
scanf("%d",&a);
for(i=0;i<a;i++)T[i].p=T[i].l=T[i].r=N;
for(i=0;i<a;i++){
scanf("%d %d %d",&c,&left,&right);
T[c].l=left;
T[c].r=right;
if(left!=N)T[left].p=c;
if(right!=N)T[right].p=c;
}
for(i=0;i<a;i++)if(T[i].p==N)b=i;
printf("Preorder\n");
pre(b);
printf("\n");
printf("Inorder\n");
in(b);
printf("\n");
printf("Postorder\n");
post(b);
printf("\n");
return 0;
}
void pre(int s)
{
if(s==N)return;
printf(" %d",s);
pre(T[s].l);
pre(T[s].r);
}
void in(int t)
{
if(t==N)return;
in(T[t].l);
printf(" %d",t);
in(T[t].r);
}
void post(int u)
{
if(u==N)return;
post(T[u].l);
post(T[u].r);
printf(" %d",u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102523/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102523/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [100000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%0 = load i32, ptr @a, align 4, !tbaa !5
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body7.preheader, label %for.end39
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond28.preheader: ; preds = %for.inc25
%cmp2967 = icmp sgt i32 %7, 0
br i1 %cmp2967, label %for.body30.preheader, label %for.end39
for.body30.preheader: ; preds = %for.cond28.preheader
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %7, 4
br i1 %3, label %for.end39.loopexit.unr-lcssa, label %for.body30.preheader.new
for.body30.preheader.new: ; preds = %for.body30.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body30
for.body7: ; preds = %for.body7.preheader, %for.inc25
%i.166 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %c, align 4, !tbaa !5
%idxprom9 = sext i32 %5 to i64
%l11 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 1
store i32 %4, ptr %l11, align 4, !tbaa !9
%6 = load i32, ptr %right, align 4, !tbaa !5
%r14 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 2
store i32 %6, ptr %r14, align 4, !tbaa !11
%cmp15.not = icmp eq i32 %4, -1
br i1 %cmp15.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%idxprom16 = sext i32 %4 to i64
%arrayidx17 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body7
%cmp19.not = icmp eq i32 %6, -1
br i1 %cmp19.not, label %for.inc25, label %if.then20
if.then20: ; preds = %if.end
%idxprom21 = sext i32 %6 to i64
%arrayidx22 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom21
store i32 %5, ptr %arrayidx22, align 4, !tbaa !12
br label %for.inc25
for.inc25: ; preds = %if.end, %if.then20
%inc26 = add nuw nsw i32 %i.166, 1
%7 = load i32, ptr @a, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc26, %7
br i1 %cmp6, label %for.body7, label %for.cond28.preheader, !llvm.loop !13
for.body30: ; preds = %for.body30, %for.body30.preheader.new
%indvars.iv = phi i64 [ 0, %for.body30.preheader.new ], [ %indvars.iv.next.3, %for.body30 ]
%b.069 = phi i32 [ undef, %for.body30.preheader.new ], [ %spec.select.3, %for.body30 ]
%niter = phi i64 [ 0, %for.body30.preheader.new ], [ %niter.next.3, %for.body30 ]
%arrayidx32 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx32, align 16, !tbaa !12
%cmp34 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp34, i32 %9, i32 %b.069
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx32.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx32.1, align 4, !tbaa !12
%cmp34.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp34.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx32.2 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx32.2, align 8, !tbaa !12
%cmp34.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp34.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx32.3 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx32.3, align 4, !tbaa !12
%cmp34.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp34.3, i32 %15, i32 %spec.select.2
%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.end39.loopexit.unr-lcssa, label %for.body30, !llvm.loop !15
for.end39.loopexit.unr-lcssa: ; preds = %for.body30, %for.body30.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body30.preheader ], [ %indvars.iv.next.3, %for.body30 ]
%b.069.unr = phi i32 [ undef, %for.body30.preheader ], [ %spec.select.3, %for.body30 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end39, label %for.body30.epil
for.body30.epil: ; preds = %for.end39.loopexit.unr-lcssa, %for.body30.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body30.epil ], [ %indvars.iv.unr, %for.end39.loopexit.unr-lcssa ]
%b.069.epil = phi i32 [ %spec.select.epil, %for.body30.epil ], [ %b.069.unr, %for.end39.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body30.epil ], [ 0, %for.end39.loopexit.unr-lcssa ]
%arrayidx32.epil = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx32.epil, align 4, !tbaa !12
%cmp34.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp34.epil, i32 %17, i32 %b.069.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end39, label %for.body30.epil, !llvm.loop !16
for.end39: ; preds = %for.end39.loopexit.unr-lcssa, %for.body30.epil, %entry, %for.cond28.preheader
%b.0.lcssa = phi i32 [ undef, %for.cond28.preheader ], [ undef, %entry ], [ %b.069.unr, %for.end39.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body30.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @pre(i32 noundef %b.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @in(i32 noundef %b.0.lcssa)
%putchar60 = call i32 @putchar(i32 10)
%puts61 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @post(i32 noundef %b.0.lcssa)
%putchar62 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @pre(i32 noundef %s) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %s, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%s.tr7 = phi i32 [ %1, %if.end ], [ %s, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %s.tr7)
%idxprom = sext i32 %s.tr7 to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
tail call void @pre(i32 noundef %0)
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @in(i32 noundef %t) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %t, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%t.tr7 = phi i32 [ %1, %if.end ], [ %t, %entry ]
%idxprom = sext i32 %t.tr7 to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
tail call void @in(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %t.tr7)
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @post(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
tail call void @post(i32 noundef %0)
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !11
tail call void @post(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#define NIL -1
struct node{
int parent, left, right;
};
struct node t[25];
void preorder(int);
void inorder(int);
void postorder(int);
int main(){
int n, vec, left ,right, root;
int i;
scanf("%d", &n);
for(i=0; i<n; i++){
t[i].parent =t[i].left =t[i].right = NIL;
}
for(i=0; i<n; i++){
scanf("%d %d %d", &vec, &left, &right);
t[vec].left=left; t[vec].right=right;
if(left!=NIL) t[left].parent=vec;
if(right!=NIL) t[right].parent=vec;
}
for(i=0; i<n; i++){
if(t[i].parent == NIL) root=i;
}
printf("Preorder\n");
preorder(root);
printf("\nInorder\n");
inorder(root);
printf("\nPostorder\n");
postorder(root);
printf("\n");
return 0;
}
void preorder(int x){
if(x==NIL) return;
printf(" %d", x);
preorder(t[x].left);
preorder(t[x].right);
}
void inorder(int x){
if(x==NIL) return ;
inorder(t[x].left);
printf(" %d", x);
inorder(t[x].right);
}
void postorder(int x){
if(x==NIL) return ;
postorder(t[x].left);
postorder(t[x].right);
printf(" %d", x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102567/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102567/source.c"
target datalayout = "e-m:e-p270: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.node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@t = dso_local local_unnamed_addr global [25 x %struct.node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%vec = alloca i32, align 4
%left = alloca i32, align 4
%right = 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 %vec) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body9.preheader, label %for.end41
for.body9.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
call void @llvm.memset.p0.i64(ptr nonnull align 16 @t, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body9
for.cond30.preheader: ; preds = %for.inc27
%cmp3165 = icmp sgt i32 %7, 0
br i1 %cmp3165, label %for.body32.preheader, label %for.end41
for.body32.preheader: ; preds = %for.cond30.preheader
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %7, 4
br i1 %3, label %for.end41.loopexit.unr-lcssa, label %for.body32.preheader.new
for.body32.preheader.new: ; preds = %for.body32.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body32
for.body9: ; preds = %for.body9.preheader, %for.inc27
%i.164 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vec, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %vec, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%left13 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom11, i32 1
store i32 %4, ptr %left13, align 4, !tbaa !9
%6 = load i32, ptr %right, align 4, !tbaa !5
%right16 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom11, i32 2
store i32 %6, ptr %right16, align 4, !tbaa !11
%cmp17.not = icmp eq i32 %4, -1
br i1 %cmp17.not, label %if.end, label %if.then
if.then: ; preds = %for.body9
%idxprom18 = sext i32 %4 to i64
%arrayidx19 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom18
store i32 %5, ptr %arrayidx19, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body9
%cmp21.not = icmp eq i32 %6, -1
br i1 %cmp21.not, label %for.inc27, label %if.then22
if.then22: ; preds = %if.end
%idxprom23 = sext i32 %6 to i64
%arrayidx24 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom23
store i32 %5, ptr %arrayidx24, align 4, !tbaa !12
br label %for.inc27
for.inc27: ; preds = %if.end, %if.then22
%inc28 = add nuw nsw i32 %i.164, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc28, %7
br i1 %cmp8, label %for.body9, label %for.cond30.preheader, !llvm.loop !13
for.body32: ; preds = %for.body32, %for.body32.preheader.new
%indvars.iv = phi i64 [ 0, %for.body32.preheader.new ], [ %indvars.iv.next.3, %for.body32 ]
%root.066 = phi i32 [ undef, %for.body32.preheader.new ], [ %spec.select.3, %for.body32 ]
%niter = phi i64 [ 0, %for.body32.preheader.new ], [ %niter.next.3, %for.body32 ]
%arrayidx34 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx34, align 16, !tbaa !12
%cmp36 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp36, i32 %9, i32 %root.066
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx34.1 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx34.1, align 4, !tbaa !12
%cmp36.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp36.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx34.2 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx34.2, align 8, !tbaa !12
%cmp36.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp36.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx34.3 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx34.3, align 4, !tbaa !12
%cmp36.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp36.3, i32 %15, i32 %spec.select.2
%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.end41.loopexit.unr-lcssa, label %for.body32, !llvm.loop !15
for.end41.loopexit.unr-lcssa: ; preds = %for.body32, %for.body32.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next.3, %for.body32 ]
%root.066.unr = phi i32 [ undef, %for.body32.preheader ], [ %spec.select.3, %for.body32 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end41, label %for.body32.epil
for.body32.epil: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body32.epil ], [ %indvars.iv.unr, %for.end41.loopexit.unr-lcssa ]
%root.066.epil = phi i32 [ %spec.select.epil, %for.body32.epil ], [ %root.066.unr, %for.end41.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body32.epil ], [ 0, %for.end41.loopexit.unr-lcssa ]
%arrayidx34.epil = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx34.epil, align 4, !tbaa !12
%cmp36.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp36.epil, i32 %17, i32 %root.066.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end41, label %for.body32.epil, !llvm.loop !16
for.end41: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil, %entry, %for.cond30.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond30.preheader ], [ undef, %entry ], [ %root.066.unr, %for.end41.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body32.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preorder(i32 noundef %root.0.lcssa)
%puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inorder(i32 noundef %root.0.lcssa)
%puts60 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vec) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %x, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr7 = phi i32 [ %1, %if.end ], [ %x, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr7)
%idxprom = sext i32 %x.tr7 to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
tail call void @preorder(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %x, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr7 = phi i32 [ %1, %if.end ], [ %x, %entry ]
%idxprom = sext i32 %x.tr7 to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
tail call void @inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr7)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %x to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
tail call void @postorder(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
tail call void @postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if (abs(a-b)<=c && c)
printf("?\n");
else if (a>b)
printf("+\n");
else if (a<b)
printf("-\n");
else
printf("0\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10261/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10261/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"-\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"+\00", align 1
@str.7 = private unnamed_addr constant [2 x i8] c"?\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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%3 = load i32, ptr %c, align 4
%cmp = icmp sle i32 %2, %3
%tobool = icmp ne i32 %3, 0
%or.cond = and i1 %tobool, %cmp
br i1 %or.cond, label %if.end12, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end12, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp slt i32 %0, %1
%str.5.str = select i1 %cmp6, ptr @str.5, ptr @str
br label %if.end12
if.end12: ; preds = %if.else5, %if.else, %entry
%str.6.sink = phi ptr [ @str.7, %entry ], [ @str.6, %if.else ], [ %str.5.str, %if.else5 ]
%puts15 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
struct Node {
int parent;
int left;
int right;
};
void setup(struct Node node[], int n) {
for (int i = 0; i < n; i++) {
node[i].parent = -1;
node[i].left = -1;
node[i].right = -1;
}
}
void input(struct Node node[], int n) {
int id, cleft , cright;
for (int i = 0; i < n; i++) {
scanf("%d", &id);
scanf("%d", &cleft);
scanf("%d", &cright);
node[id].left = cleft;
node[id].right = cright;
node[cleft].parent = id;
node[cright].parent = id;
}
}
int root_search(struct Node node[], int n) {
for (int i = 0; i < n; i++) {
if (node[i].parent == -1)
return i;
}
}
void preorder_tree_walk(struct Node node[], int id) {
printf(" %d", id);
if (node[id].left != -1)
preorder_tree_walk(node, node[id].left);
if (node[id].right != -1)
preorder_tree_walk(node, node[id].right);
}
void inorder_tree_walk(struct Node node[], int id) {
if (node[id].left == -1 && node[id].right == -1)
printf(" %d", id);
else {
if (node[id].left != -1)
inorder_tree_walk(node, node[id].left);
printf(" %d", id);
if (node[id].right != -1)
inorder_tree_walk(node, node[id].right);
}
}
void postorder_tree_walk(struct Node node[], int id) {
if (node[id].left != -1)
postorder_tree_walk(node, node[id].left);
if (node[id].right != -1)
postorder_tree_walk(node, node[id].right);
printf(" %d", id);
}
int main(void) {
int n, root;
struct Node node[25];
scanf("%d", &n);
setup(node, n);
input(node, n);
root = root_search(node, n);
printf("Preorder\n");
preorder_tree_walk(node, root);
printf("\nInorder\n");
inorder_tree_walk(node, root);
printf("\nPostorder\n");
postorder_tree_walk(node, root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102653/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102653/source.c"
target datalayout = "e-m:e-p270: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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.6 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @setup(ptr nocapture noundef writeonly %node, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = mul nuw nsw i64 %0, 12
tail call void @llvm.memset.p0.i64(ptr align 4 %node, i8 -1, i64 %1, i1 false), !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @input(ptr nocapture noundef writeonly %node, i32 noundef %n) local_unnamed_addr #2 {
entry:
%id = alloca i32, align 4
%cleft = alloca i32, align 4
%cright = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cleft) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cright) #7
%cmp14 = icmp sgt i32 %n, 0
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cright) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cleft) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #7
ret void
for.body: ; preds = %entry, %for.body
%i.015 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cleft)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cright)
%0 = load i32, ptr %cleft, align 4, !tbaa !5
%1 = load i32, ptr %id, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%left = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 1
store i32 %0, ptr %left, align 4, !tbaa !9
%2 = load i32, ptr %cright, align 4, !tbaa !5
%right = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 2
store i32 %2, ptr %right, align 4, !tbaa !11
%idxprom5 = sext i32 %0 to i64
%arrayidx6 = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom5
store i32 %1, ptr %arrayidx6, align 4, !tbaa !12
%idxprom7 = sext i32 %2 to i64
%arrayidx8 = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom7
store i32 %1, ptr %arrayidx8, align 4, !tbaa !12
%inc = add nuw nsw i32 %i.015, 1
%exitcond.not = icmp eq i32 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @root_search(ptr nocapture noundef readonly %node, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp5 = icmp sgt i32 %n, 0
br i1 %cmp5, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds %struct.Node, ptr %node, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp1 = icmp eq i32 %0, -1
br i1 %cmp1, label %cleanup.loopexit.split.loop.exit, label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !15
cleanup.loopexit.split.loop.exit: ; preds = %for.body
%1 = trunc i64 %indvars.iv to i32
br label %cleanup
cleanup: ; preds = %for.inc, %cleanup.loopexit.split.loop.exit, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %1, %cleanup.loopexit.split.loop.exit ], [ %n, %for.inc ]
ret i32 %i.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder_tree_walk(ptr nocapture noundef readonly %node, i32 noundef %id) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%id.tr = phi i32 [ %id, %entry ], [ %1, %if.end ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %id.tr)
%idxprom = sext i32 %id.tr to i64
%left = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder_tree_walk(ptr noundef nonnull %node, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%right = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
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 @inorder_tree_walk(ptr nocapture noundef readonly %node, i32 noundef %id) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%id.tr = phi i32 [ %id, %entry ], [ %2, %if.end ]
%idxprom = sext i32 %id.tr to i64
%left = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %land.lhs.true, label %if.then8
land.lhs.true: ; preds = %tailrecurse
%right = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp3, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %id.tr)
br label %if.end22
if.then8: ; preds = %tailrecurse
tail call void @inorder_tree_walk(ptr noundef nonnull %node, i32 noundef %0)
br label %if.end
if.end: ; preds = %land.lhs.true, %if.then8
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %id.tr)
%right15 = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 2
%2 = load i32, ptr %right15, align 4, !tbaa !11
%cmp16.not = icmp eq i32 %2, -1
br i1 %cmp16.not, label %if.end22, label %tailrecurse
if.end22: ; preds = %if.end, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postorder_tree_walk(ptr noundef %node, i32 noundef %id) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %id to i64
%left = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
tail call void @postorder_tree_walk(ptr noundef nonnull %node, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%right = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %if.then7
if.then7: ; preds = %if.end
tail call void @postorder_tree_walk(ptr noundef nonnull %node, i32 noundef %1)
br label %if.end11
if.end11: ; preds = %if.then7, %if.end
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %id)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%id.i = alloca i32, align 4
%cleft.i = alloca i32, align 4
%cright.i = alloca i32, align 4
%n = alloca i32, align 4
%node = alloca [25 x %struct.Node], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %node) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11.i = icmp sgt i32 %0, 0
br i1 %cmp11.i, label %setup.exit, label %root_search.exit
setup.exit: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
call void @llvm.memset.p0.i64(ptr nonnull align 16 %node, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id.i) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cleft.i) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cright.i) #7
br label %for.body.i
for.body.i: ; preds = %setup.exit, %for.body.i
%i.015.i = phi i32 [ %inc.i, %for.body.i ], [ 0, %setup.exit ]
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id.i)
%call1.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cleft.i)
%call2.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cright.i)
%3 = load i32, ptr %cleft.i, align 4, !tbaa !5
%4 = load i32, ptr %id.i, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%left.i = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom.i, i32 1
store i32 %3, ptr %left.i, align 4, !tbaa !9
%5 = load i32, ptr %cright.i, align 4, !tbaa !5
%right.i = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom.i, i32 2
store i32 %5, ptr %right.i, align 4, !tbaa !11
%idxprom5.i = sext i32 %3 to i64
%arrayidx6.i = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom5.i
store i32 %4, ptr %arrayidx6.i, align 4, !tbaa !12
%idxprom7.i = sext i32 %5 to i64
%arrayidx8.i = getelementptr inbounds %struct.Node, ptr %node, i64 %idxprom7.i
store i32 %4, ptr %arrayidx8.i, align 4, !tbaa !12
%inc.i = add nuw nsw i32 %i.015.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %0
br i1 %exitcond.not.i, label %input.exit, label %for.body.i, !llvm.loop !13
input.exit: ; preds = %for.body.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cright.i) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cleft.i) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id.i) #7
%cmp5.i = icmp sgt i32 %.pre, 0
br i1 %cmp5.i, label %for.body.preheader.i15, label %root_search.exit
for.body.preheader.i15: ; preds = %input.exit
%wide.trip.count.i = zext i32 %.pre to i64
br label %for.body.i16
for.body.i16: ; preds = %for.inc.i, %for.body.preheader.i15
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i15 ], [ %indvars.iv.next.i, %for.inc.i ]
%arrayidx.i = getelementptr inbounds %struct.Node, ptr %node, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !12
%cmp1.i = icmp eq i32 %6, -1
br i1 %cmp1.i, label %cleanup.loopexit.split.loop.exit.i, label %for.inc.i
for.inc.i: ; preds = %for.body.i16
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i17 = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i17, label %root_search.exit, label %for.body.i16, !llvm.loop !15
cleanup.loopexit.split.loop.exit.i: ; preds = %for.body.i16
%7 = trunc i64 %indvars.iv.i to i32
br label %root_search.exit
root_search.exit: ; preds = %for.inc.i, %entry, %input.exit, %cleanup.loopexit.split.loop.exit.i
%i.0.lcssa.i = phi i32 [ 0, %input.exit ], [ %7, %cleanup.loopexit.split.loop.exit.i ], [ 0, %entry ], [ %.pre, %for.inc.i ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preorder_tree_walk(ptr noundef nonnull %node, i32 noundef %i.0.lcssa.i)
%puts13 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @inorder_tree_walk(ptr noundef nonnull %node, i32 noundef %i.0.lcssa.i)
%puts14 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @postorder_tree_walk(ptr noundef nonnull %node, i32 noundef %i.0.lcssa.i)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %node) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
#define MAX 25
#define NIL -1
typedef struct{
int parent;
int left;
int right;
}node;
void preParse(int);
void inParse(int);
void postParse(int);
node t[MAX];
int main(){
int n, index, root;
int i;
scanf("%d", &n);
//初期化
for(i=0;i<n;i++){
t[i].parent = NIL;
}
for(i=0;i<n;i++){
scanf("%d", &index);
scanf("%d %d", &t[index].left, &t[index].right);
//右の子と左の子の親を設定
if(t[index].left != NIL) t[t[index].left].parent = index;
if(t[index].right != NIL) t[t[index].right].parent = index;
}
for(i=0;i<n;i++){
if(t[i].parent == NIL) root = i;
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
void preParse(int u){
if(u == NIL) return;
printf(" %d", u);
preParse(t[u].left);
preParse(t[u].right);
}
void inParse(int u){
if(u == NIL) return;
inParse(t[u].left);
printf(" %d", u);
inParse(t[u].right);
}
void postParse(int u){
if(u == NIL) return;
postParse(t[u].left);
postParse(t[u].right);
printf(" %d", u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102697/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102697/source.c"
target datalayout = "e-m:e-p270: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.node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@t = dso_local global [25 x %struct.node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%index = 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 %index) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body.preheader, label %for.end46
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%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.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp68, label %for.body3, label %for.end46
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond35.preheader: ; preds = %for.inc32
%cmp3672 = icmp sgt i32 %7, 0
br i1 %cmp3672, label %for.body37.preheader, label %for.end46
for.body37.preheader: ; preds = %for.cond35.preheader
%wide.trip.count81 = zext i32 %7 to i64
%xtraiter85 = and i64 %wide.trip.count81, 3
%2 = icmp ult i32 %7, 4
br i1 %2, label %for.end46.loopexit.unr-lcssa, label %for.body37.preheader.new
for.body37.preheader.new: ; preds = %for.body37.preheader
%unroll_iter89 = and i64 %wide.trip.count81, 4294967292
br label %for.body37
for.body3: ; preds = %for.cond1.preheader, %for.inc32
%i.171 = phi i32 [ %inc33, %for.inc32 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %index)
%3 = load i32, ptr %index, align 4, !tbaa !5
%idxprom5 = sext i32 %3 to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom5, i32 1
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom5, i32 2
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %index, align 4, !tbaa !5
%idxprom10 = sext i32 %4 to i64
%left12 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom10, i32 1
%5 = load i32, ptr %left12, align 4, !tbaa !15
%cmp13.not = icmp eq i32 %5, -1
br i1 %cmp13.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%right22 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom10, i32 2
%6 = load i32, ptr %right22, align 4, !tbaa !16
%cmp23.not = icmp eq i32 %6, -1
br i1 %cmp23.not, label %for.inc32, label %if.then24
if.then24: ; preds = %if.end
%idxprom28 = sext i32 %6 to i64
%arrayidx29 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom28
store i32 %4, ptr %arrayidx29, align 4, !tbaa !9
br label %for.inc32
for.inc32: ; preds = %if.end, %if.then24
%inc33 = add nuw nsw i32 %i.171, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc33, %7
br i1 %cmp2, label %for.body3, label %for.cond35.preheader, !llvm.loop !17
for.body37: ; preds = %for.body37, %for.body37.preheader.new
%indvars.iv78 = phi i64 [ 0, %for.body37.preheader.new ], [ %indvars.iv.next79.3, %for.body37 ]
%root.073 = phi i32 [ undef, %for.body37.preheader.new ], [ %spec.select.3, %for.body37 ]
%niter90 = phi i64 [ 0, %for.body37.preheader.new ], [ %niter90.next.3, %for.body37 ]
%arrayidx39 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv78
%8 = load i32, ptr %arrayidx39, align 16, !tbaa !9
%cmp41 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv78 to i32
%spec.select = select i1 %cmp41, i32 %9, i32 %root.073
%indvars.iv.next79 = or i64 %indvars.iv78, 1
%arrayidx39.1 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next79
%10 = load i32, ptr %arrayidx39.1, align 4, !tbaa !9
%cmp41.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next79 to i32
%spec.select.1 = select i1 %cmp41.1, i32 %11, i32 %spec.select
%indvars.iv.next79.1 = or i64 %indvars.iv78, 2
%arrayidx39.2 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next79.1
%12 = load i32, ptr %arrayidx39.2, align 8, !tbaa !9
%cmp41.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next79.1 to i32
%spec.select.2 = select i1 %cmp41.2, i32 %13, i32 %spec.select.1
%indvars.iv.next79.2 = or i64 %indvars.iv78, 3
%arrayidx39.3 = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv.next79.2
%14 = load i32, ptr %arrayidx39.3, align 4, !tbaa !9
%cmp41.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next79.2 to i32
%spec.select.3 = select i1 %cmp41.3, i32 %15, i32 %spec.select.2
%indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
%niter90.next.3 = add i64 %niter90, 4
%niter90.ncmp.3 = icmp eq i64 %niter90.next.3, %unroll_iter89
br i1 %niter90.ncmp.3, label %for.end46.loopexit.unr-lcssa, label %for.body37, !llvm.loop !18
for.end46.loopexit.unr-lcssa: ; preds = %for.body37, %for.body37.preheader
%indvars.iv78.unr = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next79.3, %for.body37 ]
%root.073.unr = phi i32 [ undef, %for.body37.preheader ], [ %spec.select.3, %for.body37 ]
%lcmp.mod87.not = icmp eq i64 %xtraiter85, 0
br i1 %lcmp.mod87.not, label %for.end46, label %for.body37.epil
for.body37.epil: ; preds = %for.end46.loopexit.unr-lcssa, %for.body37.epil
%indvars.iv78.epil = phi i64 [ %indvars.iv.next79.epil, %for.body37.epil ], [ %indvars.iv78.unr, %for.end46.loopexit.unr-lcssa ]
%root.073.epil = phi i32 [ %spec.select.epil, %for.body37.epil ], [ %root.073.unr, %for.end46.loopexit.unr-lcssa ]
%epil.iter86 = phi i64 [ %epil.iter86.next, %for.body37.epil ], [ 0, %for.end46.loopexit.unr-lcssa ]
%arrayidx39.epil = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %indvars.iv78.epil
%16 = load i32, ptr %arrayidx39.epil, align 4, !tbaa !9
%cmp41.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv78.epil to i32
%spec.select.epil = select i1 %cmp41.epil, i32 %17, i32 %root.073.epil
%indvars.iv.next79.epil = add nuw nsw i64 %indvars.iv78.epil, 1
%epil.iter86.next = add i64 %epil.iter86, 1
%epil.iter86.cmp.not = icmp eq i64 %epil.iter86.next, %xtraiter85
br i1 %epil.iter86.cmp.not, label %for.end46, label %for.body37.epil, !llvm.loop !19
for.end46: ; preds = %for.end46.loopexit.unr-lcssa, %for.body37.epil, %entry, %for.cond1.preheader, %for.cond35.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond35.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.073.unr, %for.end46.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body37.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar65 = call i32 @putchar(i32 10)
%puts66 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar67 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %index) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @preParse(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @postParse(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
int main()
{
int x,y,z;
while(scanf("%d%d%d",&x,&y,&z)!=EOF){
if(x>y+z)
printf("+\n");
else if(y>x+z)
printf("-\n");
else if(x==y&&z==0)
printf("0\n");
else
printf("?\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10274/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10274/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [2 x i8] c"?\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"-\00", align 1
@str.7 = private unnamed_addr constant [2 x i8] c"+\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 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 %z) #4
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%cmp.not21 = icmp eq i32 %call20, -1
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end15
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%2 = load i32, ptr %z, align 4
%add = add nsw i32 %2, %1
%cmp1 = icmp sgt i32 %0, %add
br i1 %cmp1, label %if.end15, label %if.else
if.else: ; preds = %while.body
%add3 = add nsw i32 %2, %0
%cmp4 = icmp sgt i32 %1, %add3
br i1 %cmp4, label %if.end15, label %if.else7
if.else7: ; preds = %if.else
%cmp8 = icmp eq i32 %0, %1
%cmp9 = icmp eq i32 %2, 0
%or.cond = and i1 %cmp8, %cmp9
%str.5.str = select i1 %or.cond, ptr @str.5, ptr @str
br label %if.end15
if.end15: ; preds = %if.else7, %if.else, %while.body
%str.6.sink = phi ptr [ @str.7, %while.body ], [ @str.6, %if.else ], [ %str.5.str, %if.else7 ]
%puts18 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
/* ALDS1_7_C:TreeWalk */
/* 20181125 AOJ */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#define N 25
#define NIL -1
typedef struct {
int parent;
int left;
int right;
} Tree;
void Preorder(Tree *node, int id);
void Inorder(Tree *node, int id);
void Postorder(Tree *node, int id);
int main(void) {
Tree *node = (Tree *)malloc(sizeof(Tree) * N);
int i, n, id, left, right, root;
scanf("%d", &n);
for(i = 0; i < n; i++) node[i].parent = NIL;
for(i = 0; i < n; i++) {
scanf("%d %d %d", &id, &left, &right);
node[id].left = left;
node[id].right = right;
if(left != NIL) node[left].parent = id;
if(right != NIL) node[right].parent = id;
}
for(i = 0; i < n; i++) {
if(node[i].parent == NIL) {
root = i;
break;
}
}
printf("Preorder\n");
Preorder(node, root);
printf("\n");
printf("Inorder\n");
Inorder(node, root);
printf("\n");
printf("Postorder\n");
Postorder(node, root);
printf("\n");
return 0;
}
void Preorder(Tree *node, int id) {
if(id == NIL) return;
printf(" %d", id);
Preorder(node, node[id].left);
Preorder(node, node[id].right);
}
void Inorder(Tree *node, int id) {
if(id == NIL) return;
Inorder(node, node[id].left);
printf(" %d", id);
Inorder(node, node[id].right);
}
void Postorder(Tree *node, int id) {
if(id == NIL) return;
Postorder(node, node[id].left);
Postorder(node, node[id].right);
printf(" %d", id);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102790/source.c"
target datalayout = "e-m:e-p270: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.Tree = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
%call = tail call noalias dereferenceable_or_null(300) ptr @malloc(i64 noundef 300) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body.preheader, label %for.end36
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond2.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond2.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond2.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond2.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond2.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond2.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%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.cond2.preheader, label %for.body.epil, !llvm.loop !11
for.cond2.preheader: ; preds = %for.body.epil, %for.cond2.preheader.unr-lcssa
br i1 %cmp66, label %for.body4, label %for.end36
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 4, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 4, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%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.cond2.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond25.preheader: ; preds = %for.inc22
%cmp2670 = icmp sgt i32 %5, 0
br i1 %cmp2670, label %for.body27.preheader, label %for.end36
for.body27.preheader: ; preds = %for.cond25.preheader
%wide.trip.count79 = zext i32 %5 to i64
br label %for.body27
for.body4: ; preds = %for.cond2.preheader, %for.inc22
%i.169 = phi i32 [ %inc23, %for.inc22 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%2 = load i32, ptr %left, align 4, !tbaa !5
%3 = load i32, ptr %id, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%left8 = getelementptr inbounds %struct.Tree, ptr %call, i64 %idxprom6, i32 1
store i32 %2, ptr %left8, align 4, !tbaa !15
%4 = load i32, ptr %right, align 4, !tbaa !5
%right11 = getelementptr inbounds %struct.Tree, ptr %call, i64 %idxprom6, i32 2
store i32 %4, ptr %right11, align 4, !tbaa !16
%cmp12.not = icmp eq i32 %2, -1
br i1 %cmp12.not, label %if.end, label %if.then
if.then: ; preds = %for.body4
%idxprom13 = sext i32 %2 to i64
%arrayidx14 = getelementptr inbounds %struct.Tree, ptr %call, i64 %idxprom13
store i32 %3, ptr %arrayidx14, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body4
%cmp16.not = icmp eq i32 %4, -1
br i1 %cmp16.not, label %for.inc22, label %if.then17
if.then17: ; preds = %if.end
%idxprom18 = sext i32 %4 to i64
%arrayidx19 = getelementptr inbounds %struct.Tree, ptr %call, i64 %idxprom18
store i32 %3, ptr %arrayidx19, align 4, !tbaa !9
br label %for.inc22
for.inc22: ; preds = %if.end, %if.then17
%inc23 = add nuw nsw i32 %i.169, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc23, %5
br i1 %cmp3, label %for.body4, label %for.cond25.preheader, !llvm.loop !17
for.body27: ; preds = %for.body27.preheader, %for.inc34
%indvars.iv76 = phi i64 [ 0, %for.body27.preheader ], [ %indvars.iv.next77, %for.inc34 ]
%arrayidx29 = getelementptr inbounds %struct.Tree, ptr %call, i64 %indvars.iv76
%6 = load i32, ptr %arrayidx29, align 4, !tbaa !9
%cmp31 = icmp eq i32 %6, -1
br i1 %cmp31, label %for.end36.loopexit.split.loop.exit, label %for.inc34
for.inc34: ; preds = %for.body27
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
br i1 %exitcond80.not, label %for.end36, label %for.body27, !llvm.loop !18
for.end36.loopexit.split.loop.exit: ; preds = %for.body27
%7 = trunc i64 %indvars.iv76 to i32
br label %for.end36
for.end36: ; preds = %for.inc34, %for.end36.loopexit.split.loop.exit, %entry, %for.cond2.preheader, %for.cond25.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %7, %for.end36.loopexit.split.loop.exit ], [ %5, %for.inc34 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(ptr noundef %call, i32 noundef %i.2.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts62 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(ptr noundef %call, i32 noundef %i.2.lcssa)
%putchar63 = call i32 @putchar(i32 10)
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(ptr noundef %call, i32 noundef %i.2.lcssa)
%putchar65 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(ptr nocapture noundef readonly %node, i32 noundef %id) local_unnamed_addr #0 {
entry:
%cmp9 = icmp eq i32 %id, -1
br i1 %cmp9, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%id.tr10 = phi i32 [ %1, %if.end ], [ %id, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id.tr10)
%idxprom = sext i32 %id.tr10 to i64
%left = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @Preorder(ptr noundef %node, i32 noundef %0)
%right = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(ptr nocapture noundef readonly %node, i32 noundef %id) local_unnamed_addr #0 {
entry:
%cmp9 = icmp eq i32 %id, -1
br i1 %cmp9, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%id.tr10 = phi i32 [ %1, %if.end ], [ %id, %entry ]
%idxprom = sext i32 %id.tr10 to i64
%left = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @Inorder(ptr noundef %node, i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id.tr10)
%right = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(ptr noundef %node, i32 noundef %id) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %id, -1
br i1 %cmp, label %common.ret9, label %if.end
common.ret9: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %id to i64
%left = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @Postorder(ptr noundef %node, i32 noundef %0)
%right = getelementptr inbounds %struct.Tree, ptr %node, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @Postorder(ptr noundef %node, i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id)
br label %common.ret9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-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 allocsize(0) }
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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
|
#include<stdio.h>
#define NIL -1
typedef struct{
int parent;
int left;
int right;
} Tree;
Tree t[10000];
void Preorder(int i){
printf(" %d",i);
if(t[i].left!=NIL){
Preorder(t[i].left);
}
if(t[i].right!=NIL){
Preorder(t[i].right);
}
}
void Inorder(int i){
if(t[i].left!=NIL && t[i].right!=NIL){
Inorder(t[i].left);
printf(" %d",i);
Inorder(t[i].right);
}
if(t[i].left!=NIL && t[i].right==NIL){
Inorder(t[i].left);
printf(" %d",i);
}
if(t[i].right!=NIL && t[i].left==NIL){
printf(" %d",i);
Inorder(t[i].right);
}
if(t[i].left==NIL && t[i].right==NIL) printf(" %d",i);
}
void Postorder(int i){
if(t[i].left==NIL && t[i].right==NIL){
printf(" %d",i);
}
else if(t[i].left!=NIL && t[i].right==NIL){
Postorder(t[i].left);
printf(" %d",i);
}
else if(t[i].right!=NIL && t[i].left==NIL){
Postorder(t[i].right);
printf(" %d",i);
}
else{
Postorder(t[i].left);
Postorder(t[i].right);
printf(" %d",i);
}
}
int main(){
int i,id,j,n,k,num,l,r;
int depth=0,degree=0,height=0;
scanf("%d",&n);
for(i=0;i<n;i++){
t[i].parent=NIL;
}
for(i=0;i<n;i++){
scanf("%d%d%d",&id,&l,&r);
t[id].left=l;
t[id].right=r;
if(l!=NIL && r!=NIL){
t[l].parent=id;
t[r].parent=id;
}
else if(l!=NIL && r==NIL){
t[l].parent=id;
}
else if(l==NIL && r!=NIL){
t[r].parent=id;
}
}
for(j=t[0].parent;t[j].parent!=NIL;j=t[j].parent);
printf("Preorder\n");
Preorder(j);
printf("\nInorder\n");
Inorder(j);
printf("\nPostorder\n");
Postorder(j);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102840/source.c"
target datalayout = "e-m:e-p270: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.Tree = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@t = dso_local local_unnamed_addr global [10000 x %struct.Tree] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %i) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%i.tr = phi i32 [ %i, %entry ], [ %1, %if.end ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.tr)
%idxprom = sext i32 %i.tr to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @Preorder(i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end24, label %land.lhs.true
land.lhs.true: ; preds = %entry
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
%cmp3.not = icmp eq i32 %1, -1
br i1 %cmp3.not, label %if.then19, label %if.end
if.end: ; preds = %land.lhs.true
tail call void @Inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
%2 = load i32, ptr %right, align 4, !tbaa !10
tail call void @Inorder(i32 noundef %2)
%.pr.pre = load i32, ptr %left, align 4, !tbaa !5
%cmp13.not = icmp eq i32 %.pr.pre, -1
br i1 %cmp13.not, label %if.end24, label %land.lhs.true14
land.lhs.true14: ; preds = %if.end
%.pr = load i32, ptr %right, align 4, !tbaa !10
%cmp18 = icmp eq i32 %.pr, -1
br i1 %cmp18, label %if.then19, label %if.end24
if.then19: ; preds = %land.lhs.true, %land.lhs.true14
%.pr7780 = phi i32 [ %.pr.pre, %land.lhs.true14 ], [ %0, %land.lhs.true ]
tail call void @Inorder(i32 noundef %.pr7780)
%call23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
%.pr69.pre72.pre = load i32, ptr %left, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %entry, %if.then19, %land.lhs.true14, %if.end
%.pr69.pre72 = phi i32 [ -1, %entry ], [ %.pr69.pre72.pre, %if.then19 ], [ %.pr.pre, %land.lhs.true14 ], [ -1, %if.end ]
%right27 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%3 = load i32, ptr %right27, align 4, !tbaa !10
%cmp28.not = icmp eq i32 %3, -1
br i1 %cmp28.not, label %if.end39, label %land.lhs.true29
land.lhs.true29: ; preds = %if.end24
%cmp33 = icmp eq i32 %.pr69.pre72, -1
br i1 %cmp33, label %if.then34, label %if.end51
if.then34: ; preds = %land.lhs.true29
%call35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
%4 = load i32, ptr %right27, align 4, !tbaa !10
tail call void @Inorder(i32 noundef %4)
%.pr69.pre = load i32, ptr %left, align 4, !tbaa !5
br label %if.end39
if.end39: ; preds = %if.then34, %if.end24
%.pr69 = phi i32 [ %.pr69.pre, %if.then34 ], [ %.pr69.pre72, %if.end24 ]
%cmp43 = icmp eq i32 %.pr69, -1
br i1 %cmp43, label %land.lhs.true44, label %if.end51
land.lhs.true44: ; preds = %if.end39
%5 = load i32, ptr %right27, align 4, !tbaa !10
%cmp48 = icmp eq i32 %5, -1
br i1 %cmp48, label %if.then49, label %if.end51
if.then49: ; preds = %land.lhs.true44
%call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
br label %if.end51
if.end51: ; preds = %land.lhs.true29, %if.then49, %land.lhs.true44, %if.end39
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
%cmp = icmp eq i32 %0, -1
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp, label %land.lhs.true, label %land.lhs.true8
land.lhs.true: ; preds = %entry
br i1 %cmp3, label %common.ret, label %common.ret.sink.split
land.lhs.true8: ; preds = %entry
tail call void @Postorder(i32 noundef %0)
br i1 %cmp3, label %common.ret, label %if.else33
common.ret.sink.split: ; preds = %land.lhs.true, %if.else33
%.sink = phi i32 [ %2, %if.else33 ], [ %1, %land.lhs.true ]
tail call void @Postorder(i32 noundef %.sink)
br label %common.ret
common.ret: ; preds = %common.ret.sink.split, %land.lhs.true, %land.lhs.true8
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
ret void
if.else33: ; preds = %land.lhs.true8
%2 = load i32, ptr %right, align 4, !tbaa !10
br label %common.ret.sink.split
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%id = alloca i32, align 4
%n = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body.preheader, label %for.end36
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp66, label %for.body3, label %for.end36
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.body3: ; preds = %for.cond1.preheader, %for.inc34
%i.169 = phi i32 [ %inc35, %for.inc34 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %id, ptr noundef nonnull %l, ptr noundef nonnull %r)
%2 = load i32, ptr %l, align 4, !tbaa !11
%3 = load i32, ptr %id, align 4, !tbaa !11
%idxprom5 = sext i32 %3 to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom5, i32 1
store i32 %2, ptr %left, align 4, !tbaa !5
%4 = load i32, ptr %r, align 4
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom5, i32 2
store i32 %4, ptr %right, align 4, !tbaa !10
%cmp9 = icmp ne i32 %2, -1
%cmp10 = icmp ne i32 %4, -1
%or.cond = select i1 %cmp9, i1 %cmp10, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body3
%idxprom11 = sext i32 %2 to i64
%arrayidx12 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom11
store i32 %3, ptr %arrayidx12, align 4, !tbaa !12
br label %for.inc34.sink.split
if.else: ; preds = %for.body3
%cmp19 = icmp eq i32 %4, -1
%or.cond52 = select i1 %cmp9, i1 %cmp19, i1 false
br i1 %or.cond52, label %for.inc34.sink.split, label %if.else24
if.else24: ; preds = %if.else
%cmp25 = icmp eq i32 %2, -1
%or.cond53 = select i1 %cmp25, i1 %cmp10, i1 false
br i1 %or.cond53, label %for.inc34.sink.split, label %for.inc34
for.inc34.sink.split: ; preds = %if.else24, %if.else, %if.then
%.sink = phi i32 [ %4, %if.then ], [ %2, %if.else ], [ %4, %if.else24 ]
%idxprom14 = sext i32 %.sink to i64
%arrayidx15 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom14
store i32 %3, ptr %arrayidx15, align 4, !tbaa !12
br label %for.inc34
for.inc34: ; preds = %for.inc34.sink.split, %if.else24
%inc35 = add nuw nsw i32 %i.169, 1
%5 = load i32, ptr %n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc35, %5
br i1 %cmp2, label %for.body3, label %for.end36, !llvm.loop !17
for.end36: ; preds = %for.inc34, %entry, %for.cond1.preheader
%6 = load i32, ptr @t, align 16, !tbaa !12
br label %for.cond37
for.cond37: ; preds = %for.cond37, %for.end36
%j.0 = phi i32 [ %6, %for.end36 ], [ %7, %for.cond37 ]
%idxprom38 = sext i32 %j.0 to i64
%arrayidx39 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom38
%7 = load i32, ptr %arrayidx39, align 4, !tbaa !12
%cmp41.not = icmp eq i32 %7, -1
br i1 %cmp41.not, label %for.end47, label %for.cond37, !llvm.loop !18
for.end47: ; preds = %for.cond37
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %j.0)
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %j.0)
%puts65 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %j.0)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
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, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
|
#include <stdio.h>
int main(){
int n,m,k,i,j,t,rx=10,ry=10,tx,ty,ta[21][21],z;
char d,x;
while(1){
rx=10;
ry=10;
scanf("%d",&n);
if(n==0){
break;
}
for(i=0;i<21;i++){
for(j=0;j<21;j++){
ta[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&tx,&ty);
ta[tx][ty]=1;
}
ta[10][10]=0;
scanf("%d",&m);
scanf("%c",&x);
for(i=0;i<m;i++){
scanf("%c %d",&d,&z);
scanf("%c",&x);
switch(d){
case 'N':
for(j=0;j<z;ry++,j++){
ta[rx][ry]=0;
}
break;
case 'S':
for(j=0;j<z;ry--,j++){
ta[rx][ry]=0;
}
break;
case 'E':
for(j=0;j<z;rx++,j++){
ta[rx][ry]=0;
}
break;
case 'W':
for(j=0;j<z;rx--,j++){
ta[rx][ry]=0;
}
break;
}
ta[rx][ry]=0;
}
k=0;
for(i=0;i<21;i++){
for(j=0;j<21;j++){
if(ta[i][j]==1){
k=1;
}
}
}
if(k==0){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102899/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102899/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%tx = alloca i32, align 4
%ty = alloca i32, align 4
%ta = alloca [21 x [21 x i32]], align 16
%z = alloca i32, align 4
%d = alloca i8, align 1
%x = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tx) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ty) #6
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %ta) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #6
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %d) #6
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %x) #6
%call180 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp181 = icmp eq i32 %0, 0
br i1 %cmp181, label %while.end, label %for.cond.preheader.lr.ph
for.cond.preheader.lr.ph: ; preds = %entry
%arrayidx22 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 10, i64 10
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %for.end108
%1 = phi i32 [ %0, %for.cond.preheader.lr.ph ], [ %84, %for.end108 ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %ta, i8 0, i64 1764, i1 false), !tbaa !5
%cmp11155 = icmp sgt i32 %1, 0
br i1 %cmp11155, label %for.body12, label %for.end20
for.body12: ; preds = %for.cond.preheader, %for.body12
%i.1156 = phi i32 [ %inc19, %for.body12 ], [ 0, %for.cond.preheader ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tx, ptr noundef nonnull %ty)
%2 = load i32, ptr %tx, align 4, !tbaa !5
%idxprom14 = sext i32 %2 to i64
%3 = load i32, ptr %ty, align 4, !tbaa !5
%idxprom16 = sext i32 %3 to i64
%arrayidx17 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %idxprom14, i64 %idxprom16
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
%inc19 = add nuw nsw i32 %i.1156, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp slt i32 %inc19, %4
br i1 %cmp11, label %for.body12, label %for.end20, !llvm.loop !9
for.end20: ; preds = %for.body12, %for.cond.preheader
store i32 0, ptr %arrayidx22, align 16, !tbaa !5
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x)
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp26172 = icmp sgt i32 %5, 0
br i1 %cmp26172, label %for.body27, label %for.cond91.preheader.preheader
for.body27: ; preds = %for.end20, %sw.epilog
%ry.0175 = phi i32 [ %ry.3, %sw.epilog ], [ 10, %for.end20 ]
%rx.0174 = phi i32 [ %rx.3, %sw.epilog ], [ 10, %for.end20 ]
%i.2173 = phi i32 [ %inc85, %sw.epilog ], [ 0, %for.end20 ]
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %d, ptr noundef nonnull %z)
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x)
%6 = load i8, ptr %d, align 1, !tbaa !11
%conv = sext i8 %6 to i32
switch i32 %conv, label %sw.epilog [
i32 78, label %for.cond30.preheader
i32 83, label %for.cond43.preheader
i32 69, label %for.cond55.preheader
i32 87, label %for.cond68.preheader
]
for.cond68.preheader: ; preds = %for.body27
%7 = load i32, ptr %z, align 4, !tbaa !5
%cmp69157 = icmp sgt i32 %7, 0
br i1 %cmp69157, label %for.body71.lr.ph, label %sw.epilog
for.body71.lr.ph: ; preds = %for.cond68.preheader
%idxprom74 = sext i32 %ry.0175 to i64
%8 = sext i32 %rx.0174 to i64
%xtraiter = and i32 %7, 3
%9 = icmp ult i32 %7, 4
br i1 %9, label %sw.epilog.loopexit184.unr-lcssa, label %for.body71.lr.ph.new
for.body71.lr.ph.new: ; preds = %for.body71.lr.ph
%unroll_iter = and i32 %7, -4
br label %for.body71
for.cond55.preheader: ; preds = %for.body27
%10 = load i32, ptr %z, align 4, !tbaa !5
%cmp56160 = icmp sgt i32 %10, 0
br i1 %cmp56160, label %for.body58.lr.ph, label %sw.epilog
for.body58.lr.ph: ; preds = %for.cond55.preheader
%idxprom61 = sext i32 %ry.0175 to i64
%11 = sext i32 %rx.0174 to i64
%xtraiter213 = and i32 %10, 3
%12 = icmp ult i32 %10, 4
br i1 %12, label %sw.epilog.loopexit183.unr-lcssa, label %for.body58.lr.ph.new
for.body58.lr.ph.new: ; preds = %for.body58.lr.ph
%unroll_iter217 = and i32 %10, -4
br label %for.body58
for.cond43.preheader: ; preds = %for.body27
%13 = load i32, ptr %z, align 4, !tbaa !5
%cmp44164 = icmp sgt i32 %13, 0
br i1 %cmp44164, label %for.body46.lr.ph, label %sw.epilog
for.body46.lr.ph: ; preds = %for.cond43.preheader
%idxprom47 = sext i32 %rx.0174 to i64
%14 = mul nsw i64 %idxprom47, 84
%15 = sext i32 %ry.0175 to i64
%16 = shl nsw i64 %15, 2
%17 = add nsw i64 %14, %16
%18 = add nsw i32 %13, -1
%19 = zext i32 %18 to i64
%20 = shl nuw nsw i64 %19, 2
%21 = sub nsw i64 %17, %20
%scevgep = getelementptr i8, ptr %ta, i64 %21
%22 = zext i32 %13 to i64
%23 = shl nuw nsw i64 %22, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %23, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %13, 4
br i1 %min.iters.check, label %for.body46.preheader, label %vector.ph
vector.ph: ; preds = %for.body46.lr.ph
%n.vec = and i32 %13, -4
%24 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %15, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %24, %vector.ph ], [ %25, %vector.body ]
%vec.phi209 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
%25 = add <2 x i64> %vec.phi, <i64 -1, i64 -1>
%26 = add <2 x i64> %vec.phi209, <i64 -1, i64 -1>
%index.next = add nuw i32 %index, 4
%27 = icmp eq i32 %index.next, %n.vec
br i1 %27, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %26, %25
%28 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i32 %13, %n.vec
br i1 %cmp.n, label %sw.epilog.loopexit182, label %for.body46.preheader
for.body46.preheader: ; preds = %for.body46.lr.ph, %middle.block
%indvars.iv192.ph = phi i64 [ %15, %for.body46.lr.ph ], [ %28, %middle.block ]
%j.2165.ph = phi i32 [ 0, %for.body46.lr.ph ], [ %n.vec, %middle.block ]
br label %for.body46
for.cond30.preheader: ; preds = %for.body27
%29 = load i32, ptr %z, align 4, !tbaa !5
%cmp31168 = icmp sgt i32 %29, 0
br i1 %cmp31168, label %for.body33.lr.ph, label %sw.epilog
for.body33.lr.ph: ; preds = %for.cond30.preheader
%idxprom34 = sext i32 %rx.0174 to i64
%30 = mul nsw i64 %idxprom34, 84
%31 = sext i32 %ry.0175 to i64
%32 = shl nsw i64 %31, 2
%33 = getelementptr i8, ptr %ta, i64 %30
%scevgep196 = getelementptr i8, ptr %33, i64 %32
%34 = zext i32 %29 to i64
%35 = shl nuw nsw i64 %34, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep196, i8 0, i64 %35, i1 false), !tbaa !5
%36 = add i32 %ry.0175, %29
br label %sw.epilog
for.body46: ; preds = %for.body46.preheader, %for.body46
%indvars.iv192 = phi i64 [ %indvars.iv.next193, %for.body46 ], [ %indvars.iv192.ph, %for.body46.preheader ]
%j.2165 = phi i32 [ %inc52, %for.body46 ], [ %j.2165.ph, %for.body46.preheader ]
%indvars.iv.next193 = add nsw i64 %indvars.iv192, -1
%inc52 = add nuw nsw i32 %j.2165, 1
%exitcond195.not = icmp eq i32 %inc52, %13
br i1 %exitcond195.not, label %sw.epilog.loopexit182, label %for.body46, !llvm.loop !15
for.body58: ; preds = %for.body58, %for.body58.lr.ph.new
%indvars.iv188 = phi i64 [ %11, %for.body58.lr.ph.new ], [ %indvars.iv.next189.3, %for.body58 ]
%niter218 = phi i32 [ 0, %for.body58.lr.ph.new ], [ %niter218.next.3, %for.body58 ]
%arrayidx62 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv188, i64 %idxprom61
store i32 0, ptr %arrayidx62, align 4, !tbaa !5
%indvars.iv.next189 = add nsw i64 %indvars.iv188, 1
%arrayidx62.1 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next189, i64 %idxprom61
store i32 0, ptr %arrayidx62.1, align 4, !tbaa !5
%indvars.iv.next189.1 = add nsw i64 %indvars.iv188, 2
%arrayidx62.2 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next189.1, i64 %idxprom61
store i32 0, ptr %arrayidx62.2, align 4, !tbaa !5
%indvars.iv.next189.2 = add nsw i64 %indvars.iv188, 3
%arrayidx62.3 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next189.2, i64 %idxprom61
store i32 0, ptr %arrayidx62.3, align 4, !tbaa !5
%indvars.iv.next189.3 = add nsw i64 %indvars.iv188, 4
%niter218.next.3 = add i32 %niter218, 4
%niter218.ncmp.3 = icmp eq i32 %niter218.next.3, %unroll_iter217
br i1 %niter218.ncmp.3, label %sw.epilog.loopexit183.unr-lcssa, label %for.body58, !llvm.loop !16
for.body71: ; preds = %for.body71, %for.body71.lr.ph.new
%indvars.iv = phi i64 [ %8, %for.body71.lr.ph.new ], [ %indvars.iv.next.3, %for.body71 ]
%niter = phi i32 [ 0, %for.body71.lr.ph.new ], [ %niter.next.3, %for.body71 ]
%arrayidx75 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv, i64 %idxprom74
store i32 0, ptr %arrayidx75, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx75.1 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next, i64 %idxprom74
store i32 0, ptr %arrayidx75.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, -2
%arrayidx75.2 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next.1, i64 %idxprom74
store i32 0, ptr %arrayidx75.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nsw i64 %indvars.iv, -3
%arrayidx75.3 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.next.2, i64 %idxprom74
store i32 0, ptr %arrayidx75.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nsw i64 %indvars.iv, -4
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %sw.epilog.loopexit184.unr-lcssa, label %for.body71, !llvm.loop !17
sw.epilog.loopexit182: ; preds = %for.body46, %middle.block
%indvars.iv.next193.lcssa = phi i64 [ %28, %middle.block ], [ %indvars.iv.next193, %for.body46 ]
%37 = trunc i64 %indvars.iv.next193.lcssa to i32
br label %sw.epilog
sw.epilog.loopexit183.unr-lcssa: ; preds = %for.body58, %for.body58.lr.ph
%indvars.iv.next189.lcssa.ph = phi i64 [ undef, %for.body58.lr.ph ], [ %indvars.iv.next189.3, %for.body58 ]
%indvars.iv188.unr = phi i64 [ %11, %for.body58.lr.ph ], [ %indvars.iv.next189.3, %for.body58 ]
%lcmp.mod215.not = icmp eq i32 %xtraiter213, 0
br i1 %lcmp.mod215.not, label %sw.epilog.loopexit183, label %for.body58.epil
for.body58.epil: ; preds = %sw.epilog.loopexit183.unr-lcssa, %for.body58.epil
%indvars.iv188.epil = phi i64 [ %indvars.iv.next189.epil, %for.body58.epil ], [ %indvars.iv188.unr, %sw.epilog.loopexit183.unr-lcssa ]
%epil.iter214 = phi i32 [ %epil.iter214.next, %for.body58.epil ], [ 0, %sw.epilog.loopexit183.unr-lcssa ]
%arrayidx62.epil = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv188.epil, i64 %idxprom61
store i32 0, ptr %arrayidx62.epil, align 4, !tbaa !5
%indvars.iv.next189.epil = add nsw i64 %indvars.iv188.epil, 1
%epil.iter214.next = add i32 %epil.iter214, 1
%epil.iter214.cmp.not = icmp eq i32 %epil.iter214.next, %xtraiter213
br i1 %epil.iter214.cmp.not, label %sw.epilog.loopexit183, label %for.body58.epil, !llvm.loop !18
sw.epilog.loopexit183: ; preds = %for.body58.epil, %sw.epilog.loopexit183.unr-lcssa
%indvars.iv.next189.lcssa = phi i64 [ %indvars.iv.next189.lcssa.ph, %sw.epilog.loopexit183.unr-lcssa ], [ %indvars.iv.next189.epil, %for.body58.epil ]
%38 = trunc i64 %indvars.iv.next189.lcssa to i32
br label %sw.epilog
sw.epilog.loopexit184.unr-lcssa: ; preds = %for.body71, %for.body71.lr.ph
%indvars.iv.next.lcssa.ph = phi i64 [ undef, %for.body71.lr.ph ], [ %indvars.iv.next.3, %for.body71 ]
%indvars.iv.unr = phi i64 [ %8, %for.body71.lr.ph ], [ %indvars.iv.next.3, %for.body71 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %sw.epilog.loopexit184, label %for.body71.epil
for.body71.epil: ; preds = %sw.epilog.loopexit184.unr-lcssa, %for.body71.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body71.epil ], [ %indvars.iv.unr, %sw.epilog.loopexit184.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body71.epil ], [ 0, %sw.epilog.loopexit184.unr-lcssa ]
%arrayidx75.epil = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv.epil, i64 %idxprom74
store i32 0, ptr %arrayidx75.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nsw i64 %indvars.iv.epil, -1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %sw.epilog.loopexit184, label %for.body71.epil, !llvm.loop !20
sw.epilog.loopexit184: ; preds = %for.body71.epil, %sw.epilog.loopexit184.unr-lcssa
%indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next.lcssa.ph, %sw.epilog.loopexit184.unr-lcssa ], [ %indvars.iv.next.epil, %for.body71.epil ]
%39 = trunc i64 %indvars.iv.next.lcssa to i32
br label %sw.epilog
sw.epilog: ; preds = %sw.epilog.loopexit184, %sw.epilog.loopexit183, %sw.epilog.loopexit182, %for.body33.lr.ph, %for.cond68.preheader, %for.cond55.preheader, %for.cond43.preheader, %for.cond30.preheader, %for.body27
%rx.3 = phi i32 [ %rx.0174, %for.body27 ], [ %rx.0174, %for.cond30.preheader ], [ %rx.0174, %for.cond43.preheader ], [ %rx.0174, %for.cond55.preheader ], [ %rx.0174, %for.cond68.preheader ], [ %rx.0174, %for.body33.lr.ph ], [ %rx.0174, %sw.epilog.loopexit182 ], [ %38, %sw.epilog.loopexit183 ], [ %39, %sw.epilog.loopexit184 ]
%ry.3 = phi i32 [ %ry.0175, %for.body27 ], [ %ry.0175, %for.cond30.preheader ], [ %ry.0175, %for.cond43.preheader ], [ %ry.0175, %for.cond55.preheader ], [ %ry.0175, %for.cond68.preheader ], [ %36, %for.body33.lr.ph ], [ %37, %sw.epilog.loopexit182 ], [ %ry.0175, %sw.epilog.loopexit183 ], [ %ry.0175, %sw.epilog.loopexit184 ]
%idxprom80 = sext i32 %rx.3 to i64
%idxprom82 = sext i32 %ry.3 to i64
%arrayidx83 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %idxprom80, i64 %idxprom82
store i32 0, ptr %arrayidx83, align 4, !tbaa !5
%inc85 = add nuw nsw i32 %i.2173, 1
%40 = load i32, ptr %m, align 4, !tbaa !5
%cmp26 = icmp slt i32 %inc85, %40
br i1 %cmp26, label %for.body27, label %for.cond91.preheader.preheader, !llvm.loop !21
for.cond91.preheader.preheader: ; preds = %sw.epilog, %for.end20
br label %for.cond91.preheader
for.cond91.preheader: ; preds = %for.cond91.preheader.preheader, %for.cond91.preheader
%indvars.iv205 = phi i64 [ %indvars.iv.next206, %for.cond91.preheader ], [ 0, %for.cond91.preheader.preheader ]
%k.0179 = phi i32 [ %spec.select.20, %for.cond91.preheader ], [ 0, %for.cond91.preheader.preheader ]
%arrayidx98 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 0
%41 = load i32, ptr %arrayidx98, align 4, !tbaa !5
%cmp99 = icmp eq i32 %41, 1
%arrayidx98.1 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 1
%42 = load i32, ptr %arrayidx98.1, align 4, !tbaa !5
%cmp99.1 = icmp eq i32 %42, 1
%arrayidx98.2 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 2
%43 = load i32, ptr %arrayidx98.2, align 4, !tbaa !5
%cmp99.2 = icmp eq i32 %43, 1
%arrayidx98.3 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 3
%44 = load i32, ptr %arrayidx98.3, align 4, !tbaa !5
%cmp99.3 = icmp eq i32 %44, 1
%arrayidx98.4 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 4
%45 = load i32, ptr %arrayidx98.4, align 4, !tbaa !5
%cmp99.4 = icmp eq i32 %45, 1
%arrayidx98.5 = getelementptr inbounds [21 x [21 x i32]], ptr %ta, i64 0, i64 %indvars.iv205, i64 5
%46 = load <16 x i32>, ptr %arrayidx98.5, align 4, !tbaa !5
%47 = icmp eq <16 x i32> %46, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%48 = extractelement <16 x i1> %47, i64 14
%49 = extractelement <16 x i1> %47, i64 15
%50 = select i1 %49, i1 true, i1 %48
%51 = extractelement <16 x i1> %47, i64 13
%52 = select i1 %50, i1 true, i1 %51
%53 = extractelement <16 x i1> %47, i64 12
%54 = select i1 %52, i1 true, i1 %53
%55 = extractelement <16 x i1> %47, i64 11
%56 = select i1 %54, i1 true, i1 %55
%57 = extractelement <16 x i1> %47, i64 10
%58 = select i1 %56, i1 true, i1 %57
%59 = extractelement <16 x i1> %47, i64 9
%60 = select i1 %58, i1 true, i1 %59
%61 = extractelement <16 x i1> %47, i64 8
%62 = select i1 %60, i1 true, i1 %61
%63 = extractelement <16 x i1> %47, i64 7
%64 = select i1 %62, i1 true, i1 %63
%65 = extractelement <16 x i1> %47, i64 6
%66 = select i1 %64, i1 true, i1 %65
%67 = extractelement <16 x i1> %47, i64 5
%68 = select i1 %66, i1 true, i1 %67
%69 = extractelement <16 x i1> %47, i64 4
%70 = select i1 %68, i1 true, i1 %69
%71 = extractelement <16 x i1> %47, i64 3
%72 = select i1 %70, i1 true, i1 %71
%73 = extractelement <16 x i1> %47, i64 2
%74 = select i1 %72, i1 true, i1 %73
%75 = extractelement <16 x i1> %47, i64 1
%76 = select i1 %74, i1 true, i1 %75
%77 = extractelement <16 x i1> %47, i64 0
%78 = select i1 %76, i1 true, i1 %77
%79 = select i1 %78, i1 true, i1 %cmp99.4
%80 = select i1 %79, i1 true, i1 %cmp99.3
%81 = select i1 %80, i1 true, i1 %cmp99.2
%82 = select i1 %81, i1 true, i1 %cmp99.1
%83 = select i1 %82, i1 true, i1 %cmp99
%spec.select.20 = select i1 %83, i32 1, i32 %k.0179
%indvars.iv.next206 = add nuw nsw i64 %indvars.iv205, 1
%exitcond208.not = icmp eq i64 %indvars.iv.next206, 21
br i1 %exitcond208.not, label %for.end108, label %for.cond91.preheader, !llvm.loop !22
for.end108: ; preds = %for.cond91.preheader
%cmp109 = icmp eq i32 %spec.select.20, 0
%str.6.str = select i1 %cmp109, ptr @str.6, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%84 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %84, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end108, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %d) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #6
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %ta) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ty) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tx) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
int main() {
int map[21][21];
int i, j;
int A, M;
int x, y;
int in1, in2;
char c[2], a;
int dx, dy;
int count;
while(1) {
scanf("%d", &A);
if(A == 0) {break;}
for(i = 0; i < 21; i++) {
for(j = 0; j < 21; j++) {
map[i][j] = 0;
}
}
for(i = 0; i < A; i++) {
scanf("%d %d", &in1, &in2);
map[in1][in2] = 1;
}
scanf("%d", &M);
count = 0;
x = 10;
y = 10;
if(map[x][y] == 1) {
map[x][y] = 0;
count++;
}
for(i = 0; i < M; i++) {
scanf("%s %d", c, &in1);
if(c[0] == 'N') {
dx = 0;
dy = 1;
}
if(c[0] == 'S') {
dx = 0;
dy = -1;
}
if(c[0] == 'W') {
dx = -1;
dy = 0;
}
if(c[0] == 'E') {
dx = 1;
dy = 0;
}
for(j = 0; j < in1; j++) {
x += dx;
y += dy;
if(map[x][y] == 1) {
map[x][y] = 0;
count++;
}
}
}
if(count == A){
printf("Yes\n");
}
else {
printf("No\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102941/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102941/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%s %d\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:
%map = alloca [21 x [21 x i32]], align 16
%A = alloca i32, align 4
%M = alloca i32, align 4
%in1 = alloca i32, align 4
%in2 = alloca i32, align 4
%c = alloca [2 x i8], align 1
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %map) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in1) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in2) #5
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %c) #5
%call135 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp136 = icmp eq i32 %0, 0
br i1 %cmp136, label %while.end, label %for.cond.preheader.lr.ph
for.cond.preheader.lr.ph: ; preds = %entry
%arrayidx25 = getelementptr inbounds [21 x [21 x i32]], ptr %map, i64 0, i64 10, i64 10
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %for.end84
%1 = phi i32 [ %0, %for.cond.preheader.lr.ph ], [ %23, %for.end84 ]
%dy.0138 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %dy.1.lcssa, %for.end84 ]
%dx.0137 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %dx.1.lcssa, %for.end84 ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %map, i8 0, i64 1764, i1 false), !tbaa !5
%cmp11116 = icmp sgt i32 %1, 0
br i1 %cmp11116, label %for.body12, label %for.end20
for.body12: ; preds = %for.cond.preheader, %for.body12
%i.1117 = phi i32 [ %inc19, %for.body12 ], [ 0, %for.cond.preheader ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %in1, ptr noundef nonnull %in2)
%2 = load i32, ptr %in1, align 4, !tbaa !5
%idxprom14 = sext i32 %2 to i64
%3 = load i32, ptr %in2, align 4, !tbaa !5
%idxprom16 = sext i32 %3 to i64
%arrayidx17 = getelementptr inbounds [21 x [21 x i32]], ptr %map, i64 0, i64 %idxprom14, i64 %idxprom16
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
%inc19 = add nuw nsw i32 %i.1117, 1
%4 = load i32, ptr %A, align 4, !tbaa !5
%cmp11 = icmp slt i32 %inc19, %4
br i1 %cmp11, label %for.body12, label %for.end20.loopexit, !llvm.loop !9
for.end20.loopexit: ; preds = %for.body12
%.pre = load i32, ptr %arrayidx25, align 16, !tbaa !5
br label %for.end20
for.end20: ; preds = %for.end20.loopexit, %for.cond.preheader
%5 = phi i32 [ %.pre, %for.end20.loopexit ], [ 0, %for.cond.preheader ]
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M)
%cmp26 = icmp eq i32 %5, 1
%spec.store.select = select i1 %cmp26, i32 0, i32 %5
store i32 %spec.store.select, ptr %arrayidx25, align 16
%spec.select = zext i1 %cmp26 to i32
%6 = load i32, ptr %M, align 4, !tbaa !5
%cmp35125 = icmp sgt i32 %6, 0
br i1 %cmp35125, label %for.body36, label %for.end84
for.body36: ; preds = %for.end20, %for.inc82
%count.1131 = phi i32 [ %count.2.lcssa, %for.inc82 ], [ %spec.select, %for.end20 ]
%dy.1130 = phi i32 [ %dy.5, %for.inc82 ], [ %dy.0138, %for.end20 ]
%dx.1129 = phi i32 [ %dx.5, %for.inc82 ], [ %dx.0137, %for.end20 ]
%i.2128 = phi i32 [ %inc83, %for.inc82 ], [ 0, %for.end20 ]
%y.0127 = phi i32 [ %y.1.lcssa, %for.inc82 ], [ 10, %for.end20 ]
%x.0126 = phi i32 [ %x.1.lcssa, %for.inc82 ], [ 10, %for.end20 ]
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c, ptr noundef nonnull %in1)
%7 = load i8, ptr %c, align 1, !tbaa !11
%cmp39 = icmp eq i8 %7, 78
%spec.select113 = select i1 %cmp39, i32 1, i32 %dy.1130
%cmp45 = icmp eq i8 %7, 83
%8 = or i1 %cmp45, %cmp39
%dx.3 = select i1 %8, i32 0, i32 %dx.1129
%dy.3 = select i1 %cmp45, i32 -1, i32 %spec.select113
%cmp51 = icmp eq i8 %7, 87
%dx.4 = select i1 %cmp51, i32 -1, i32 %dx.3
%cmp57 = icmp eq i8 %7, 69
%dx.5 = select i1 %cmp57, i32 1, i32 %dx.4
%9 = or i1 %cmp57, %cmp51
%dy.5 = select i1 %9, i32 0, i32 %dy.3
%10 = load i32, ptr %in1, align 4, !tbaa !5
%cmp62118 = icmp sgt i32 %10, 0
br i1 %cmp62118, label %for.body64.preheader, label %for.inc82
for.body64.preheader: ; preds = %for.body36
%11 = sext i32 %y.0127 to i64
%12 = sext i32 %dy.5 to i64
%13 = sext i32 %x.0126 to i64
%14 = sext i32 %dx.5 to i64
%xtraiter = and i32 %10, 1
%15 = icmp eq i32 %10, 1
br i1 %15, label %for.inc82.loopexit.unr-lcssa, label %for.body64.preheader.new
for.body64.preheader.new: ; preds = %for.body64.preheader
%unroll_iter = and i32 %10, -2
br label %for.body64
for.body64: ; preds = %for.inc79.1, %for.body64.preheader.new
%indvars.iv141 = phi i64 [ %13, %for.body64.preheader.new ], [ %indvars.iv.next142.1, %for.inc79.1 ]
%indvars.iv = phi i64 [ %11, %for.body64.preheader.new ], [ %indvars.iv.next.1, %for.inc79.1 ]
%count.2122 = phi i32 [ %count.1131, %for.body64.preheader.new ], [ %count.3.1, %for.inc79.1 ]
%niter = phi i32 [ 0, %for.body64.preheader.new ], [ %niter.next.1, %for.inc79.1 ]
%indvars.iv.next142 = add i64 %indvars.iv141, %14
%indvars.iv.next = add i64 %indvars.iv, %12
%arrayidx69 = getelementptr inbounds [21 x [21 x i32]], ptr %map, i64 0, i64 %indvars.iv.next142, i64 %indvars.iv.next
%16 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%cmp70 = icmp eq i32 %16, 1
br i1 %cmp70, label %if.then72, label %for.inc79
if.then72: ; preds = %for.body64
store i32 0, ptr %arrayidx69, align 4, !tbaa !5
%inc77 = add nsw i32 %count.2122, 1
br label %for.inc79
for.inc79: ; preds = %for.body64, %if.then72
%count.3 = phi i32 [ %inc77, %if.then72 ], [ %count.2122, %for.body64 ]
%indvars.iv.next142.1 = add i64 %indvars.iv.next142, %14
%indvars.iv.next.1 = add i64 %indvars.iv.next, %12
%arrayidx69.1 = getelementptr inbounds [21 x [21 x i32]], ptr %map, i64 0, i64 %indvars.iv.next142.1, i64 %indvars.iv.next.1
%17 = load i32, ptr %arrayidx69.1, align 4, !tbaa !5
%cmp70.1 = icmp eq i32 %17, 1
br i1 %cmp70.1, label %if.then72.1, label %for.inc79.1
if.then72.1: ; preds = %for.inc79
store i32 0, ptr %arrayidx69.1, align 4, !tbaa !5
%inc77.1 = add nsw i32 %count.3, 1
br label %for.inc79.1
for.inc79.1: ; preds = %if.then72.1, %for.inc79
%count.3.1 = phi i32 [ %inc77.1, %if.then72.1 ], [ %count.3, %for.inc79 ]
%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.inc82.loopexit.unr-lcssa, label %for.body64, !llvm.loop !12
for.inc82.loopexit.unr-lcssa: ; preds = %for.inc79.1, %for.body64.preheader
%count.3.lcssa.ph = phi i32 [ undef, %for.body64.preheader ], [ %count.3.1, %for.inc79.1 ]
%indvars.iv.next142.lcssa.ph = phi i64 [ undef, %for.body64.preheader ], [ %indvars.iv.next142.1, %for.inc79.1 ]
%indvars.iv.next.lcssa.ph = phi i64 [ undef, %for.body64.preheader ], [ %indvars.iv.next.1, %for.inc79.1 ]
%indvars.iv141.unr = phi i64 [ %13, %for.body64.preheader ], [ %indvars.iv.next142.1, %for.inc79.1 ]
%indvars.iv.unr = phi i64 [ %11, %for.body64.preheader ], [ %indvars.iv.next.1, %for.inc79.1 ]
%count.2122.unr = phi i32 [ %count.1131, %for.body64.preheader ], [ %count.3.1, %for.inc79.1 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc82.loopexit, label %for.body64.epil
for.body64.epil: ; preds = %for.inc82.loopexit.unr-lcssa
%indvars.iv.next142.epil = add i64 %indvars.iv141.unr, %14
%indvars.iv.next.epil = add i64 %indvars.iv.unr, %12
%arrayidx69.epil = getelementptr inbounds [21 x [21 x i32]], ptr %map, i64 0, i64 %indvars.iv.next142.epil, i64 %indvars.iv.next.epil
%18 = load i32, ptr %arrayidx69.epil, align 4, !tbaa !5
%cmp70.epil = icmp eq i32 %18, 1
br i1 %cmp70.epil, label %if.then72.epil, label %for.inc82.loopexit
if.then72.epil: ; preds = %for.body64.epil
store i32 0, ptr %arrayidx69.epil, align 4, !tbaa !5
%inc77.epil = add nsw i32 %count.2122.unr, 1
br label %for.inc82.loopexit
for.inc82.loopexit: ; preds = %for.body64.epil, %if.then72.epil, %for.inc82.loopexit.unr-lcssa
%count.3.lcssa = phi i32 [ %count.3.lcssa.ph, %for.inc82.loopexit.unr-lcssa ], [ %inc77.epil, %if.then72.epil ], [ %count.2122.unr, %for.body64.epil ]
%indvars.iv.next142.lcssa = phi i64 [ %indvars.iv.next142.lcssa.ph, %for.inc82.loopexit.unr-lcssa ], [ %indvars.iv.next142.epil, %if.then72.epil ], [ %indvars.iv.next142.epil, %for.body64.epil ]
%indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next.lcssa.ph, %for.inc82.loopexit.unr-lcssa ], [ %indvars.iv.next.epil, %if.then72.epil ], [ %indvars.iv.next.epil, %for.body64.epil ]
%19 = trunc i64 %indvars.iv.next142.lcssa to i32
%20 = trunc i64 %indvars.iv.next.lcssa to i32
br label %for.inc82
for.inc82: ; preds = %for.inc82.loopexit, %for.body36
%x.1.lcssa = phi i32 [ %x.0126, %for.body36 ], [ %19, %for.inc82.loopexit ]
%y.1.lcssa = phi i32 [ %y.0127, %for.body36 ], [ %20, %for.inc82.loopexit ]
%count.2.lcssa = phi i32 [ %count.1131, %for.body36 ], [ %count.3.lcssa, %for.inc82.loopexit ]
%inc83 = add nuw nsw i32 %i.2128, 1
%21 = load i32, ptr %M, align 4, !tbaa !5
%cmp35 = icmp slt i32 %inc83, %21
br i1 %cmp35, label %for.body36, label %for.end84, !llvm.loop !13
for.end84: ; preds = %for.inc82, %for.end20
%dx.1.lcssa = phi i32 [ %dx.0137, %for.end20 ], [ %dx.5, %for.inc82 ]
%dy.1.lcssa = phi i32 [ %dy.0138, %for.end20 ], [ %dy.5, %for.inc82 ]
%count.1.lcssa = phi i32 [ %spec.select, %for.end20 ], [ %count.2.lcssa, %for.inc82 ]
%22 = load i32, ptr %A, align 4, !tbaa !5
%cmp85 = icmp eq i32 %count.1.lcssa, %22
%str.5.str = select i1 %cmp85, ptr @str.5, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%23 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp eq i32 %23, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end84, %entry
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in2) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in1) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %map) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,k,mm,mn,i,j=0,count1=0;
int a[10001],b[10001];
scanf("%d %d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int max1=a[0],min1=a[0];
mm=0;mn=0;
for(i=0;i<n;i++)
{
if (a[i]>max1)
{max1=a[i];
mm=i;}
if (a[i]< min1)
{min1=a[i];
mn=i;}
}
while(count1<k && max1>min1+1)
{
a[mm]--;
max1=a[mm];
a[mn]++;
min1=a[mn];
count1++;
b[j++]=mm+1;
b[j++]=mn+1;
for(i=0;i<n;i++)
{
if (a[i]>max1)
{max1=a[i];
mm=i;}
if (a[i]<min1)
{min1=a[i];
mn=i;}
}
}
printf("%d %d\n",(max1-min1),count1);
for(i=0;i<j;i++)
{
printf("%d %d\n",b[i],b[i+1]);
i++;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [10001 x i32], align 16
%b = alloca [10001 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 %k) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %b) #4
%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
%cmp119 = icmp sgt i32 %0, 0
br i1 %cmp119, label %for.body, label %while.end.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%cmp5121 = icmp sgt i32 %1, 0
br i1 %cmp5121, label %for.body6.preheader, label %while.cond.preheader
for.body6.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %1, 1
br i1 %3, label %while.cond.preheader.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
while.cond.preheader.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %spec.select.1, %for.body6 ]
%spec.select116.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %spec.select116.1, %for.body6 ]
%mn.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %mn.1.1, %for.body6 ]
%min1.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %min1.1.1, %for.body6 ]
%indvars.iv156.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next157.1, %for.body6 ]
%min1.0126.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %min1.1.1, %for.body6 ]
%max1.0125.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %spec.select116.1, %for.body6 ]
%mn.0123.unr = phi i32 [ 0, %for.body6.preheader ], [ %mn.1.1, %for.body6 ]
%mm.0122.unr = phi i32 [ 0, %for.body6.preheader ], [ %spec.select.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.cond.preheader, label %for.body6.epil
for.body6.epil: ; preds = %while.cond.preheader.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv156.unr
%4 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.epil = icmp sgt i32 %4, %max1.0125.unr
%5 = trunc i64 %indvars.iv156.unr to i32
%spec.select.epil = select i1 %cmp9.epil, i32 %5, i32 %mm.0122.unr
%spec.select116.epil = call i32 @llvm.smax.i32(i32 %4, i32 %max1.0125.unr)
%cmp14.epil = icmp slt i32 %4, %min1.0126.unr
%mn.1.epil = select i1 %cmp14.epil, i32 %5, i32 %mn.0123.unr
%min1.1.epil = call i32 @llvm.smin.i32(i32 %4, i32 %min1.0126.unr)
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body6.epil, %while.cond.preheader.loopexit.unr-lcssa, %for.end
%cmp5121175 = phi i1 [ false, %for.end ], [ %cmp5121, %while.cond.preheader.loopexit.unr-lcssa ], [ %cmp5121, %for.body6.epil ]
%mm.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select.lcssa.ph, %while.cond.preheader.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body6.epil ]
%mn.0.lcssa = phi i32 [ 0, %for.end ], [ %mn.1.lcssa.ph, %while.cond.preheader.loopexit.unr-lcssa ], [ %mn.1.epil, %for.body6.epil ]
%max1.0.lcssa = phi i32 [ %.pre, %for.end ], [ %spec.select116.lcssa.ph, %while.cond.preheader.loopexit.unr-lcssa ], [ %spec.select116.epil, %for.body6.epil ]
%min1.0.lcssa = phi i32 [ %.pre, %for.end ], [ %min1.1.lcssa.ph, %while.cond.preheader.loopexit.unr-lcssa ], [ %min1.1.epil, %for.body6.epil ]
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp22141 = icmp sgt i32 %6, 0
%add142 = add nsw i32 %min1.0.lcssa, 1
%cmp23143 = icmp sgt i32 %max1.0.lcssa, %add142
%7 = select i1 %cmp22141, i1 %cmp23143, i1 false
br i1 %7, label %while.body.lr.ph, label %while.end.thread
while.body.lr.ph: ; preds = %while.cond.preheader
%wide.trip.count162 = zext i32 %1 to i64
%xtraiter196 = and i64 %wide.trip.count162, 1
%8 = icmp eq i32 %1, 1
%unroll_iter202 = and i64 %wide.trip.count162, 4294967294
%lcmp.mod197.not = icmp eq i64 %xtraiter196, 0
br label %while.body
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv156 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next157.1, %for.body6 ]
%min1.0126 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %min1.1.1, %for.body6 ]
%max1.0125 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %spec.select116.1, %for.body6 ]
%mn.0123 = phi i32 [ 0, %for.body6.preheader.new ], [ %mn.1.1, %for.body6 ]
%mm.0122 = phi i32 [ 0, %for.body6.preheader.new ], [ %spec.select.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv156
%9 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9 = icmp sgt i32 %9, %max1.0125
%10 = trunc i64 %indvars.iv156 to i32
%spec.select = select i1 %cmp9, i32 %10, i32 %mm.0122
%spec.select116 = call i32 @llvm.smax.i32(i32 %9, i32 %max1.0125)
%cmp14 = icmp slt i32 %9, %min1.0126
%mn.1 = select i1 %cmp14, i32 %10, i32 %mn.0123
%min1.1 = call i32 @llvm.smin.i32(i32 %9, i32 %min1.0126)
%indvars.iv.next157 = or i64 %indvars.iv156, 1
%arrayidx8.1 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv.next157
%11 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.1 = icmp sgt i32 %11, %spec.select116
%12 = trunc i64 %indvars.iv.next157 to i32
%spec.select.1 = select i1 %cmp9.1, i32 %12, i32 %spec.select
%spec.select116.1 = call i32 @llvm.smax.i32(i32 %11, i32 %spec.select116)
%cmp14.1 = icmp slt i32 %11, %min1.1
%mn.1.1 = select i1 %cmp14.1, i32 %12, i32 %mn.1
%min1.1.1 = call i32 @llvm.smin.i32(i32 %11, i32 %min1.1)
%indvars.iv.next157.1 = add nuw nsw i64 %indvars.iv156, 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 %while.cond.preheader.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11
while.cond.loopexit.loopexit.unr-lcssa: ; preds = %for.body44, %for.body44.preheader
%spec.select117.lcssa.ph = phi i32 [ undef, %for.body44.preheader ], [ %spec.select117.1, %for.body44 ]
%spec.select118.lcssa.ph = phi i32 [ undef, %for.body44.preheader ], [ %spec.select118.1, %for.body44 ]
%mn.4.lcssa.ph = phi i32 [ undef, %for.body44.preheader ], [ %mn.4.1, %for.body44 ]
%min1.4.lcssa.ph = phi i32 [ undef, %for.body44.preheader ], [ %min1.4.1, %for.body44 ]
%indvars.iv159.unr = phi i64 [ 0, %for.body44.preheader ], [ %indvars.iv.next160.1, %for.body44 ]
%min1.3136.unr = phi i32 [ %inc30, %for.body44.preheader ], [ %min1.4.1, %for.body44 ]
%max1.3135.unr = phi i32 [ %dec, %for.body44.preheader ], [ %spec.select118.1, %for.body44 ]
%mn.3133.unr = phi i32 [ %mn.2145, %for.body44.preheader ], [ %mn.4.1, %for.body44 ]
%mm.3132.unr = phi i32 [ %mm.2144, %for.body44.preheader ], [ %spec.select117.1, %for.body44 ]
br i1 %lcmp.mod197.not, label %while.cond.loopexit, label %for.body44.epil
for.body44.epil: ; preds = %while.cond.loopexit.loopexit.unr-lcssa
%arrayidx46.epil = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv159.unr
%13 = load i32, ptr %arrayidx46.epil, align 4, !tbaa !5
%cmp47.epil = icmp sgt i32 %13, %max1.3135.unr
%14 = trunc i64 %indvars.iv159.unr to i32
%spec.select117.epil = select i1 %cmp47.epil, i32 %14, i32 %mm.3132.unr
%spec.select118.epil = call i32 @llvm.smax.i32(i32 %13, i32 %max1.3135.unr)
%cmp54.epil = icmp slt i32 %13, %min1.3136.unr
%mn.4.epil = select i1 %cmp54.epil, i32 %14, i32 %mn.3133.unr
%min1.4.epil = call i32 @llvm.smin.i32(i32 %13, i32 %min1.3136.unr)
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %for.body44.epil, %while.cond.loopexit.loopexit.unr-lcssa, %while.body
%mm.3.lcssa = phi i32 [ %mm.2144, %while.body ], [ %spec.select117.lcssa.ph, %while.cond.loopexit.loopexit.unr-lcssa ], [ %spec.select117.epil, %for.body44.epil ]
%mn.3.lcssa = phi i32 [ %mn.2145, %while.body ], [ %mn.4.lcssa.ph, %while.cond.loopexit.loopexit.unr-lcssa ], [ %mn.4.epil, %for.body44.epil ]
%max1.3.lcssa = phi i32 [ %dec, %while.body ], [ %spec.select118.lcssa.ph, %while.cond.loopexit.loopexit.unr-lcssa ], [ %spec.select118.epil, %for.body44.epil ]
%min1.3.lcssa = phi i32 [ %inc30, %while.body ], [ %min1.4.lcssa.ph, %while.cond.loopexit.loopexit.unr-lcssa ], [ %min1.4.epil, %for.body44.epil ]
%cmp22 = icmp slt i32 %inc33, %6
%add = add nsw i32 %min1.3.lcssa, 1
%cmp23 = icmp sgt i32 %max1.3.lcssa, %add
%15 = select i1 %cmp22, i1 %cmp23, i1 false
br i1 %15, label %while.body, label %while.end, !llvm.loop !12
while.body: ; preds = %while.body.lr.ph, %while.cond.loopexit
%indvars.iv164 = phi i64 [ 0, %while.body.lr.ph ], [ %indvars.iv.next165, %while.cond.loopexit ]
%count1.0147 = phi i32 [ 0, %while.body.lr.ph ], [ %inc33, %while.cond.loopexit ]
%mn.2145 = phi i32 [ %mn.0.lcssa, %while.body.lr.ph ], [ %mn.3.lcssa, %while.cond.loopexit ]
%mm.2144 = phi i32 [ %mm.0.lcssa, %while.body.lr.ph ], [ %mm.3.lcssa, %while.cond.loopexit ]
%idxprom24 = sext i32 %mm.2144 to i64
%arrayidx25 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%dec = add nsw i32 %16, -1
store i32 %dec, ptr %arrayidx25, align 4, !tbaa !5
%idxprom28 = sext i32 %mn.2145 to i64
%arrayidx29 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %idxprom28
%17 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%inc30 = add nsw i32 %17, 1
store i32 %inc30, ptr %arrayidx29, align 4, !tbaa !5
%inc33 = add nuw nsw i32 %count1.0147, 1
%add34 = add nsw i32 %mm.2144, 1
%18 = or i64 %indvars.iv164, 1
%arrayidx37 = getelementptr inbounds [10001 x i32], ptr %b, i64 0, i64 %indvars.iv164
store i32 %add34, ptr %arrayidx37, align 8, !tbaa !5
%add38 = add nsw i32 %mn.2145, 1
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 2
%arrayidx41 = getelementptr inbounds [10001 x i32], ptr %b, i64 0, i64 %18
store i32 %add38, ptr %arrayidx41, align 4, !tbaa !5
br i1 %cmp5121175, label %for.body44.preheader, label %while.cond.loopexit
for.body44.preheader: ; preds = %while.body
br i1 %8, label %while.cond.loopexit.loopexit.unr-lcssa, label %for.body44
for.body44: ; preds = %for.body44.preheader, %for.body44
%indvars.iv159 = phi i64 [ %indvars.iv.next160.1, %for.body44 ], [ 0, %for.body44.preheader ]
%min1.3136 = phi i32 [ %min1.4.1, %for.body44 ], [ %inc30, %for.body44.preheader ]
%max1.3135 = phi i32 [ %spec.select118.1, %for.body44 ], [ %dec, %for.body44.preheader ]
%mn.3133 = phi i32 [ %mn.4.1, %for.body44 ], [ %mn.2145, %for.body44.preheader ]
%mm.3132 = phi i32 [ %spec.select117.1, %for.body44 ], [ %mm.2144, %for.body44.preheader ]
%niter203 = phi i64 [ %niter203.next.1, %for.body44 ], [ 0, %for.body44.preheader ]
%arrayidx46 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv159
%19 = load i32, ptr %arrayidx46, align 8, !tbaa !5
%cmp47 = icmp sgt i32 %19, %max1.3135
%20 = trunc i64 %indvars.iv159 to i32
%spec.select117 = select i1 %cmp47, i32 %20, i32 %mm.3132
%spec.select118 = call i32 @llvm.smax.i32(i32 %19, i32 %max1.3135)
%cmp54 = icmp slt i32 %19, %min1.3136
%mn.4 = select i1 %cmp54, i32 %20, i32 %mn.3133
%min1.4 = call i32 @llvm.smin.i32(i32 %19, i32 %min1.3136)
%indvars.iv.next160 = or i64 %indvars.iv159, 1
%arrayidx46.1 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv.next160
%21 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%cmp47.1 = icmp sgt i32 %21, %spec.select118
%22 = trunc i64 %indvars.iv.next160 to i32
%spec.select117.1 = select i1 %cmp47.1, i32 %22, i32 %spec.select117
%spec.select118.1 = call i32 @llvm.smax.i32(i32 %21, i32 %spec.select118)
%cmp54.1 = icmp slt i32 %21, %min1.4
%mn.4.1 = select i1 %cmp54.1, i32 %22, i32 %mn.4
%min1.4.1 = call i32 @llvm.smin.i32(i32 %21, i32 %min1.4)
%indvars.iv.next160.1 = add nuw nsw i64 %indvars.iv159, 2
%niter203.next.1 = add i64 %niter203, 2
%niter203.ncmp.1 = icmp eq i64 %niter203.next.1, %unroll_iter202
br i1 %niter203.ncmp.1, label %while.cond.loopexit.loopexit.unr-lcssa, label %for.body44, !llvm.loop !13
while.end.thread: ; preds = %while.cond.preheader, %entry
%max1.2.lcssa.ph = phi i32 [ %max1.0.lcssa, %while.cond.preheader ], [ undef, %entry ]
%min1.2.lcssa.ph = phi i32 [ %min1.0.lcssa, %while.cond.preheader ], [ undef, %entry ]
%sub189 = sub nsw i32 %max1.2.lcssa.ph, %min1.2.lcssa.ph
%call62190 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub189, i32 noundef 0)
br label %for.end75
while.end: ; preds = %while.cond.loopexit
%sub = sub nsw i32 %max1.3.lcssa, %min1.3.lcssa
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub, i32 noundef %inc33)
%23 = and i64 %indvars.iv.next165, 4294967294
%cmp64152.not = icmp eq i64 %23, 0
br i1 %cmp64152.not, label %for.end75, label %for.body65.preheader
for.body65.preheader: ; preds = %while.end
%24 = and i64 %indvars.iv.next165, 4294967294
br label %for.body65
for.body65: ; preds = %for.body65.preheader, %for.body65
%indvars.iv168 = phi i64 [ 0, %for.body65.preheader ], [ %indvars.iv.next169, %for.body65 ]
%arrayidx67 = getelementptr inbounds [10001 x i32], ptr %b, i64 0, i64 %indvars.iv168
%25 = load i32, ptr %arrayidx67, align 8, !tbaa !5
%26 = or i64 %indvars.iv168, 1
%arrayidx70 = getelementptr inbounds [10001 x i32], ptr %b, i64 0, i64 %26
%27 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25, i32 noundef %27)
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 2
%cmp64 = icmp ult i64 %indvars.iv.next169, %24
br i1 %cmp64, label %for.body65, label %for.end75, !llvm.loop !14
for.end75: ; preds = %for.body65, %while.end.thread, %while.end
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
/*
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 200000000000007LL
#define MOD 1000000007
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 200000
#define M_MAX 200000
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
hwll a;
hwll b;
} linell;
typedef struct {
ull s;
ull t;
int32_t c;
} struct_a;
typedef struct {
int32_t from;
int32_t to;
sll cost;
} struct_b;
ull n, m;
ull h, w;
ull k;
ull q;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
size_t slen;
size_t tlen;
char ch, dh;
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
char s[401];
ull dp[305][305][305];
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;
n = strlen(s);
for (j = 0; j <= n; j++) {
for (i = 0; i + j <= n; i++) {
for (ki = 0; ki <= k; ki++) {
if (j == 0) {
dp[i][j][ki] = 0;
continue;
}
if (j == 1) {
dp[i][j][ki] = 1;
continue;
}
bool isaddable = (s[i] == s[i + j - 1]);
maybe = umax(umax(dp[i][j - 1][ki], dp[i + 1][j - 1][ki]), dp[i + 1][j - 2][ki] + (isaddable ? 2 : 0));
if (!isaddable && ki) {
maybe = umax(maybe, dp[i + 1][j - 2][ki - 1] + 2);
}
dp[i][j][ki] = maybe;
// printf("%lld/%lld/%lld: %lld\n", i, j, ki, maybe);
}
}
}
result = 0;
for (ki = 0; ki <= k; ki++) {
result = umax(result, dp[0][n][ki]);
}
printf("%lld\n", result);
return 0;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
scanf("%s", s);
scanf("%llu", &k);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103041/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103041/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local global [401 x i8] zeroinitializer, align 16
@n = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local global i64 0, align 8
@dp = dso_local local_unnamed_addr global [305 x [305 x [305 x i64]]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@m = dso_local local_unnamed_addr global i64 0, align 8
@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
@vua = dso_local local_unnamed_addr global i64 0, align 8
@vub = dso_local local_unnamed_addr global i64 0, align 8
@vuc = dso_local local_unnamed_addr global i64 0, align 8
@vud = dso_local local_unnamed_addr global i64 0, align 8
@vue = dso_local local_unnamed_addr global i64 0, align 8
@vuf = dso_local local_unnamed_addr global i64 0, align 8
@vsa = dso_local local_unnamed_addr global i64 0, align 8
@vsb = dso_local local_unnamed_addr global i64 0, align 8
@vsc = dso_local local_unnamed_addr global i64 0, align 8
@vsd = dso_local local_unnamed_addr global i64 0, align 8
@vse = dso_local local_unnamed_addr global i64 0, align 8
@vsf = 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
@slen = dso_local local_unnamed_addr global i64 0, align 8
@tlen = dso_local local_unnamed_addr global i64 0, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
; 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: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #6
store i64 %call, ptr @n, align 8, !tbaa !5
%0 = load i64, ptr @k, align 8, !tbaa !5
%1 = shl i64 %0, 3
%2 = add i64 %1, 8
%3 = add i64 %0, 1
%min.iters.check = icmp ult i64 %3, 4
%n.vec = and i64 %3, -4
%cmp.n = icmp eq i64 %3, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc59
%j.0139 = phi i64 [ 0, %entry ], [ %inc60, %for.inc59 ]
%sub23 = add nsw i64 %j.0139, -1
%sub34 = add nsw i64 %j.0139, -2
switch i64 %j.0139, label %for.cond4.preheader [
i64 0, label %for.cond4.preheader.us
i64 1, label %for.cond4.preheader.us125
]
for.cond4.preheader.us: ; preds = %for.cond1.preheader, %for.cond4.preheader.us
%i.0120.us = phi i64 [ %inc57.us, %for.cond4.preheader.us ], [ %j.0139, %for.cond1.preheader ]
%4 = mul nuw nsw i64 %i.0120.us, 744200
%scevgep = getelementptr i8, ptr @dp, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%inc57.us = add nuw nsw i64 %i.0120.us, 1
%cmp2.not.us.not = icmp ult i64 %i.0120.us, %call
br i1 %cmp2.not.us.not, label %for.cond4.preheader.us, label %for.inc59, !llvm.loop !9
for.cond4.preheader.us125: ; preds = %for.cond1.preheader, %for.inc56.split.split.us.us
%i.0120.us127 = phi i64 [ %inc57.us135, %for.inc56.split.split.us.us ], [ 0, %for.cond1.preheader ]
br i1 %min.iters.check, label %for.body6.us115.us.preheader, label %vector.body
vector.body: ; preds = %for.cond4.preheader.us125, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond4.preheader.us125 ]
%5 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %i.0120.us127, i64 1, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i64, ptr %5, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %6, align 8, !tbaa !5
%index.next = add nuw i64 %index, 4
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.inc56.split.split.us.us, label %for.body6.us115.us.preheader
for.body6.us115.us.preheader: ; preds = %for.cond4.preheader.us125, %middle.block
%ki.0113.us116.us.ph = phi i64 [ 0, %for.cond4.preheader.us125 ], [ %n.vec, %middle.block ]
br label %for.body6.us115.us
for.body6.us115.us: ; preds = %for.body6.us115.us.preheader, %for.body6.us115.us
%ki.0113.us116.us = phi i64 [ %inc.us118.us, %for.body6.us115.us ], [ %ki.0113.us116.us.ph, %for.body6.us115.us.preheader ]
%arrayidx14.us.us = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %i.0120.us127, i64 1, i64 %ki.0113.us116.us
store i64 1, ptr %arrayidx14.us.us, align 8, !tbaa !5
%inc.us118.us = add nuw i64 %ki.0113.us116.us, 1
%exitcond.not = icmp eq i64 %ki.0113.us116.us, %0
br i1 %exitcond.not, label %for.inc56.split.split.us.us, label %for.body6.us115.us, !llvm.loop !14
for.inc56.split.split.us.us: ; preds = %for.body6.us115.us, %middle.block
%inc57.us135 = add nuw nsw i64 %i.0120.us127, 1
%add.us136 = add nuw nsw i64 %i.0120.us127, 2
%cmp2.not.us137 = icmp ugt i64 %add.us136, %call
br i1 %cmp2.not.us137, label %for.inc59, label %for.cond4.preheader.us125, !llvm.loop !9
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc56.split.split
%add122 = phi i64 [ %add, %for.inc56.split.split ], [ %j.0139, %for.cond1.preheader ]
%i.0120 = phi i64 [ %add26, %for.inc56.split.split ], [ 0, %for.cond1.preheader ]
%arrayidx16 = getelementptr inbounds [401 x i8], ptr @s, i64 0, i64 %i.0120
%sub = add nsw i64 %add122, -1
%arrayidx18 = getelementptr inbounds [401 x i8], ptr @s, i64 0, i64 %sub
%add26 = add nuw nsw i64 %i.0120, 1
%8 = load i8, ptr %arrayidx16, align 1, !tbaa !15
%9 = load i8, ptr %arrayidx18, align 1, !tbaa !15
%cmp20 = icmp ne i8 %8, %9
%conv38 = select i1 %cmp20, i64 0, i64 2
br label %for.body6
for.body6: ; preds = %for.cond4.preheader, %if.end52
%ki.0113 = phi i64 [ 0, %for.cond4.preheader ], [ %inc, %if.end52 ]
%arrayidx25 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %i.0120, i64 %sub23, i64 %ki.0113
%10 = load i64, ptr %arrayidx25, align 8, !tbaa !5
%arrayidx30 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %add26, i64 %sub23, i64 %ki.0113
%11 = load i64, ptr %arrayidx30, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.umax.i64(i64 %10, i64 %11)
%arrayidx36 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %add26, i64 %sub34, i64 %ki.0113
%12 = load i64, ptr %arrayidx36, align 8, !tbaa !5
%add39 = add i64 %12, %conv38
%cond.i110 = tail call i64 @llvm.umax.i64(i64 %cond.i, i64 %add39)
%tobool42 = icmp ne i64 %ki.0113, 0
%or.cond = and i1 %tobool42, %cmp20
br i1 %or.cond, label %if.then43, label %if.end52
if.then43: ; preds = %for.body6
%sub48 = add nsw i64 %ki.0113, -1
%arrayidx49 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %add26, i64 %sub34, i64 %sub48
%13 = load i64, ptr %arrayidx49, align 8, !tbaa !5
%add50 = add i64 %13, 2
%cond.i111 = tail call i64 @llvm.umax.i64(i64 %cond.i110, i64 %add50)
br label %if.end52
if.end52: ; preds = %if.then43, %for.body6
%maybe.0 = phi i64 [ %cond.i111, %if.then43 ], [ %cond.i110, %for.body6 ]
%arrayidx55 = getelementptr inbounds [305 x [305 x [305 x i64]]], ptr @dp, i64 0, i64 %i.0120, i64 %j.0139, i64 %ki.0113
store i64 %maybe.0, ptr %arrayidx55, align 8, !tbaa !5
%inc = add nuw i64 %ki.0113, 1
%exitcond145.not = icmp eq i64 %ki.0113, %0
br i1 %exitcond145.not, label %for.inc56.split.split, label %for.body6, !llvm.loop !16
for.inc56.split.split: ; preds = %if.end52
%add = add nuw nsw i64 %add26, %j.0139
%cmp2.not = icmp ugt i64 %add, %call
br i1 %cmp2.not, label %for.inc59, label %for.cond4.preheader, !llvm.loop !9
for.inc59: ; preds = %for.inc56.split.split.us.us, %for.cond4.preheader.us, %for.inc56.split.split
%inc60 = add nuw i64 %j.0139, 1
%exitcond146.not = icmp eq i64 %j.0139, %call
br i1 %exitcond146.not, label %for.body65.preheader, label %for.cond1.preheader, !llvm.loop !17
for.body65.preheader: ; preds = %for.inc59
%14 = add i64 %0, 1
%min.iters.check154 = icmp ult i64 %14, 4
br i1 %min.iters.check154, label %for.body65.preheader165, label %vector.ph155
vector.ph155: ; preds = %for.body65.preheader
%n.vec157 = and i64 %14, -4
br label %vector.body160
vector.body160: ; preds = %vector.body160, %vector.ph155
%index161 = phi i64 [ 0, %vector.ph155 ], [ %index.next164, %vector.body160 ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph155 ], [ %17, %vector.body160 ]
%vec.phi162 = phi <2 x i64> [ zeroinitializer, %vector.ph155 ], [ %18, %vector.body160 ]
%15 = getelementptr inbounds [305 x [305 x i64]], ptr @dp, i64 0, i64 %call, i64 %index161
%wide.load = load <2 x i64>, ptr %15, align 8, !tbaa !5
%16 = getelementptr inbounds i64, ptr %15, i64 2
%wide.load163 = load <2 x i64>, ptr %16, align 8, !tbaa !5
%17 = tail call <2 x i64> @llvm.umax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%18 = tail call <2 x i64> @llvm.umax.v2i64(<2 x i64> %vec.phi162, <2 x i64> %wide.load163)
%index.next164 = add nuw i64 %index161, 4
%19 = icmp eq i64 %index.next164, %n.vec157
br i1 %19, label %middle.block152, label %vector.body160, !llvm.loop !18
middle.block152: ; preds = %vector.body160
%rdx.minmax = tail call <2 x i64> @llvm.umax.v2i64(<2 x i64> %17, <2 x i64> %18)
%20 = tail call i64 @llvm.vector.reduce.umax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n159 = icmp eq i64 %14, %n.vec157
br i1 %cmp.n159, label %for.end71, label %for.body65.preheader165
for.body65.preheader165: ; preds = %for.body65.preheader, %middle.block152
%ki.1142.ph = phi i64 [ 0, %for.body65.preheader ], [ %n.vec157, %middle.block152 ]
%result.0141.ph = phi i64 [ 0, %for.body65.preheader ], [ %20, %middle.block152 ]
br label %for.body65
for.body65: ; preds = %for.body65.preheader165, %for.body65
%ki.1142 = phi i64 [ %inc70, %for.body65 ], [ %ki.1142.ph, %for.body65.preheader165 ]
%result.0141 = phi i64 [ %cond.i112, %for.body65 ], [ %result.0141.ph, %for.body65.preheader165 ]
%arrayidx67 = getelementptr inbounds [305 x [305 x i64]], ptr @dp, i64 0, i64 %call, i64 %ki.1142
%21 = load i64, ptr %arrayidx67, align 8, !tbaa !5
%cond.i112 = tail call i64 @llvm.umax.i64(i64 %result.0141, i64 %21)
%inc70 = add nuw i64 %ki.1142, 1
%exitcond147.not = icmp eq i64 %ki.1142, %0
br i1 %exitcond147.not, label %for.end71, label %for.body65, !llvm.loop !19
for.end71: ; preds = %for.body65, %middle.block152
%cond.i112.lcssa = phi i64 [ %20, %middle.block152 ], [ %cond.i112, %for.body65 ]
%call72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %cond.i112.lcssa)
ret i64 0
}
; 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 #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @s)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @k)
%call2 = tail call i64 @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.umax.v2i64(<2 x i64>, <2 x i64>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.umax.v2i64(<2 x i64>) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !12, !13}
!19 = distinct !{!19, !10, !13, !12}
|
#include<stdio.h>
#include<string.h>
int a[2005];
int b[2005];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int k=0;
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]%2!=0)
{
printf("%d ",a[i]);
}
else
{
b[++k]=a[i];
}
}
for(int i=1;i<=k;i++)
{
printf("%d ",b[i]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1031/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1031/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [2005 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@b = dso_local local_unnamed_addr global [2005 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec39 = add nsw i32 %0, -1
store i32 %dec39, ptr %t, align 4, !tbaa !5
%tobool.not40 = icmp eq i32 %0, 0
br i1 %tobool.not40, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup17
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %1, 0
br i1 %cmp34, label %for.body, label %for.cond.cleanup17
for.cond15.preheader: ; preds = %for.inc
%cmp16.not37 = icmp slt i32 %k.1, 1
br i1 %cmp16.not37, label %for.cond.cleanup17, label %for.body18.preheader
for.body18.preheader: ; preds = %for.cond15.preheader
%2 = add nuw i32 %k.1, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.body18
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %while.body ]
%k.035 = phi i32 [ %k.1, %for.inc ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [2005 x i32], ptr @a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp5.not = icmp eq i32 %4, 0
br i1 %cmp5.not, label %if.else, label %if.then
if.then: ; preds = %for.body
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
br label %for.inc
if.else: ; preds = %for.body
%inc = add nsw i32 %k.035, 1
%idxprom11 = sext i32 %inc to i64
%arrayidx12 = getelementptr inbounds [2005 x i32], ptr @b, i64 0, i64 %idxprom11
store i32 %3, ptr %arrayidx12, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%k.1 = phi i32 [ %k.035, %if.then ], [ %inc, %if.else ]
%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.cond15.preheader, !llvm.loop !9
for.cond.cleanup17: ; preds = %for.body18, %while.body, %for.cond15.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%7 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
for.body18: ; preds = %for.body18.preheader, %for.body18
%indvars.iv42 = phi i64 [ 1, %for.body18.preheader ], [ %indvars.iv.next43, %for.body18 ]
%arrayidx20 = getelementptr inbounds [2005 x i32], ptr @b, i64 0, i64 %indvars.iv42
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !12
while.end: ; preds = %for.cond.cleanup17, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
char s[12];
int a,b,i,ans=1;
scanf("%d%d%s",&a,&b,s);
for(i=0;i<a+b+1;i++){
if(i==a){
if(s[i]!='-'){
ans=0;
break;
}
}
else{
if(s[i]=='-'){
ans=0;
break;
}
}
}
puts(ans?"Yes":"No");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103142/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103142/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [12 x i8], align 1
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %s)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %1, %0
%cmp.not.not19 = icmp slt i32 %add, 0
br i1 %cmp.not.not19, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%2 = zext i32 %0 to i64
%3 = add nuw i32 %add, 1
%wide.trip.count = zext i32 %3 to i64
%arrayidx = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %2
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%cmp2 = icmp eq i64 %indvars.iv, %2
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp3.not = icmp eq i8 %4, 45
br i1 %cmp3.not, label %for.inc, label %for.end
if.else: ; preds = %for.body
%arrayidx7 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx7, align 1, !tbaa !9
%cmp9 = icmp eq i8 %5, 45
br i1 %cmp9, label %for.end, label %for.inc
for.inc: ; preds = %if.then, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %if.then, %if.else, %entry
%cond = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.2, %if.then ], [ @.str.1, %for.inc ]
%call14 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int a,b,count=0,i,sum;
scanf("%d %d",&a,&b);
sum=a+b;
char s[15];
scanf("%s",s);
for(i=0;i<=sum;i++){
if(i==a) continue;
else if(!(s[i]>='0' && s[i]<='9')|| s[a]!='-'){
count++;
break;
}
}
if(count==0) printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103186/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103186/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%s = alloca [15 x i8], align 1
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 %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %1, %0
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %s) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%cmp.not31 = icmp slt i32 %add, 0
br i1 %cmp.not31, label %if.end24, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%2 = load i32, ptr %a, align 4, !tbaa !5
%idxprom10 = sext i32 %2 to i64
%arrayidx11 = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %idxprom10
%3 = zext i32 %2 to i64
%4 = add nuw i32 %add, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%cmp2 = icmp eq i64 %indvars.iv, %3
br i1 %cmp2, label %for.inc, label %if.else
if.else: ; preds = %for.body
%arrayidx = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx, align 1, !tbaa !9
%6 = add i8 %5, -48
%or.cond = icmp ult i8 %6, 10
br i1 %or.cond, label %lor.lhs.false, label %if.end24
lor.lhs.false: ; preds = %if.else
%7 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%cmp13.not = icmp eq i8 %7, 45
br i1 %cmp13.not, label %for.inc, label %if.end24
for.inc: ; preds = %lor.lhs.false, %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.end24, label %for.body, !llvm.loop !10
if.end24: ; preds = %if.else, %lor.lhs.false, %for.inc, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str.4, %for.inc ], [ @str, %lor.lhs.false ], [ @str, %if.else ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int a, b, c, i;
char s[12];
int len;
c = scanf("%d %d", &a, &b);
c = scanf("%s", s);
len = strlen(s);
if(len != a + b + 1){
printf("No");
exit(0);
}
else{
for(i = 0; i < len; i++){
if(i == a){
if(s[i] != '-'){
printf("No");
exit(0);
}
}
else{
if(s[i] == '-'){
printf("No");
exit(0);
}
}
}
printf("Yes");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103229/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103229/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%s = alloca [12 x i8], align 1
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 12, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call3 to i32
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %0, 1
%add4 = add i32 %add, %1
%cmp.not = icmp eq i32 %add4, %conv
br i1 %cmp.not, label %for.cond.preheader, label %if.then
for.cond.preheader: ; preds = %entry
%cmp734 = icmp sgt i32 %conv, 0
br i1 %cmp734, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%2 = zext i32 %0 to i64
%wide.trip.count = and i64 %call3, 4294967295
%arrayidx = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %2
br label %for.body
if.then: ; preds = %entry
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #7
unreachable
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%cmp9 = icmp eq i64 %indvars.iv, %2
br i1 %cmp9, label %if.then11, label %if.else17
if.then11: ; preds = %for.body
%3 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp13.not = icmp eq i8 %3, 45
br i1 %cmp13.not, label %for.inc, label %if.then15
if.then15: ; preds = %if.then11
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #7
unreachable
if.else17: ; preds = %for.body
%arrayidx19 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx19, align 1, !tbaa !9
%cmp21 = icmp eq i8 %4, 45
br i1 %cmp21, label %if.then23, label %for.inc
if.then23: ; preds = %if.else17
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #7
unreachable
for.inc: ; preds = %if.then11, %if.else17
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %for.cond.preheader
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(){
char s[258] = {}, tmp[258] = {};
int m, h, i, l;
while(scanf("%s", s) && s[0] != '-'){
scanf("%d", &m);
while(m--){
scanf("%d", &h);
strcpy(tmp, s + h);
s[h] = '\0';
strcat(tmp, s);
strcpy(s, tmp);
}
puts(s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103272/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103272/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [258 x i8], align 16
%tmp = alloca [258 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 258, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(258) %s, i8 0, i64 258, i1 false)
call void @llvm.lifetime.start.p0(i64 258, ptr nonnull %tmp) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(258) %tmp, i8 0, i64 258, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%tobool23 = icmp ne i32 %call22, 0
%0 = load i8, ptr %s, align 16
%cmp24 = icmp ne i8 %0, 45
%1 = select i1 %tobool23, i1 %cmp24, i1 false
br i1 %1, label %while.body, label %while.end19
while.body: ; preds = %entry, %while.end
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%2 = load i32, ptr %m, align 4, !tbaa !5
%dec20 = add nsw i32 %2, -1
store i32 %dec20, ptr %m, align 4, !tbaa !5
%tobool4.not21 = icmp eq i32 %2, 0
br i1 %tobool4.not21, label %while.end, label %while.body5
while.body5: ; preds = %while.body, %while.body5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%3 = load i32, ptr %h, align 4, !tbaa !5
%idx.ext = sext i32 %3 to i64
%add.ptr = getelementptr inbounds i8, ptr %s, i64 %idx.ext
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %add.ptr) #5
store i8 0, ptr %add.ptr, align 1, !tbaa !9
%call13 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %s) #5
%call16 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %tmp) #5
%4 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool4.not = icmp eq i32 %4, 0
br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !10
while.end: ; preds = %while.body5, %while.body
%call18 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %s)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%tobool = icmp ne i32 %call, 0
%5 = load i8, ptr %s, align 16
%cmp = icmp ne i8 %5, 45
%6 = select i1 %tobool, i1 %cmp, i1 false
br i1 %6, label %while.body, label %while.end19, !llvm.loop !12
while.end19: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 258, ptr nonnull %tmp) #5
call void @llvm.lifetime.end.p0(i64 258, 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: 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 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: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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>
int main()
{
int m,h;
int i;
char str[201],head[201],tail[201];
while(1)
{
scanf("%s",str);
if(!strcmp(str,"-")){break;}
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&h);
strncpy(tail,str,h);
tail[h]='\0';
strcpy(head,str+h);
sprintf(str,"%s%s",head,tail);
}
puts(str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103315/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103315/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%h = alloca i32, align 4
%str = alloca [201 x i8], align 16
%head = alloca [201 x i8], align 16
%tail = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %head) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %tail) #4
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%lhsv22 = load i16, ptr %str, align 16
%.not23 = icmp eq i16 %lhsv22, 45
br i1 %.not23, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.020 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%call7 = call ptr @strncpy(ptr noundef nonnull %tail, ptr noundef nonnull %str, i64 noundef %conv) #4
%arrayidx = getelementptr inbounds [201 x i8], ptr %tail, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !9
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %conv
%call10 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %head, ptr noundef nonnull dereferenceable(1) %add.ptr) #4
%call14 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %head, ptr noundef nonnull %tail) #4
%inc = add nuw nsw i32 %i.020, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%call16 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%lhsv = load i16, ptr %str, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %tail) #4
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %head) #4
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char w[201],t[201];
int m,h,l,i;
while(1){
scanf("%s",w);
if(strcmp(w,"-")==0)
break;
l=strlen(w);
scanf("%d",&m);
while(m--){
scanf("%d",&h);
for(i=0;i<l;i++){
t[i]=w[(i+h)%l];
}
t[l]='\0';
strcpy(w,t);
}
printf("%s\n",t);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103366/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103366/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = 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:
%w = alloca [201 x i8], align 16
%t = alloca [201 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %w) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%lhsv32 = load i16, ptr %w, align 16
%.not33 = icmp eq i16 %lhsv32, 45
br i1 %.not33, label %while.end20, label %if.end
if.end: ; preds = %entry, %while.end
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %w) #7
%call4.fr = freeze i64 %call4
%conv = trunc i64 %call4.fr to i32
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%dec29 = add nsw i32 %0, -1
store i32 %dec29, ptr %m, align 4, !tbaa !5
%tobool.not30 = icmp eq i32 %0, 0
br i1 %tobool.not30, label %while.end, label %while.body7.lr.ph
while.body7.lr.ph: ; preds = %if.end
%cmp927 = icmp sgt i32 %conv, 0
%sext = shl i64 %call4.fr, 32
%idxprom13 = ashr exact i64 %sext, 32
%arrayidx14 = getelementptr inbounds [201 x i8], ptr %t, i64 0, i64 %idxprom13
br i1 %cmp927, label %while.body7.us.preheader, label %while.body7
while.body7.us.preheader: ; preds = %while.body7.lr.ph
%wide.trip.count = and i64 %call4.fr, 4294967295
%xtraiter = and i64 %call4.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 %while.body7.us
while.body7.us: ; preds = %while.body7.us.preheader, %for.cond.for.end_crit_edge.us
%call8.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%2 = load i32, ptr %h, align 4, !tbaa !5
br i1 %1, label %for.cond.for.end_crit_edge.us.unr-lcssa, label %for.body.us
for.body.us: ; preds = %while.body7.us, %for.body.us
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body.us ], [ 0, %while.body7.us ]
%niter = phi i64 [ %niter.next.1, %for.body.us ], [ 0, %while.body7.us ]
%3 = trunc i64 %indvars.iv to i32
%4 = add i32 %2, %3
%rem.us = srem i32 %4, %conv
%idxprom.us = sext i32 %rem.us to i64
%arrayidx.us = getelementptr inbounds [201 x i8], ptr %w, i64 0, i64 %idxprom.us
%5 = load i8, ptr %arrayidx.us, align 1, !tbaa !9
%arrayidx12.us = getelementptr inbounds [201 x i8], ptr %t, i64 0, i64 %indvars.iv
store i8 %5, ptr %arrayidx12.us, align 2, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%6 = trunc i64 %indvars.iv.next to i32
%7 = add i32 %2, %6
%rem.us.1 = srem i32 %7, %conv
%idxprom.us.1 = sext i32 %rem.us.1 to i64
%arrayidx.us.1 = getelementptr inbounds [201 x i8], ptr %w, i64 0, i64 %idxprom.us.1
%8 = load i8, ptr %arrayidx.us.1, align 1, !tbaa !9
%arrayidx12.us.1 = getelementptr inbounds [201 x i8], ptr %t, i64 0, i64 %indvars.iv.next
store i8 %8, ptr %arrayidx12.us.1, align 1, !tbaa !9
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.for.end_crit_edge.us.unr-lcssa, label %for.body.us, !llvm.loop !10
for.cond.for.end_crit_edge.us.unr-lcssa: ; preds = %for.body.us, %while.body7.us
%indvars.iv.unr = phi i64 [ 0, %while.body7.us ], [ %indvars.iv.next.1, %for.body.us ]
br i1 %lcmp.mod.not, label %for.cond.for.end_crit_edge.us, label %for.body.us.epil
for.body.us.epil: ; preds = %for.cond.for.end_crit_edge.us.unr-lcssa
%9 = trunc i64 %indvars.iv.unr to i32
%10 = add i32 %2, %9
%rem.us.epil = srem i32 %10, %conv
%idxprom.us.epil = sext i32 %rem.us.epil to i64
%arrayidx.us.epil = getelementptr inbounds [201 x i8], ptr %w, i64 0, i64 %idxprom.us.epil
%11 = load i8, ptr %arrayidx.us.epil, align 1, !tbaa !9
%arrayidx12.us.epil = getelementptr inbounds [201 x i8], ptr %t, i64 0, i64 %indvars.iv.unr
store i8 %11, ptr %arrayidx12.us.epil, align 1, !tbaa !9
br label %for.cond.for.end_crit_edge.us
for.cond.for.end_crit_edge.us: ; preds = %for.cond.for.end_crit_edge.us.unr-lcssa, %for.body.us.epil
store i8 0, ptr %arrayidx14, align 1, !tbaa !9
%call17.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %w, ptr noundef nonnull dereferenceable(1) %t) #6
%12 = load i32, ptr %m, align 4, !tbaa !5
%dec.us = add nsw i32 %12, -1
store i32 %dec.us, ptr %m, align 4, !tbaa !5
%tobool.not.us = icmp eq i32 %12, 0
br i1 %tobool.not.us, label %while.end, label %while.body7.us, !llvm.loop !12
while.body7: ; preds = %while.body7.lr.ph, %while.body7
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
store i8 0, ptr %arrayidx14, align 1, !tbaa !9
%call17 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %w, ptr noundef nonnull dereferenceable(1) %t) #6
%13 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %13, 0
br i1 %tobool.not, label %while.end, label %while.body7, !llvm.loop !12
while.end: ; preds = %while.body7, %for.cond.for.end_crit_edge.us, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %t)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%lhsv = load i16, ptr %w, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end20, label %if.end
while.end20: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %w) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#include<string.h>
int main(){
char c[201],n;
int len,m,h,a,b,d,e;
while(1){
scanf("%s",c);
if(strcmp(c,"-")==0)break;
len=strlen(c);
scanf("%d",&m);
for(d=0;d<m;d++){
scanf("%d",&h);
for(a=0;a<h;a++){
n=c[0];
for(b=1;b<=len-1;b++){
c[b-1]=c[b];
}
c[len-1]=n;
}
}
printf("%s\n",c);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103409/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103409/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = 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:
%c = alloca [201 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %c) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%lhsv46 = load i16, ptr %c, align 16
%.not47 = icmp eq i16 %lhsv46, 45
br i1 %.not47, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%scevgep = getelementptr inbounds i8, ptr %c, i64 1
br label %if.end
if.end: ; preds = %if.end.preheader, %for.end29
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %c) #7
%call4.fr = freeze i64 %call4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp643 = icmp sgt i32 %0, 0
br i1 %cmp643, label %for.body.lr.ph, label %for.end29
for.body.lr.ph: ; preds = %if.end
%conv = trunc i64 %call4.fr to i32
%cmp14.not.not39 = icmp sgt i32 %conv, 1
%sub = shl i64 %call4.fr, 32
%sext = add i64 %sub, -4294967296
%idxprom22 = ashr exact i64 %sext, 32
%arrayidx23 = getelementptr inbounds [201 x i8], ptr %c, i64 0, i64 %idxprom22
br i1 %cmp14.not.not39, label %for.body.us.preheader, label %for.body
for.body.us.preheader: ; preds = %for.body.lr.ph
%1 = add i64 %call4.fr, 4294967295
%2 = and i64 %1, 4294967295
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.inc27.us
%d.044.us = phi i32 [ %inc28.us, %for.inc27.us ], [ 0, %for.body.us.preheader ]
%call8.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%3 = load i32, ptr %h, align 4, !tbaa !5
%cmp1041.us = icmp sgt i32 %3, 0
br i1 %cmp1041.us, label %for.body12.us.us.preheader, label %for.inc27.us
for.body12.us.us.preheader: ; preds = %for.body.us
%xtraiter55 = and i32 %3, 3
%4 = icmp ult i32 %3, 4
br i1 %4, label %for.inc27.us.loopexit.unr-lcssa, label %for.body12.us.us.preheader.new
for.body12.us.us.preheader.new: ; preds = %for.body12.us.us.preheader
%unroll_iter58 = and i32 %3, -4
br label %for.body12.us.us
for.inc27.us.loopexit.unr-lcssa: ; preds = %for.body12.us.us, %for.body12.us.us.preheader
%lcmp.mod57.not = icmp eq i32 %xtraiter55, 0
br i1 %lcmp.mod57.not, label %for.inc27.us, label %for.body12.us.us.epil
for.body12.us.us.epil: ; preds = %for.inc27.us.loopexit.unr-lcssa, %for.body12.us.us.epil
%epil.iter56 = phi i32 [ %epil.iter56.next, %for.body12.us.us.epil ], [ 0, %for.inc27.us.loopexit.unr-lcssa ]
%5 = load i8, ptr %c, align 16, !tbaa !9
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %c, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !9
store i8 %5, ptr %arrayidx23, align 1, !tbaa !9
%epil.iter56.next = add i32 %epil.iter56, 1
%epil.iter56.cmp.not = icmp eq i32 %epil.iter56.next, %xtraiter55
br i1 %epil.iter56.cmp.not, label %for.inc27.us, label %for.body12.us.us.epil, !llvm.loop !10
for.inc27.us: ; preds = %for.inc27.us.loopexit.unr-lcssa, %for.body12.us.us.epil, %for.body.us
%inc28.us = add nuw nsw i32 %d.044.us, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp6.us = icmp slt i32 %inc28.us, %6
br i1 %cmp6.us, label %for.body.us, label %for.end29, !llvm.loop !12
for.body12.us.us: ; preds = %for.body12.us.us, %for.body12.us.us.preheader.new
%niter59 = phi i32 [ 0, %for.body12.us.us.preheader.new ], [ %niter59.next.3, %for.body12.us.us ]
%7 = load i8, ptr %c, align 16, !tbaa !9
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %c, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !9
store i8 %7, ptr %arrayidx23, align 1, !tbaa !9
%8 = load i8, ptr %c, align 16, !tbaa !9
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %c, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !9
store i8 %8, ptr %arrayidx23, align 1, !tbaa !9
%9 = load i8, ptr %c, align 16, !tbaa !9
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %c, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !9
store i8 %9, ptr %arrayidx23, align 1, !tbaa !9
%10 = load i8, ptr %c, align 16, !tbaa !9
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %c, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !9
store i8 %10, ptr %arrayidx23, align 1, !tbaa !9
%niter59.next.3 = add i32 %niter59, 4
%niter59.ncmp.3 = icmp eq i32 %niter59.next.3, %unroll_iter58
br i1 %niter59.ncmp.3, label %for.inc27.us.loopexit.unr-lcssa, label %for.body12.us.us, !llvm.loop !14
for.body: ; preds = %for.body.lr.ph, %for.inc27
%d.044 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body.lr.ph ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%11 = load i32, ptr %h, align 4, !tbaa !5
%cmp1041 = icmp sgt i32 %11, 0
br i1 %cmp1041, label %for.body12.preheader, label %for.inc27
for.body12.preheader: ; preds = %for.body
%xtraiter = and i32 %11, 3
%12 = icmp ult i32 %11, 4
br i1 %12, label %for.inc27.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i32 %11, -4
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%niter = phi i32 [ 0, %for.body12.preheader.new ], [ %niter.next.3, %for.body12 ]
%13 = load i8, ptr %c, align 16, !tbaa !9
store i8 %13, ptr %arrayidx23, align 1, !tbaa !9
%14 = load i8, ptr %c, align 16, !tbaa !9
store i8 %14, ptr %arrayidx23, align 1, !tbaa !9
%15 = load i8, ptr %c, align 16, !tbaa !9
store i8 %15, ptr %arrayidx23, align 1, !tbaa !9
%16 = load i8, ptr %c, align 16, !tbaa !9
store i8 %16, ptr %arrayidx23, align 1, !tbaa !9
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.inc27.loopexit.unr-lcssa, label %for.body12, !llvm.loop !14
for.inc27.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc27, label %for.body12.epil
for.body12.epil: ; preds = %for.inc27.loopexit.unr-lcssa, %for.body12.epil
%epil.iter = phi i32 [ %epil.iter.next, %for.body12.epil ], [ 0, %for.inc27.loopexit.unr-lcssa ]
%17 = load i8, ptr %c, align 16, !tbaa !9
store i8 %17, ptr %arrayidx23, align 1, !tbaa !9
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.inc27, label %for.body12.epil, !llvm.loop !15
for.inc27: ; preds = %for.inc27.loopexit.unr-lcssa, %for.body12.epil, %for.body
%inc28 = add nuw nsw i32 %d.044, 1
%18 = load i32, ptr %m, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc28, %18
br i1 %cmp6, label %for.body, label %for.end29, !llvm.loop !12
for.end29: ; preds = %for.inc27, %for.inc27.us, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %c)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%lhsv = load i16, ptr %c, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %if.end
while.end: ; preds = %for.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %c) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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.unroll.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !11}
|
// ITP1_9_B: Shuffle
// 2017.7.28
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
char *gets(char *s);
int main()
{
char card[2][210], buf[100];
int id0, id1;
int i, m, h, len;
while (1) {
gets(card[0]); len = strlen(card[0]); card[1][len] = 0;
if (card[0][0] == '-') break;
gets(buf); m = atoi(buf);
for (i = 0, id0 = 0; i < m; i++) {
gets(buf); h = atoi(buf);
if (h > 0 && h < len) {
id1 = !id0;
memcpy(card[id1], card[id0] + h, len - h);
memcpy(card[id1] + len - h, card[id0], h);
id0 = id1;
}
}
puts(card[id0]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103452/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103452/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%card = alloca [2 x [210 x i8]], align 16
%buf = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %card) #6
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %buf) #6
%call68 = call ptr @gets(ptr noundef nonnull %card)
%call369 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %card) #7
%sext71 = shl i64 %call369, 32
%idxprom72 = ashr exact i64 %sext71, 32
%arrayidx573 = getelementptr inbounds [2 x [210 x i8]], ptr %card, i64 0, i64 1, i64 %idxprom72
store i8 0, ptr %arrayidx573, align 1, !tbaa !5
%0 = load i8, ptr %card, align 16, !tbaa !5
%cmp74 = icmp eq i8 %0, 45
br i1 %cmp74, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%idxprom77 = phi i64 [ %idxprom, %for.end ], [ %idxprom72, %entry ]
%call375 = phi i64 [ %call3, %for.end ], [ %call369, %entry ]
%conv76 = trunc i64 %call375 to i32
%call11 = call ptr @gets(ptr noundef nonnull %buf)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %buf, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%cmp1465 = icmp sgt i32 %conv.i, 0
br i1 %cmp1465, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.inc
%id0.067 = phi i32 [ %id0.1, %for.inc ], [ 0, %if.end ]
%i.066 = phi i32 [ %inc, %for.inc ], [ 0, %if.end ]
%call17 = call ptr @gets(ptr noundef nonnull %buf)
%call.i62 = call i64 @strtol(ptr nocapture noundef nonnull %buf, ptr noundef null, i32 noundef 10) #6
%conv.i63 = trunc i64 %call.i62 to i32
%cmp20 = icmp sgt i32 %conv.i63, 0
%cmp22 = icmp slt i32 %conv.i63, %conv76
%or.cond = and i1 %cmp20, %cmp22
br i1 %or.cond, label %if.then24, label %for.inc
if.then24: ; preds = %for.body
%tobool.not = icmp eq i32 %id0.067, 0
%lnot.ext = zext i1 %tobool.not to i32
%idxprom25 = zext i1 %tobool.not to i64
%arrayidx26 = getelementptr inbounds [2 x [210 x i8]], ptr %card, i64 0, i64 %idxprom25
%idxprom28 = zext i32 %id0.067 to i64
%arrayidx29 = getelementptr inbounds [2 x [210 x i8]], ptr %card, i64 0, i64 %idxprom28
%idx.ext = and i64 %call.i62, 4294967295
%add.ptr = getelementptr inbounds i8, ptr %arrayidx29, i64 %idx.ext
%sub = sub i64 %call375, %call.i62
%sext64 = shl i64 %sub, 32
%conv31 = ashr exact i64 %sext64, 32
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 2 %arrayidx26, ptr nonnull align 1 %add.ptr, i64 %conv31, i1 false)
%add.ptr36 = getelementptr inbounds i8, ptr %arrayidx26, i64 %idxprom77
%idx.neg = sub nsw i64 0, %idx.ext
%add.ptr38 = getelementptr inbounds i8, ptr %add.ptr36, i64 %idx.neg
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %add.ptr38, ptr nonnull align 2 %arrayidx29, i64 %idx.ext, i1 false)
br label %for.inc
for.inc: ; preds = %for.body, %if.then24
%id0.1 = phi i32 [ %lnot.ext, %if.then24 ], [ %id0.067, %for.body ]
%inc = add nuw nsw i32 %i.066, 1
%exitcond.not = icmp eq i32 %inc, %conv.i
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.inc, %if.end
%id0.0.lcssa = phi i32 [ 0, %if.end ], [ %id0.1, %for.inc ]
%idxprom44 = zext i32 %id0.0.lcssa to i64
%arrayidx45 = getelementptr inbounds [2 x [210 x i8]], ptr %card, i64 0, i64 %idxprom44
%call47 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %arrayidx45)
%call = call ptr @gets(ptr noundef nonnull %card)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %card) #7
%sext = shl i64 %call3, 32
%idxprom = ashr exact i64 %sext, 32
%arrayidx5 = getelementptr inbounds [2 x [210 x i8]], ptr %card, i64 0, i64 1, i64 %idxprom
store i8 0, ptr %arrayidx5, align 1, !tbaa !5
%1 = load i8, ptr %card, align 16, !tbaa !5
%cmp = icmp eq i8 %1, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %buf) #6
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %card) #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 ptr @gets(ptr noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @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 nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
char str[200];
char te[200];
int m;
char temp = '-';
int i, j;
int num;
int h;
while(1){
scanf("%s", str);
if(str[0] == temp){
break;
}
else{
scanf("%d", &h);
for(j=0; j<h; j++){
scanf("%d", &num);
/* printf("b:%s\n", str);*/
strcpy(te, str);
for(i=num; i<strlen(str); i++){
str[i-num] = te[i];
}
for(i=0; i<num; i++){
str[i + strlen(str) - num] = te[i];
}
/* printf("a:%s\n", str);*/
}
printf("%s\n", str);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [200 x i8], align 16
%te = alloca [200 x i8], align 16
%num = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str) #6
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %te) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp58 = icmp eq i8 %0, 45
br i1 %cmp58, label %while.end, label %if.else
if.else: ; preds = %entry, %for.end37
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !8
%cmp455 = icmp sgt i32 %1, 0
br i1 %cmp455, label %for.body, label %for.end37
for.body: ; preds = %if.else, %for.inc35
%j.056 = phi i32 [ %inc36, %for.inc35 ], [ 0, %if.else ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num)
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %te, ptr noundef nonnull dereferenceable(1) %str) #6
%2 = load i32, ptr %num, align 4, !tbaa !8
%conv1148 = sext i32 %2 to i64
%call1349 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%cmp1450 = icmp ugt i64 %call1349, %conv1148
br i1 %cmp1450, label %for.body16, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body16, %for.body
%cmp2153 = icmp sgt i32 %2, 0
br i1 %cmp2153, label %for.body23.lr.ph, label %for.inc35
for.body23.lr.ph: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body23
for.body16: ; preds = %for.body, %for.body16
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body16 ], [ %conv1148, %for.body ]
%arrayidx17 = getelementptr inbounds [200 x i8], ptr %te, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%4 = sub nsw i64 %indvars.iv, %conv1148
%arrayidx19 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %4
store i8 %3, ptr %arrayidx19, align 1, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call13 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%cmp14 = icmp ugt i64 %call13, %indvars.iv.next
br i1 %cmp14, label %for.body16, label %for.cond20.preheader, !llvm.loop !10
for.body23: ; preds = %for.body23.lr.ph, %for.body23
%indvars.iv61 = phi i64 [ 0, %for.body23.lr.ph ], [ %indvars.iv.next62, %for.body23 ]
%arrayidx25 = getelementptr inbounds [200 x i8], ptr %te, i64 0, i64 %indvars.iv61
%5 = load i8, ptr %arrayidx25, align 1, !tbaa !5
%call28 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%add = sub nsw i64 %indvars.iv61, %conv1148
%sub30 = add i64 %add, %call28
%arrayidx31 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %sub30
store i8 %5, ptr %arrayidx31, align 1, !tbaa !5
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
br i1 %exitcond.not, label %for.inc35, label %for.body23, !llvm.loop !12
for.inc35: ; preds = %for.body23, %for.cond20.preheader
%inc36 = add nuw nsw i32 %j.056, 1
%6 = load i32, ptr %h, align 4, !tbaa !8
%cmp4 = icmp slt i32 %inc36, %6
br i1 %cmp4, label %for.body, label %for.end37, !llvm.loop !13
for.end37: ; preds = %for.inc35, %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%7 = load i8, ptr %str, align 16, !tbaa !5
%cmp = icmp eq i8 %7, 45
br i1 %cmp, label %while.end, label %if.else
while.end: ; preds = %for.end37, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %te) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
/*
??????????????贈????????????
?????????Run time error
C?即??????則???????????????????????????????????贈??\??????????????卒???????????????????????則'\0'?????\??????????????属???????????????
??\???????????即???????????卒????????????????????贈???????????????
strcpy()???strcat()???????????則????属????'\0'?????\??????????????????
C++??則???????????則?????贈???????????????
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
char top[300];
char bottom[300];
char data[300];
char none[1] = "";
int kai,mai;
int i,k,m,len;
while(1){
scanf("%s", data);
if(data[0]=='-'&&strlen(data)==1){
break;
}
len=strlen(data);
scanf("%d", &kai);
for(i=0; i<kai; i++){
scanf("%d", &mai);
for(k=0; k<mai; k++){
top[k]=data[k];
}
top[mai] = '\0';
m=0;
for(k=mai; k<len; k++){
bottom[m]=data[k];
m++;
}
bottom[len-mai] = '\0';
strcpy(data, bottom);
strcat(data, top);
top[0] = '\0';
bottom[0] = '\0';
}
printf("%s\n", data);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103553/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103553/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%top = alloca [300 x i8], align 16
%bottom = alloca [300 x i8], align 16
%data = alloca [300 x i8], align 16
%kai = alloca i32, align 4
%mai = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %top) #7
call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %bottom) #7
call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %data) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kai) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mai) #7
br label %while.cond
while.cond: ; preds = %for.end46, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%0 = load i8, ptr %data, align 16, !tbaa !5
%cmp = icmp eq i8 %0, 45
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.cond
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %data) #8
%cmp4 = icmp eq i64 %call3, 1
br i1 %cmp4, label %while.end, label %if.end
if.end: ; preds = %land.lhs.true, %while.cond
%call7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %data) #8
%conv8 = trunc i64 %call7 to i32
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %kai)
%1 = load i32, ptr %kai, align 4, !tbaa !8
%cmp1063 = icmp sgt i32 %1, 0
br i1 %cmp1063, label %for.body, label %for.end46
for.body: ; preds = %if.end, %for.end33
%i.064 = phi i32 [ %inc45, %for.end33 ], [ 0, %if.end ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %mai)
%2 = load i32, ptr %mai, align 4, !tbaa !8
%cmp1458 = icmp sgt i32 %2, 0
br i1 %cmp1458, label %for.body16.preheader, label %for.end
for.body16.preheader: ; preds = %for.body
%3 = zext i32 %2 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %top, ptr nonnull align 16 %data, i64 %3, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body16.preheader, %for.body
%idxprom20 = sext i32 %2 to i64
%arrayidx21 = getelementptr inbounds [300 x i8], ptr %top, i64 0, i64 %idxprom20
store i8 0, ptr %arrayidx21, align 1, !tbaa !5
%cmp2360 = icmp slt i32 %2, %conv8
br i1 %cmp2360, label %for.body25.preheader, label %for.end33
for.body25.preheader: ; preds = %for.end
%scevgep = getelementptr i8, ptr %data, i64 %idxprom20
%4 = xor i32 %2, -1
%5 = add i32 %4, %conv8
%6 = zext i32 %5 to i64
%7 = add nuw nsw i64 %6, 1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %bottom, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %7, i1 false), !tbaa !5
br label %for.end33
for.end33: ; preds = %for.body25.preheader, %for.end
%sub = sub nsw i32 %conv8, %2
%idxprom34 = sext i32 %sub to i64
%arrayidx35 = getelementptr inbounds [300 x i8], ptr %bottom, i64 0, i64 %idxprom34
store i8 0, ptr %arrayidx35, align 1, !tbaa !5
%call38 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %data, ptr noundef nonnull dereferenceable(1) %bottom) #7
%call41 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %data, ptr noundef nonnull dereferenceable(1) %top) #7
store i8 0, ptr %top, align 16, !tbaa !5
store i8 0, ptr %bottom, align 16, !tbaa !5
%inc45 = add nuw nsw i32 %i.064, 1
%8 = load i32, ptr %kai, align 4, !tbaa !8
%cmp10 = icmp slt i32 %inc45, %8
br i1 %cmp10, label %for.body, label %for.end46, !llvm.loop !10
for.end46: ; preds = %for.end33, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %data)
br label %while.cond
while.end: ; preds = %land.lhs.true
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mai) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kai) #7
call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %data) #7
call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %bottom) #7
call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %top) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int n,k,res,i;
scanf("%d%d",&n,&k);
int a[n];
for(i=1;i<=n;i++)
{
a[i]=0;
}
a[k]=1;
if(k==1||k==n){
res=(n-1)+2*(n-1)+3;
}
else{
if(k>n/2){
res= 2*(n-1)+3+2*(n-k)+(k-2)+1;
}
else{
res=2*(k-1)+3+(k-1)*2+1+2*(n-k)+(n-k-1);
}
}
printf("%d",res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10364/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10364/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = 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 %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = call ptr @llvm.stacksave.p0()
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, 1
%cmp4 = icmp eq i32 %2, %1
%or.cond = or i1 %cmp3, %cmp4
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%3 = mul i32 %1, 3
br label %if.end32
if.else: ; preds = %entry
%div = sdiv i32 %1, 2
%cmp7 = icmp sgt i32 %2, %div
br i1 %cmp7, label %if.then8, label %if.else18
if.then8: ; preds = %if.else
%sub9 = shl i32 %1, 1
%sub12 = sub nsw i32 %1, %2
%mul13 = shl nsw i32 %sub12, 1
%add16 = add i32 %2, %sub9
%add17 = add i32 %add16, %mul13
br label %if.end32
if.else18: ; preds = %if.else
%sub26 = sub nsw i32 %1, %2
%4 = shl i32 %2, 2
%5 = shl i32 %sub26, 1
%reass.mul = add i32 %4, %5
%sub30 = add i32 %sub26, -1
%add31 = add i32 %sub30, %reass.mul
br label %if.end32
if.end32: ; preds = %if.then8, %if.else18, %if.then
%res.0 = phi i32 [ %3, %if.then ], [ %add17, %if.then8 ], [ %add31, %if.else18 ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(void){
int i,j,k,n,s;
char ca[201],can[201];
while(1){
scanf("%s\n%d", ca, &n);
if(!strcmp(ca, "-")) break;
for(i=0;i<n;i++){
scanf("%d", &s);
for(j=s;ca[j]!='\0';j++)
can[j-s] = ca[j];
for(k=0;k<s;k++)
can[j-s+k] = ca[k];
for(j=0;ca[j]!='\0';j++)
ca[j] = can[j];
}
printf("%s\n", ca);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103690/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103690/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s\0A%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%ca = alloca [201 x i8], align 16
%can = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %ca) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %can) #4
%call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ca, ptr noundef nonnull %n)
%lhsv69 = load i16, ptr %ca, align 16
%.not70 = icmp eq i16 %lhsv69, 45
br i1 %.not70, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end40
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.end40
for.body: ; preds = %for.cond.preheader, %for.inc38
%i.067 = phi i32 [ %inc39, %for.inc38 ], [ 0, %for.cond.preheader ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %s)
%1 = load i32, ptr %s, align 4, !tbaa !5
%idxprom56 = sext i32 %1 to i64
%arrayidx57 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %idxprom56
%2 = load i8, ptr %arrayidx57, align 1, !tbaa !9
%cmp5.not58 = icmp eq i8 %2, 0
br i1 %cmp5.not58, label %for.cond12.preheader, label %for.body7
for.cond12.preheader.loopexit: ; preds = %for.body7
%3 = trunc i64 %indvars.iv.next to i32
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.loopexit, %for.body
%j.0.lcssa = phi i32 [ %1, %for.body ], [ %3, %for.cond12.preheader.loopexit ]
%cmp1360 = icmp sgt i32 %1, 0
br i1 %cmp1360, label %iter.check, label %for.cond24.preheader
iter.check: ; preds = %for.cond12.preheader
%sub18 = sub i32 %j.0.lcssa, %1
%4 = sext i32 %sub18 to i64
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body15.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check79 = icmp ult i32 %1, 32
br i1 %min.iters.check79, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %5, align 16, !tbaa !9
%6 = getelementptr inbounds i8, ptr %5, i64 16
%wide.load80 = load <16 x i8>, ptr %6, align 16, !tbaa !9
%7 = add nsw i64 %index, %4
%8 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %7
store <16 x i8> %wide.load, ptr %8, align 1, !tbaa !9
%9 = getelementptr inbounds i8, ptr %8, i64 16
store <16 x i8> %wide.load80, ptr %9, align 1, !tbaa !9
%index.next = add nuw i64 %index, 32
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond24.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body15.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec82 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index84 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next86, %vec.epilog.vector.body ]
%11 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %index84
%wide.load85 = load <8 x i8>, ptr %11, align 8, !tbaa !9
%12 = add nsw i64 %index84, %4
%13 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %12
store <8 x i8> %wide.load85, ptr %13, align 1, !tbaa !9
%index.next86 = add nuw i64 %index84, 8
%14 = icmp eq i64 %index.next86, %n.vec82
br i1 %14, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n83 = icmp eq i64 %n.vec82, %wide.trip.count
br i1 %cmp.n83, label %for.cond24.preheader, label %for.body15.preheader
for.body15.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv72.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec82, %vec.epilog.middle.block ]
br label %for.body15
for.body7: ; preds = %for.body, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ %idxprom56, %for.body ]
%15 = phi i8 [ %17, %for.body7 ], [ %2, %for.body ]
%16 = sub nsw i64 %indvars.iv, %idxprom56
%arrayidx11 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %16
store i8 %15, ptr %arrayidx11, align 1, !tbaa !9
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv.next
%17 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp5.not = icmp eq i8 %17, 0
br i1 %cmp5.not, label %for.cond12.preheader.loopexit, label %for.body7, !llvm.loop !15
for.cond24.preheader: ; preds = %for.body15, %middle.block, %vec.epilog.middle.block, %for.cond12.preheader
%18 = load i8, ptr %ca, align 16, !tbaa !9
%cmp28.not62 = icmp eq i8 %18, 0
br i1 %cmp28.not62, label %for.inc38, label %for.body30
for.body15: ; preds = %for.body15.preheader, %for.body15
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body15 ], [ %indvars.iv72.ph, %for.body15.preheader ]
%arrayidx17 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv72
%19 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%20 = add nsw i64 %indvars.iv72, %4
%arrayidx20 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %20
store i8 %19, ptr %arrayidx20, align 1, !tbaa !9
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body15, !llvm.loop !16
for.body30: ; preds = %for.cond24.preheader, %for.body30
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body30 ], [ 0, %for.cond24.preheader ]
%arrayidx2665 = phi ptr [ %arrayidx26, %for.body30 ], [ %ca, %for.cond24.preheader ]
%arrayidx32 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %indvars.iv76
%21 = load i8, ptr %arrayidx32, align 1, !tbaa !9
store i8 %21, ptr %arrayidx2665, align 1, !tbaa !9
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%arrayidx26 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv.next77
%22 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%cmp28.not = icmp eq i8 %22, 0
br i1 %cmp28.not, label %for.inc38, label %for.body30, !llvm.loop !17
for.inc38: ; preds = %for.body30, %for.cond24.preheader
%inc39 = add nuw nsw i32 %i.067, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc39, %23
br i1 %cmp, label %for.body, label %for.end40, !llvm.loop !18
for.end40: ; preds = %for.inc38, %for.cond.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %ca)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ca, ptr noundef nonnull %n)
%lhsv = load i16, ptr %ca, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end40, %entry
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %can) #4
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %ca) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11, !13, !12}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
|
#include <stdio.h>
#include <string.h>
int main()
{
char card[201];
char str[201];
char stra[201];
int m,h,length;
int i,k,j=0;
while(1){
scanf("%s",card);
length=strlen(card);
if(strcmp(card,"-")==0) break;
scanf("%d",&m);
for(k=0;k<m;k++){
strcpy(str,card);
scanf("%d",&h);
for(i=0;i<(length-h);i++){
card[i]=str[i+h];
}
// printf("%s\n",card);
for(i=0;i<h;i++){
card[length-h+i]=str[i];
//printf("%d\n",length-h+i);
}
}
for(i=0;i<length;i++){
stra[j++]=card[i];
}
stra[j++]='\n';
}
stra[j]='\0';
printf("%s",stra);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103733/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103733/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = 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:
%card = alloca [201 x i8], align 16
%str = alloca [201 x i8], align 16
%stra = alloca [201 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %card) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %stra) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %card)
%lhsv83 = load i16, ptr %card, align 16
%.not84 = icmp eq i16 %lhsv83, 45
br i1 %.not84, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%call281 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %card) #7
br label %if.end
if.end: ; preds = %if.end.preheader, %for.end46
%conv86.in = phi i64 [ %call2, %for.end46 ], [ %call281, %if.end.preheader ]
%j.085 = phi i32 [ %inc47, %for.end46 ], [ 0, %if.end.preheader ]
%conv86 = trunc i64 %conv86.in to i32
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp775 = icmp sgt i32 %0, 0
br i1 %cmp775, label %for.body, label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.inc32, %if.end
%cmp3677 = icmp sgt i32 %conv86, 0
br i1 %cmp3677, label %for.body38.preheader, label %for.end46
for.body38.preheader: ; preds = %for.cond35.preheader
%1 = sext i32 %j.085 to i64
%scevgep92 = getelementptr i8, ptr %stra, i64 %1
%2 = and i64 %conv86.in, 4294967295
call void @llvm.memcpy.p0.p0.i64(ptr align 1 %scevgep92, ptr nonnull align 16 %card, i64 %2, i1 false), !tbaa !9
%3 = trunc i64 %conv86.in to i32
%4 = add i32 %j.085, %3
br label %for.end46
for.body: ; preds = %if.end, %for.inc32
%k.076 = phi i32 [ %inc33, %for.inc32 ], [ 0, %if.end ]
%call11 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %card) #6
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%5 = load i32, ptr %h, align 4, !tbaa !5
%sub = sub nsw i32 %conv86, %5
%cmp1470 = icmp sgt i32 %sub, 0
br i1 %cmp1470, label %for.body16.preheader, label %for.cond19.preheader
for.body16.preheader: ; preds = %for.body
%6 = sext i32 %5 to i64
%scevgep = getelementptr i8, ptr %str, i64 %6
%7 = xor i32 %5, -1
%8 = add i32 %7, %conv86
%9 = zext i32 %8 to i64
%10 = add nuw nsw i64 %9, 1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %card, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %10, i1 false), !tbaa !9
br label %for.cond19.preheader
for.cond19.preheader: ; preds = %for.body16.preheader, %for.body
%cmp2073 = icmp sgt i32 %5, 0
br i1 %cmp2073, label %iter.check, label %for.inc32
iter.check: ; preds = %for.cond19.preheader
%wide.trip.count = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body22.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%11 = add nsw i64 %wide.trip.count, -1
%12 = trunc i64 %11 to i32
%13 = add i32 %sub, %12
%14 = icmp slt i32 %13, %sub
%15 = icmp ugt i64 %11, 4294967295
%16 = or i1 %14, %15
br i1 %16, label %for.body22.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check102 = icmp ult i32 %5, 32
br i1 %min.iters.check102, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%17 = trunc i64 %offset.idx to i32
%18 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %18, align 16, !tbaa !9
%19 = getelementptr inbounds i8, ptr %18, i64 16
%wide.load103 = load <16 x i8>, ptr %19, align 16, !tbaa !9
%20 = add nsw i32 %sub, %17
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %21
store <16 x i8> %wide.load, ptr %22, align 1, !tbaa !9
%23 = getelementptr inbounds i8, ptr %22, i64 16
store <16 x i8> %wide.load103, ptr %23, align 1, !tbaa !9
%index.next = add nuw i64 %offset.idx, 32
%24 = icmp eq i64 %index.next, %n.vec
br i1 %24, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.inc32, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body22.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec105 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%offset.idx107 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next109, %vec.epilog.vector.body ]
%25 = trunc i64 %offset.idx107 to i32
%26 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %offset.idx107
%wide.load108 = load <8 x i8>, ptr %26, align 8, !tbaa !9
%27 = add nsw i32 %sub, %25
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %28
store <8 x i8> %wide.load108, ptr %29, align 1, !tbaa !9
%index.next109 = add nuw i64 %offset.idx107, 8
%30 = icmp eq i64 %index.next109, %n.vec105
br i1 %30, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n106 = icmp eq i64 %n.vec105, %wide.trip.count
br i1 %cmp.n106, label %for.inc32, label %for.body22.preheader
for.body22.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec105, %vec.epilog.middle.block ]
%31 = xor i64 %indvars.iv.ph, -1
%32 = add nsw i64 %31, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body22.prol.loopexit, label %for.body22.prol
for.body22.prol: ; preds = %for.body22.preheader, %for.body22.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body22.prol ], [ %indvars.iv.ph, %for.body22.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body22.prol ], [ 0, %for.body22.preheader ]
%indvars91.prol = trunc i64 %indvars.iv.prol to i32
%arrayidx24.prol = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %indvars.iv.prol
%33 = load i8, ptr %arrayidx24.prol, align 1, !tbaa !9
%add26.prol = add nsw i32 %sub, %indvars91.prol
%idxprom27.prol = sext i32 %add26.prol to i64
%arrayidx28.prol = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %idxprom27.prol
store i8 %33, ptr %arrayidx28.prol, align 1, !tbaa !9
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body22.prol.loopexit, label %for.body22.prol, !llvm.loop !15
for.body22.prol.loopexit: ; preds = %for.body22.prol, %for.body22.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body22.preheader ], [ %indvars.iv.next.prol, %for.body22.prol ]
%34 = icmp ult i64 %32, 3
br i1 %34, label %for.inc32, label %for.body22
for.body22: ; preds = %for.body22.prol.loopexit, %for.body22
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body22 ], [ %indvars.iv.unr, %for.body22.prol.loopexit ]
%indvars91 = trunc i64 %indvars.iv to i32
%arrayidx24 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %indvars.iv
%35 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%add26 = add nsw i32 %sub, %indvars91
%idxprom27 = sext i32 %add26 to i64
%arrayidx28 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %idxprom27
store i8 %35, ptr %arrayidx28, align 1, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%indvars91.1 = trunc i64 %indvars.iv.next to i32
%arrayidx24.1 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%36 = load i8, ptr %arrayidx24.1, align 1, !tbaa !9
%add26.1 = add nsw i32 %sub, %indvars91.1
%idxprom27.1 = sext i32 %add26.1 to i64
%arrayidx28.1 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %idxprom27.1
store i8 %36, ptr %arrayidx28.1, align 1, !tbaa !9
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%indvars91.2 = trunc i64 %indvars.iv.next.1 to i32
%arrayidx24.2 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %indvars.iv.next.1
%37 = load i8, ptr %arrayidx24.2, align 1, !tbaa !9
%add26.2 = add nsw i32 %sub, %indvars91.2
%idxprom27.2 = sext i32 %add26.2 to i64
%arrayidx28.2 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %idxprom27.2
store i8 %37, ptr %arrayidx28.2, align 1, !tbaa !9
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%indvars91.3 = trunc i64 %indvars.iv.next.2 to i32
%arrayidx24.3 = getelementptr inbounds [201 x i8], ptr %str, i64 0, i64 %indvars.iv.next.2
%38 = load i8, ptr %arrayidx24.3, align 1, !tbaa !9
%add26.3 = add nsw i32 %sub, %indvars91.3
%idxprom27.3 = sext i32 %add26.3 to i64
%arrayidx28.3 = getelementptr inbounds [201 x i8], ptr %card, i64 0, i64 %idxprom27.3
store i8 %38, ptr %arrayidx28.3, align 1, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.inc32, label %for.body22, !llvm.loop !17
for.inc32: ; preds = %for.body22.prol.loopexit, %for.body22, %middle.block, %vec.epilog.middle.block, %for.cond19.preheader
%inc33 = add nuw nsw i32 %k.076, 1
%39 = load i32, ptr %m, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc33, %39
br i1 %cmp7, label %for.body, label %for.cond35.preheader, !llvm.loop !18
for.end46: ; preds = %for.body38.preheader, %for.cond35.preheader
%j.1.lcssa = phi i32 [ %j.085, %for.cond35.preheader ], [ %4, %for.body38.preheader ]
%inc47 = add nsw i32 %j.1.lcssa, 1
%idxprom48 = sext i32 %j.1.lcssa to i64
%arrayidx49 = getelementptr inbounds [201 x i8], ptr %stra, i64 0, i64 %idxprom48
store i8 10, ptr %arrayidx49, align 1, !tbaa !9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %card)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %card) #7
%lhsv = load i16, ptr %card, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end.loopexit, label %if.end
while.end.loopexit: ; preds = %for.end46
%40 = sext i32 %inc47 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%j.0.lcssa = phi i64 [ 0, %entry ], [ %40, %while.end.loopexit ]
%arrayidx51 = getelementptr inbounds [201 x i8], ptr %stra, i64 0, i64 %j.0.lcssa
store i8 0, ptr %arrayidx51, align 1, !tbaa !9
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %stra)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %stra) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %card) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11, !12}
!18 = distinct !{!18, !11}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 100
// size: specify sizeof(str)
int get_str(char *str, int size) {
if(!fgets(str, size, stdin)) return -1;
return 0;
}
int get_int(void) {
int num;
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return 0;
sscanf(line, "%d", &num);
#else
#error
#endif
return num;
}
int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return -1;
sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
return 0;
}
int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return -1;
sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
return 0;
}
#define VERTEX_MAX 300
#define INF (int)(0x0101010101)
#define QUERY_MAX 100000
struct pair {
int start;
int end;
};
int main(void) {
int vs, es, litters;
static uint64_t graph[VERTEX_MAX][VERTEX_MAX];
static int cnt[VERTEX_MAX][VERTEX_MAX];
memset(graph, 0x01, sizeof(uint64_t)*VERTEX_MAX*VERTEX_MAX);
memset(cnt, 0x01, sizeof(int)*VERTEX_MAX*VERTEX_MAX);
get_int3(&vs, &es, &litters);
int i, j, k;
for(i = 0; i < es; i++) {
int v1, v2, cost;
get_int3(&v1, &v2, &cost);
// 1-indexed -> 0-indexed
v1--; v2--;
// cannot passed
if(litters < cost) continue;
graph[v1][v2] = graph[v2][v1] = cost;
cnt[v1][v2] = cnt[v2][v1] = 0;
}
// Warshall-floyd
for(k = 0; k < vs; k++) {
for(i = 0; i < vs; i++) {
for(j = 0; j < vs; j++) {
uint64_t new = graph[i][k] + graph[k][j];
if(graph[i][j] > new) {
if(new > litters) continue;
graph[i][j] = new;
cnt[i][j] = 0;
}
}
}
}
// Warshall-floyd
for(k = 0; k < vs; k++) {
for(i = 0; i < vs; i++) {
for(j = 0; j < vs; j++) {
cnt[i][j] = min(cnt[i][k] + cnt[k][j] + 1, cnt[i][j]);
}
}
}
int qs = get_int();
int ans[QUERY_MAX];
int aidx = 0;
for(i = 0; i < qs; i++) {
int src, dst;
get_int2(&src, &dst);
// 1-indexed -> 0-indexed
src--; dst--;
if(cnt[src][dst] == INF) {
ans[aidx++] = -1;
} else {
ans[aidx++] = cnt[src][dst];
}
}
// presentation
for(i = 0; i < aidx; i++) {
printf("%d\n", ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103777/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103777/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@main.graph = internal unnamed_addr global [300 x [300 x i64]] zeroinitializer, align 16
@main.cnt = internal unnamed_addr global [300 x [300 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_str(ptr noundef %str, i32 noundef %size) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef %str, i32 noundef %size, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
%. = sext i1 %tobool.not to i32
ret i32 %.
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%line = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 100, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %num) #4
%1 = load i32, ptr %num, align 4, !tbaa !9
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %1, %if.end ], [ 0, %entry ]
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%line = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 100, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str.1, ptr noundef %a1, ptr noundef %a2) #4
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ]
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line) #4
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int3(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) local_unnamed_addr #0 {
entry:
%line = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 100, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str.2, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) #4
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ]
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line) #4
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%line.i235 = alloca [100 x i8], align 16
%num.i = alloca i32, align 4
%line.i229 = alloca [100 x i8], align 16
%line.i222 = alloca [100 x i8], align 16
%line.i = alloca [100 x i8], align 16
%vs = alloca i32, align 4
%es = alloca i32, align 4
%litters = alloca i32, align 4
%v1 = alloca i32, align 4
%v2 = alloca i32, align 4
%cost = alloca i32, align 4
%ans = alloca [100000 x i32], align 16
%src = alloca i32, align 4
%dst = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vs) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %es) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %litters) #4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(720000) @main.graph, i8 1, i64 720000, i1 false)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(360000) @main.cnt, i8 1, i64 360000, i1 false)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line.i) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call ptr @fgets(ptr noundef nonnull %line.i, i32 noundef 100, ptr noundef %0)
%tobool.not.i = icmp eq ptr %call.i, null
br i1 %tobool.not.i, label %get_int3.exit, label %if.end.i
if.end.i: ; preds = %entry
%call2.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i, ptr noundef nonnull @.str.2, ptr noundef nonnull %vs, ptr noundef nonnull %es, ptr noundef nonnull %litters) #4
br label %get_int3.exit
get_int3.exit: ; preds = %entry, %if.end.i
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line.i) #4
%1 = load i32, ptr %es, align 4, !tbaa !9
%cmp241 = icmp sgt i32 %1, 0
br i1 %cmp241, label %for.body, label %for.cond20.preheader
for.cond20.preheader: ; preds = %cleanup, %get_int3.exit
%2 = load i32, ptr %vs, align 4, !tbaa !9
%cmp21247 = icmp sgt i32 %2, 0
br i1 %cmp21247, label %for.cond24.preheader.lr.ph, label %for.end127
for.cond24.preheader.lr.ph: ; preds = %for.cond20.preheader
%3 = load i32, ptr %litters, align 4
%conv47 = sext i32 %3 to i64
%wide.trip.count270 = zext i32 %2 to i64
br label %for.cond24.preheader.us
for.cond24.preheader.us: ; preds = %for.cond24.for.inc70_crit_edge.split.us.us, %for.cond24.preheader.lr.ph
%indvars.iv267 = phi i64 [ %indvars.iv.next268, %for.cond24.for.inc70_crit_edge.split.us.us ], [ 0, %for.cond24.preheader.lr.ph ]
br label %for.cond28.preheader.us.us
for.cond28.preheader.us.us: ; preds = %for.cond28.for.inc67_crit_edge.us.us, %for.cond24.preheader.us
%indvars.iv262 = phi i64 [ %indvars.iv.next263, %for.cond28.for.inc67_crit_edge.us.us ], [ 0, %for.cond24.preheader.us ]
%arrayidx35.us.us = getelementptr inbounds [300 x [300 x i64]], ptr @main.graph, i64 0, i64 %indvars.iv262, i64 %indvars.iv267
br label %for.body31.us.us
for.body31.us.us: ; preds = %cleanup61.us.us, %for.cond28.preheader.us.us
%indvars.iv = phi i64 [ %indvars.iv.next, %cleanup61.us.us ], [ 0, %for.cond28.preheader.us.us ]
%4 = load i64, ptr %arrayidx35.us.us, align 8, !tbaa !11
%arrayidx39.us.us = getelementptr inbounds [300 x [300 x i64]], ptr @main.graph, i64 0, i64 %indvars.iv267, i64 %indvars.iv
%5 = load i64, ptr %arrayidx39.us.us, align 8, !tbaa !11
%add.us.us = add i64 %5, %4
%arrayidx43.us.us = getelementptr inbounds [300 x [300 x i64]], ptr @main.graph, i64 0, i64 %indvars.iv262, i64 %indvars.iv
%6 = load i64, ptr %arrayidx43.us.us, align 8, !tbaa !11
%cmp44.us.us = icmp ule i64 %6, %add.us.us
%cmp48.us.us = icmp ugt i64 %add.us.us, %conv47
%or.cond.us.us = select i1 %cmp44.us.us, i1 true, i1 %cmp48.us.us
br i1 %or.cond.us.us, label %cleanup61.us.us, label %if.end51.us.us
if.end51.us.us: ; preds = %for.body31.us.us
store i64 %add.us.us, ptr %arrayidx43.us.us, align 8, !tbaa !11
%arrayidx59.us.us = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv262, i64 %indvars.iv
store i32 0, ptr %arrayidx59.us.us, align 4, !tbaa !9
br label %cleanup61.us.us
cleanup61.us.us: ; preds = %if.end51.us.us, %for.body31.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count270
br i1 %exitcond.not, label %for.cond28.for.inc67_crit_edge.us.us, label %for.body31.us.us, !llvm.loop !13
for.cond28.for.inc67_crit_edge.us.us: ; preds = %cleanup61.us.us
%indvars.iv.next263 = add nuw nsw i64 %indvars.iv262, 1
%exitcond266.not = icmp eq i64 %indvars.iv.next263, %wide.trip.count270
br i1 %exitcond266.not, label %for.cond24.for.inc70_crit_edge.split.us.us, label %for.cond28.preheader.us.us, !llvm.loop !15
for.cond24.for.inc70_crit_edge.split.us.us: ; preds = %for.cond28.for.inc67_crit_edge.us.us
%indvars.iv.next268 = add nuw nsw i64 %indvars.iv267, 1
%exitcond271.not = icmp eq i64 %indvars.iv.next268, %wide.trip.count270
br i1 %exitcond271.not, label %for.cond73.preheader, label %for.cond24.preheader.us, !llvm.loop !16
for.body: ; preds = %get_int3.exit, %cleanup
%i.0242 = phi i32 [ %inc, %cleanup ], [ 0, %get_int3.exit ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cost) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line.i222) #4
%7 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i223 = call ptr @fgets(ptr noundef nonnull %line.i222, i32 noundef 100, ptr noundef %7)
%tobool.not.i224 = icmp eq ptr %call.i223, null
br i1 %tobool.not.i224, label %get_int3.exit228, label %if.end.i225
if.end.i225: ; preds = %for.body
%call2.i226 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i222, ptr noundef nonnull @.str.2, ptr noundef nonnull %v1, ptr noundef nonnull %v2, ptr noundef nonnull %cost) #4
br label %get_int3.exit228
get_int3.exit228: ; preds = %for.body, %if.end.i225
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line.i222) #4
%8 = load i32, ptr %litters, align 4, !tbaa !9
%9 = load i32, ptr %cost, align 4, !tbaa !9
%cmp3 = icmp slt i32 %8, %9
br i1 %cmp3, label %cleanup, label %if.end
if.end: ; preds = %get_int3.exit228
%10 = load i32, ptr %v2, align 4, !tbaa !9
%dec2 = add nsw i32 %10, -1
%11 = load i32, ptr %v1, align 4, !tbaa !9
%dec = add nsw i32 %11, -1
%conv = sext i32 %9 to i64
%idxprom = sext i32 %dec2 to i64
%idxprom4 = sext i32 %dec to i64
%arrayidx5 = getelementptr inbounds [300 x [300 x i64]], ptr @main.graph, i64 0, i64 %idxprom, i64 %idxprom4
store i64 %conv, ptr %arrayidx5, align 8, !tbaa !11
%arrayidx9 = getelementptr inbounds [300 x [300 x i64]], ptr @main.graph, i64 0, i64 %idxprom4, i64 %idxprom
store i64 %conv, ptr %arrayidx9, align 8, !tbaa !11
%arrayidx13 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %idxprom, i64 %idxprom4
store i32 0, ptr %arrayidx13, align 4, !tbaa !9
%arrayidx17 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %idxprom4, i64 %idxprom
store i32 0, ptr %arrayidx17, align 4, !tbaa !9
br label %cleanup
cleanup: ; preds = %get_int3.exit228, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cost) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v1) #4
%inc = add nuw nsw i32 %i.0242, 1
%12 = load i32, ptr %es, align 4, !tbaa !9
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.cond20.preheader, !llvm.loop !17
for.cond73.preheader: ; preds = %for.cond24.for.inc70_crit_edge.split.us.us
br i1 %cmp21247, label %for.cond77.preheader.us.preheader, label %for.end127
for.cond77.preheader.us.preheader: ; preds = %for.cond73.preheader
%wide.trip.count285 = zext i32 %2 to i64
%13 = shl nuw nsw i64 %wide.trip.count270, 2
%14 = getelementptr i8, ptr @main.cnt, i64 %13
%min.iters.check = icmp ult i32 %2, 8
%15 = getelementptr i8, ptr @main.cnt, i64 %13
%n.vec = and i64 %wide.trip.count270, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count270
%xtraiter = and i64 %wide.trip.count285, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%16 = sub nsw i64 0, %wide.trip.count285
br label %for.cond77.preheader.us
for.cond77.preheader.us: ; preds = %for.cond77.preheader.us.preheader, %for.cond77.for.inc125_crit_edge.split.us.us
%indvars.iv282 = phi i64 [ 0, %for.cond77.preheader.us.preheader ], [ %indvars.iv.next283, %for.cond77.for.inc125_crit_edge.split.us.us ]
%17 = shl nuw nsw i64 %indvars.iv282, 2
%18 = mul nuw nsw i64 %indvars.iv282, 1200
%scevgep306 = getelementptr i8, ptr @main.cnt, i64 %18
%scevgep307 = getelementptr i8, ptr %14, i64 %18
%gep = getelementptr i8, ptr getelementptr (i8, ptr @main.cnt, i64 4), i64 %17
%19 = getelementptr i8, ptr @main.cnt, i64 %17
%bound0 = icmp ugt ptr %gep, @main.cnt
%bound1 = icmp ult ptr %19, %15
%found.conflict = and i1 %bound0, %bound1
br label %for.cond81.preheader.us.us
for.cond81.preheader.us.us: ; preds = %for.cond81.for.inc122_crit_edge.us.us, %for.cond77.preheader.us
%indvars.iv277 = phi i64 [ %indvars.iv.next278, %for.cond81.for.inc122_crit_edge.us.us ], [ 0, %for.cond77.preheader.us ]
%arrayidx88.us.us = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv277, i64 %indvars.iv282
br i1 %min.iters.check, label %for.body84.us.us.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.cond81.preheader.us.us
%20 = mul nuw nsw i64 %indvars.iv277, 1200
%scevgep303 = getelementptr i8, ptr %15, i64 %20
%scevgep = getelementptr i8, ptr @main.cnt, i64 %20
%bound0308 = icmp ult ptr %scevgep, %scevgep307
%bound1309 = icmp ult ptr %scevgep306, %scevgep303
%found.conflict310 = and i1 %bound0308, %bound1309
%conflict.rdx = or i1 %found.conflict, %found.conflict310
br i1 %conflict.rdx, label %for.body84.us.us.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%21 = load i32, ptr %arrayidx88.us.us, align 4, !tbaa !9, !alias.scope !18
%broadcast.splatinsert312 = insertelement <4 x i32> poison, i32 %21, i64 0
%broadcast.splat313 = shufflevector <4 x i32> %broadcast.splatinsert312, <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 ]
%22 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv282, i64 %index
%wide.load = load <4 x i32>, ptr %22, align 16, !tbaa !9, !alias.scope !21
%23 = getelementptr inbounds i32, ptr %22, i64 4
%wide.load311 = load <4 x i32>, ptr %23, align 16, !tbaa !9, !alias.scope !21
%24 = add nsw <4 x i32> %wide.load, %broadcast.splat313
%25 = add nsw <4 x i32> %wide.load311, %broadcast.splat313
%26 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv277, i64 %index
%wide.load314 = load <4 x i32>, ptr %26, align 16, !tbaa !9, !alias.scope !23, !noalias !25
%27 = getelementptr inbounds i32, ptr %26, i64 4
%wide.load315 = load <4 x i32>, ptr %27, align 16, !tbaa !9, !alias.scope !23, !noalias !25
%28 = icmp slt <4 x i32> %24, %wide.load314
%29 = icmp slt <4 x i32> %25, %wide.load315
%30 = add nsw <4 x i32> %24, <i32 1, i32 1, i32 1, i32 1>
%31 = add nsw <4 x i32> %25, <i32 1, i32 1, i32 1, i32 1>
%32 = select <4 x i1> %28, <4 x i32> %30, <4 x i32> %wide.load314
%33 = select <4 x i1> %29, <4 x i32> %31, <4 x i32> %wide.load315
store <4 x i32> %32, ptr %26, align 16, !tbaa !9, !alias.scope !23, !noalias !25
store <4 x i32> %33, ptr %27, align 16, !tbaa !9, !alias.scope !23, !noalias !25
%index.next = add nuw i64 %index, 8
%34 = icmp eq i64 %index.next, %n.vec
br i1 %34, label %middle.block, label %vector.body, !llvm.loop !26
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond81.for.inc122_crit_edge.us.us, label %for.body84.us.us.preheader
for.body84.us.us.preheader: ; preds = %vector.memcheck, %for.cond81.preheader.us.us, %middle.block
%indvars.iv272.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.cond81.preheader.us.us ], [ %n.vec, %middle.block ]
br i1 %lcmp.mod.not, label %for.body84.us.us.prol.loopexit, label %for.body84.us.us.prol
for.body84.us.us.prol: ; preds = %for.body84.us.us.preheader
%35 = load i32, ptr %arrayidx88.us.us, align 4, !tbaa !9
%arrayidx92.us.us.prol = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv282, i64 %indvars.iv272.ph
%36 = load i32, ptr %arrayidx92.us.us.prol, align 16, !tbaa !9
%add93.us.us.prol = add nsw i32 %36, %35
%arrayidx98.us.us.prol = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv277, i64 %indvars.iv272.ph
%37 = load i32, ptr %arrayidx98.us.us.prol, align 16, !tbaa !9
%cmp99.not.us.us.prol = icmp slt i32 %add93.us.us.prol, %37
%add94.us.us.prol = add nsw i32 %add93.us.us.prol, 1
%cond.us.us.prol = select i1 %cmp99.not.us.us.prol, i32 %add94.us.us.prol, i32 %37
store i32 %cond.us.us.prol, ptr %arrayidx98.us.us.prol, align 16, !tbaa !9
%indvars.iv.next273.prol = or i64 %indvars.iv272.ph, 1
br label %for.body84.us.us.prol.loopexit
for.body84.us.us.prol.loopexit: ; preds = %for.body84.us.us.prol, %for.body84.us.us.preheader
%indvars.iv272.unr = phi i64 [ %indvars.iv272.ph, %for.body84.us.us.preheader ], [ %indvars.iv.next273.prol, %for.body84.us.us.prol ]
%38 = xor i64 %indvars.iv272.ph, %16
%39 = icmp eq i64 %38, -1
br i1 %39, label %for.cond81.for.inc122_crit_edge.us.us, label %for.body84.us.us
for.body84.us.us: ; preds = %for.body84.us.us.prol.loopexit, %for.body84.us.us
%indvars.iv272 = phi i64 [ %indvars.iv.next273.1, %for.body84.us.us ], [ %indvars.iv272.unr, %for.body84.us.us.prol.loopexit ]
%40 = load i32, ptr %arrayidx88.us.us, align 4, !tbaa !9
%arrayidx92.us.us = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv282, i64 %indvars.iv272
%41 = load i32, ptr %arrayidx92.us.us, align 4, !tbaa !9
%add93.us.us = add nsw i32 %41, %40
%arrayidx98.us.us = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv277, i64 %indvars.iv272
%42 = load i32, ptr %arrayidx98.us.us, align 4, !tbaa !9
%cmp99.not.us.us = icmp slt i32 %add93.us.us, %42
%add94.us.us = add nsw i32 %add93.us.us, 1
%cond.us.us = select i1 %cmp99.not.us.us, i32 %add94.us.us, i32 %42
store i32 %cond.us.us, ptr %arrayidx98.us.us, align 4, !tbaa !9
%indvars.iv.next273 = add nuw nsw i64 %indvars.iv272, 1
%43 = load i32, ptr %arrayidx88.us.us, align 4, !tbaa !9
%arrayidx92.us.us.1 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv282, i64 %indvars.iv.next273
%44 = load i32, ptr %arrayidx92.us.us.1, align 4, !tbaa !9
%add93.us.us.1 = add nsw i32 %44, %43
%arrayidx98.us.us.1 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %indvars.iv277, i64 %indvars.iv.next273
%45 = load i32, ptr %arrayidx98.us.us.1, align 4, !tbaa !9
%cmp99.not.us.us.1 = icmp slt i32 %add93.us.us.1, %45
%add94.us.us.1 = add nsw i32 %add93.us.us.1, 1
%cond.us.us.1 = select i1 %cmp99.not.us.us.1, i32 %add94.us.us.1, i32 %45
store i32 %cond.us.us.1, ptr %arrayidx98.us.us.1, align 4, !tbaa !9
%indvars.iv.next273.1 = add nuw nsw i64 %indvars.iv272, 2
%exitcond276.not.1 = icmp eq i64 %indvars.iv.next273.1, %wide.trip.count285
br i1 %exitcond276.not.1, label %for.cond81.for.inc122_crit_edge.us.us, label %for.body84.us.us, !llvm.loop !29
for.cond81.for.inc122_crit_edge.us.us: ; preds = %for.body84.us.us.prol.loopexit, %for.body84.us.us, %middle.block
%indvars.iv.next278 = add nuw nsw i64 %indvars.iv277, 1
%exitcond281.not = icmp eq i64 %indvars.iv.next278, %wide.trip.count285
br i1 %exitcond281.not, label %for.cond77.for.inc125_crit_edge.split.us.us, label %for.cond81.preheader.us.us, !llvm.loop !30
for.cond77.for.inc125_crit_edge.split.us.us: ; preds = %for.cond81.for.inc122_crit_edge.us.us
%indvars.iv.next283 = add nuw nsw i64 %indvars.iv282, 1
%exitcond286.not = icmp eq i64 %indvars.iv.next283, %wide.trip.count285
br i1 %exitcond286.not, label %for.end127, label %for.cond77.preheader.us, !llvm.loop !31
for.end127: ; preds = %for.cond77.for.inc125_crit_edge.split.us.us, %for.cond20.preheader, %for.cond73.preheader
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num.i) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line.i229) #4
%46 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i230 = call ptr @fgets(ptr noundef nonnull %line.i229, i32 noundef 100, ptr noundef %46)
%tobool.not.i231 = icmp eq ptr %call.i230, null
br i1 %tobool.not.i231, label %get_int.exit.thread, label %get_int.exit
get_int.exit.thread: ; preds = %for.end127
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line.i229) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num.i) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %ans) #4
br label %for.end166
get_int.exit: ; preds = %for.end127
%call2.i233 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i229, ptr noundef nonnull @.str, ptr noundef nonnull %num.i) #4
%47 = load i32, ptr %num.i, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line.i229) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num.i) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %ans) #4
%cmp130255 = icmp sgt i32 %47, 0
br i1 %cmp130255, label %for.body132.preheader, label %for.end166
for.body132.preheader: ; preds = %get_int.exit
%wide.trip.count292 = zext i32 %47 to i64
br label %for.body132
for.body160.preheader: ; preds = %get_int2.exit
%wide.trip.count297 = zext i32 %47 to i64
br label %for.body160
for.body132: ; preds = %for.body132.preheader, %get_int2.exit
%indvars.iv287 = phi i64 [ 0, %for.body132.preheader ], [ %indvars.iv.next288, %get_int2.exit ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %src) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %dst) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line.i235) #4
%48 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i236 = call ptr @fgets(ptr noundef nonnull %line.i235, i32 noundef 100, ptr noundef %48)
%tobool.not.i237 = icmp eq ptr %call.i236, null
br i1 %tobool.not.i237, label %get_int2.exit, label %if.end.i238
if.end.i238: ; preds = %for.body132
%call2.i239 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i235, ptr noundef nonnull @.str.1, ptr noundef nonnull %src, ptr noundef nonnull %dst) #4
br label %get_int2.exit
get_int2.exit: ; preds = %for.body132, %if.end.i238
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line.i235) #4
%49 = load i32, ptr %src, align 4, !tbaa !9
%dec134 = add nsw i32 %49, -1
%50 = load i32, ptr %dst, align 4, !tbaa !9
%dec135 = add nsw i32 %50, -1
%idxprom136 = sext i32 %dec134 to i64
%idxprom138 = sext i32 %dec135 to i64
%arrayidx139 = getelementptr inbounds [300 x [300 x i32]], ptr @main.cnt, i64 0, i64 %idxprom136, i64 %idxprom138
%51 = load i32, ptr %arrayidx139, align 4, !tbaa !9
%cmp140 = icmp eq i32 %51, 16843009
%spec.select = select i1 %cmp140, i32 -1, i32 %51
%52 = getelementptr inbounds [100000 x i32], ptr %ans, i64 0, i64 %indvars.iv287
store i32 %spec.select, ptr %52, align 4
%indvars.iv.next288 = add nuw nsw i64 %indvars.iv287, 1
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %dst) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %src) #4
%exitcond293.not = icmp eq i64 %indvars.iv.next288, %wide.trip.count292
br i1 %exitcond293.not, label %for.body160.preheader, label %for.body132, !llvm.loop !32
for.body160: ; preds = %for.body160.preheader, %for.body160
%indvars.iv294 = phi i64 [ 0, %for.body160.preheader ], [ %indvars.iv.next295, %for.body160 ]
%arrayidx162 = getelementptr inbounds [100000 x i32], ptr %ans, i64 0, i64 %indvars.iv294
%53 = load i32, ptr %arrayidx162, align 4, !tbaa !9
%call163 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %53)
%indvars.iv.next295 = add nuw nsw i64 %indvars.iv294, 1
%exitcond298.not = icmp eq i64 %indvars.iv.next295, %wide.trip.count297
br i1 %exitcond298.not, label %for.end166, label %for.body160, !llvm.loop !33
for.end166: ; preds = %for.body160, %get_int.exit.thread, %get_int.exit
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %ans) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %litters) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %es) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vs) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!19}
!19 = distinct !{!19, !20}
!20 = distinct !{!20, !"LVerDomain"}
!21 = !{!22}
!22 = distinct !{!22, !20}
!23 = !{!24}
!24 = distinct !{!24, !20}
!25 = !{!19, !22}
!26 = distinct !{!26, !14, !27, !28}
!27 = !{!"llvm.loop.isvectorized", i32 1}
!28 = !{!"llvm.loop.unroll.runtime.disable"}
!29 = distinct !{!29, !14, !27}
!30 = distinct !{!30, !14}
!31 = distinct !{!31, !14}
!32 = distinct !{!32, !14}
!33 = distinct !{!33, !14}
|
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
int hyouka(int a,int b){
if(C<b)return 1;
if(C<a||b==0)return 0;
return N[H[a]]<N[H[b]]?1:0;
}
void hin(int a){
int i=C++;
for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
H[i]=R++;
}
int hout(){
int rt=H[1],i,j=2,k=H[--C];
for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
H[j/2]=k;
return rt;
}
int ta[100010],nt[400010],to[400010],co[400010];
void mkls(int v,int e,int *a,int *b,int *c){
int i;
for(i=0;i<v;i++)ta[i+1]=-1;
for(i=0;i<e;i++){
nt[i ]=ta[to[i+e]=a[i]];
nt[i+e]=ta[to[i ]=b[i]];
co[ta[b[i]]=i+e]=co[ta[a[i]]=i]=c[i];
}
}
int MAX(int a,int b){return a<b?b:a;}
int MIN(int a,int b){return a<b?a:b;}
int main(){
int n,m,k,a[200010],b[200010],c[200010],d[100010],f[100010],e[100010]={};
int q[100010],t,r,i,j;
scanf("%d %d %d",&n,&m,&k);
for(i=0;i<m;i++)scanf("%d %d",&a[i],&b[i]);
for(i=0;i<m;i++)c[i]=1e9;
for(i=0;i<k;i++){
scanf("%d",&j);
c[j-1]=i+1;
}
mkls(n,m,a,b,c);
q[t=0]=1;
for(i=0;i<n;i++)d[i+1]=1e9;
d[1]=0;
e[1]=1e9;
for(r=1;r-t;t++){
hin(e[q[t]]);
for(i=ta[q[t]];i+1;i=nt[i]){
if(d[to[i]]<d[q[t]]+1)continue;
if(d[to[i]]>d[q[t]]+1)q[r++]=to[i];
d[to[i]]=d[q[t]]+1;
e[to[i]]=MAX(e[to[i]],MIN(e[q[t]],co[i]));
}
}
for(i=0;i<n;i++)f[i]=N[hout()];
for(i=j=0;i<k;i++){
while(f[j]<=i+1)j++;
printf("%d\n",j);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@R = dso_local local_unnamed_addr global i32 1, align 4
@C = dso_local local_unnamed_addr global i32 1, align 4
@N = dso_local local_unnamed_addr global [2000010 x i32] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [2000010 x i32] zeroinitializer, align 16
@ta = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@to = dso_local local_unnamed_addr global [400010 x i32] zeroinitializer, align 16
@nt = dso_local local_unnamed_addr global [400010 x i32] zeroinitializer, align 16
@co = dso_local local_unnamed_addr global [400010 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @hyouka(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @C, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %b
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %0, %a
%cmp2 = icmp eq i32 %b, 0
%or.cond = or i1 %cmp2, %cmp1
br i1 %or.cond, label %return, label %if.end4
if.end4: ; preds = %if.end
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%idxprom7 = sext i32 %b to i64
%arrayidx8 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%idxprom9 = sext i32 %3 to i64
%arrayidx10 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp slt i32 %2, %4
%cond = zext i1 %cmp11 to i32
br label %return
return: ; preds = %if.end, %entry, %if.end4
%retval.0 = phi i32 [ %cond, %if.end4 ], [ 1, %entry ], [ 0, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @hin(i32 noundef %a) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @C, align 4, !tbaa !5
%.fr = freeze i32 %0
%inc = add nsw i32 %.fr, 1
store i32 %inc, ptr @C, align 4, !tbaa !5
%1 = load i32, ptr @R, align 4, !tbaa !5
store i32 %1, ptr @H, align 16, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
%cmp1.i = icmp slt i32 %.fr, -1
br i1 %cmp1.i, label %entry.split.us, label %for.cond
entry.split.us: ; preds = %entry
%.fr.nonneg = sub i32 0, %.fr
%div.us192426 = lshr i32 %.fr.nonneg, 1
%div.us1924.neg = sub nsw i32 0, %div.us192426
%cmp.i.us20 = icmp ult i32 %inc, %div.us1924.neg
br i1 %cmp.i.us20, label %for.body.us, label %for.end
for.body.us: ; preds = %entry.split.us, %for.body.us
%div.us22 = phi i32 [ %div.us, %for.body.us ], [ %div.us1924.neg, %entry.split.us ]
%i.0.us21 = phi i32 [ %div.us22, %for.body.us ], [ %.fr, %entry.split.us ]
%idxprom2.us = sext i32 %div.us22 to i64
%arrayidx3.us = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.us
%2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%idxprom4.us = sext i32 %i.0.us21 to i64
%arrayidx5.us = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.us
store i32 %2, ptr %arrayidx5.us, align 4, !tbaa !5
%div.us = sdiv i32 %div.us22, 2
%cmp.i.us = icmp slt i32 %inc, %div.us
br i1 %cmp.i.us, label %for.body.us, label %for.end, !llvm.loop !9
for.cond: ; preds = %entry, %for.body
%i.0 = phi i32 [ %div, %for.body ], [ %.fr, %entry ]
%div = sdiv i32 %i.0, 2
%cmp.i = icmp slt i32 %inc, %div
br i1 %cmp.i, label %for.cond.for.body_crit_edge, label %if.end.i
for.cond.for.body_crit_edge: ; preds = %for.cond
%idxprom2.phi.trans.insert = sext i32 %div to i64
%arrayidx3.phi.trans.insert = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.phi.trans.insert
%.pre = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5
br label %for.body
if.end.i: ; preds = %for.cond
%i.0.off = add i32 %i.0, 1
%cmp2.i = icmp ult i32 %i.0.off, 3
br i1 %cmp2.i, label %for.end, label %hyouka.exit
hyouka.exit: ; preds = %if.end.i
%3 = load i32, ptr @H, align 16, !tbaa !5
%idxprom5.i = sext i32 %3 to i64
%arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i
%4 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%idxprom7.i = sext i32 %div to i64
%arrayidx8.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i
%5 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5
%idxprom9.i = sext i32 %5 to i64
%arrayidx10.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i
%6 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%cmp11.i.not = icmp slt i32 %4, %6
br i1 %cmp11.i.not, label %for.body, label %for.end
for.body: ; preds = %for.cond.for.body_crit_edge, %hyouka.exit
%7 = phi i32 [ %.pre, %for.cond.for.body_crit_edge ], [ %5, %hyouka.exit ]
%idxprom4 = sext i32 %i.0 to i64
%arrayidx5 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4
store i32 %7, ptr %arrayidx5, align 4, !tbaa !5
br label %for.cond, !llvm.loop !9
for.end: ; preds = %hyouka.exit, %if.end.i, %for.body.us, %entry.split.us
%.us-phi = phi i32 [ %.fr, %entry.split.us ], [ %div.us22, %for.body.us ], [ %i.0, %if.end.i ], [ %i.0, %hyouka.exit ]
%inc7 = add nsw i32 %1, 1
store i32 %inc7, ptr @R, align 4, !tbaa !5
%idxprom8 = sext i32 %.us-phi to i64
%arrayidx9 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom8
store i32 %1, ptr %arrayidx9, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; 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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @hout() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr getelementptr inbounds ([2000010 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5
%1 = load i32, ptr @C, align 4, !tbaa !5
%.fr = freeze i32 %1
%dec = add i32 %.fr, -1
store i32 %dec, ptr @C, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond.i35 = icmp slt i32 %.fr, 2
br i1 %or.cond.i35, label %for.end, label %hyouka.exit.lr.ph.split
hyouka.exit.lr.ph.split: ; preds = %entry
%idxprom5.i40 = sext i32 %0 to i64
%arrayidx6.i41 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i40
%3 = load i32, ptr %arrayidx6.i41, align 4, !tbaa !5
%idxprom9.i42 = sext i32 %2 to i64
%arrayidx10.i43 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i42
%4 = load i32, ptr %arrayidx10.i43, align 4, !tbaa !5
%cmp11.i.not44 = icmp slt i32 %3, %4
br i1 %cmp11.i.not44, label %for.body, label %for.end
hyouka.exit: ; preds = %hyouka.exit31
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%idxprom5.i = sext i32 %5 to i64
%arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i
%6 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom9.i = sext i32 %7 to i64
%arrayidx10.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i
%8 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%cmp11.i.not = icmp slt i32 %6, %8
br i1 %cmp11.i.not, label %for.body, label %for.end.loopexit, !llvm.loop !11
for.body: ; preds = %hyouka.exit.lr.ph.split, %hyouka.exit
%i.03745 = phi i32 [ %sub, %hyouka.exit ], [ 1, %hyouka.exit.lr.ph.split ]
%mul = shl nsw i32 %i.03745, 1
%add = or i32 %mul, 1
%cmp.i16.not = icmp sgt i32 %.fr, %add
br i1 %cmp.i16.not, label %if.end.i17, label %hyouka.exit31
if.end.i17: ; preds = %for.body
%cmp1.i18.not = icmp sgt i32 %.fr, %mul
br i1 %cmp1.i18.not, label %if.end4.i19, label %hyouka.exit31
if.end4.i19: ; preds = %if.end.i17
%idxprom.i20 = sext i32 %mul to i64
%arrayidx.i21 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i20
%9 = load i32, ptr %arrayidx.i21, align 8, !tbaa !5
%idxprom5.i22 = sext i32 %9 to i64
%arrayidx6.i23 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i22
%10 = load i32, ptr %arrayidx6.i23, align 4, !tbaa !5
%idxprom7.i24 = sext i32 %add to i64
%arrayidx8.i25 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i24
%11 = load i32, ptr %arrayidx8.i25, align 4, !tbaa !5
%idxprom9.i26 = sext i32 %11 to i64
%arrayidx10.i27 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i26
%12 = load i32, ptr %arrayidx10.i27, align 4, !tbaa !5
%cmp11.i28 = icmp slt i32 %10, %12
%cond.i29.neg = sext i1 %cmp11.i28 to i32
br label %hyouka.exit31
hyouka.exit31: ; preds = %for.body, %if.end.i17, %if.end4.i19
%retval.0.i30.neg = phi i32 [ %cond.i29.neg, %if.end4.i19 ], [ -1, %for.body ], [ 0, %if.end.i17 ]
%sub = add i32 %retval.0.i30.neg, %add
%idxprom5 = sext i32 %sub to i64
%arrayidx6 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom5
%13 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%idxprom7 = sext i32 %i.03745 to i64
%arrayidx8 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7
store i32 %13, ptr %arrayidx8, align 4, !tbaa !5
%cmp1.i.not = icmp sgt i32 %.fr, %sub
br i1 %cmp1.i.not, label %hyouka.exit, label %for.end.loopexit, !llvm.loop !11
for.end.loopexit: ; preds = %hyouka.exit31, %hyouka.exit
%14 = sdiv i32 %sub, 2
%15 = sext i32 %14 to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %hyouka.exit.lr.ph.split, %entry
%j.0.lcssa = phi i64 [ 1, %entry ], [ 1, %hyouka.exit.lr.ph.split ], [ %15, %for.end.loopexit ]
%arrayidx10 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %j.0.lcssa
store i32 %2, ptr %arrayidx10, align 4, !tbaa !5
ret i32 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @mkls(i32 noundef %v, i32 noundef %e, ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, ptr nocapture noundef readonly %c) local_unnamed_addr #3 {
entry:
%cmp60 = icmp sgt i32 %v, 0
br i1 %cmp60, label %for.body.preheader, label %for.cond1.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %v to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([100010 x i32], ptr @ta, i64 0, i64 1), i8 -1, i64 %1, i1 false), !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.body.preheader, %entry
%cmp262 = icmp sgt i32 %e, 0
br i1 %cmp262, label %for.body3.preheader, label %for.end39
for.body3.preheader: ; preds = %for.cond1.preheader
%2 = zext i32 %e to i64
%wide.trip.count = zext i32 %e to i64
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.body3 ]
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%4 = add nuw nsw i64 %indvars.iv, %2
%arrayidx8 = getelementptr inbounds [400010 x i32], ptr @to, i64 0, i64 %4
store i32 %3, ptr %arrayidx8, align 4, !tbaa !5
%idxprom9 = sext i32 %3 to i64
%arrayidx10 = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom9
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [400010 x i32], ptr @nt, i64 0, i64 %indvars.iv
store i32 %5, ptr %arrayidx12, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [400010 x i32], ptr @to, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%arrayidx18 = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom17
%7 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%arrayidx21 = getelementptr inbounds [400010 x i32], ptr @nt, i64 0, i64 %4
store i32 %7, ptr %arrayidx21, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i32, ptr %c, i64 %indvars.iv
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%idxprom26 = sext i32 %9 to i64
%arrayidx27 = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom26
%10 = trunc i64 %indvars.iv to i32
store i32 %10, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx29 = getelementptr inbounds [400010 x i32], ptr @co, i64 0, i64 %indvars.iv
store i32 %8, ptr %arrayidx29, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%idxprom33 = sext i32 %11 to i64
%arrayidx34 = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom33
%12 = trunc i64 %4 to i32
store i32 %12, ptr %arrayidx34, align 4, !tbaa !5
%arrayidx36 = getelementptr inbounds [400010 x i32], ptr @co, i64 0, i64 %4
store i32 %8, ptr %arrayidx36, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end39, label %for.body3, !llvm.loop !12
for.end39: ; preds = %for.body3, %for.cond1.preheader
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MAX(i32 noundef %a, i32 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MIN(i32 noundef %a, i32 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [200010 x i32], align 16
%b = alloca [200010 x i32], align 16
%c = alloca [200010 x i32], align 16
%d = alloca [100010 x i32], align 16
%f = alloca [100010 x i32], align 16
%e = alloca [100010 x i32], align 16
%q = alloca [100010 x i32], align 16
%j = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %a) #9
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %b) #9
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %c) #9
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %d) #9
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %f) #9
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %e) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) %e, i8 0, i64 400040, i1 false)
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %q) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp183 = icmp sgt i32 %0, 0
br i1 %cmp183, label %for.body, label %for.cond12.preheader
for.cond4.preheader: ; preds = %for.body
%cmp5185 = icmp sgt i32 %4, 0
br i1 %cmp5185, label %for.body6.preheader, label %for.cond12.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body6.preheader267, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr inbounds [200010 x i32], ptr %c, i64 0, i64 %index
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond12.preheader, label %for.body6.preheader267
for.body6.preheader267: ; preds = %for.body6.preheader, %middle.block
%indvars.iv219.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200010 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [200010 x i32], ptr %b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !16
for.cond12.preheader: ; preds = %for.body6, %middle.block, %entry, %for.cond4.preheader
%.lcssa182246 = phi i32 [ %4, %for.cond4.preheader ], [ %0, %entry ], [ %4, %middle.block ], [ %4, %for.body6 ]
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp13187 = icmp sgt i32 %6, 0
br i1 %cmp13187, label %for.body14, label %for.end20
for.body6: ; preds = %for.body6.preheader267, %for.body6
%indvars.iv219 = phi i64 [ %indvars.iv.next220, %for.body6 ], [ %indvars.iv219.ph, %for.body6.preheader267 ]
%arrayidx8 = getelementptr inbounds [200010 x i32], ptr %c, i64 0, i64 %indvars.iv219
store i32 1000000000, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next220 = add nuw nsw i64 %indvars.iv219, 1
%exitcond.not = icmp eq i64 %indvars.iv.next220, %wide.trip.count
br i1 %exitcond.not, label %for.cond12.preheader, label %for.body6, !llvm.loop !17
for.body14: ; preds = %for.cond12.preheader, %for.body14
%i.2188 = phi i32 [ %add, %for.body14 ], [ 0, %for.cond12.preheader ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %j)
%add = add nuw nsw i32 %i.2188, 1
%7 = load i32, ptr %j, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%idxprom16 = sext i32 %sub to i64
%arrayidx17 = getelementptr inbounds [200010 x i32], ptr %c, i64 0, i64 %idxprom16
store i32 %add, ptr %arrayidx17, align 4, !tbaa !5
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp13 = icmp slt i32 %add, %8
br i1 %cmp13, label %for.body14, label %for.end20.loopexit, !llvm.loop !18
for.end20.loopexit: ; preds = %for.body14
%.pre = load i32, ptr %m, align 4, !tbaa !5
%9 = icmp sgt i32 %8, 0
br label %for.end20
for.end20: ; preds = %for.end20.loopexit, %for.cond12.preheader
%cmp121214 = phi i1 [ %9, %for.end20.loopexit ], [ false, %for.cond12.preheader ]
%10 = phi i32 [ %.pre, %for.end20.loopexit ], [ %.lcssa182246, %for.cond12.preheader ]
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp60.i = icmp sgt i32 %11, 0
br i1 %cmp60.i, label %for.body.preheader.i, label %for.cond1.preheader.i
for.body.preheader.i: ; preds = %for.end20
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([100010 x i32], ptr @ta, i64 0, i64 1), i8 -1, i64 %13, i1 false), !tbaa !5
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.body.preheader.i, %for.end20
%cmp262.i = icmp sgt i32 %10, 0
br i1 %cmp262.i, label %for.body3.preheader.i, label %mkls.exit
for.body3.preheader.i: ; preds = %for.cond1.preheader.i
%14 = zext i32 %10 to i64
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.body3.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.body3.i ]
%arrayidx5.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%15 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%16 = add nuw nsw i64 %indvars.iv.i, %14
%arrayidx8.i = getelementptr inbounds [400010 x i32], ptr @to, i64 0, i64 %16
store i32 %15, ptr %arrayidx8.i, align 4, !tbaa !5
%idxprom9.i = sext i32 %15 to i64
%arrayidx10.i = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom9.i
%17 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx12.i = getelementptr inbounds [400010 x i32], ptr @nt, i64 0, i64 %indvars.iv.i
store i32 %17, ptr %arrayidx12.i, align 4, !tbaa !5
%arrayidx14.i = getelementptr inbounds i32, ptr %b, i64 %indvars.iv.i
%18 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [400010 x i32], ptr @to, i64 0, i64 %indvars.iv.i
store i32 %18, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %18 to i64
%arrayidx18.i = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom17.i
%19 = load i32, ptr %arrayidx18.i, align 4, !tbaa !5
%arrayidx21.i = getelementptr inbounds [400010 x i32], ptr @nt, i64 0, i64 %16
store i32 %19, ptr %arrayidx21.i, align 4, !tbaa !5
%arrayidx23.i = getelementptr inbounds i32, ptr %c, i64 %indvars.iv.i
%20 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%21 = trunc i64 %indvars.iv.i to i32
store i32 %21, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx29.i = getelementptr inbounds [400010 x i32], ptr @co, i64 0, i64 %indvars.iv.i
store i32 %20, ptr %arrayidx29.i, align 4, !tbaa !5
%22 = trunc i64 %16 to i32
store i32 %22, ptr %arrayidx18.i, align 4, !tbaa !5
%arrayidx36.i = getelementptr inbounds [400010 x i32], ptr @co, i64 0, i64 %16
store i32 %20, ptr %arrayidx36.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %14
br i1 %exitcond.not.i, label %mkls.exit, label %for.body3.i, !llvm.loop !12
mkls.exit: ; preds = %for.body3.i, %for.cond1.preheader.i
store i32 1, ptr %q, align 16, !tbaa !5
br i1 %cmp60.i, label %for.body26.preheader, label %for.end32
for.body26.preheader: ; preds = %mkls.exit
%wide.trip.count225 = zext i32 %11 to i64
%min.iters.check255 = icmp ult i32 %11, 8
br i1 %min.iters.check255, label %for.body26.preheader265, label %vector.ph256
vector.ph256: ; preds = %for.body26.preheader
%n.vec258 = and i64 %wide.trip.count225, 4294967288
br label %vector.body261
vector.body261: ; preds = %vector.body261, %vector.ph256
%index262 = phi i64 [ 0, %vector.ph256 ], [ %index.next263, %vector.body261 ]
%23 = or i64 %index262, 1
%24 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %23
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %24, align 4, !tbaa !5
%25 = getelementptr inbounds i32, ptr %24, i64 4
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %25, align 4, !tbaa !5
%index.next263 = add nuw i64 %index262, 8
%26 = icmp eq i64 %index.next263, %n.vec258
br i1 %26, label %middle.block253, label %vector.body261, !llvm.loop !19
middle.block253: ; preds = %vector.body261
%cmp.n260 = icmp eq i64 %n.vec258, %wide.trip.count225
br i1 %cmp.n260, label %for.end32, label %for.body26.preheader265
for.body26.preheader265: ; preds = %for.body26.preheader, %middle.block253
%indvars.iv222.ph = phi i64 [ 0, %for.body26.preheader ], [ %n.vec258, %middle.block253 ]
br label %for.body26
for.body26: ; preds = %for.body26.preheader265, %for.body26
%indvars.iv222 = phi i64 [ %indvars.iv.next223, %for.body26 ], [ %indvars.iv222.ph, %for.body26.preheader265 ]
%indvars.iv.next223 = add nuw nsw i64 %indvars.iv222, 1
%arrayidx29 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %indvars.iv.next223
store i32 1000000000, ptr %arrayidx29, align 4, !tbaa !5
%exitcond226.not = icmp eq i64 %indvars.iv.next223, %wide.trip.count225
br i1 %exitcond226.not, label %for.end32, label %for.body26, !llvm.loop !20
for.end32: ; preds = %for.body26, %middle.block253, %mkls.exit
%arrayidx33 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 1
store i32 0, ptr %arrayidx33, align 4, !tbaa !5
%arrayidx34 = getelementptr inbounds [100010 x i32], ptr %e, i64 0, i64 1
store i32 1000000000, ptr %arrayidx34, align 4, !tbaa !5
%C.promoted = load i32, ptr @C, align 4, !tbaa !5
%R.promoted = load i32, ptr @R, align 4, !tbaa !5
%C.promoted.fr = freeze i32 %C.promoted
%27 = sext i32 %R.promoted to i64
br label %for.body37
for.cond109.preheader: ; preds = %for.inc106
%28 = trunc i64 %indvars.iv.next230 to i32
store i32 %inc.i, ptr @C, align 4, !tbaa !5
store i32 %28, ptr @R, align 4, !tbaa !5
br i1 %cmp60.i, label %for.body111.preheader, label %for.end119
for.body111.preheader: ; preds = %for.cond109.preheader
%wide.trip.count237 = zext i32 %11 to i64
br label %for.body111
for.body37: ; preds = %for.end32, %for.inc106
%indvars.iv229 = phi i64 [ %27, %for.end32 ], [ %indvars.iv.next230, %for.inc106 ]
%indvars.iv227 = phi i64 [ 0, %for.end32 ], [ %indvars.iv.next228, %for.inc106 ]
%r.0201 = phi i32 [ 1, %for.end32 ], [ %r.1.lcssa, %for.inc106 ]
%inc.i196199 = phi i32 [ %C.promoted.fr, %for.end32 ], [ %inc.i, %for.inc106 ]
%arrayidx39 = getelementptr inbounds [100010 x i32], ptr %q, i64 0, i64 %indvars.iv227
%29 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%idxprom40 = sext i32 %29 to i64
%arrayidx41 = getelementptr inbounds [100010 x i32], ptr %e, i64 0, i64 %idxprom40
%30 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%inc.i = add i32 %inc.i196199, 1
%31 = trunc i64 %indvars.iv229 to i32
store i32 %31, ptr @H, align 16, !tbaa !5
%arrayidx.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %indvars.iv229
store i32 %30, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i.i = icmp slt i32 %inc.i196199, -1
br i1 %cmp1.i.i, label %entry.split.us.i, label %for.cond.i
entry.split.us.i: ; preds = %for.body37
%.fr.nonneg.i = sub i32 0, %inc.i196199
%div.us192426.i = lshr i32 %.fr.nonneg.i, 1
%div.us1924.neg.i = sub nsw i32 0, %div.us192426.i
%cmp.i.us20.i = icmp ult i32 %inc.i, %div.us1924.neg.i
br i1 %cmp.i.us20.i, label %for.body.us.i, label %hin.exit
for.body.us.i: ; preds = %entry.split.us.i, %for.body.us.i
%div.us22.i = phi i32 [ %div.us.i, %for.body.us.i ], [ %div.us1924.neg.i, %entry.split.us.i ]
%i.0.us21.i = phi i32 [ %div.us22.i, %for.body.us.i ], [ %inc.i196199, %entry.split.us.i ]
%idxprom2.us.i = sext i32 %div.us22.i to i64
%arrayidx3.us.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.us.i
%32 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%idxprom4.us.i = sext i32 %i.0.us21.i to i64
%arrayidx5.us.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.us.i
store i32 %32, ptr %arrayidx5.us.i, align 4, !tbaa !5
%div.us.i = sdiv i32 %div.us22.i, 2
%cmp.i.us.i = icmp slt i32 %inc.i, %div.us.i
br i1 %cmp.i.us.i, label %for.body.us.i, label %hin.exit, !llvm.loop !9
for.cond.i: ; preds = %for.body37, %for.body.i
%i.0.i = phi i32 [ %div.i, %for.body.i ], [ %inc.i196199, %for.body37 ]
%div.i = sdiv i32 %i.0.i, 2
%cmp.i.i = icmp slt i32 %inc.i, %div.i
br i1 %cmp.i.i, label %for.cond.for.body_crit_edge.i, label %if.end.i.i
for.cond.for.body_crit_edge.i: ; preds = %for.cond.i
%idxprom2.phi.trans.insert.i = sext i32 %div.i to i64
%arrayidx3.phi.trans.insert.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.phi.trans.insert.i
%.pre.i = load i32, ptr %arrayidx3.phi.trans.insert.i, align 4, !tbaa !5
br label %for.body.i
if.end.i.i: ; preds = %for.cond.i
%i.0.off.i = add i32 %i.0.i, 1
%cmp2.i.i = icmp ult i32 %i.0.off.i, 3
br i1 %cmp2.i.i, label %hin.exit, label %hyouka.exit.i
hyouka.exit.i: ; preds = %if.end.i.i
%33 = load i32, ptr @H, align 16, !tbaa !5
%idxprom5.i.i = sext i32 %33 to i64
%arrayidx6.i.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i.i
%34 = load i32, ptr %arrayidx6.i.i, align 4, !tbaa !5
%idxprom7.i.i = sext i32 %div.i to i64
%arrayidx8.i.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i.i
%35 = load i32, ptr %arrayidx8.i.i, align 4, !tbaa !5
%idxprom9.i.i = sext i32 %35 to i64
%arrayidx10.i.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i.i
%36 = load i32, ptr %arrayidx10.i.i, align 4, !tbaa !5
%cmp11.i.not.i = icmp slt i32 %34, %36
br i1 %cmp11.i.not.i, label %for.body.i, label %hin.exit
for.body.i: ; preds = %hyouka.exit.i, %for.cond.for.body_crit_edge.i
%37 = phi i32 [ %.pre.i, %for.cond.for.body_crit_edge.i ], [ %35, %hyouka.exit.i ]
%idxprom4.i = sext i32 %i.0.i to i64
%arrayidx5.i167 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.i
store i32 %37, ptr %arrayidx5.i167, align 4, !tbaa !5
br label %for.cond.i, !llvm.loop !9
hin.exit: ; preds = %if.end.i.i, %hyouka.exit.i, %for.body.us.i, %entry.split.us.i
%.us-phi.i = phi i32 [ %inc.i196199, %entry.split.us.i ], [ %div.us22.i, %for.body.us.i ], [ %i.0.i, %hyouka.exit.i ], [ %i.0.i, %if.end.i.i ]
%indvars.iv.next230 = add i64 %indvars.iv229, 1
%idxprom8.i = sext i32 %.us-phi.i to i64
%arrayidx9.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom8.i
store i32 %31, ptr %arrayidx9.i, align 4, !tbaa !5
%arrayidx45 = getelementptr inbounds [100010 x i32], ptr @ta, i64 0, i64 %idxprom40
%i.4191 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%tobool48.not192 = icmp eq i32 %i.4191, -1
br i1 %tobool48.not192, label %for.inc106, label %for.body49
for.body49: ; preds = %hin.exit, %for.inc102
%38 = phi i32 [ %48, %for.inc102 ], [ %29, %hin.exit ]
%39 = phi i32 [ %49, %for.inc102 ], [ %29, %hin.exit ]
%i.4194 = phi i32 [ %i.4, %for.inc102 ], [ %i.4191, %hin.exit ]
%r.1193 = phi i32 [ %r.3, %for.inc102 ], [ %r.0201, %hin.exit ]
%idxprom50 = sext i32 %i.4194 to i64
%arrayidx51 = getelementptr inbounds [400010 x i32], ptr @to, i64 0, i64 %idxprom50
%40 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%idxprom52 = sext i32 %40 to i64
%arrayidx53 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %idxprom52
%41 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%idxprom56 = sext i32 %39 to i64
%arrayidx57 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %idxprom56
%42 = load i32, ptr %arrayidx57, align 4, !tbaa !5
%cmp59.not = icmp sgt i32 %41, %42
br i1 %cmp59.not, label %if.end, label %for.inc102
if.end: ; preds = %for.body49
%add58 = add nsw i32 %42, 1
%cmp69 = icmp sgt i32 %41, %add58
br i1 %cmp69, label %if.then70, label %if.end76
if.then70: ; preds = %if.end
%inc73 = add nsw i32 %r.1193, 1
%idxprom74 = sext i32 %r.1193 to i64
%arrayidx75 = getelementptr inbounds [100010 x i32], ptr %q, i64 0, i64 %idxprom74
store i32 %40, ptr %arrayidx75, align 4, !tbaa !5
%.pre242 = load i32, ptr %arrayidx39, align 4, !tbaa !5
br label %if.end76
if.end76: ; preds = %if.then70, %if.end
%43 = phi i32 [ %.pre242, %if.then70 ], [ %38, %if.end ]
%r.2 = phi i32 [ %inc73, %if.then70 ], [ %r.1193, %if.end ]
%idxprom79 = sext i32 %43 to i64
%arrayidx80 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %idxprom79
%44 = load i32, ptr %arrayidx80, align 4, !tbaa !5
%add81 = add nsw i32 %44, 1
store i32 %add81, ptr %arrayidx53, align 4, !tbaa !5
%arrayidx89 = getelementptr inbounds [100010 x i32], ptr %e, i64 0, i64 %idxprom52
%45 = load i32, ptr %arrayidx89, align 4, !tbaa !5
%arrayidx93 = getelementptr inbounds [100010 x i32], ptr %e, i64 0, i64 %idxprom79
%46 = load i32, ptr %arrayidx93, align 4, !tbaa !5
%arrayidx95 = getelementptr inbounds [400010 x i32], ptr @co, i64 0, i64 %idxprom50
%47 = load i32, ptr %arrayidx95, align 4, !tbaa !5
%cond.i = call i32 @llvm.smin.i32(i32 %46, i32 %47)
%cond.i168 = call i32 @llvm.smax.i32(i32 %45, i32 %cond.i)
store i32 %cond.i168, ptr %arrayidx89, align 4, !tbaa !5
br label %for.inc102
for.inc102: ; preds = %for.body49, %if.end76
%48 = phi i32 [ %38, %for.body49 ], [ %43, %if.end76 ]
%49 = phi i32 [ %39, %for.body49 ], [ %43, %if.end76 ]
%r.3 = phi i32 [ %r.1193, %for.body49 ], [ %r.2, %if.end76 ]
%arrayidx104 = getelementptr inbounds [400010 x i32], ptr @nt, i64 0, i64 %idxprom50
%i.4 = load i32, ptr %arrayidx104, align 4, !tbaa !5
%tobool48.not = icmp eq i32 %i.4, -1
br i1 %tobool48.not, label %for.inc106, label %for.body49, !llvm.loop !21
for.inc106: ; preds = %for.inc102, %hin.exit
%r.1.lcssa = phi i32 [ %r.0201, %hin.exit ], [ %r.3, %for.inc102 ]
%indvars.iv.next228 = add nuw nsw i64 %indvars.iv227, 1
%50 = zext i32 %r.1.lcssa to i64
%tobool.not = icmp eq i64 %indvars.iv.next228, %50
br i1 %tobool.not, label %for.cond109.preheader, label %for.body37, !llvm.loop !22
for.body111: ; preds = %for.body111.preheader, %hout.exit
%indvars.iv234 = phi i64 [ 0, %for.body111.preheader ], [ %indvars.iv.next235, %hout.exit ]
%dec.i203205 = phi i32 [ %inc.i, %for.body111.preheader ], [ %dec.i, %hout.exit ]
%51 = load i32, ptr getelementptr inbounds ([2000010 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5
%dec.i = add i32 %dec.i203205, -1
%idxprom.i170 = sext i32 %dec.i to i64
%arrayidx.i171 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i170
%52 = load i32, ptr %arrayidx.i171, align 4, !tbaa !5
%or.cond.i35.i = icmp slt i32 %dec.i203205, 2
%idxprom113.phi.trans.insert = sext i32 %51 to i64
%arrayidx114.phi.trans.insert = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom113.phi.trans.insert
%.pre243 = load i32, ptr %arrayidx114.phi.trans.insert, align 4, !tbaa !5
br i1 %or.cond.i35.i, label %hout.exit, label %hyouka.exit.lr.ph.split.i
hyouka.exit.lr.ph.split.i: ; preds = %for.body111
%idxprom9.i42.i = sext i32 %52 to i64
%arrayidx10.i43.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i42.i
%53 = load i32, ptr %arrayidx10.i43.i, align 4, !tbaa !5
%cmp11.i.not44.i = icmp slt i32 %.pre243, %53
br i1 %cmp11.i.not44.i, label %for.body.i173, label %hout.exit
hyouka.exit.i175: ; preds = %hyouka.exit31.i
%54 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%idxprom5.i.i176 = sext i32 %54 to i64
%arrayidx6.i.i177 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i.i176
%55 = load i32, ptr %arrayidx6.i.i177, align 4, !tbaa !5
%56 = load i32, ptr %arrayidx.i171, align 4, !tbaa !5
%idxprom9.i.i178 = sext i32 %56 to i64
%arrayidx10.i.i179 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i.i178
%57 = load i32, ptr %arrayidx10.i.i179, align 4, !tbaa !5
%cmp11.i.not.i180 = icmp slt i32 %55, %57
br i1 %cmp11.i.not.i180, label %for.body.i173, label %for.end.loopexit.i, !llvm.loop !11
for.body.i173: ; preds = %hyouka.exit.lr.ph.split.i, %hyouka.exit.i175
%i.03745.i = phi i32 [ %sub.i, %hyouka.exit.i175 ], [ 1, %hyouka.exit.lr.ph.split.i ]
%mul.i = shl nsw i32 %i.03745.i, 1
%add.i = or i32 %mul.i, 1
%cmp.i16.not.i = icmp sgt i32 %dec.i203205, %add.i
br i1 %cmp.i16.not.i, label %if.end4.i19.i, label %hyouka.exit31.i
if.end4.i19.i: ; preds = %for.body.i173
%idxprom.i20.i = sext i32 %mul.i to i64
%arrayidx.i21.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i20.i
%58 = load i32, ptr %arrayidx.i21.i, align 8, !tbaa !5
%idxprom5.i22.i = sext i32 %58 to i64
%arrayidx6.i23.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i22.i
%59 = load i32, ptr %arrayidx6.i23.i, align 4, !tbaa !5
%idxprom7.i24.i = sext i32 %add.i to i64
%arrayidx8.i25.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i24.i
%60 = load i32, ptr %arrayidx8.i25.i, align 4, !tbaa !5
%idxprom9.i26.i = sext i32 %60 to i64
%arrayidx10.i27.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i26.i
%61 = load i32, ptr %arrayidx10.i27.i, align 4, !tbaa !5
%cmp11.i28.i = icmp slt i32 %59, %61
%cond.i29.neg.i = sext i1 %cmp11.i28.i to i32
br label %hyouka.exit31.i
hyouka.exit31.i: ; preds = %if.end4.i19.i, %for.body.i173
%retval.0.i30.neg.i = phi i32 [ %cond.i29.neg.i, %if.end4.i19.i ], [ -1, %for.body.i173 ]
%sub.i = add i32 %retval.0.i30.neg.i, %add.i
%idxprom5.i = sext i32 %sub.i to i64
%arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom5.i
%62 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%idxprom7.i = sext i32 %i.03745.i to i64
%arrayidx8.i174 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i
store i32 %62, ptr %arrayidx8.i174, align 4, !tbaa !5
%cmp1.i.not.i = icmp sgt i32 %dec.i203205, %sub.i
br i1 %cmp1.i.not.i, label %hyouka.exit.i175, label %for.end.loopexit.i, !llvm.loop !11
for.end.loopexit.i: ; preds = %hyouka.exit31.i, %hyouka.exit.i175
%63 = sdiv i32 %sub.i, 2
%64 = sext i32 %63 to i64
br label %hout.exit
hout.exit: ; preds = %for.body111, %hyouka.exit.lr.ph.split.i, %for.end.loopexit.i
%j.0.lcssa.i = phi i64 [ 1, %hyouka.exit.lr.ph.split.i ], [ %64, %for.end.loopexit.i ], [ 1, %for.body111 ]
%arrayidx10.i172 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %j.0.lcssa.i
store i32 %52, ptr %arrayidx10.i172, align 4, !tbaa !5
%arrayidx116 = getelementptr inbounds [100010 x i32], ptr %f, i64 0, i64 %indvars.iv234
store i32 %.pre243, ptr %arrayidx116, align 4, !tbaa !5
%indvars.iv.next235 = add nuw nsw i64 %indvars.iv234, 1
%exitcond238.not = icmp eq i64 %indvars.iv.next235, %wide.trip.count237
br i1 %exitcond238.not, label %for.cond109.for.end119_crit_edge, label %for.body111, !llvm.loop !23
for.cond109.for.end119_crit_edge: ; preds = %hout.exit
store i32 %dec.i, ptr @C, align 4, !tbaa !5
br label %for.end119
for.end119: ; preds = %for.cond109.for.end119_crit_edge, %for.cond109.preheader
store i32 0, ptr %j, align 4, !tbaa !5
br i1 %cmp121214, label %while.cond.preheader, label %for.end131
while.cond.preheader: ; preds = %for.end119, %while.end
%i.6215 = phi i32 [ %add125, %while.end ], [ 0, %for.end119 ]
%add125 = add nuw nsw i32 %i.6215, 1
%j.promoted = load i32, ptr %j, align 4, !tbaa !5
%idxprom123208 = sext i32 %j.promoted to i64
%arrayidx124209 = getelementptr inbounds [100010 x i32], ptr %f, i64 0, i64 %idxprom123208
%65 = load i32, ptr %arrayidx124209, align 4, !tbaa !5
%cmp126.not210 = icmp sgt i32 %65, %add125
br i1 %cmp126.not210, label %while.end, label %while.body
while.body: ; preds = %while.cond.preheader, %while.body
%indvars.iv239 = phi i64 [ %indvars.iv.next240, %while.body ], [ %idxprom123208, %while.cond.preheader ]
%indvars.iv.next240 = add i64 %indvars.iv239, 1
%arrayidx124 = getelementptr inbounds [100010 x i32], ptr %f, i64 0, i64 %indvars.iv.next240
%66 = load i32, ptr %arrayidx124, align 4, !tbaa !5
%cmp126.not = icmp sgt i32 %66, %add125
br i1 %cmp126.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !24
while.cond.while.end_crit_edge: ; preds = %while.body
%67 = trunc i64 %indvars.iv.next240 to i32
store i32 %67, ptr %j, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %while.cond.preheader
%.lcssa = phi i32 [ %67, %while.cond.while.end_crit_edge ], [ %j.promoted, %while.cond.preheader ]
%call128 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.lcssa)
%68 = load i32, ptr %k, align 4, !tbaa !5
%cmp121 = icmp slt i32 %add125, %68
br i1 %cmp121, label %while.cond.preheader, label %for.end131, !llvm.loop !25
for.end131: ; preds = %while.end, %for.end119
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #9
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %q) #9
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %e) #9
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %f) #9
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %d) #9
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %c) #9
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %b) #9
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %a) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15, !14}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !15}
!20 = distinct !{!20, !10, !15, !14}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#pragma region 定義
typedef long long ll;
typedef unsigned long long ull;
#define _itoa(A,N) sprintf(A, "%d", N);
int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);
//昇順
int s_asort(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int i_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int i_gcd(int a, int b);
int i_gcd(int a, int b) {
if (!b)return a;
return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
if (!b)return a;
return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
return (a * b) / ll_gcd(a, b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
//#define _USE_MATH_DEFINES でM_PIが使える
#define deg_rad(X) (X*(M_PI/180))
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
// long i, r;
// if (a % 2 == 0) {
// pf[pc] = 2; pc++;
// return(_pfact(a / 2));
// }
// r = sqrt(a);
// for (i = 3; i <= r; i += 2) {
// if (a % i == 0) {
// pf[pc] = i; pc++;
// return(_pfact(a / i));
// }
// }
// if (a != 1) {
// pf[pc] = a; pc++;
// }
// return 0;
//
//}
//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
char rc;
rc = strcmp((char*)b, (char*)a);
if (rc == 0) {
*(char*)a = 0x00;
return(1);
}
return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
int bit;
for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
if (0 != (uc & 1))++bit;
return bit;
}//bitco
#define _rnd(a,b) ((a+b-1)/b) // A/Bの余りを繰り上げる
#pragma endregion
// ABC081 B- Shift only
int _div2(int n);
int _div2(int n) {
int cnt = 0;
while (1) {
if (n % 2) return(cnt);
n /= 2;
cnt++;
}
}
int main(void) {
const int INF = 10000000;
int n, a;
int i, cnt,res=INF;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a);
cnt = 0;
while (1) {
if (a % 2) break;
a /= 2;
cnt++;
}
res = _min(cnt, res);
}
printf("%d\n",res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i32 %b, 0
br i1 %tobool.not4.i, label %i_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %i_gcd.exit, label %if.end.i
i_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %if.then, label %if.end
if.then: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
%conv = trunc i64 %a.tr.lcssa to i32
ret i32 %conv
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %ll_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %ll_gcd.exit, label %if.end.i
ll_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%sext = shl i64 %a.tr.lcssa.i, 32
%conv = ashr exact i64 %sext, 32
%div = sdiv i64 %mul, %conv
%conv1 = trunc i64 %div to i32
ret i32 %conv1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !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) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #7 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #15
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !11
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #15
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #15
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_sort(ptr nocapture noundef %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
%sext = shl i32 %call, 24
%cmp = icmp eq i32 %sext, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i8 0, ptr %a, align 1, !tbaa !11
br label %cleanup
if.end: ; preds = %entry
%conv1 = ashr exact i32 %sext, 24
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ %conv1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i32 noundef %uc) local_unnamed_addr #3 {
entry:
%cmp.not5 = icmp eq i32 %uc, 0
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.07 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%uc.addr.06 = phi i32 [ %shr, %for.body ], [ %uc, %entry ]
%and = and i32 %uc.addr.06, 1
%spec.select = add i32 %bit.07, %and
%shr = lshr i32 %uc.addr.06, 1
%cmp.not = icmp ult i32 %uc.addr.06, 2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%bit.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %bit.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @_div2(i32 noundef %n) local_unnamed_addr #3 {
entry:
%0 = and i32 %n, 1
%tobool.not3 = icmp eq i32 %0, 0
br i1 %tobool.not3, label %if.end, label %if.then
if.then: ; preds = %if.end, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %if.end ]
ret i32 %cnt.0.lcssa
if.end: ; preds = %entry, %if.end
%cnt.05 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
%n.addr.04 = phi i32 [ %div, %if.end ], [ %n, %entry ]
%div = sdiv i32 %n.addr.04, 2
%inc = add nuw nsw i32 %cnt.05, 1
%1 = and i32 %div, 1
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %if.end, label %if.then
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.end
for.body: ; preds = %entry, %while.end
%res.016 = phi i32 [ %cond, %while.end ], [ 10000000, %entry ]
%i.015 = phi i32 [ %inc3, %while.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%1 = and i32 %a.promoted, 1
%tobool.not11 = icmp eq i32 %1, 0
br i1 %tobool.not11, label %if.end, label %while.end
if.end: ; preds = %for.body, %if.end
%cnt.013 = phi i32 [ %inc, %if.end ], [ 0, %for.body ]
%div1012 = phi i32 [ %div, %if.end ], [ %a.promoted, %for.body ]
%div = sdiv i32 %div1012, 2
%inc = add nuw nsw i32 %cnt.013, 1
%2 = and i32 %div, 1
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %if.end, label %while.cond.while.end_crit_edge
while.cond.while.end_crit_edge: ; preds = %if.end
store i32 %div, ptr %a, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.body
%cnt.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %for.body ]
%cond = call i32 @llvm.smin.i32(i32 %cnt.0.lcssa, i32 %res.016)
%inc3 = add nuw nsw i32 %i.015, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %while.end, %entry
%res.0.lcssa = phi i32 [ 10000000, %entry ], [ %cond, %while.end ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { 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 #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind "no-trapping-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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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>
int main()
{
int n;
scanf("%d",&n);
int a[n];
int i;
i = 0;
int counter;
counter = 0;
while (i < n)
{
scanf("%d",&a[i]);
i++;
}
i = 0;
while (i < n)
{
if (a[i] % 2 == 0)
{
a[i] /= 2;
}
else
{
printf("%d",counter);
return (0);
}
i++;
if (i == n)
{
counter++;
i = 0;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %3, 0
br i1 %cmp30, label %while.body, label %cleanup
while.cond2.preheader: ; preds = %while.body
%cmp332 = icmp sgt i32 %4, 0
br i1 %cmp332, label %while.body4, label %cleanup
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %while.body, label %while.cond2.preheader, !llvm.loop !9
while.body4: ; preds = %while.cond2.preheader, %if.then
%counter.034 = phi i32 [ %spec.select28, %if.then ], [ 0, %while.cond2.preheader ]
%i.133 = phi i32 [ %spec.select, %if.then ], [ 0, %while.cond2.preheader ]
%idxprom5 = sext i32 %i.133 to i64
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %idxprom5
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%7 = and i32 %6, 1
%cmp7 = icmp eq i32 %7, 0
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %while.body4
%div = sdiv i32 %6, 2
store i32 %div, ptr %arrayidx6, align 4, !tbaa !5
%inc11 = add nsw i32 %i.133, 1
%cmp12 = icmp eq i32 %inc11, %4
%spec.select = select i1 %cmp12, i32 0, i32 %inc11
%inc14 = zext i1 %cmp12 to i32
%spec.select28 = add nuw nsw i32 %counter.034, %inc14
%cmp3 = icmp slt i32 %spec.select, %4
br i1 %cmp3, label %while.body4, label %cleanup, !llvm.loop !11
if.else: ; preds = %while.body4
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %counter.034)
br label %cleanup
cleanup: ; preds = %if.then, %entry, %while.cond2.preheader, %if.else
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int N;
scanf("%d",&N);
int A[N];
int count = 0;
int check = 0;
for(int i=0; i<N; i++){
scanf("%d",&A[i]);
}
while(check == 0){
for(int i=0; i<N; i++){
// printf("A[%d] = %d\n",i,A[i]);
if(A[i] %2 == 0){
A[i] /= 2;
}
else{
check = 1;
break;
}
}
count++;
}
printf("%d\n",count-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%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
%cmp28 = icmp sgt i32 %3, 0
br i1 %cmp28, label %for.body, label %for.cond4.preheader.preheader
while.cond.preheader: ; preds = %for.body
%cmp530 = icmp sgt i32 %6, 0
br i1 %cmp530, label %for.cond4.preheader.us.preheader, label %for.cond4.preheader.preheader
for.cond4.preheader.preheader: ; preds = %entry, %while.cond.preheader
br label %for.cond4.preheader
for.cond4.preheader.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %6 to i64
br label %for.cond4.preheader.us
for.cond4.preheader.us: ; preds = %cleanup.us, %for.cond4.preheader.us.preheader
%count.034.us = phi i32 [ %inc16.us, %cleanup.us ], [ 0, %for.cond4.preheader.us.preheader ]
br label %for.body7.us
for.body7.us: ; preds = %for.cond4.preheader.us, %if.then.us
%indvars.iv37 = phi i64 [ 0, %for.cond4.preheader.us ], [ %indvars.iv.next38, %if.then.us ]
%arrayidx9.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv37
%4 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%5 = and i32 %4, 1
%cmp10.us = icmp eq i32 %5, 0
br i1 %cmp10.us, label %if.then.us, label %while.end
cleanup.us: ; preds = %if.then.us
%inc16.us = add nuw nsw i32 %count.034.us, 1
br label %for.cond4.preheader.us, !llvm.loop !9
if.then.us: ; preds = %for.body7.us
%div.us = sdiv i32 %4, 2
store i32 %div.us, ptr %arrayidx9.us, align 4, !tbaa !5
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%exitcond.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count
br i1 %exitcond.not, label %cleanup.us, label %for.body7.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !12
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.cond4.preheader
br label %for.cond4.preheader
while.end: ; preds = %for.body7.us
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.034.us)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
typedef long long ll;
int main()
{
int N, i, count = 0, flg = 0;
scanf("%d", &N);
int A[N + 1];
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
if (A[i] % 2 != 0) flg = 1;
}
while (flg == 0) {
for (i = 0; i < N; i++) {
if (A[i] % 2 != 0) {
flg = 1;
break;
}
A[i] = A[i] / 2;
}
if (flg == 1) break;
count++;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104020/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104020/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %3, 0
br i1 %cmp40, label %for.body, label %for.cond6.preheader.us50.preheader
while.cond.preheader: ; preds = %for.body
%4 = icmp eq i32 %spec.select, 0
br i1 %4, label %for.cond6.preheader.lr.ph, label %while.end
for.cond6.preheader.lr.ph: ; preds = %while.cond.preheader
%cmp744 = icmp sgt i32 %9, 0
br i1 %cmp744, label %for.cond6.preheader.us.us.preheader, label %for.cond6.preheader.us50.preheader
for.cond6.preheader.us50.preheader: ; preds = %entry, %for.cond6.preheader.lr.ph
br label %for.cond6.preheader.us50
for.cond6.preheader.us.us.preheader: ; preds = %for.cond6.preheader.lr.ph
%wide.trip.count = zext i32 %9 to i64
br label %for.cond6.preheader.us.us
for.cond6.preheader.us.us: ; preds = %for.cond6.preheader.us.us.preheader, %for.cond6.if.end24_crit_edge.us.us
%count.047.us.us = phi i32 [ %inc25.us.us, %for.cond6.if.end24_crit_edge.us.us ], [ 0, %for.cond6.preheader.us.us.preheader ]
br label %for.body8.us.us
for.body8.us.us: ; preds = %if.end14.us.us, %for.cond6.preheader.us.us
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %if.end14.us.us ], [ 0, %for.cond6.preheader.us.us ]
%arrayidx10.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv57
%5 = load i32, ptr %arrayidx10.us.us, align 4, !tbaa !5
%6 = and i32 %5, 1
%cmp12.not.us.us = icmp eq i32 %6, 0
br i1 %cmp12.not.us.us, label %if.end14.us.us, label %while.end
if.end14.us.us: ; preds = %for.body8.us.us
%div.us.us = sdiv i32 %5, 2
store i32 %div.us.us, ptr %arrayidx10.us.us, align 4, !tbaa !5
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count
br i1 %exitcond.not, label %for.cond6.if.end24_crit_edge.us.us, label %for.body8.us.us, !llvm.loop !9
for.cond6.if.end24_crit_edge.us.us: ; preds = %if.end14.us.us
%inc25.us.us = add nuw nsw i32 %count.047.us.us, 1
br label %for.cond6.preheader.us.us
for.cond6.preheader.us50: ; preds = %for.cond6.preheader.us50.preheader, %for.cond6.preheader.us50
br label %for.cond6.preheader.us50
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%flg.041 = phi i32 [ %spec.select, %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)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%8 = and i32 %7, 1
%cmp4.not = icmp eq i32 %8, 0
%spec.select = select i1 %cmp4.not, i32 %flg.041, i32 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.body8.us.us, %while.cond.preheader
%count.039 = phi i32 [ 0, %while.cond.preheader ], [ %count.047.us.us, %for.body8.us.us ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.039)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int n;
scanf("%d", &n);
int i, a[n], c=0;
for(i=0;i<n;i++){
scanf("%d", &a[i]);
}
int f=1;
while(f==1){
for(i=0;i<n;i++){
if(a[i]%2==0){
a[i]/=2;
}else{
f=0;
break;
}
}
if(f==1) c++;
}
printf("%d", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104064/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca 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 %for.cond3.preheader.us.preheader
while.cond.preheader: ; preds = %for.body
%cmp4.not29 = icmp slt i32 %7, 1
br i1 %cmp4.not29, label %for.cond3.preheader.us.preheader, label %for.cond3.preheader.preheader
for.cond3.preheader.us.preheader: ; preds = %entry, %while.cond.preheader
br label %for.cond3.preheader.us
for.cond3.preheader.preheader: ; preds = %while.cond.preheader
%4 = zext i32 %7 to i64
%wide.trip.count = zext i32 %7 to i64
%5 = load i32, ptr %vla, align 16, !tbaa !5
%6 = and i32 %5, 1
%cmp84955 = icmp eq i32 %6, 0
br i1 %cmp84955, label %if.then.lr.ph, label %while.end
for.cond3.preheader.us: ; preds = %for.cond3.preheader.us.preheader, %for.cond3.preheader.us
br label %for.cond3.preheader.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9
if.then.lr.ph: ; preds = %for.cond3.preheader.preheader, %for.end13
%9 = phi i32 [ %13, %for.end13 ], [ %5, %for.cond3.preheader.preheader ]
%c.03656 = phi i32 [ %spec.select, %for.end13 ], [ 0, %for.cond3.preheader.preheader ]
br label %if.then
for.body5: ; preds = %if.then
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next40
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%11 = and i32 %10, 1
%cmp8 = icmp eq i32 %11, 0
br i1 %cmp8, label %if.then, label %for.body5.while.end_crit_edge, !llvm.loop !11
if.then: ; preds = %if.then.lr.ph, %for.body5
%12 = phi i32 [ %9, %if.then.lr.ph ], [ %10, %for.body5 ]
%arrayidx751 = phi ptr [ %vla, %if.then.lr.ph ], [ %arrayidx7, %for.body5 ]
%indvars.iv3950 = phi i64 [ 0, %if.then.lr.ph ], [ %indvars.iv.next40, %for.body5 ]
%div = sdiv i32 %12, 2
store i32 %div, ptr %arrayidx751, align 4, !tbaa !5
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv3950, 1
%exitcond = icmp eq i64 %indvars.iv.next40, %wide.trip.count
br i1 %exitcond, label %for.end13, label %for.body5, !llvm.loop !11
for.end13: ; preds = %if.then
%cmp4.not.le63 = icmp uge i64 %indvars.iv.next40, %4
%inc16 = zext i1 %cmp4.not.le63 to i32
%spec.select = add nuw nsw i32 %c.03656, %inc16
%13 = load i32, ptr %vla, align 16, !tbaa !5
%14 = and i32 %13, 1
%cmp849 = icmp eq i32 %14, 0
br i1 %cmp849, label %if.then.lr.ph, label %while.end, !llvm.loop !12
for.body5.while.end_crit_edge: ; preds = %for.body5
%cmp4.not.le = icmp uge i64 %indvars.iv.next40, %4
%15 = zext i1 %cmp4.not.le to i32
br label %while.end
while.end: ; preds = %for.end13, %for.cond3.preheader.preheader, %for.body5.while.end_crit_edge
%c.036.lcssa = phi i32 [ %c.03656, %for.body5.while.end_crit_edge ], [ 0, %for.cond3.preheader.preheader ], [ %spec.select, %for.end13 ]
%cmp4.not31.lcssa = phi i32 [ %15, %for.body5.while.end_crit_edge ], [ 0, %for.cond3.preheader.preheader ], [ 0, %for.end13 ]
%spec.select45 = add nuw nsw i32 %c.036.lcssa, %cmp4.not31.lcssa
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select45)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
long long int gcd(long long int a, long long int b) {
if (b == 0) {
return a;
}
return gcd(b, a%b);
}
int main(void) {
int n;
scanf("%d", &n);
long long int a[n];
int i;
long long int element = 0;
for (i = 0; i < n; i++) {
scanf("%lld", &a[i]);
}
if (n == 1) {
printf("%lld\n", a[0]);
} else {
element = gcd(a[0], a[1]);
if (n == 2) {
printf("%lld\n", element);
} else {
for (i = 2; i < n; i++) {
element = gcd(element, a[i]);
}
}
}
int count = 0;
while (1) {
if (element % 2 == 0 && element > 0) {
element /= 2;
count++;
} else {
break;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104107/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104107/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.3 = 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 i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i64 %a.tr.lcssa
}
; 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 !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %3, 0
br i1 %cmp48, label %for.body, label %if.else
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp2 = icmp eq i32 %4, 1
br i1 %cmp2, label %if.end21.thread, label %if.else
if.end21.thread: ; preds = %for.end
%6 = load i64, ptr %vla, align 16, !tbaa !11
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %6)
br label %while.end
if.else: ; preds = %entry, %for.end
%.lcssa67 = phi i32 [ %4, %for.end ], [ %3, %entry ]
%7 = load i64, ptr %vla, align 16, !tbaa !11
%arrayidx6 = getelementptr inbounds i64, ptr %vla, i64 1
%8 = load i64, ptr %arrayidx6, align 8, !tbaa !11
%cmp4.i = icmp eq i64 %8, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %if.else, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %8, %if.else ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %7, %if.else ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %if.else
%a.tr.lcssa.i = phi i64 [ %7, %if.else ], [ %b.tr6.i, %if.end.i ]
%cmp8 = icmp eq i32 %.lcssa67, 2
br i1 %cmp8, label %if.then9, label %for.cond12.preheader
for.cond12.preheader: ; preds = %gcd.exit
%cmp1350 = icmp sgt i32 %.lcssa67, 2
br i1 %cmp1350, label %for.body14.preheader, label %if.end21
for.body14.preheader: ; preds = %for.cond12.preheader
%wide.trip.count = zext i32 %.lcssa67 to i64
%xtraiter = and i64 %wide.trip.count, 1
%9 = icmp eq i32 %.lcssa67, 3
br i1 %9, label %if.end21.loopexit.unr-lcssa, label %for.body14.preheader.new
for.body14.preheader.new: ; preds = %for.body14.preheader
%10 = and i64 %wide.trip.count, 4294967294
%11 = add nsw i64 %10, -4
br label %for.body14
if.then9: ; preds = %gcd.exit
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %a.tr.lcssa.i)
br label %if.end21
for.body14: ; preds = %gcd.exit47.1, %for.body14.preheader.new
%indvars.iv62 = phi i64 [ 2, %for.body14.preheader.new ], [ %indvars.iv.next63.1, %gcd.exit47.1 ]
%element.052 = phi i64 [ %a.tr.lcssa.i, %for.body14.preheader.new ], [ %a.tr.lcssa.i46.1, %gcd.exit47.1 ]
%niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.1, %gcd.exit47.1 ]
%arrayidx16 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv62
%12 = load i64, ptr %arrayidx16, align 16, !tbaa !11
%cmp4.i40 = icmp eq i64 %12, 0
br i1 %cmp4.i40, label %gcd.exit47, label %if.end.i41
if.end.i41: ; preds = %for.body14, %if.end.i41
%b.tr6.i42 = phi i64 [ %rem.i44, %if.end.i41 ], [ %12, %for.body14 ]
%a.tr5.i43 = phi i64 [ %b.tr6.i42, %if.end.i41 ], [ %element.052, %for.body14 ]
%rem.i44 = srem i64 %a.tr5.i43, %b.tr6.i42
%cmp.i45 = icmp eq i64 %rem.i44, 0
br i1 %cmp.i45, label %gcd.exit47, label %if.end.i41
gcd.exit47: ; preds = %if.end.i41, %for.body14
%a.tr.lcssa.i46 = phi i64 [ %element.052, %for.body14 ], [ %b.tr6.i42, %if.end.i41 ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx16.1 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next63
%13 = load i64, ptr %arrayidx16.1, align 8, !tbaa !11
%cmp4.i40.1 = icmp eq i64 %13, 0
br i1 %cmp4.i40.1, label %gcd.exit47.1, label %if.end.i41.1
if.end.i41.1: ; preds = %gcd.exit47, %if.end.i41.1
%b.tr6.i42.1 = phi i64 [ %rem.i44.1, %if.end.i41.1 ], [ %13, %gcd.exit47 ]
%a.tr5.i43.1 = phi i64 [ %b.tr6.i42.1, %if.end.i41.1 ], [ %a.tr.lcssa.i46, %gcd.exit47 ]
%rem.i44.1 = srem i64 %a.tr5.i43.1, %b.tr6.i42.1
%cmp.i45.1 = icmp eq i64 %rem.i44.1, 0
br i1 %cmp.i45.1, label %gcd.exit47.1, label %if.end.i41.1
gcd.exit47.1: ; preds = %if.end.i41.1, %gcd.exit47
%a.tr.lcssa.i46.1 = phi i64 [ %a.tr.lcssa.i46, %gcd.exit47 ], [ %b.tr6.i42.1, %if.end.i41.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter, %11
br i1 %niter.ncmp.1, label %if.end21.loopexit.unr-lcssa, label %for.body14, !llvm.loop !13
if.end21.loopexit.unr-lcssa: ; preds = %gcd.exit47.1, %for.body14.preheader
%a.tr.lcssa.i46.lcssa.ph = phi i64 [ undef, %for.body14.preheader ], [ %a.tr.lcssa.i46.1, %gcd.exit47.1 ]
%indvars.iv62.unr = phi i64 [ 2, %for.body14.preheader ], [ %indvars.iv.next63.1, %gcd.exit47.1 ]
%element.052.unr = phi i64 [ %a.tr.lcssa.i, %for.body14.preheader ], [ %a.tr.lcssa.i46.1, %gcd.exit47.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %if.end21, label %for.body14.epil
for.body14.epil: ; preds = %if.end21.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv62.unr
%14 = load i64, ptr %arrayidx16.epil, align 8, !tbaa !11
%cmp4.i40.epil = icmp eq i64 %14, 0
br i1 %cmp4.i40.epil, label %if.end21, label %if.end.i41.epil
if.end.i41.epil: ; preds = %for.body14.epil, %if.end.i41.epil
%b.tr6.i42.epil = phi i64 [ %rem.i44.epil, %if.end.i41.epil ], [ %14, %for.body14.epil ]
%a.tr5.i43.epil = phi i64 [ %b.tr6.i42.epil, %if.end.i41.epil ], [ %element.052.unr, %for.body14.epil ]
%rem.i44.epil = srem i64 %a.tr5.i43.epil, %b.tr6.i42.epil
%cmp.i45.epil = icmp eq i64 %rem.i44.epil, 0
br i1 %cmp.i45.epil, label %if.end21, label %if.end.i41.epil
if.end21: ; preds = %if.end21.loopexit.unr-lcssa, %if.end.i41.epil, %for.body14.epil, %for.cond12.preheader, %if.then9
%element.1 = phi i64 [ %a.tr.lcssa.i, %if.then9 ], [ %a.tr.lcssa.i, %for.cond12.preheader ], [ %a.tr.lcssa.i46.lcssa.ph, %if.end21.loopexit.unr-lcssa ], [ %element.052.unr, %for.body14.epil ], [ %b.tr6.i42.epil, %if.end.i41.epil ]
%15 = and i64 %element.1, 1
%cmp2254 = icmp eq i64 %15, 0
%cmp2355 = icmp sgt i64 %element.1, 0
%or.cond56 = and i1 %cmp2355, %cmp2254
br i1 %or.cond56, label %if.then24, label %while.end
if.then24: ; preds = %if.end21, %if.then24
%count.058 = phi i32 [ %inc25, %if.then24 ], [ 0, %if.end21 ]
%element.257 = phi i64 [ %div39, %if.then24 ], [ %element.1, %if.end21 ]
%div39 = lshr i64 %element.257, 1
%inc25 = add nuw nsw i32 %count.058, 1
%16 = and i64 %element.257, 2
%cmp22 = icmp eq i64 %16, 0
%cmp23 = icmp ugt i64 %element.257, 1
%or.cond = and i1 %cmp23, %cmp22
br i1 %or.cond, label %if.then24, label %while.end
while.end: ; preds = %if.then24, %if.end21.thread, %if.end21
%count.0.lcssa = phi i32 [ 0, %if.end21 ], [ 0, %if.end21.thread ], [ %inc25, %if.then24 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
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, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
int main (void){
int i,count;
long long int a[200],max=0,flag=0,n,k[100]={0};
scanf("%d",&n);
max=0;
flag=0;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
while(1)
{
for(i=0;i<n;i++)
{
if(a[i]%2==0){
a[i]/=2;
}else{
flag=1;
break;
}
}
if(flag==1)
{
break;
}
max++;
}
printf("%lld",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104158/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [200 x i64], align 16
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp30 = icmp sgt i64 %0, 0
br i1 %cmp30, label %for.body, label %while.cond.preheader44
while.cond.preheader: ; preds = %for.body
%cmp533 = icmp sgt i64 %3, 0
br i1 %cmp533, label %while.cond.us, label %while.cond.preheader44
while.cond.preheader44: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us: ; preds = %while.cond.preheader, %for.cond3.if.end20_crit_edge.us
%max.0.us = phi i64 [ %inc21.us, %for.cond3.if.end20_crit_edge.us ], [ 0, %while.cond.preheader ]
br label %for.body7.us
for.body7.us: ; preds = %while.cond.us, %if.then.us
%indvars.iv39 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next40, %if.then.us ]
%arrayidx9.us = getelementptr inbounds [200 x i64], ptr %a, i64 0, i64 %indvars.iv39
%1 = load i64, ptr %arrayidx9.us, align 8, !tbaa !5
%2 = and i64 %1, 1
%cmp10.us = icmp eq i64 %2, 0
br i1 %cmp10.us, label %if.then.us, label %while.end
if.then.us: ; preds = %for.body7.us
%div.us = sdiv i64 %1, 2
store i64 %div.us, ptr %arrayidx9.us, align 8, !tbaa !5
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, %3
br i1 %exitcond.not, label %for.cond3.if.end20_crit_edge.us, label %for.body7.us, !llvm.loop !9
for.cond3.if.end20_crit_edge.us: ; preds = %if.then.us
%inc21.us = add nuw nsw i64 %max.0.us, 1
br label %while.cond.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i64], 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
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %3, %indvars.iv.next
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.cond: ; preds = %while.cond.preheader44, %while.cond
br label %while.cond
while.end: ; preds = %for.body7.us
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %max.0.us)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
//usr/bin/env picoc $0 - $@;exit
#include <stdio.h>
int main(){
int n,x,r=1<<29;
for(scanf("%d",&n);n--;){
int r0=0;
scanf("%d",&x);
for(;x%2<1;x/=2)r0++;
if(r>r0)r=r0;
}
printf("%d\n",r);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104200/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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) #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 !5
%dec15 = add nsw i32 %0, -1
store i32 %dec15, ptr %n, align 4, !tbaa !5
%tobool.not16 = icmp eq i32 %0, 0
br i1 %tobool.not16, label %for.end5, label %for.body
for.body: ; preds = %entry, %for.end
%r.017 = phi i32 [ %spec.select, %for.end ], [ 536870912, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
%rem11 = srem i32 %x.promoted, 2
%cmp12 = icmp slt i32 %rem11, 1
br i1 %cmp12, label %for.body3, label %for.end
for.body3: ; preds = %for.body, %for.body3
%r0.014 = phi i32 [ %inc, %for.body3 ], [ 0, %for.body ]
%div1013 = phi i32 [ %div, %for.body3 ], [ %x.promoted, %for.body ]
%inc = add nuw nsw i32 %r0.014, 1
%div = sdiv i32 %div1013, 2
%rem = srem i32 %div, 2
%cmp = icmp slt i32 %rem, 1
br i1 %cmp, label %for.body3, label %for.cond2.for.end_crit_edge, !llvm.loop !9
for.cond2.for.end_crit_edge: ; preds = %for.body3
store i32 %div, ptr %x, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond2.for.end_crit_edge, %for.body
%r0.0.lcssa = phi i32 [ %inc, %for.cond2.for.end_crit_edge ], [ 0, %for.body ]
%spec.select = call i32 @llvm.smin.i32(i32 %r.017, i32 %r0.0.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
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %for.end5, label %for.body, !llvm.loop !11
for.end5: ; preds = %for.end, %entry
%r.0.lcssa = phi i32 [ 536870912, %entry ], [ %spec.select, %for.end ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int n,a[200],b=0,i,c=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]%2==0)
b++;
}
if(b!=n)
printf("%d\n",c);
else
{
while(b==n)
{
c++;
b=0;
for(i=0;i<n;i++)
{
a[i]=a[i]/2;
if(a[i]%2==0)
b++;
}
}
printf("%d\n",c);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104244/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104244/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end11.thread
for.cond2.preheader: ; preds = %for.body
%cmp354 = icmp sgt i32 %11, 0
br i1 %cmp354, label %for.body4.preheader, label %for.end11
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %11 to i64
%min.iters.check = icmp ult i32 %11, 8
br i1 %min.iters.check, label %for.body4.preheader112, label %vector.ph
vector.ph: ; preds = %for.body4.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi91 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load92 = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%4 = and <4 x i32> %wide.load92, <i32 1, i32 1, i32 1, i32 1>
%5 = xor <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1>
%6 = xor <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1>
%7 = add <4 x i32> %5, %vec.phi
%8 = add <4 x i32> %6, %vec.phi91
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end11, label %for.body4.preheader112
for.body4.preheader112: ; preds = %for.body4.preheader, %middle.block
%indvars.iv68.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ]
%b.055.ph = phi i32 [ 0, %for.body4.preheader ], [ %10, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 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
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader112, %for.body4
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.body4 ], [ %indvars.iv68.ph, %for.body4.preheader112 ]
%b.055 = phi i32 [ %spec.select, %for.body4 ], [ %b.055.ph, %for.body4.preheader112 ]
%arrayidx6 = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv68
%13 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%14 = and i32 %13, 1
%15 = xor i32 %14, 1
%spec.select = add i32 %15, %b.055
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count
br i1 %exitcond.not, label %for.end11, label %for.body4, !llvm.loop !14
for.end11: ; preds = %for.body4, %middle.block, %for.cond2.preheader
%b.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %10, %middle.block ], [ %spec.select, %for.body4 ]
%cmp12.not = icmp eq i32 %b.0.lcssa, %11
br i1 %cmp12.not, label %while.cond.preheader, label %if.end35
for.end11.thread: ; preds = %entry
%cmp12.not83 = icmp eq i32 %0, 0
br i1 %cmp12.not83, label %while.body.us63.preheader, label %if.end35
while.cond.preheader: ; preds = %for.end11
br i1 %cmp354, label %while.body.us.preheader, label %while.cond.preheader.split
while.body.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count74 = zext i32 %11 to i64
%min.iters.check95 = icmp ult i32 %11, 8
%n.vec98 = and i64 %wide.trip.count74, 4294967288
%cmp.n100 = icmp eq i64 %n.vec98, %wide.trip.count74
br label %while.body.us
while.body.us: ; preds = %while.body.us.preheader, %for.cond17.while.cond.loopexit_crit_edge.us
%c.062.us = phi i32 [ %inc16.us, %for.cond17.while.cond.loopexit_crit_edge.us ], [ 0, %while.body.us.preheader ]
br i1 %min.iters.check95, label %for.body19.us.preheader, label %vector.body101
vector.body101: ; preds = %while.body.us, %vector.body101
%index102 = phi i64 [ %index.next107, %vector.body101 ], [ 0, %while.body.us ]
%vec.phi103 = phi <4 x i32> [ %24, %vector.body101 ], [ zeroinitializer, %while.body.us ]
%vec.phi104 = phi <4 x i32> [ %25, %vector.body101 ], [ zeroinitializer, %while.body.us ]
%16 = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %index102
%wide.load105 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load106 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = sdiv <4 x i32> %wide.load105, <i32 2, i32 2, i32 2, i32 2>
%19 = sdiv <4 x i32> %wide.load106, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %18, ptr %16, align 16, !tbaa !5
store <4 x i32> %19, ptr %17, align 16, !tbaa !5
%20 = and <4 x i32> %18, <i32 1, i32 1, i32 1, i32 1>
%21 = and <4 x i32> %19, <i32 1, i32 1, i32 1, i32 1>
%22 = xor <4 x i32> %20, <i32 1, i32 1, i32 1, i32 1>
%23 = xor <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1>
%24 = add <4 x i32> %22, %vec.phi103
%25 = add <4 x i32> %23, %vec.phi104
%index.next107 = add nuw i64 %index102, 8
%26 = icmp eq i64 %index.next107, %n.vec98
br i1 %26, label %middle.block93, label %vector.body101, !llvm.loop !15
middle.block93: ; preds = %vector.body101
%bin.rdx108 = add <4 x i32> %25, %24
%27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx108)
br i1 %cmp.n100, label %for.cond17.while.cond.loopexit_crit_edge.us, label %for.body19.us.preheader
for.body19.us.preheader: ; preds = %while.body.us, %middle.block93
%indvars.iv71.ph = phi i64 [ 0, %while.body.us ], [ %n.vec98, %middle.block93 ]
%b.359.us.ph = phi i32 [ 0, %while.body.us ], [ %27, %middle.block93 ]
br label %for.body19.us
for.body19.us: ; preds = %for.body19.us.preheader, %for.body19.us
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body19.us ], [ %indvars.iv71.ph, %for.body19.us.preheader ]
%b.359.us = phi i32 [ %spec.select51.us, %for.body19.us ], [ %b.359.us.ph, %for.body19.us.preheader ]
%arrayidx21.us = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv71
%28 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%div.us = sdiv i32 %28, 2
store i32 %div.us, ptr %arrayidx21.us, align 4, !tbaa !5
%29 = and i32 %div.us, 1
%30 = xor i32 %29, 1
%spec.select51.us = add i32 %30, %b.359.us
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
br i1 %exitcond75.not, label %for.cond17.while.cond.loopexit_crit_edge.us, label %for.body19.us, !llvm.loop !16
for.cond17.while.cond.loopexit_crit_edge.us: ; preds = %for.body19.us, %middle.block93
%spec.select51.us.lcssa = phi i32 [ %27, %middle.block93 ], [ %spec.select51.us, %for.body19.us ]
%inc16.us = add nuw nsw i32 %c.062.us, 1
%cmp15.us = icmp eq i32 %spec.select51.us.lcssa, %11
br i1 %cmp15.us, label %while.body.us, label %if.end35, !llvm.loop !17
while.cond.preheader.split: ; preds = %while.cond.preheader
%cmp15 = icmp eq i32 %11, 0
br i1 %cmp15, label %while.body.us63.preheader, label %if.end35, !llvm.loop !17
while.body.us63.preheader: ; preds = %for.end11.thread, %while.cond.preheader.split
br label %while.body.us63
while.body.us63: ; preds = %while.body.us63.preheader, %while.body.us63
br label %while.body.us63
if.end35: ; preds = %for.cond17.while.cond.loopexit_crit_edge.us, %while.cond.preheader.split, %for.end11, %for.end11.thread
%.us-phi.sink = phi i32 [ 0, %for.end11.thread ], [ 0, %for.end11 ], [ 1, %while.cond.preheader.split ], [ %inc16.us, %for.cond17.while.cond.loopexit_crit_edge.us ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi.sink)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define c_cin(X) scanf("%c",&X);
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)
#define lf_cin(X) scanf("%lf", &X)
#define i_cout(X) printf("%d\n",X)
#define f_cout(X) printf("%g\n",X)
#define i_cout2(X,Y) printf("%d %d\n",X,Y)
#define l_cout(X) printf("%ld\n",X)
#define s_cout(X) printf("%s\n",X)
#define c_cout(X) printf("%c",X)
#define ll_cout(X) printf("%lld\n",X)
#define ull_cout(X) printf("%llu\n",X)
typedef long long ll;
typedef unsigned long long ull;
#define rept(x, s, n) for (int x = s; x < n; x++)
#define S_RTN(S) s_cout(S);return 0
#define _itoa(A,N) sprintf(A, "%d", N);
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asorts(const void* a, const void* b);
//昇順
int s_asorts(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
int i;
rept(i, 0, n) {
l_cin2(*(a + i), *(b + i));
}
return 0;
}
int i_cins(int n, int* a) {
int i;
for (i = 0; i < n; i++) {
i_cin(*(a + i));
}
return 0;
}
int _gcd(int a, int b) {
int r, tmp;
if (a < b) { tmp = a; a = b; b = tmp; }
r = a % b;
while (r) {
if (!r) break;
a = b; b = r;
r = a % b;
}
return(b);
}
long _max(long a, long b) {
return a > b ? a : b;
}
long _min(long a, long b) {
return a < b ? a : b;
}
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
#pragma endregion
// 148-D
//static int a[200001];
//int main(void) {
// int n, a;
// int j, i = 1, c = 0;
//
// i_cin(n);
//
// for(j=0;j<n;j++) {
// i_cin(a);
//// printf("i:%d a:%d \n", i, a);
// if (a == i) {
// i++; continue;
// }
// c++;
// }
//
// (c == n) ? i_cout(-1) : i_cout(c);
// return 0;
//}
//static char s[100001];
//158-D
static char s[500000];
int main(void) {
long i,n, x, y,p=200000,len,flg=1;
char q;
s_cin(s[p]);
len=strlen(&s[p]);
l_cin(n);
for (i = 0; i < n; i++) {
l_cin(x);
if (x == 1) {
flg = !flg;
continue;
}
l_cin(y); c_cin(q); c_cin(q);
if ((y == 1 && flg) || (y==2 && !flg))
{p--; s[p] = q; }
else {s[p+len] = q;}
len++;
}
if (flg) {s_cout(&s[p]); return 0; }
for (i = p+len - 1; i >= p; i--)
c_cout(s[i]);
c_cout('\n');
return 0;
}
//#define _N 1000000000
//int main(void)
//{
//
// int n,i;
// ull tmp=1;
//
// i_cin(n);
//
// for (i = 1; i <= n; i++) {
// if (!(tmp % ((ull)_N + 7)))
// tmp = 1;
// tmp *= (ull)i;
// }
// tmp %= ((ull)_N + 7);
//
// ull_cout(tmp);
// return 0;
//}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104288/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@s = internal global [500000 x i8] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asorts(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #15
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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 @l_cins2(i32 noundef %n, ptr noundef %a, ptr noundef %b) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %indvars.iv
%add.ptr3 = getelementptr inbounds i64, ptr %b, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr, ptr noundef %add.ptr3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @i_cins(i32 noundef %n, ptr noundef %a) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i32 %n, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry
ret i32 0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #6 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%spec.select15 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select15, %spec.select
%tobool.not16 = icmp eq i32 %rem, 0
br i1 %tobool.not16, label %while.end, label %if.end3
if.end3: ; preds = %entry, %if.end3
%r.018 = phi i32 [ %rem4, %if.end3 ], [ %rem, %entry ]
%b.addr.117 = phi i32 [ %r.018, %if.end3 ], [ %spec.select, %entry ]
%rem4 = srem i32 %b.addr.117, %r.018
%tobool.not = icmp eq i32 %rem4, 0
br i1 %tobool.not, label %while.end, label %if.end3, !llvm.loop !12
while.end: ; preds = %if.end3, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.018, %if.end3 ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #8 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
ret i32 0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #9 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !13
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #10 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #16
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !14
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #16
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #16
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #11
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
%q = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #16
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %q) #16
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull getelementptr inbounds ([500000 x i8], ptr @s, i64 0, i64 200000))
%call2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([500000 x i8], ptr @s, i64 0, i64 200000)) #15
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !15
%cmp64 = icmp sgt i64 %0, 0
br i1 %cmp64, label %for.body, label %if.then22
for.body: ; preds = %entry, %for.inc
%flg.068 = phi i64 [ %flg.1, %for.inc ], [ 1, %entry ]
%len.067 = phi i64 [ %len.1, %for.inc ], [ %call2, %entry ]
%p.066 = phi i64 [ %p.2, %for.inc ], [ 200000, %entry ]
%i.065 = phi i64 [ %inc20, %for.inc ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %x)
%1 = load i64, ptr %x, align 8, !tbaa !15
%cmp5 = icmp eq i64 %1, 1
br i1 %cmp5, label %if.then, label %if.end
if.then: ; preds = %for.body
%tobool.not = icmp eq i64 %flg.068, 0
%conv = zext i1 %tobool.not to i64
br label %for.inc
if.end: ; preds = %for.body
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %y)
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %q)
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %q)
%2 = load i64, ptr %y, align 8, !tbaa !15
%cmp9 = icmp eq i64 %2, 1
%tobool11 = icmp ne i64 %flg.068, 0
%or.cond = select i1 %cmp9, i1 %tobool11, i1 false
%or.cond.not = xor i1 %or.cond, true
%cmp12 = icmp ne i64 %2, 2
%or.cond45 = select i1 %cmp12, i1 true, i1 %tobool11
%or.cond63 = select i1 %or.cond.not, i1 %or.cond45, i1 false
%3 = load i8, ptr %q, align 1
%add = add nsw i64 %len.067, %p.066
%dec = add nsw i64 %p.066, -1
%add.sink = select i1 %or.cond63, i64 %add, i64 %dec
%p.1 = select i1 %or.cond63, i64 %p.066, i64 %dec
%arrayidx18 = getelementptr inbounds [500000 x i8], ptr @s, i64 0, i64 %add.sink
store i8 %3, ptr %arrayidx18, align 1, !tbaa !14
%inc = add nsw i64 %len.067, 1
br label %for.inc
for.inc: ; preds = %if.end, %if.then
%p.2 = phi i64 [ %p.066, %if.then ], [ %p.1, %if.end ]
%len.1 = phi i64 [ %len.067, %if.then ], [ %inc, %if.end ]
%flg.1 = phi i64 [ %conv, %if.then ], [ %flg.068, %if.end ]
%inc20 = add nuw nsw i64 %i.065, 1
%4 = load i64, ptr %n, align 8, !tbaa !15
%cmp = icmp slt i64 %inc20, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.inc
%5 = icmp eq i64 %flg.1, 0
br i1 %5, label %if.end25, label %if.then22
if.then22: ; preds = %entry, %for.end
%p.0.lcssa76 = phi i64 [ %p.2, %for.end ], [ 200000, %entry ]
%arrayidx23 = getelementptr inbounds [500000 x i8], ptr @s, i64 0, i64 %p.0.lcssa76
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx23)
br label %cleanup
if.end25: ; preds = %for.end
%cmp28.not.not71 = icmp sgt i64 %len.1, 0
br i1 %cmp28.not.not71, label %for.body30.preheader, label %for.end36
for.body30.preheader: ; preds = %if.end25
%add26 = add nsw i64 %len.1, %p.2
br label %for.body30
for.body30: ; preds = %for.body30.preheader, %for.body30
%i.1.in72 = phi i64 [ %i.1, %for.body30 ], [ %add26, %for.body30.preheader ]
%i.1 = add nsw i64 %i.1.in72, -1
%arrayidx31 = getelementptr inbounds [500000 x i8], ptr @s, i64 0, i64 %i.1
%6 = load i8, ptr %arrayidx31, align 1, !tbaa !14
%conv32 = sext i8 %6 to i32
%putchar62 = call i32 @putchar(i32 %conv32)
%cmp28.not.not = icmp sgt i64 %i.1, %p.2
br i1 %cmp28.not.not, label %for.body30, label %for.end36, !llvm.loop !18
for.end36: ; preds = %for.body30, %if.end25
%putchar = call i32 @putchar(i32 10)
br label %cleanup
cleanup: ; preds = %for.end36, %if.then22
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %q) #16
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #16
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #16
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #16
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #10 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #12 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nofree nounwind }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
int main(){
int q,a[2]={499999,500000},t,f,g=0;
char s[1000000],c[2];
scanf("%s",&s[a[1]]);
while(s[a[1]]!=0) a[1]++;
scanf("%d",&q);
for(;q>0;q--){
scanf("%d",&t);
if(t==1){
g^=1;
}else{
scanf("%d",&f);
f--;
f^=g;
scanf("%s",&c);
s[a[f]]=c[0];
a[f]+=(f<<1)-1;
}
}
s[a[1]]=0;
a[0]++; a[1]--;
if(g){
f=(a[0]+a[1]);
for(q=a[0];q<=f/2;q++){
t=s[q];
s[q]=s[f-q];
s[f-q]=t;
}
}
printf("%s",&s[a[0]]);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104330/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%a = alloca [2 x i32], align 8
%t = alloca i32, align 4
%f = alloca i32, align 4
%s = alloca [1000000 x i8], align 16
%c = alloca [2 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
store i64 2147483648499999, ptr %a, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %c) #3
%arrayidx = getelementptr inbounds [2 x i32], ptr %a, i64 0, i64 1
%arrayidx1 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 500000
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 500000, %entry ]
%arrayidx4 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !8
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx, align 4, !tbaa !10
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q)
%.pr = load i32, ptr %q, align 4, !tbaa !10
%cmp863 = icmp sgt i32 %.pr, 0
br i1 %cmp863, label %for.body, label %for.end.thread
for.end.thread: ; preds = %while.end
%sext = shl i64 %indvars.iv, 32
%idxprom2575 = ashr exact i64 %sext, 32
%arrayidx2676 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %idxprom2575
store i8 0, ptr %arrayidx2676, align 1, !tbaa !5
br label %if.end55
for.body: ; preds = %while.end, %for.inc
%g.064 = phi i32 [ %g.1, %for.inc ], [ 0, %while.end ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%2 = load i32, ptr %t, align 4, !tbaa !10
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body
%xor = xor i32 %g.064, 1
br label %for.inc
if.else: ; preds = %for.body
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %f)
%3 = load i32, ptr %f, align 4, !tbaa !10
%dec = add nsw i32 %3, -1
%xor14 = xor i32 %dec, %g.064
store i32 %xor14, ptr %f, align 4, !tbaa !10
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%4 = load i8, ptr %c, align 1, !tbaa !5
%5 = load i32, ptr %f, align 4, !tbaa !10
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [2 x i32], ptr %a, i64 0, i64 %idxprom17
%6 = load i32, ptr %arrayidx18, align 4, !tbaa !10
%idxprom19 = sext i32 %6 to i64
%arrayidx20 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %idxprom19
store i8 %4, ptr %arrayidx20, align 1, !tbaa !5
%shl = shl i32 %5, 1
%sub = add nsw i32 %shl, -1
%add = add nsw i32 %sub, %6
store i32 %add, ptr %arrayidx18, align 4, !tbaa !10
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%g.1 = phi i32 [ %xor, %if.then ], [ %g.064, %if.else ]
%7 = load i32, ptr %q, align 4, !tbaa !10
%dec23 = add nsw i32 %7, -1
store i32 %dec23, ptr %q, align 4, !tbaa !10
%cmp8 = icmp sgt i32 %7, 1
br i1 %cmp8, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !10
%.pre73 = load i32, ptr %a, align 8, !tbaa !10
%8 = icmp eq i32 %g.1, 0
%idxprom25 = sext i32 %.pre to i64
%arrayidx26 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %idxprom25
store i8 0, ptr %arrayidx26, align 1, !tbaa !5
%inc28 = add nsw i32 %.pre73, 1
br i1 %8, label %if.end55, label %if.then31
if.then31: ; preds = %for.end
%add34 = add i32 %.pre73, %.pre
store i32 %add34, ptr %f, align 4, !tbaa !10
%div = sdiv i32 %add34, 2
%cmp37.not65.not = icmp slt i32 %.pre73, %div
br i1 %cmp37.not65.not, label %for.body39.preheader, label %if.end55.loopexit
for.body39.preheader: ; preds = %if.then31
%9 = sext i32 %.pre73 to i64
%10 = add nsw i64 %9, 1
%11 = sext i32 %add34 to i64
%12 = add nsw i32 %div, 1
%13 = sub i32 %div, %.pre73
%.neg = add i32 %.pre73, 1
%xtraiter = and i32 %13, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body39.prol.loopexit, label %for.body39.prol
for.body39.prol: ; preds = %for.body39.preheader
%arrayidx41.prol = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %10
%14 = load i8, ptr %arrayidx41.prol, align 1, !tbaa !5
%15 = sub nsw i64 %11, %10
%arrayidx45.prol = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %15
%16 = load i8, ptr %arrayidx45.prol, align 1, !tbaa !5
store i8 %16, ptr %arrayidx41.prol, align 1, !tbaa !5
store i8 %14, ptr %arrayidx45.prol, align 1, !tbaa !5
%indvars.iv.next70.prol = add nsw i64 %9, 2
br label %for.body39.prol.loopexit
for.body39.prol.loopexit: ; preds = %for.body39.prol, %for.body39.preheader
%.lcssa.unr = phi i8 [ undef, %for.body39.preheader ], [ %14, %for.body39.prol ]
%indvars.iv69.unr = phi i64 [ %10, %for.body39.preheader ], [ %indvars.iv.next70.prol, %for.body39.prol ]
%17 = icmp eq i32 %div, %.neg
br i1 %17, label %for.cond36.if.end55.loopexit_crit_edge, label %for.body39
for.body39: ; preds = %for.body39.prol.loopexit, %for.body39
%indvars.iv69 = phi i64 [ %indvars.iv.next70.1, %for.body39 ], [ %indvars.iv69.unr, %for.body39.prol.loopexit ]
%arrayidx41 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %indvars.iv69
%18 = load i8, ptr %arrayidx41, align 1, !tbaa !5
%19 = sub nsw i64 %11, %indvars.iv69
%arrayidx45 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %19
%20 = load i8, ptr %arrayidx45, align 1, !tbaa !5
store i8 %20, ptr %arrayidx41, align 1, !tbaa !5
store i8 %18, ptr %arrayidx45, align 1, !tbaa !5
%indvars.iv.next70 = add nsw i64 %indvars.iv69, 1
%arrayidx41.1 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %indvars.iv.next70
%21 = load i8, ptr %arrayidx41.1, align 1, !tbaa !5
%22 = sub nsw i64 %11, %indvars.iv.next70
%arrayidx45.1 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %22
%23 = load i8, ptr %arrayidx45.1, align 1, !tbaa !5
store i8 %23, ptr %arrayidx41.1, align 1, !tbaa !5
store i8 %21, ptr %arrayidx45.1, align 1, !tbaa !5
%indvars.iv.next70.1 = add nsw i64 %indvars.iv69, 2
%lftr.wideiv.1 = trunc i64 %indvars.iv.next70.1 to i32
%exitcond.not.1 = icmp eq i32 %12, %lftr.wideiv.1
br i1 %exitcond.not.1, label %for.cond36.if.end55.loopexit_crit_edge, label %for.body39, !llvm.loop !13
for.cond36.if.end55.loopexit_crit_edge: ; preds = %for.body39, %for.body39.prol.loopexit
%.lcssa = phi i8 [ %.lcssa.unr, %for.body39.prol.loopexit ], [ %21, %for.body39 ]
%conv42 = sext i8 %.lcssa to i32
store i32 %conv42, ptr %t, align 4, !tbaa !10
br label %if.end55.loopexit
if.end55.loopexit: ; preds = %for.cond36.if.end55.loopexit_crit_edge, %if.then31
%storemerge.lcssa = phi i32 [ %12, %for.cond36.if.end55.loopexit_crit_edge ], [ %inc28, %if.then31 ]
store i32 %storemerge.lcssa, ptr %q, align 4, !tbaa !10
br label %if.end55
if.end55: ; preds = %for.end.thread, %if.end55.loopexit, %for.end
%inc2879 = phi i32 [ 500000, %for.end.thread ], [ %inc28, %if.end55.loopexit ], [ %inc28, %for.end ]
%idxprom57 = sext i32 %inc2879 to i64
%arrayidx58 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %idxprom57
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %arrayidx58)
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
|
#include<stdio.h>
#define ll long long
ll absolute(ll a){
if(a>0) return a;
return -a;
}
int main(){
int n,ans;
scanf("%d",&n);
ll h[n];
int p=1;
for(int i=0;i<n;i++)
scanf("%lld",&h[i]);
for(int i=1;i<n;i++){
if(h[i-1]<=h[i]-1)
h[i]-=1;
else if(h[i-1]==h[i]){
ans++;
}
else
p=0;
}
if(p)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104424/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104424/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @absolute(i64 noundef %a) local_unnamed_addr #0 {
entry:
%retval.0 = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %retval.0
}
; 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) #7
%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 i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %3, 0
br i1 %cmp44, label %for.body, label %if.end33
for.cond3.preheader: ; preds = %for.body
%cmp446 = icmp sgt i32 %6, 1
br i1 %cmp446, label %for.body6.preheader, label %if.end33
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %6 to i64
%.pre = load i64, ptr %vla, align 16, !tbaa !9
%4 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %4, 1
%5 = icmp eq i32 %6, 2
br i1 %5, label %for.cond.cleanup5.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %4, -2
%invariant.gep = getelementptr i64, ptr %vla, i64 1
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !11
for.cond.cleanup5.unr-lcssa: ; preds = %for.inc26.1, %for.body6.preheader
%p.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %p.1.1, %for.inc26.1 ]
%.unr = phi i64 [ %.pre, %for.body6.preheader ], [ %14, %for.inc26.1 ]
%indvars.iv53.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next54.1, %for.inc26.1 ]
%p.048.unr = phi i32 [ 1, %for.body6.preheader ], [ %p.1.1, %for.inc26.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.unr-lcssa
%arrayidx10.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv53.unr
%8 = load i64, ptr %arrayidx10.epil, align 8, !tbaa !9
%cmp12.not.not.epil = icmp slt i64 %.unr, %8
br i1 %cmp12.not.not.epil, label %if.then.epil, label %if.else.epil
if.else.epil: ; preds = %for.body6.epil
%cmp21.epil = icmp eq i64 %.unr, %8
%spec.select43.epil = select i1 %cmp21.epil, i32 %p.048.unr, i32 0
br label %for.cond.cleanup5
if.then.epil: ; preds = %for.body6.epil
%sub11.epil = add nsw i64 %8, -1
store i64 %sub11.epil, ptr %arrayidx10.epil, align 8, !tbaa !9
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %if.else.epil, %if.then.epil, %for.cond.cleanup5.unr-lcssa
%p.1.lcssa = phi i32 [ %p.1.lcssa.ph, %for.cond.cleanup5.unr-lcssa ], [ %p.048.unr, %if.then.epil ], [ %spec.select43.epil, %if.else.epil ]
%9 = icmp eq i32 %p.1.lcssa, 0
%spec.select = select i1 %9, ptr @str, ptr @str.4
br label %if.end33
for.body6: ; preds = %for.inc26.1, %for.body6.preheader.new
%10 = phi i64 [ %.pre, %for.body6.preheader.new ], [ %14, %for.inc26.1 ]
%indvars.iv53 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next54.1, %for.inc26.1 ]
%p.048 = phi i32 [ 1, %for.body6.preheader.new ], [ %p.1.1, %for.inc26.1 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.inc26.1 ]
%arrayidx10 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv53
%11 = load i64, ptr %arrayidx10, align 8, !tbaa !9
%cmp12.not.not = icmp slt i64 %10, %11
br i1 %cmp12.not.not, label %if.then, label %if.else
if.then: ; preds = %for.body6
%sub11 = add nsw i64 %11, -1
store i64 %sub11, ptr %arrayidx10, align 8, !tbaa !9
br label %for.inc26
if.else: ; preds = %for.body6
%cmp21 = icmp eq i64 %10, %11
%spec.select43 = select i1 %cmp21, i32 %p.048, i32 0
br label %for.inc26
for.inc26: ; preds = %if.else, %if.then
%12 = phi i64 [ %sub11, %if.then ], [ %11, %if.else ]
%p.1 = phi i32 [ %p.048, %if.then ], [ %spec.select43, %if.else ]
%gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv53
%13 = load i64, ptr %gep, align 8, !tbaa !9
%cmp12.not.not.1 = icmp slt i64 %12, %13
br i1 %cmp12.not.not.1, label %if.then.1, label %if.else.1
if.else.1: ; preds = %for.inc26
%cmp21.1 = icmp eq i64 %12, %13
%spec.select43.1 = select i1 %cmp21.1, i32 %p.1, i32 0
br label %for.inc26.1
if.then.1: ; preds = %for.inc26
%sub11.1 = add nsw i64 %13, -1
store i64 %sub11.1, ptr %gep, align 8, !tbaa !9
br label %for.inc26.1
for.inc26.1: ; preds = %if.then.1, %if.else.1
%14 = phi i64 [ %sub11.1, %if.then.1 ], [ %13, %if.else.1 ]
%p.1.1 = phi i32 [ %p.1, %if.then.1 ], [ %spec.select43.1, %if.else.1 ]
%indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup5.unr-lcssa, label %for.body6, !llvm.loop !13
if.end33: ; preds = %for.cond.cleanup5, %for.cond3.preheader, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str.4, %for.cond3.preheader ], [ %spec.select, %for.cond.cleanup5 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
//ABC136C
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(){
int n;
scanf("%d",&n);
int i, j;
int h[n];
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
for(j=n-1;j>0;j--){
if(h[j-1] <= h[j]){
h[j-1] = h[j-1];
}else{
if(h[j-1] == h[j] + 1){
h[j-1] = h[j-1] - 1;
}else{
printf("No\n");
return 0;
}
}
}
printf("Yes\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104468/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104468/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %3, 0
br i1 %cmp54, label %for.body, label %cleanup
for.cond2.preheader: ; preds = %for.body
%cmp357 = icmp sgt i32 %5, 1
br i1 %cmp357, label %for.body4.preheader, label %cleanup
for.body4.preheader: ; preds = %for.cond2.preheader
%4 = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc34
%indvars.iv62 = phi i64 [ %4, %for.body4.preheader ], [ %indvars.iv.next63, %for.inc34 ]
%indvars.iv.next63 = add nsw i64 %indvars.iv62, -1
%sub5 = add nuw i64 %indvars.iv62, 4294967294
%idxprom6 = and i64 %sub5, 4294967295
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%idxprom8 = and i64 %indvars.iv.next63, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp sgt i32 %7, %8
br i1 %cmp10.not, label %if.else, label %for.inc34
if.else: ; preds = %for.body4
%add = add nsw i32 %8, 1
%cmp22 = icmp eq i32 %7, %add
br i1 %cmp22, label %if.then23, label %cleanup
if.then23: ; preds = %if.else
%sub27 = add nsw i32 %7, -1
store i32 %sub27, ptr %arrayidx7, align 4, !tbaa !5
br label %for.inc34
for.inc34: ; preds = %for.body4, %if.then23
%cmp3 = icmp ugt i64 %indvars.iv62, 2
br i1 %cmp3, label %for.body4, label %cleanup, !llvm.loop !11
cleanup: ; preds = %for.inc34, %if.else, %for.cond2.preheader, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.cond2.preheader ], [ @str.3, %if.else ], [ @str, %for.inc34 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int mypow(int a, int b)
{
int i, ans = 1;
for (i = 0; i < b; i++)
{
ans *= a;
}
return ans;
}
int main()
{
int n, i, j,k,h[100000];
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d", &h[i]);
}
/* if(n==1)
{
printf("Yes");
return 0;
}*/
for (i = n-1; i>0; i--)
{
if(h[i-1]>h[i])
{
h[i-1] -= 1;
}
}
for (i = 0; i < n - 1; i++)
{
if (h[i] > h[i + 1])
{
printf("No");
return 0;
}
}
printf("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104510/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104510/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @mypow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%ans.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%ans.05 = phi i32 [ %mul, %for.body ], [ %ans.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %ans.05, %a
%inc = add nuw nsw i32 %i.04, 1
%exitcond.not = icmp eq i32 %inc, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %ans.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 i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%h = 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 %h) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp49 = icmp sgt i32 %0, 0
br i1 %cmp49, label %for.body, label %for.cond17.preheader
for.cond2.preheader: ; preds = %for.body
%cmp352 = icmp sgt i32 %65, 1
br i1 %cmp352, label %for.body4.preheader, label %for.cond17.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %65 to i64
%2 = add nsw i64 %1, -1
%min.iters.check = icmp ult i32 %65, 57
br i1 %min.iters.check, label %for.body4.preheader93, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body4.preheader
%3 = add nsw i64 %1, -2
%4 = add i32 %65, -2
%5 = trunc i64 %3 to i32
%6 = icmp ult i32 %4, %5
%7 = add i32 %65, -1
%8 = trunc i64 %3 to i32
%9 = icmp ult i32 %7, %8
%10 = icmp ugt i64 %3, 4294967295
%11 = or i1 %9, %10
%12 = zext i32 %4 to i64
%13 = shl nuw nsw i64 %12, 2
%scevgep = getelementptr i8, ptr %h, i64 %13
%mul.result71.neg = mul nsw i64 %3, -4
%14 = getelementptr i8, ptr %scevgep, i64 %mul.result71.neg
%15 = icmp ugt ptr %14, %scevgep
%16 = zext i32 %7 to i64
%17 = shl nuw nsw i64 %16, 2
%scevgep73 = getelementptr i8, ptr %h, i64 %17
%mul.result75.neg = mul nsw i64 %3, -4
%18 = getelementptr i8, ptr %scevgep73, i64 %mul.result75.neg
%19 = icmp ugt ptr %18, %scevgep73
%20 = or i1 %6, %11
%21 = or i1 %15, %20
%22 = or i1 %19, %21
br i1 %22, label %for.body4.preheader93, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%umin77 = call i64 @llvm.umin.i64(i64 %1, i64 2)
%23 = shl nuw nsw i64 %umin77, 2
%24 = add i32 %65, -2
%25 = zext i32 %24 to i64
%26 = shl nuw nsw i64 %25, 2
%27 = add nuw nsw i64 %23, %26
%28 = shl nuw nsw i64 %1, 2
%29 = sub nsw i64 %27, %28
%scevgep78 = getelementptr i8, ptr %h, i64 %29
%scevgep79 = getelementptr inbounds i8, ptr %h, i64 4
%scevgep80 = getelementptr i8, ptr %scevgep79, i64 %26
%30 = add i32 %65, -1
%31 = zext i32 %30 to i64
%32 = shl nuw nsw i64 %31, 2
%33 = add nuw nsw i64 %23, %32
%34 = sub nsw i64 %33, %28
%scevgep81 = getelementptr i8, ptr %h, i64 %34
%scevgep82 = getelementptr inbounds i8, ptr %h, i64 4
%scevgep83 = getelementptr i8, ptr %scevgep82, i64 %32
%bound0 = icmp ult ptr %scevgep78, %scevgep83
%bound1 = icmp ult ptr %scevgep81, %scevgep80
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body4.preheader93, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %2, -4
%ind.end = sub nsw i64 %1, %n.vec
%invariant.gep = getelementptr i32, ptr %h, i64 -3
%invariant.gep94 = getelementptr i32, ptr %h, i64 -3
br label %vector.body
vector.body: ; preds = %pred.store.continue92, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue92 ]
%offset.idx = sub i64 %1, %index
%35 = add i64 %offset.idx, 4294967295
%36 = add nuw i64 %offset.idx, 4294967294
%37 = and i64 %36, 4294967295
%gep = getelementptr [100000 x i32], ptr %invariant.gep, i64 0, i64 %37
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !10, !alias.scope !14, !noalias !17
%38 = and i64 %35, 4294967295
%gep95 = getelementptr [100000 x i32], ptr %invariant.gep94, i64 0, i64 %38
%wide.load85 = load <4 x i32>, ptr %gep95, align 4, !tbaa !10, !alias.scope !17
%39 = icmp sgt <4 x i32> %wide.load, %wide.load85
%40 = extractelement <4 x i1> %39, i64 3
br i1 %40, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%41 = add nuw i64 %offset.idx, 4294967294
%42 = and i64 %41, 4294967295
%43 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %42
%44 = extractelement <4 x i32> %wide.load, i64 3
%45 = add nsw i32 %44, -1
store i32 %45, ptr %43, align 4, !tbaa !10, !alias.scope !14, !noalias !17
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%46 = extractelement <4 x i1> %39, i64 2
br i1 %46, label %pred.store.if87, label %pred.store.continue88
pred.store.if87: ; preds = %pred.store.continue
%47 = add i64 %offset.idx, 4294967293
%48 = and i64 %47, 4294967295
%49 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %48
%50 = extractelement <4 x i32> %wide.load, i64 2
%51 = add nsw i32 %50, -1
store i32 %51, ptr %49, align 4, !tbaa !10, !alias.scope !14, !noalias !17
br label %pred.store.continue88
pred.store.continue88: ; preds = %pred.store.if87, %pred.store.continue
%52 = extractelement <4 x i1> %39, i64 1
br i1 %52, label %pred.store.if89, label %pred.store.continue90
pred.store.if89: ; preds = %pred.store.continue88
%53 = add i64 %offset.idx, 4294967292
%54 = and i64 %53, 4294967295
%55 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %54
%56 = extractelement <4 x i32> %wide.load, i64 1
%57 = add nsw i32 %56, -1
store i32 %57, ptr %55, align 4, !tbaa !10, !alias.scope !14, !noalias !17
br label %pred.store.continue90
pred.store.continue90: ; preds = %pred.store.if89, %pred.store.continue88
%58 = extractelement <4 x i1> %39, i64 0
br i1 %58, label %pred.store.if91, label %pred.store.continue92
pred.store.if91: ; preds = %pred.store.continue90
%59 = add i64 %offset.idx, 4294967291
%60 = and i64 %59, 4294967295
%61 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %60
%62 = extractelement <4 x i32> %wide.load, i64 0
%63 = add nsw i32 %62, -1
store i32 %63, ptr %61, align 4, !tbaa !10, !alias.scope !14, !noalias !17
br label %pred.store.continue92
pred.store.continue92: ; preds = %pred.store.if91, %pred.store.continue90
%index.next = add nuw i64 %index, 4
%64 = icmp eq i64 %index.next, %n.vec
br i1 %64, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %pred.store.continue92
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.cond17.preheader, label %for.body4.preheader93
for.body4.preheader93: ; preds = %vector.memcheck, %vector.scevcheck, %for.body4.preheader, %middle.block
%indvars.iv57.ph = phi i64 [ %1, %vector.memcheck ], [ %1, %vector.scevcheck ], [ %1, %for.body4.preheader ], [ %ind.end, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, 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
%65 = load i32, ptr %n, align 4, !tbaa !10
%66 = sext i32 %65 to i64
%cmp = icmp slt i64 %indvars.iv.next, %66
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !20
for.cond17.preheader: ; preds = %for.inc15, %middle.block, %entry, %for.cond2.preheader
%.lcssa66 = phi i32 [ %65, %for.cond2.preheader ], [ %0, %entry ], [ %65, %middle.block ], [ %65, %for.inc15 ]
%67 = call i32 @llvm.smax.i32(i32 %.lcssa66, i32 1)
%smax = add nsw i32 %67, -1
%wide.trip.count = zext i32 %smax to i64
br label %for.cond17
for.body4: ; preds = %for.body4.preheader93, %for.inc15
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.inc15 ], [ %indvars.iv57.ph, %for.body4.preheader93 ]
%indvars.iv.next58 = add nsw i64 %indvars.iv57, -1
%sub5 = add nuw i64 %indvars.iv57, 4294967294
%idxprom6 = and i64 %sub5, 4294967295
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %idxprom6
%68 = load i32, ptr %arrayidx7, align 4, !tbaa !10
%idxprom8 = and i64 %indvars.iv.next58, 4294967295
%arrayidx9 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %idxprom8
%69 = load i32, ptr %arrayidx9, align 4, !tbaa !10
%cmp10 = icmp sgt i32 %68, %69
br i1 %cmp10, label %if.then, label %for.inc15
if.then: ; preds = %for.body4
%sub14 = add nsw i32 %68, -1
store i32 %sub14, ptr %arrayidx7, align 4, !tbaa !10
br label %for.inc15
for.inc15: ; preds = %for.body4, %if.then
%cmp3 = icmp ugt i64 %indvars.iv57, 2
br i1 %cmp3, label %for.body4, label %for.cond17.preheader, !llvm.loop !21
for.cond17: ; preds = %for.cond17.preheader, %for.body20
%indvars.iv60 = phi i64 [ 0, %for.cond17.preheader ], [ %indvars.iv.next61, %for.body20 ]
%exitcond.not = icmp eq i64 %indvars.iv60, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body20
for.body20: ; preds = %for.cond17
%arrayidx22 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv60
%70 = load i32, ptr %arrayidx22, align 4, !tbaa !10
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%arrayidx24 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next61
%71 = load i32, ptr %arrayidx24, align 4, !tbaa !10
%cmp25 = icmp sgt i32 %70, %71
br i1 %cmp25, label %cleanup, label %for.cond17, !llvm.loop !22
cleanup: ; preds = %for.cond17, %for.body20
%.str.2.sink = phi ptr [ @.str.1, %for.body20 ], [ @.str.2, %for.cond17 ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #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 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.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = !{!15}
!15 = distinct !{!15, !16}
!16 = distinct !{!16, !"LVerDomain"}
!17 = !{!18}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !6, !7, !8}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6, !7}
!22 = distinct !{!22, !6}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int N,i;
long h[100005];
char str[2000000],*p;
fgets(str,sizeof(str),stdin);
N=atoi(str);
fgets(str,sizeof(str),stdin);
p=strtok(str," \n");
h[0]=atol(p);
for(i=1;i<N;i++){
p=strtok(NULL," \n");
h[i]=atol(p);
}
h[0]-=1;
for(i=1;i<N;i++){
if(h[i-1]>h[i]){
printf("No\n");
return 0;
}
if(h[i-1]<h[i]){
h[i]-=1;
}
}
printf("Yes\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104554/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104554/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c" \0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca [100005 x i64], align 16
%str = alloca [2000000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %str) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 2000000, ptr noundef %0)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 2000000, ptr noundef %1)
%call6 = call ptr @strtok(ptr noundef nonnull %str, ptr noundef nonnull @.str) #5
%call.i54 = call i64 @strtol(ptr nocapture noundef nonnull %call6, ptr noundef null, i32 noundef 10) #5
%cmp56 = icmp sgt i32 %conv.i, 1
br i1 %cmp56, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call.i, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call8 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #5
%call.i55 = call i64 @strtol(ptr nocapture noundef nonnull %call8, ptr noundef null, i32 noundef 10) #5
%arrayidx10 = getelementptr inbounds [100005 x i64], ptr %h, i64 0, i64 %indvars.iv
store i64 %call.i55, ptr %arrayidx10, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body
br i1 %cmp56, label %for.body14.preheader, label %cleanup
for.body14.preheader: ; preds = %for.end
%sub = add nsw i64 %call.i54, -1
%wide.trip.count65 = and i64 %call.i, 4294967295
br label %for.body14
for.body14: ; preds = %for.body14.preheader, %for.inc33
%2 = phi i64 [ %sub, %for.body14.preheader ], [ %4, %for.inc33 ]
%indvars.iv61 = phi i64 [ 1, %for.body14.preheader ], [ %indvars.iv.next62, %for.inc33 ]
%arrayidx19 = getelementptr inbounds [100005 x i64], ptr %h, i64 0, i64 %indvars.iv61
%3 = load i64, ptr %arrayidx19, align 8, !tbaa !9
%cmp20 = icmp sgt i64 %2, %3
br i1 %cmp20, label %cleanup, label %if.end
if.end: ; preds = %for.body14
%cmp27 = icmp slt i64 %2, %3
br i1 %cmp27, label %if.then28, label %for.inc33
if.then28: ; preds = %if.end
%sub31 = add nsw i64 %3, -1
store i64 %sub31, ptr %arrayidx19, align 8, !tbaa !9
br label %for.inc33
for.inc33: ; preds = %if.end, %if.then28
%4 = phi i64 [ %3, %if.end ], [ %sub31, %if.then28 ]
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond66.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count65
br i1 %exitcond66.not, label %cleanup, label %for.body14, !llvm.loop !13
cleanup: ; preds = %for.inc33, %for.body14, %for.end, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.end ], [ @str.3, %for.body14 ], [ @str, %for.inc33 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %str) #5
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
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 "no-trapping-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 = !{!"any pointer", !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>
int main(void){
char input;
scanf("%c",&input);
if(input==97||input==101||input==105||input==111||input==117){
printf("%s\n","vowel");
}
else printf("consonant");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104598/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104598/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %input) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i8, ptr %input, align 1
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
switch i8 %2, label %if.else [
i8 10, label %if.then
i8 7, label %if.then
i8 4, label %if.then
i8 2, label %if.then
i8 0, label %if.then
]
if.then: ; preds = %entry, %entry, %entry, %entry, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @.str.2)
br label %if.end
if.else: ; preds = %entry
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %input) #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 i8 @llvm.fshl.i8(i8, i8, i8) #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)"}
|
#include <stdio.h>
int main(void)
{
char a[256] = {['a'] = 1, ['i'] = 1, ['u'] = 1, ['e'] = 1, ['o'] = 1};
char c;
scanf("%c", &c);
puts(a[c] ? "vowel" : "consonant");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104640/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [256 x i8], align 16
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) %a, i8 0, i64 256, i1 false)
%0 = getelementptr inbounds [118 x i8], ptr %a, i64 0, i64 97
store i8 1, ptr %0, align 1
%1 = getelementptr inbounds [118 x i8], ptr %a, i64 0, i64 101
store i8 1, ptr %1, align 1
%2 = getelementptr inbounds [118 x i8], ptr %a, i64 0, i64 105
store i8 1, ptr %2, align 1
%3 = getelementptr inbounds [118 x i8], ptr %a, i64 0, i64 111
store i8 1, ptr %3, align 1
%4 = getelementptr inbounds [118 x i8], ptr %a, i64 0, i64 117
store i8 1, ptr %4, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%5 = load i8, ptr %c, align 1, !tbaa !5
%idxprom = sext i8 %5 to i64
%arrayidx = getelementptr inbounds [256 x i8], ptr %a, i64 0, i64 %idxprom
%6 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool.not = icmp eq i8 %6, 0
%cond = select i1 %tobool.not, ptr @.str.2, ptr @.str.1
%call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 256, 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: 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 @puts(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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
char ch;
scanf("%c", &ch);
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' ||
ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
{
printf("vowel\n", ch);
}
else
{
printf("consonant\n", ch);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104684/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104684/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@str = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str.3 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1
switch i8 %0, label %if.else [
i8 117, label %if.end
i8 111, label %if.end
i8 105, label %if.end
i8 101, label %if.end
i8 97, label %if.end
i8 85, label %if.end
i8 79, label %if.end
i8 73, label %if.end
i8 69, label %if.end
i8 65, label %if.end
]
if.else: ; preds = %entry
br label %if.end
if.end: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ], [ @str.3, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(){
char c;
scanf("%c",&c);
if(c=='a' || c == 'i' || c == 'u' || c=='e' || c=='o')
printf("vowel\n");
else printf("consonant\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@str = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str.3 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
%3 = icmp ult i8 %2, 11
br i1 %3, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%4 = sext i8 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree 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 i8 @llvm.fshl.i8(i8, i8, i8) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void)
{
int x,y,z,a,b,n;
char d[6] = {"aeiou"},c;
scanf("%c",&c);
for(x=0;x<5;x++) if (c == d[x]) break;
if (x == 5) printf("consonant");
else printf("vowel");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104778/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104778/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
%3 = icmp ult i8 %2, 11
br i1 %3, label %switch.lookup, label %if.end9
switch.lookup: ; preds = %entry
%4 = sext i8 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end9
if.end9: ; preds = %switch.lookup, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %reltable.intrinsic, %switch.lookup ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i8 @llvm.fshl.i8(i8, i8, i8) #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int i;
char a[5]={'a','e','i','o','u'};
char ch;
scanf("%c",&ch);
////for(i=0;i<5;i++)
{
if(ch == a[0] || ch == a[1] || ch == a[2] || ch==a[3] || ch==a[4] ) printf("vowel");
else printf("consonant");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104828/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1, !tbaa !5
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
%3 = icmp ult i8 %2, 11
br i1 %3, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%4 = sext i8 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
/*
A - 居合を終え、青い絵を覆う / UOIAUAI
<http://abc049.contest.atcoder.jp/tasks/abc049_a>
[Tips]
・文字列の初期化<http://www.cc.kyoto-su.ac.jp/~yamada/programming/string.html>
*/
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[]) {
char c;
char vowels[] = "aiueo";
int len = strlen( vowels );
int i;
scanf("%c", &c);
i = 0;
while( i < len ){
if( vowels[i] == c ){
printf("vowel\n");
return 0;
}
i++;
}
printf("consonant");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104879/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104879/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str = private unnamed_addr constant [6 x i8] c"vowel\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:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
switch i8 %2, label %while.cond.4 [
i8 0, label %if.then
i8 4, label %if.then
i8 10, label %if.then
i8 2, label %if.then
i8 7, label %if.then
]
while.cond.4: ; preds = %entry
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
if.then: ; preds = %entry, %entry, %entry, %entry, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %while.cond.4, %if.then
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i8 @llvm.fshl.i8(i8, i8, i8) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char s;
scanf("%c",&s);
if(s == 'a' || s == 'i' || s == 'u' || s == 'e' || s == 'o'){
printf("vowel\n");
}else{
printf("consonant");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104921/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
switch i8 %2, label %if.else [
i8 10, label %if.then
i8 7, label %if.then
i8 4, label %if.then
i8 2, label %if.then
i8 0, label %if.then
]
if.then: ; preds = %entry, %entry, %entry, %entry, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 i8 @llvm.fshl.i8(i8, i8, i8) #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)"}
|
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
if(n%2==0)
printf("%d\n",n);
else
printf("%d\n",2*n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104965/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104965/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2==0)
printf("%d\n",n);
else
printf("%d\n",2*n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105021/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105021/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x,i,n,m;
while(~scanf("%d",&n))
{
if(n%2==0)
{
printf("%d\n",n);
}
else
{
printf("%d\n",2*n);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105065/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105065/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not4 = icmp eq i32 %call3, -1
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 n;
scanf("%d", &n);
printf("%d\n", n % 2 == 0 ? n : n * 2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105108/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105108/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%1 = and i32 %0, 1
%cond = shl i32 %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond)
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)"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void)
{
//変数の宣言
//int n,k;
int N;
//データの読み込み
//scanf("%d %d",&n,&k)
scanf("%d",&N);
// printf("nは%dです\n", n);
// printf("データの読み込み終了\n");
//実際の処理
if(N%2==0){
printf("%d",N);
}else{
printf("%d",N*2);
}
// printf("計算部分終了\n");
//出力
// printf("結果の出力終了\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105159/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105159/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n;
scanf("%d",&n);
if(n%2==0) printf("%d",n);
else printf("%d",n*2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105201/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
int N;
scanf("%d", &N);
if (N % 2 == 0){
printf("%d\n", N);
} else
{printf("%d\n", N * 2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105245/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105245/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int N;
scanf("%d", &N);
if(N%2 == 0){
printf("%d\n", N);
} else{
printf("%d\n", N*2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105289/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105289/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int N;
scanf("%d",&N);
if(N%2==0){
printf("%d",N);
}else{
printf("%d",N*2);
}
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105346/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%mul.sink = shl i32 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
//>w^h
int main(void) {
double w, h;
int x, y;
scanf("%lf%lf", &w, &h);
scanf("%d%d", &x, &y);
printf("%lf ", w * h / 2);
if (x == w / 2 && y == h / 2)
printf("1\n");
else
printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lf \00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca double, align 8
%h = alloca double, align 8
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load double, ptr %w, align 8, !tbaa !5
%1 = load double, ptr %h, align 8, !tbaa !5
%mul = fmul double %0, %1
%div = fmul double %mul, 5.000000e-01
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div)
%2 = load i32, ptr %x, align 4, !tbaa !9
%conv = sitofp i32 %2 to double
%3 = load double, ptr %w, align 8, !tbaa !5
%div3 = fmul double %3, 5.000000e-01
%cmp = fcmp oeq double %div3, %conv
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%4 = load i32, ptr %y, align 4, !tbaa !9
%conv5 = sitofp i32 %4 to double
%5 = load double, ptr %h, align 8, !tbaa !5
%div6 = fmul double %5, 5.000000e-01
%cmp7 = fcmp oeq double %div6, %conv5
br i1 %cmp7, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.5, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 8, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
#include<string.h>
int main(){
char a[100002];int i,l;
scanf("%s",a);
l=strlen(a);l--;
for(i=0;i<=l;i++)
printf("%c",a[i]);
for(i=l;i>=0;i--)
printf("%c",a[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10544/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10544/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100002 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100002, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #6
%conv = trunc i64 %call2 to i32
%cmp.not.not25 = icmp sgt i32 %conv, 0
br i1 %cmp.not.not25, label %for.body.preheader, label %for.end16
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
br label %for.body
for.cond6.preheader: ; preds = %for.body
br i1 %cmp.not.not25, label %for.body9.preheader, label %for.end16
for.body9.preheader: ; preds = %for.cond6.preheader
%0 = and i64 %call2, 4294967295
br label %for.body9
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds [100002 x i8], ptr %a, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%putchar24 = call i32 @putchar(i32 %conv4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond6.preheader, label %for.body, !llvm.loop !8
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv30 = phi i64 [ %0, %for.body9.preheader ], [ %indvars.iv.next31, %for.body9 ]
%indvars.iv.next31 = add nsw i64 %indvars.iv30, -1
%idxprom10 = and i64 %indvars.iv.next31, 4294967295
%arrayidx11 = getelementptr inbounds [100002 x i8], ptr %a, i64 0, i64 %idxprom10
%2 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%conv12 = sext i8 %2 to i32
%putchar = call i32 @putchar(i32 %conv12)
%cmp7 = icmp ugt i64 %indvars.iv30, 1
br i1 %cmp7, label %for.body9, label %for.end16, !llvm.loop !10
for.end16: ; preds = %for.body9, %entry, %for.cond6.preheader
call void @llvm.lifetime.end.p0(i64 100002, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include<stdio.h>
int main(){
int x,y,w,h,i;
double s,w2,h2;
scanf("%d %d %d %d",&w,&h,&x,&y);
w2 = (double)w;
h2 = (double)h;
if((x==w2/2)&&(y==h2/2))
i=1;
else
i=0;
printf("%.6f %d",(w2 * h2) / 2.000000,i);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%.6f %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%w = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %w, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %h, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%2 = load i32, ptr %x, align 4, !tbaa !5
%conv2 = sitofp i32 %2 to double
%div = fmul double %conv, 5.000000e-01
%cmp = fcmp oeq double %div, %conv2
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%3 = load i32, ptr %y, align 4, !tbaa !5
%conv4 = sitofp i32 %3 to double
%div5 = fmul double %conv1, 5.000000e-01
%cmp6 = fcmp oeq double %div5, %conv4
br i1 %cmp6, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%i.0 = phi i32 [ 0, %if.else ], [ 1, %land.lhs.true ]
%mul = fmul double %conv, %conv1
%div8 = fmul double %mul, 5.000000e-01
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div8, i32 noundef %i.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
int W,H,x,y;
scanf("%d %d %d %d", &W, &H, &x, &y);
printf("%lf %d\n", (double)W*H/2, (2*x==W && 2*y==H)? 1:0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%lf %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%W = alloca i32, align 4
%H = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W, ptr noundef nonnull %H, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %W, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %H, align 4
%conv1 = sitofp i32 %1 to double
%mul = fmul double %conv, %conv1
%div = fmul double %mul, 5.000000e-01
%2 = load i32, ptr %x, align 4, !tbaa !5
%mul2 = shl nsw i32 %2, 1
%cmp = icmp eq i32 %mul2, %0
%3 = load i32, ptr %y, align 4
%mul4 = shl nsw i32 %3, 1
%cmp5 = icmp eq i32 %mul4, %1
%4 = select i1 %cmp, i1 %cmp5, i1 false
%cond = zext i1 %4 to i32
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div, i32 noundef %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,d,i,j;
char a[102][102];
scanf("%d%d",&n,&d);
for(i=0;i<d;i++)
{
scanf("%s",a[i]);
}
int cnt=0,f=1,max=-9999,cnt1=0;
for(i=0;i<d;i++)
{
cnt1=0;
for(j=0;j<n;j++)
{
if(a[i][j]=='0')
{
f=0;
cnt++;
if(max<cnt)
max=cnt;
break;
}
else
{
cnt1++;
}
if(cnt1==n)
{
cnt=0;
}
}
}
if(f==1)
printf("0\n");
else
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10557/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10557/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = alloca i32, align 4
%a = alloca [102 x [102 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 10404, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %if.then32
for.cond2.preheader: ; preds = %for.body
%cmp357 = icmp sgt i32 %4, 0
br i1 %cmp357, label %for.cond5.preheader.lr.ph, label %if.then32
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp652 = icmp sgt i32 %1, 0
br i1 %cmp652, label %for.cond5.preheader.us.preheader, label %if.then32
for.cond5.preheader.us.preheader: ; preds = %for.cond5.preheader.lr.ph
%wide.trip.count79 = zext i32 %4 to i64
%wide.trip.count = zext i32 %1 to i64
br label %for.cond5.preheader.us.outer
for.cond5.preheader.us.outer: ; preds = %for.inc27.us.thread, %for.cond5.preheader.us.preheader
%indvars.iv75.ph = phi i64 [ %indvars.iv.next7688, %for.inc27.us.thread ], [ 0, %for.cond5.preheader.us.preheader ]
%max.062.us.ph = phi i32 [ %spec.select.us, %for.inc27.us.thread ], [ -9999, %for.cond5.preheader.us.preheader ]
%2 = phi i1 [ false, %for.inc27.us.thread ], [ true, %for.cond5.preheader.us.preheader ]
%cnt.060.us.ph = phi i32 [ %inc14.us, %for.inc27.us.thread ], [ 0, %for.cond5.preheader.us.preheader ]
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.outer, %for.inc27.us
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc27.us ], [ %indvars.iv75.ph, %for.cond5.preheader.us.outer ]
%cnt.060.us = phi i32 [ %spec.select48.us, %for.inc27.us ], [ %cnt.060.us.ph, %for.cond5.preheader.us.outer ]
br label %for.body7.us
for.body7.us: ; preds = %for.cond5.preheader.us, %if.else.us
%indvars.iv70 = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next71, %if.else.us ]
%cnt.154.us = phi i32 [ %cnt.060.us, %for.cond5.preheader.us ], [ %spec.select48.us, %if.else.us ]
%arrayidx11.us = getelementptr inbounds [102 x [102 x i8]], ptr %a, i64 0, i64 %indvars.iv75, i64 %indvars.iv70
%3 = load i8, ptr %arrayidx11.us, align 1, !tbaa !9
%cmp12.us = icmp eq i8 %3, 48
br i1 %cmp12.us, label %for.inc27.us.thread, label %if.else.us
if.else.us: ; preds = %for.body7.us
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%indvars = trunc i64 %indvars.iv.next71 to i32
%cmp20.us = icmp eq i32 %1, %indvars
%spec.select48.us = select i1 %cmp20.us, i32 0, i32 %cnt.154.us
%exitcond.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body7.us, !llvm.loop !10
for.inc27.us: ; preds = %if.else.us
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond80.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count79
br i1 %exitcond80.not, label %for.end29, label %for.cond5.preheader.us, !llvm.loop !12
for.inc27.us.thread: ; preds = %for.body7.us
%inc14.us = add nsw i32 %cnt.154.us, 1
%cmp15.not.us = icmp sgt i32 %max.062.us.ph, %cnt.154.us
%spec.select.us = select i1 %cmp15.not.us, i32 %max.062.us.ph, i32 %inc14.us
%indvars.iv.next7688 = add nuw nsw i64 %indvars.iv75, 1
%exitcond80.not89 = icmp eq i64 %indvars.iv.next7688, %wide.trip.count79
br i1 %exitcond80.not89, label %if.else34, label %for.cond5.preheader.us.outer, !llvm.loop !12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [102 x [102 x i8]], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %d, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.end29: ; preds = %for.inc27.us
br i1 %2, label %if.then32, label %if.else34
if.then32: ; preds = %entry, %for.cond5.preheader.lr.ph, %for.cond2.preheader, %for.end29
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end36
if.else34: ; preds = %for.inc27.us.thread, %for.end29
%max.1.us9195 = phi i32 [ %max.062.us.ph, %for.end29 ], [ %spec.select.us, %for.inc27.us.thread ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %max.1.us9195)
br label %if.end36
if.end36: ; preds = %if.else34, %if.then32
call void @llvm.lifetime.end.p0(i64 10404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
int main() {
int n;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int count=1;
for(i=0;i<n;i++)
{
if(count==a[i])
{
count++;
}
}
count=count-1;
if(count==0)
{
printf("-1");
}
else
printf("%d",(n-count));
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105612/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105612/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"-1\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
%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 %if.then13
for.cond2.preheader: ; preds = %for.body
%cmp329 = icmp sgt i32 %5, 0
br i1 %cmp329, label %for.body4.preheader, label %if.then13
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %5, 4
br i1 %4, label %for.end11.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv35 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next36.3, %for.body4 ]
%count.031 = phi i32 [ 1, %for.body4.preheader.new ], [ %spec.select.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv35
%7 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%cmp7 = icmp eq i32 %count.031, %7
%inc8 = zext i1 %cmp7 to i32
%spec.select = add nuw nsw i32 %count.031, %inc8
%indvars.iv.next36 = or i64 %indvars.iv35, 1
%arrayidx6.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next36
%8 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%cmp7.1 = icmp eq i32 %spec.select, %8
%inc8.1 = zext i1 %cmp7.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc8.1
%indvars.iv.next36.1 = or i64 %indvars.iv35, 2
%arrayidx6.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next36.1
%9 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%cmp7.2 = icmp eq i32 %spec.select.1, %9
%inc8.2 = zext i1 %cmp7.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc8.2
%indvars.iv.next36.2 = or i64 %indvars.iv35, 3
%arrayidx6.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next36.2
%10 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%cmp7.3 = icmp eq i32 %spec.select.2, %10
%inc8.3 = zext i1 %cmp7.3 to i32
%spec.select.3 = add nuw nsw i32 %spec.select.2, %inc8.3
%indvars.iv.next36.3 = add nuw nsw i64 %indvars.iv35, 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.end11.unr-lcssa, label %for.body4, !llvm.loop !11
for.end11.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %spec.select.3, %for.body4 ]
%indvars.iv35.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next36.3, %for.body4 ]
%count.031.unr = phi i32 [ 1, %for.body4.preheader ], [ %spec.select.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end11, label %for.body4.epil
for.body4.epil: ; preds = %for.end11.unr-lcssa, %for.body4.epil
%indvars.iv35.epil = phi i64 [ %indvars.iv.next36.epil, %for.body4.epil ], [ %indvars.iv35.unr, %for.end11.unr-lcssa ]
%count.031.epil = phi i32 [ %spec.select.epil, %for.body4.epil ], [ %count.031.unr, %for.end11.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end11.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv35.epil
%11 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%cmp7.epil = icmp eq i32 %count.031.epil, %11
%inc8.epil = zext i1 %cmp7.epil to i32
%spec.select.epil = add nuw nsw i32 %count.031.epil, %inc8.epil
%indvars.iv.next36.epil = add nuw nsw i64 %indvars.iv35.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end11, label %for.body4.epil, !llvm.loop !12
for.end11: ; preds = %for.body4.epil, %for.end11.unr-lcssa
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.end11.unr-lcssa ], [ %spec.select.epil, %for.body4.epil ]
%12 = add nsw i32 %spec.select.lcssa, -1
%cmp12 = icmp eq i32 %12, 0
br i1 %cmp12, label %if.then13, label %if.else
if.then13: ; preds = %entry, %for.cond2.preheader, %for.end11
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end17
if.else: ; preds = %for.end11
%sub15 = sub nsw i32 %5, %12
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub15)
br label %if.end17
if.end17: ; preds = %if.else, %if.then13
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int num, kowasu = 0, now = 1;
int brick[200000] = {0};
scanf("%d", &num);
for (int i = 0; i < num; i++) {
scanf("%d", &brick[i]);
}
for (int i = 0; i < num; i++) {
if (now != brick[i]) {
kowasu++;
}
else {
now++;
}
}
if (kowasu == num) {
printf("-1\n");
}
else {
printf("%d\n", kowasu);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105663/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%brick = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %brick) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %brick, i8 0, i64 800000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp430 = icmp sgt i32 %2, 0
br i1 %cmp430, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr %brick, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%kowasu.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %kowasu.1.1, %for.body6 ]
%indvars.iv37.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next38.1, %for.body6 ]
%now.032.unr = phi i32 [ 1, %for.body6.preheader ], [ %now.1.1, %for.body6 ]
%kowasu.031.unr = phi i32 [ 0, %for.body6.preheader ], [ %kowasu.1.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [200000 x i32], ptr %brick, i64 0, i64 %indvars.iv37.unr
%4 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.not.epil = icmp ne i32 %now.032.unr, %4
%inc10.epil = zext i1 %cmp9.not.epil to i32
%kowasu.1.epil = add nuw nsw i32 %kowasu.031.unr, %inc10.epil
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %for.body6.epil, %for.cond.cleanup5.loopexit.unr-lcssa, %entry, %for.cond3.preheader
%.lcssa42 = phi i32 [ %2, %for.cond3.preheader ], [ %0, %entry ], [ %2, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %2, %for.body6.epil ]
%kowasu.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %kowasu.1.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %kowasu.1.epil, %for.body6.epil ]
%cmp15 = icmp eq i32 %kowasu.0.lcssa, %.lcssa42
br i1 %cmp15, label %if.then16, label %if.else18
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv37 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next38.1, %for.body6 ]
%now.032 = phi i32 [ 1, %for.body6.preheader.new ], [ %now.1.1, %for.body6 ]
%kowasu.031 = phi i32 [ 0, %for.body6.preheader.new ], [ %kowasu.1.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [200000 x i32], ptr %brick, i64 0, i64 %indvars.iv37
%5 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9.not = icmp ne i32 %now.032, %5
%inc10 = zext i1 %cmp9.not to i32
%kowasu.1 = add nuw nsw i32 %kowasu.031, %inc10
%not.cmp9.not = xor i1 %cmp9.not, true
%inc11 = zext i1 %not.cmp9.not to i32
%now.1 = add nuw nsw i32 %now.032, %inc11
%indvars.iv.next38 = or i64 %indvars.iv37, 1
%arrayidx8.1 = getelementptr inbounds [200000 x i32], ptr %brick, i64 0, i64 %indvars.iv.next38
%6 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.not.1 = icmp ne i32 %now.1, %6
%inc10.1 = zext i1 %cmp9.not.1 to i32
%kowasu.1.1 = add nuw nsw i32 %kowasu.1, %inc10.1
%not.cmp9.not.1 = xor i1 %cmp9.not.1, true
%inc11.1 = zext i1 %not.cmp9.not.1 to i32
%now.1.1 = add nuw nsw i32 %now.1, %inc11.1
%indvars.iv.next38.1 = add nuw nsw i64 %indvars.iv37, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11
if.then16: ; preds = %for.cond.cleanup5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end20
if.else18: ; preds = %for.cond.cleanup5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %kowasu.0.lcssa)
br label %if.end20
if.end20: ; preds = %if.else18, %if.then16
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %brick) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int N,s = 1,ans = 0,t;
int i;
int a[200000];
scanf("%d",&N);
for(i = 0;i < N;i++){
scanf("%d",&t);
a[i] = t;
}
i = 0;
while(i < N){
if(a[i] == s){
ans++;
s++;
}
i++;
}
if(ans == 0){
printf("-1\n");
}
else{
ans = N - ans;
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\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
%a = alloca [200000 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 %t) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %if.then10
while.cond.preheader: ; preds = %for.body
%cmp225 = icmp sgt i32 %3, 0
br i1 %cmp225, label %while.body.preheader, label %if.then10
while.body.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %3, 4
br i1 %1, label %while.end.unr-lcssa, label %while.body.preheader.new
while.body.preheader.new: ; preds = %while.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%2 = load i32, ptr %t, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
%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 %while.cond.preheader, !llvm.loop !9
while.body: ; preds = %while.body, %while.body.preheader.new
%indvars.iv32 = phi i64 [ 0, %while.body.preheader.new ], [ %indvars.iv.next33.3, %while.body ]
%ans.027 = phi i32 [ 0, %while.body.preheader.new ], [ %ans.1.3, %while.body ]
%s.026 = phi i32 [ 1, %while.body.preheader.new ], [ %s.1.3, %while.body ]
%niter = phi i64 [ 0, %while.body.preheader.new ], [ %niter.next.3, %while.body ]
%arrayidx4 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv32
%5 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%cmp5 = icmp eq i32 %5, %s.026
%inc7 = zext i1 %cmp5 to i32
%s.1 = add nuw nsw i32 %s.026, %inc7
%ans.1 = add nuw nsw i32 %ans.027, %inc7
%indvars.iv.next33 = or i64 %indvars.iv32, 1
%arrayidx4.1 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next33
%6 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %6, %s.1
%inc7.1 = zext i1 %cmp5.1 to i32
%s.1.1 = add nuw nsw i32 %s.1, %inc7.1
%ans.1.1 = add nuw nsw i32 %ans.1, %inc7.1
%indvars.iv.next33.1 = or i64 %indvars.iv32, 2
%arrayidx4.2 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next33.1
%7 = load i32, ptr %arrayidx4.2, align 8, !tbaa !5
%cmp5.2 = icmp eq i32 %7, %s.1.1
%inc7.2 = zext i1 %cmp5.2 to i32
%s.1.2 = add nuw nsw i32 %s.1.1, %inc7.2
%ans.1.2 = add nuw nsw i32 %ans.1.1, %inc7.2
%indvars.iv.next33.2 = or i64 %indvars.iv32, 3
%arrayidx4.3 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next33.2
%8 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %8, %s.1.2
%inc7.3 = zext i1 %cmp5.3 to i32
%s.1.3 = add nuw nsw i32 %s.1.2, %inc7.3
%ans.1.3 = add nuw nsw i32 %ans.1.2, %inc7.3
%indvars.iv.next33.3 = add nuw nsw i64 %indvars.iv32, 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 %while.end.unr-lcssa, label %while.body, !llvm.loop !11
while.end.unr-lcssa: ; preds = %while.body, %while.body.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %while.body.preheader ], [ %ans.1.3, %while.body ]
%indvars.iv32.unr = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next33.3, %while.body ]
%ans.027.unr = phi i32 [ 0, %while.body.preheader ], [ %ans.1.3, %while.body ]
%s.026.unr = phi i32 [ 1, %while.body.preheader ], [ %s.1.3, %while.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.unr-lcssa, %while.body.epil
%indvars.iv32.epil = phi i64 [ %indvars.iv.next33.epil, %while.body.epil ], [ %indvars.iv32.unr, %while.end.unr-lcssa ]
%ans.027.epil = phi i32 [ %ans.1.epil, %while.body.epil ], [ %ans.027.unr, %while.end.unr-lcssa ]
%s.026.epil = phi i32 [ %s.1.epil, %while.body.epil ], [ %s.026.unr, %while.end.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %while.body.epil ], [ 0, %while.end.unr-lcssa ]
%arrayidx4.epil = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv32.epil
%9 = load i32, ptr %arrayidx4.epil, align 4, !tbaa !5
%cmp5.epil = icmp eq i32 %9, %s.026.epil
%inc7.epil = zext i1 %cmp5.epil to i32
%s.1.epil = add nuw nsw i32 %s.026.epil, %inc7.epil
%ans.1.epil = add nuw nsw i32 %ans.027.epil, %inc7.epil
%indvars.iv.next33.epil = add nuw nsw i64 %indvars.iv32.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 %while.end, label %while.body.epil, !llvm.loop !12
while.end: ; preds = %while.body.epil, %while.end.unr-lcssa
%ans.1.lcssa = phi i32 [ %ans.1.lcssa.ph, %while.end.unr-lcssa ], [ %ans.1.epil, %while.body.epil ]
%cmp9 = icmp eq i32 %ans.1.lcssa, 0
br i1 %cmp9, label %if.then10, label %if.else
if.then10: ; preds = %entry, %while.cond.preheader, %while.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end13
if.else: ; preds = %while.end
%sub = sub nsw i32 %3, %ans.1.lcssa
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end13
if.end13: ; preds = %if.else, %if.then10
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(void) {
// your code goes here
int n;
scanf("%d",&n);
int a;
int i;
int notBreak = 1;
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==notBreak){
notBreak++;
}
}
if(notBreak == 1)
printf("-1\n");
else
printf("%d\n",n-notBreak+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105757/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body, label %if.then5
for.body: ; preds = %entry, %for.body
%notBreak.015 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%i.014 = phi i32 [ %inc3, %for.body ], [ 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
%cmp2 = icmp eq i32 %1, %notBreak.015
%inc = zext i1 %cmp2 to i32
%spec.select = add nuw nsw i32 %notBreak.015, %inc
%inc3 = add nuw nsw i32 %i.014, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp4 = icmp eq i32 %spec.select, 1
br i1 %cmp4, label %if.then5, label %if.else
if.then5: ; preds = %entry, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end8
if.else: ; preds = %for.end
%reass.sub = sub i32 %2, %spec.select
%add = add i32 %reass.sub, 1
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end8
if.end8: ; preds = %if.else, %if.then5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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"}
|
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define BIG 2000000007
#define VERYBIG 200000000000007LL
#define MOD 1000000007
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 300000
#define M_MAX 200000
#ifdef __cplusplus
#include <queue>
#include <stack>
// #include <tuple>
#include <set>
// using namespace std; // HELL
using std::queue;
using std::priority_queue;
using std::stack;
// using std::tuple;
using std::set;
using std::vector;
using std::greater;
using std::pair;
typedef priority_queue<ull, vector<ull>, greater<ull> > upque123;
typedef priority_queue<ull, vector<ull> > upque321;
typedef priority_queue<sll, vector<sll>, greater<sll> > spque123;
typedef priority_queue<sll, vector<sll> > spque321;
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
hwll a;
hwll b;
} linell;
typedef struct {
ull s;
ull t;
int32_t c;
} struct_a;
typedef struct {
int32_t from;
int32_t to;
sll cost;
} struct_b;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull q;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
size_t slen;
size_t tlen;
char ch, dh;
void swap_adj (ull *a, ull *b) {
if (*a != *b) {
ull tmp = *b;
*b = *a;
*a = tmp;
}
return;
}
int32_t digits (ull x) {
int32_t i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
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 ullabs (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sllabs (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll nibutanlobo (bool (*func)(sll arg), sll ok, sll ng) {
while (sllabs(ok, ng) > 1) {
sll med = (ok + ng) / 2;
if (func(med)) {
ok = med;
} else {
ng = med;
}
// printf("debug: [%lld %lld)\n", ok, ng);
}
if (!func(ok)) return ok * 2 - ng;
return ok;
}
void printUquotient (ull left, ull right) {
const int32_t digits = 20;
printf("%llu.", left / right);
left %= right;
for (int32_t i = 0; i < digits; i++) {
left *= 10;
printf("%1d", left / right);
left %= right;
}
puts("");
return;
}
void printSquotient (sll left, sll right) {
if (left * right < 0) putchar('-');
printUquotient(sllabs(left, 0), sllabs(right, 0));
return;
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#ifdef __cplusplus
typedef struct {
int32_t to;
sll cost;
} edge;
typedef pair<sll, int32_t> P;
std::vector<edge> g[N_MAX];
void dijk_init (ull n, struct_b arr[]) {
edge x;
for (int32_t i = 0; i < n; i++) {
x.to = arr[i].to;
x.cost = arr[i].cost;
g[arr[i].from].push_back(x);
}
}
bool dijkstra (int s, sll distance[]) {
priority_queue<P, std::vector<P>, greater<P> > que; // (最短距離, 頂点番号)
que.push(P(distance[s], s));
bool ischanged = false;
while (!que.empty()) {
P p = que.top();
que.pop();
sll v = p.second;
if (distance[v] < p.first) continue;
int32_t maxsize = g[v].size();
for (int32_t i = 0; i < maxsize; i++) {
edge e = g[v][i];
if (distance[e.to] > distance[v] + e.cost) {
distance[e.to] = distance[v] + e.cost;
ischanged = true;
que.push(P(distance[e.to], e.to));
}
}
}
return ischanged;
}
#endif
sll dist[N_MAX];
struct_b path[M_MAX * 2];
// ull a[N_MAX];
// ull a[M_MAX];
// sll a[N_MAX];
// ull a[N_MAX][N_MAX];
// ull a[M_MAX][M_MAX];
// sll a[N_MAX][N_MAX];
// ull b[N_MAX];
// ull b[M_MAX];
// sll b[N_MAX];
// ull c[N_MAX];
// sll c[M_MAX];
// char c[N_MAX];
char s[N_MAX + 1];
// char s[N_MAX + 1][N_MAX + 1];
// char s[N_MAX + 1][M_MAX + 1];
char t[N_MAX + 1];
// ull alphabets[26];
// ull blphabets[26];
// char alphabets[26];
// ull dp[N_MAX + 1];
// sll dp[N_MAX + 1];
// ull dp[N_MAX + 1][N_MAX + 1];
// sll dp[N_MAX + 1][N_MAX + 1];
// bool dp[N_MAX + 1];
// bool dp[N_MAX + 1][N_MAX + 1];
hwll arr[N_MAX];
// hwll arr[M_MAX];
// hwll brr[M_MAX];
ull dp[N_MAX + 1][26];
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 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;
}
ull mergeteq (sll array[], ull n) {
if (n == 1) return 0;
ull left = n / 2;
ull right = n - left;
ull result = mergeteq(array, left) + mergeteq(array + left, right);
sll tmparr[n];
sll i = 0, j = 0;
while (i < left || j < right) {
if (i == left) {
tmparr[i + j] = array[left + j];
j++;
continue;
}
if (j == right) {
tmparr[i + j] = array[i];
i++;
continue;
}
if (array[i] > array[left + j]) {
result += (left - i);
tmparr[i + j] = array[left + j];
j++;
} else {
tmparr[i + j] = array[i];
i++;
}
}
for (i = 0; i < n; i++) {
array[i] = tmparr[i];
}
return result;
}
ull solve () {
sll i, j, ki;
// ull result = 0;
sll result = 0;
// double result = 0;
ull maybe = 0;
// sll maybe = 0;
ull sum = 0;
// sll sum = 0;
ull item;
ull *dpcell;
slen = strlen(s);
for (i = 0; i < 26; i++) dp[slen][i] = 0;
for (i = slen - 1; i >= 0; i--) {
for (j = 0; j < 26; j++) {
if (s[i] != 'a' + j) {
dp[i][j] = dp[i + 1][j];
continue;
}
ull mincompleted = BIG;
for (ki = 0; ki < 26; ki++) {
mincompleted = umin(mincompleted, dp[i + 1][ki]);
}
dp[i][j] = mincompleted + 1;
}
}
result = BIG;
for (i = 0; i < 26; i++) {
result = umin(result, dp[0][i]);
}
result++;
j = 0;
for (i = 0; i < result; i++) {
for (ki = 0; ki < 26; ki++) {
// printf("[%llu][%llu]: %llu\n", j, ki, dp[j][ki]);
if (dp[j][ki] < result - i) break;
}
t[i] = ki + 'a';
// printf("%lld: %llu\n", i, ki);
if (i == result - 1) break;
while (s[j] != t[i]) j++;
j++;
// printf("%lld: %llu\n", i, j);
}
puts(t);
// printf("%llu\n", result);
// printf("%.12lf\n", (double)result);
// puts(s);
return 0;
success:
// puts("YES");
// puts("Yes");
printf("%llu\n", result);
// puts("0");
// puts("CONTINUE");
return 0;
fail:
// puts("NO");
// puts("No");
// puts("0");
// puts("-1");
// puts("-1 -1 -1");
puts("Impossible");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%lf%lf", &vda, &vdb);
// scanf("%lld%lld%lld%lld", &vsa, &vsb, &vsc, &vsd);
// scanf("%llu%llu", &vua, &vub, &vuc, &vud);
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &n, &m);
// scanf("%*llu");
// scanf("%llu", &k, &m, &n);
// scanf("%llu%llu", &vua, &vub, &vuc, &vud, &vue, &vuf);
// scanf("%lld%lld", &vsa, &vsb, &vsc);
scanf("%s", s);
// scanf("%s", t);
// scanf("%llu", &m);
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// scanf("%llu", &a[i]);
// // a[i]--;
// }
// for (i = 0; i < m; i++) {
// scanf("%llu", &b[i]);
// }
// for (i = 0; i < h; i++) {
// scanf("%llu", &a[i]);
// }
// for (i = 0; i < h; i++) {
// for (j = 0; j < w; j++) {
// scanf("%llu", &a[i][j]);
// }
// }
// for (i = 0; i < w; i++) {
// scanf("%llu", &b[i]);
// }
// for (i = 0; i < m; i++) {
// scanf("%llu", &b[i]);
// }
// for (i = 0; i < n; i++) {
// scanf("%s", s[i]);
// }
// scanf("%s", t);
// for (i = 0; i < n - 1; i++) {
// // scanf("%llu", &a[i]);
// // scanf("%llu", &b[i]);
// scanf("%llu", &arr[i].a);
// scanf("%llu", &arr[i].b);
// // scanf("%llu", &c[i]);
// arr[i].a--;
// arr[i].b--;
// // a[i]--;
// // b[i]--;
// }
// for (i = 0; i < k; i++) {
// scanf("%llu", &c[i]);
// c[i]--;
// }
// for (i = 0; i < m; i++) {
// scanf("%llu%llu", &arr[i].a, &arr[i].b);
// arr[i].a--;
// arr[i].b--;
// }
// for (i = 0; i < k; i++) {
// scanf("%llu%llu", &brr[i].a, &brr[i].b);
// brr[i].a--;
// brr[i].b--;
// }
// for (i = 0; i < m; i++) {
// for (j = 0; j < m; j++) {
// scanf("%llu", &a[i][j]);
// }
// }
// for (i = 0; i < n; i++) {
// scanf("%llu%llu%llu", &a[i], &b[i], &c[i]);
// }
// scanf("%llu", &q);
// scanf("%llu", &k);
// k--;
// for (i = 0; i < q; i++) {
// scanf("%llu%llu%llu", &c[i], &a[i], &b[i]);
// // a[i]--;
// // b[i]--;
// // solve();
// }
// for (i = 0; i < m; i++) {
// scanf("%llu%llu", &arr[i].a, &arr[i].b);
// arr[i].a--;
// arr[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < m; j++) {
// scanf("%llu", &a[i][j]);
// a[i][j]--;
// }
// }
solve();
// for (i = 0; i < m; i++) {
// scanf("%llu%llu%llu", &vua, &vub, &vuc);
// // scanf("%s%s", s, t);
// // scanf("%f%f%f", &vda, &vdb, &vdc);
// // scanf("%s", s);
// solve();
// }
// while (scanf("%llu%llu", &n, &k), n + k) {
// for (i = 0; i < n; i++) {
// scanf("%llu", &a[i]);
// }
// solve();
// }
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105807/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105807/source.c"
target datalayout = "e-m:e-p270: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.hw = type { i32, i32 }
%struct.struct_b = type { i32, i32, i64 }
%struct.hwll = type { i64, i64 }
@vector8 = dso_local local_unnamed_addr constant [8 x %struct.hw] [%struct.hw { i32 -1, i32 -1 }, %struct.hw { i32 -1, i32 0 }, %struct.hw { i32 -1, i32 1 }, %struct.hw { i32 0, i32 -1 }, %struct.hw { i32 0, i32 1 }, %struct.hw { i32 1, i32 -1 }, %struct.hw { i32 1, i32 0 }, %struct.hw { i32 1, i32 1 }], align 16
@.str = private unnamed_addr constant [6 x i8] c"%llu.\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%1d\00", align 1
@s = dso_local global [300001 x i8] zeroinitializer, align 16
@slen = dso_local local_unnamed_addr global i64 0, align 8
@dp = dso_local local_unnamed_addr global [300001 x [26 x i64]] zeroinitializer, align 16
@t = dso_local global [300001 x i8] zeroinitializer, align 16
@.str.5 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@n = dso_local local_unnamed_addr global i64 0, align 8
@m = dso_local local_unnamed_addr global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@vua = dso_local local_unnamed_addr global i64 0, align 8
@vub = dso_local local_unnamed_addr global i64 0, align 8
@vuc = dso_local local_unnamed_addr global i64 0, align 8
@vud = dso_local local_unnamed_addr global i64 0, align 8
@vue = dso_local local_unnamed_addr global i64 0, align 8
@vuf = dso_local local_unnamed_addr global i64 0, align 8
@vsa = dso_local local_unnamed_addr global i64 0, align 8
@vsb = dso_local local_unnamed_addr global i64 0, align 8
@vsc = dso_local local_unnamed_addr global i64 0, align 8
@vsd = dso_local local_unnamed_addr global i64 0, align 8
@vse = dso_local local_unnamed_addr global i64 0, align 8
@vsf = 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
@tlen = dso_local local_unnamed_addr global i64 0, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@dist = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@path = dso_local local_unnamed_addr global [400000 x %struct.struct_b] zeroinitializer, align 16
@arr = dso_local local_unnamed_addr global [300000 x %struct.hwll] zeroinitializer, align 16
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_adj(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp.not = icmp eq i64 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
store i64 %0, ptr %b, align 8, !tbaa !5
store i64 %1, ptr %a, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digits(i64 noundef %x) local_unnamed_addr #1 {
entry:
%cmp3 = icmp ugt i64 %x, 9
br i1 %cmp3, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.05 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%x.addr.04 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%div = udiv i64 %x.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%cmp = icmp ugt i64 %x.addr.04, 99
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %while.body ]
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
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 #2 {
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 #2 {
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 #2 {
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 !11
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 !11
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 @ullabs(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
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 @sllabs(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
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: nounwind uwtable
define dso_local i64 @nibutanlobo(ptr nocapture noundef readonly %func, i64 noundef %ok, i64 noundef %ng) local_unnamed_addr #4 {
entry:
%sub.i14 = sub nsw i64 %ok, %ng
%retval.0.i15 = tail call i64 @llvm.abs.i64(i64 %sub.i14, i1 true)
%cmp16 = icmp ugt i64 %retval.0.i15, 1
br i1 %cmp16, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%ng.addr.018 = phi i64 [ %ng.addr.0.div, %while.body ], [ %ng, %entry ]
%ok.addr.017 = phi i64 [ %div.ok.addr.0, %while.body ], [ %ok, %entry ]
%add = add nsw i64 %ng.addr.018, %ok.addr.017
%div = sdiv i64 %add, 2
%call1 = tail call zeroext i1 %func(i64 noundef %div) #16
%div.ok.addr.0 = select i1 %call1, i64 %div, i64 %ok.addr.017
%ng.addr.0.div = select i1 %call1, i64 %ng.addr.018, i64 %div
%sub.i = sub nsw i64 %div.ok.addr.0, %ng.addr.0.div
%retval.0.i = tail call i64 @llvm.abs.i64(i64 %sub.i, i1 true)
%cmp = icmp ugt i64 %retval.0.i, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%ok.addr.0.lcssa = phi i64 [ %ok, %entry ], [ %div.ok.addr.0, %while.body ]
%ng.addr.0.lcssa = phi i64 [ %ng, %entry ], [ %ng.addr.0.div, %while.body ]
%call2 = tail call zeroext i1 %func(i64 noundef %ok.addr.0.lcssa) #16
%mul = shl nsw i64 %ok.addr.0.lcssa, 1
%sub = sub nsw i64 %mul, %ng.addr.0.lcssa
%retval.0 = select i1 %call2, i64 %ok.addr.0.lcssa, i64 %sub
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printUquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #5 {
entry:
%div = udiv i64 %left, %right
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %div)
%left.addr.0 = urem i64 %left, %right
%mul = mul i64 %left.addr.0, 10
%div1 = udiv i64 %mul, %right
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1)
%left.addr.0.1 = urem i64 %mul, %right
%mul.1 = mul i64 %left.addr.0.1, 10
%div1.1 = udiv i64 %mul.1, %right
%call2.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.1)
%left.addr.0.2 = urem i64 %mul.1, %right
%mul.2 = mul i64 %left.addr.0.2, 10
%div1.2 = udiv i64 %mul.2, %right
%call2.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.2)
%left.addr.0.3 = urem i64 %mul.2, %right
%mul.3 = mul i64 %left.addr.0.3, 10
%div1.3 = udiv i64 %mul.3, %right
%call2.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.3)
%left.addr.0.4 = urem i64 %mul.3, %right
%mul.4 = mul i64 %left.addr.0.4, 10
%div1.4 = udiv i64 %mul.4, %right
%call2.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.4)
%left.addr.0.5 = urem i64 %mul.4, %right
%mul.5 = mul i64 %left.addr.0.5, 10
%div1.5 = udiv i64 %mul.5, %right
%call2.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.5)
%left.addr.0.6 = urem i64 %mul.5, %right
%mul.6 = mul i64 %left.addr.0.6, 10
%div1.6 = udiv i64 %mul.6, %right
%call2.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.6)
%left.addr.0.7 = urem i64 %mul.6, %right
%mul.7 = mul i64 %left.addr.0.7, 10
%div1.7 = udiv i64 %mul.7, %right
%call2.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.7)
%left.addr.0.8 = urem i64 %mul.7, %right
%mul.8 = mul i64 %left.addr.0.8, 10
%div1.8 = udiv i64 %mul.8, %right
%call2.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.8)
%left.addr.0.9 = urem i64 %mul.8, %right
%mul.9 = mul i64 %left.addr.0.9, 10
%div1.9 = udiv i64 %mul.9, %right
%call2.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.9)
%left.addr.0.10 = urem i64 %mul.9, %right
%mul.10 = mul i64 %left.addr.0.10, 10
%div1.10 = udiv i64 %mul.10, %right
%call2.10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.10)
%left.addr.0.11 = urem i64 %mul.10, %right
%mul.11 = mul i64 %left.addr.0.11, 10
%div1.11 = udiv i64 %mul.11, %right
%call2.11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.11)
%left.addr.0.12 = urem i64 %mul.11, %right
%mul.12 = mul i64 %left.addr.0.12, 10
%div1.12 = udiv i64 %mul.12, %right
%call2.12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.12)
%left.addr.0.13 = urem i64 %mul.12, %right
%mul.13 = mul i64 %left.addr.0.13, 10
%div1.13 = udiv i64 %mul.13, %right
%call2.13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.13)
%left.addr.0.14 = urem i64 %mul.13, %right
%mul.14 = mul i64 %left.addr.0.14, 10
%div1.14 = udiv i64 %mul.14, %right
%call2.14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.14)
%left.addr.0.15 = urem i64 %mul.14, %right
%mul.15 = mul i64 %left.addr.0.15, 10
%div1.15 = udiv i64 %mul.15, %right
%call2.15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.15)
%left.addr.0.16 = urem i64 %mul.15, %right
%mul.16 = mul i64 %left.addr.0.16, 10
%div1.16 = udiv i64 %mul.16, %right
%call2.16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.16)
%left.addr.0.17 = urem i64 %mul.16, %right
%mul.17 = mul i64 %left.addr.0.17, 10
%div1.17 = udiv i64 %mul.17, %right
%call2.17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.17)
%left.addr.0.18 = urem i64 %mul.17, %right
%mul.18 = mul i64 %left.addr.0.18, 10
%div1.18 = udiv i64 %mul.18, %right
%call2.18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.18)
%left.addr.0.19 = urem i64 %mul.18, %right
%mul.19 = mul i64 %left.addr.0.19, 10
%div1.19 = udiv i64 %mul.19, %right
%call2.19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.19)
%0 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %0)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind uwtable
define dso_local void @printSquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #5 {
entry:
%mul = mul nsw i64 %right, %left
%cmp = icmp slt i64 %mul, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i = tail call noundef i32 @putc(i32 noundef 45, ptr noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%retval.0.i = tail call i64 @llvm.abs.i64(i64 %left, i1 true)
%retval.0.i5 = tail call i64 @llvm.abs.i64(i64 %right, i1 true)
tail call void @printUquotient(i64 noundef %retval.0.i, i64 noundef %retval.0.i5)
ret void
}
; 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 !15
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 nounwind willreturn memory(write) uwtable
define dso_local double @distance(i64 noundef %x1, i64 noundef %y1, i64 noundef %x2, i64 noundef %y2) local_unnamed_addr #7 {
entry:
%sub = sub nsw i64 %x1, %x2
%mul = mul nsw i64 %sub, %sub
%conv = sitofp i64 %mul to double
%sub2 = sub nsw i64 %y1, %y2
%mul4 = mul nsw i64 %sub2, %sub2
%conv5 = sitofp i64 %mul4 to double
%add = fadd double %conv, %conv5
%call = tail call double @sqrt(double noundef %add) #16
ret double %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #8
; 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 #9 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !5
%1 = load i64, ptr %right, align 8, !tbaa !5
%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 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #9 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !16
%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
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !16
%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
%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: nofree nosync nounwind uwtable
define dso_local i64 @mergeteq(ptr noundef %array, i64 noundef %n) local_unnamed_addr #10 {
entry:
%cmp = icmp eq i64 %n, 1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%div87 = lshr i64 %n, 1
%sub = sub i64 %n, %div87
%call = tail call i64 @mergeteq(ptr noundef %array, i64 noundef %div87)
%add.ptr = getelementptr inbounds i64, ptr %array, i64 %div87
%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
%cmp393127 = icmp ne i64 %div87, %n
%cmp2104128 = icmp ne i64 %n, 0
%1 = or i1 %cmp2104128, %cmp393127
br i1 %1, label %while.body.lr.ph.lr.ph.preheader, label %for.end
while.body.lr.ph.lr.ph.preheader: ; preds = %if.end
%cmp10187 = icmp eq i64 %sub, 0
br i1 %cmp10187, label %while.body.lr.ph.lr.ph.split.us, label %while.body.lr.ph.lr.ph.split
while.body.lr.ph.lr.ph: ; preds = %if.end33
%cmp10 = icmp eq i64 %j.1, %sub
br i1 %cmp10, label %while.body.lr.ph.lr.ph.split.us, label %while.body.lr.ph.lr.ph.split, !llvm.loop !18
while.body.lr.ph.lr.ph.split.us: ; preds = %while.body.lr.ph.lr.ph, %while.body.lr.ph.lr.ph.preheader
%cmp2104133.lcssa = phi i1 [ %cmp2104128, %while.body.lr.ph.lr.ph.preheader ], [ %cmp2104, %while.body.lr.ph.lr.ph ]
%cmp393132.lcssa = phi i1 [ %cmp393127, %while.body.lr.ph.lr.ph.preheader ], [ %cmp393, %while.body.lr.ph.lr.ph ]
%i.0.ph130.lcssa = phi i64 [ 0, %while.body.lr.ph.lr.ph.preheader ], [ %i.1, %while.body.lr.ph.lr.ph ]
%result.0.ph129.lcssa = phi i64 [ %add, %while.body.lr.ph.lr.ph.preheader ], [ %result.1, %while.body.lr.ph.lr.ph ]
%invariant.gep.le = getelementptr i64, ptr %vla, i64 %sub
%cmp4.us195 = icmp eq i64 %i.0.ph130.lcssa, %div87
br i1 %cmp4.us195, label %while.body.lr.ph.split.us, label %while.body.lr.ph.split.us109
while.body.lr.ph.us: ; preds = %while.body.lr.ph.split.us109
%cmp4.us = icmp eq i64 %inc15.us, %div87
br i1 %cmp4.us, label %while.body.lr.ph.split.us, label %while.body.lr.ph.split.us109, !llvm.loop !18
while.body.lr.ph.split.us109: ; preds = %while.body.lr.ph.lr.ph.split.us, %while.body.lr.ph.us
%i.0.ph89105.us196 = phi i64 [ %inc15.us, %while.body.lr.ph.us ], [ %i.0.ph130.lcssa, %while.body.lr.ph.lr.ph.split.us ]
%arrayidx12.us = getelementptr inbounds i64, ptr %array, i64 %i.0.ph89105.us196
%2 = load i64, ptr %arrayidx12.us, align 8, !tbaa !5
%gep.us = getelementptr i64, ptr %invariant.gep.le, i64 %i.0.ph89105.us196
store i64 %2, ptr %gep.us, align 8, !tbaa !5
%inc15.us = add nsw i64 %i.0.ph89105.us196, 1
%cmp2.us = icmp ult i64 %inc15.us, %div87
%3 = or i1 %cmp2.us, %cmp393132.lcssa
br i1 %3, label %while.body.lr.ph.us, label %for.cond.preheader, !llvm.loop !18
while.body.lr.ph.lr.ph.split: ; preds = %while.body.lr.ph.lr.ph.preheader, %while.body.lr.ph.lr.ph
%result.0.ph129191 = phi i64 [ %result.1, %while.body.lr.ph.lr.ph ], [ %add, %while.body.lr.ph.lr.ph.preheader ]
%i.0.ph130190 = phi i64 [ %i.1, %while.body.lr.ph.lr.ph ], [ 0, %while.body.lr.ph.lr.ph.preheader ]
%j.0.ph131189 = phi i64 [ %j.1, %while.body.lr.ph.lr.ph ], [ 0, %while.body.lr.ph.lr.ph.preheader ]
%cmp2104133188 = phi i1 [ %cmp2104, %while.body.lr.ph.lr.ph ], [ %cmp2104128, %while.body.lr.ph.lr.ph.preheader ]
%cmp4 = icmp eq i64 %i.0.ph130190, %div87
br i1 %cmp4, label %while.body.lr.ph.split.us, label %while.body.lr.ph.split
while.body.lr.ph.split.us: ; preds = %while.body.lr.ph.lr.ph.split, %while.body.lr.ph.us, %while.body.lr.ph.lr.ph.split.us
%result.0.ph129178 = phi i64 [ %result.0.ph129.lcssa, %while.body.lr.ph.lr.ph.split.us ], [ %result.0.ph129.lcssa, %while.body.lr.ph.us ], [ %result.0.ph129191, %while.body.lr.ph.lr.ph.split ]
%j.0.ph131149 = phi i64 [ %sub, %while.body.lr.ph.lr.ph.split.us ], [ %sub, %while.body.lr.ph.us ], [ %j.0.ph131189, %while.body.lr.ph.lr.ph.split ]
%.us-phi112 = phi i1 [ %cmp2104133.lcssa, %while.body.lr.ph.lr.ph.split.us ], [ %cmp2.us, %while.body.lr.ph.us ], [ %cmp2104133188, %while.body.lr.ph.lr.ph.split ]
%4 = getelementptr i64, ptr %vla, i64 %div87
br label %while.body.us
while.body.us: ; preds = %while.body.us, %while.body.lr.ph.split.us
%j.094.us = phi i64 [ %j.0.ph131149, %while.body.lr.ph.split.us ], [ %inc.us, %while.body.us ]
%arrayidx.us = getelementptr i64, ptr %add.ptr, i64 %j.094.us
%5 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%arrayidx8.us = getelementptr i64, ptr %4, i64 %j.094.us
store i64 %5, ptr %arrayidx8.us, align 8, !tbaa !5
%inc.us = add nsw i64 %j.094.us, 1
%cmp3.us = icmp ult i64 %inc.us, %sub
%6 = select i1 %.us-phi112, i1 true, i1 %cmp3.us
br i1 %6, label %while.body.us, label %for.cond.preheader, !llvm.loop !18
while.body.lr.ph.split: ; preds = %while.body.lr.ph.lr.ph.split
%arrayidx17 = getelementptr inbounds i64, ptr %array, i64 %i.0.ph130190
%7 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%arrayidx19 = getelementptr i64, ptr %add.ptr, i64 %j.0.ph131189
%8 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %7, %8
br i1 %cmp20, label %if.then21, label %if.else
for.cond.preheader: ; preds = %if.end33, %while.body.lr.ph.split.us109, %while.body.us
%result.0.ph.lcssa = phi i64 [ %result.0.ph129178, %while.body.us ], [ %result.0.ph129.lcssa, %while.body.lr.ph.split.us109 ], [ %result.1, %if.end33 ]
%cmp34135.not = icmp eq i64 %n, 0
br i1 %cmp34135.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%9 = shl nuw i64 %n, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %array, ptr nonnull align 16 %vla, i64 %9, i1 false), !tbaa !5
br label %for.end
if.then21: ; preds = %while.body.lr.ph.split
%sub22 = add i64 %result.0.ph129191, %div87
%add23 = sub i64 %sub22, %i.0.ph130190
%10 = getelementptr i64, ptr %vla, i64 %i.0.ph130190
%arrayidx27 = getelementptr i64, ptr %10, i64 %j.0.ph131189
store i64 %8, ptr %arrayidx27, align 8, !tbaa !5
%inc28 = add i64 %j.0.ph131189, 1
br label %if.end33
if.else: ; preds = %while.body.lr.ph.split
%11 = getelementptr i64, ptr %vla, i64 %i.0.ph130190
%arrayidx31 = getelementptr i64, ptr %11, i64 %j.0.ph131189
store i64 %7, ptr %arrayidx31, align 8, !tbaa !5
%inc32 = add nsw i64 %i.0.ph130190, 1
br label %if.end33
if.end33: ; preds = %if.else, %if.then21
%result.1 = phi i64 [ %add23, %if.then21 ], [ %result.0.ph129191, %if.else ]
%i.1 = phi i64 [ %i.0.ph130190, %if.then21 ], [ %inc32, %if.else ]
%j.1 = phi i64 [ %inc28, %if.then21 ], [ %j.0.ph131189, %if.else ]
%cmp393 = icmp ult i64 %j.1, %sub
%cmp2104 = icmp ult i64 %i.1, %div87
%12 = or i1 %cmp2104, %cmp393
br i1 %12, label %while.body.lr.ph.lr.ph, label %for.cond.preheader, !llvm.loop !18
for.end: ; preds = %if.end, %for.body.preheader, %for.cond.preheader
%result.0.ph.lcssa156 = phi i64 [ %result.0.ph.lcssa, %for.body.preheader ], [ %result.0.ph.lcssa, %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 [ %result.0.ph.lcssa156, %for.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #11
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #11
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #5 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #17
store i64 %call, ptr @slen, align 8, !tbaa !5
%0 = mul nsw i64 %call, 208
%scevgep = getelementptr i8, ptr @dp, i64 %0
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(208) %scevgep, i8 0, i64 208, i1 false), !tbaa !5
%i.1135 = add i64 %call, -1
%cmp3136 = icmp sgt i64 %i.1135, -1
br i1 %cmp3136, label %for.cond5.preheader, label %for.cond49.preheader.preheader
for.cond2.loopexit: ; preds = %for.inc30
%i.1 = add nsw i64 %i.1138, -1
%cmp3 = icmp sgt i64 %i.1138, 0
br i1 %cmp3, label %for.cond5.preheader, label %for.cond49.preheader.preheader, !llvm.loop !19
for.cond5.preheader: ; preds = %entry, %for.cond2.loopexit
%i.1138 = phi i64 [ %i.1, %for.cond2.loopexit ], [ %i.1135, %entry ]
%i.1.in137 = phi i64 [ %i.1138, %for.cond2.loopexit ], [ %call, %entry ]
%arrayidx8 = getelementptr inbounds [300001 x i8], ptr @s, i64 0, i64 %i.1138
%1 = load i8, ptr %arrayidx8, align 1, !tbaa !20
%conv = sext i8 %1 to i64
%arrayidx22 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 0
%arrayidx22.1 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 1
%arrayidx22.2 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 2
%arrayidx22.3 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 3
%arrayidx22.4 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 4
%arrayidx22.5 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 5
%arrayidx22.6 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 6
%arrayidx22.7 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 7
%arrayidx22.8 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 8
%arrayidx22.9 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 9
%arrayidx22.10 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 10
%arrayidx22.11 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 11
%arrayidx22.12 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 12
%arrayidx22.13 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 13
%arrayidx22.14 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 14
%arrayidx22.15 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 15
%arrayidx22.16 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 16
%arrayidx22.17 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 17
%arrayidx22.18 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 18
%arrayidx22.19 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 19
%arrayidx22.20 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 20
%arrayidx22.21 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 21
%arrayidx22.22 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 22
%arrayidx22.23 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 23
%arrayidx22.24 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 24
%arrayidx22.25 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 25
br label %for.body7
for.body7: ; preds = %for.cond5.preheader, %for.inc30
%j.0134 = phi i64 [ 0, %for.cond5.preheader ], [ %inc31, %for.inc30 ]
%add = add nuw nsw i64 %j.0134, 97
%cmp9.not = icmp eq i64 %add, %conv
br i1 %cmp9.not, label %for.body19.preheader, label %if.then
for.body19.preheader: ; preds = %for.body7
%2 = load i64, ptr %arrayidx22, align 16, !tbaa !5
%3 = load i64, ptr %arrayidx22.1, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.umin.i64(i64 %2, i64 %3)
%4 = load i64, ptr %arrayidx22.2, align 16, !tbaa !5
%cond.i.1 = tail call i64 @llvm.umin.i64(i64 %cond.i, i64 %4)
%5 = load i64, ptr %arrayidx22.3, align 8, !tbaa !5
%cond.i.2 = tail call i64 @llvm.umin.i64(i64 %cond.i.1, i64 %5)
%6 = load i64, ptr %arrayidx22.4, align 16, !tbaa !5
%cond.i.3 = tail call i64 @llvm.umin.i64(i64 %cond.i.2, i64 %6)
%7 = load i64, ptr %arrayidx22.5, align 8, !tbaa !5
%cond.i.4 = tail call i64 @llvm.umin.i64(i64 %cond.i.3, i64 %7)
%8 = load i64, ptr %arrayidx22.6, align 16, !tbaa !5
%cond.i.5 = tail call i64 @llvm.umin.i64(i64 %cond.i.4, i64 %8)
%9 = load i64, ptr %arrayidx22.7, align 8, !tbaa !5
%cond.i.6 = tail call i64 @llvm.umin.i64(i64 %cond.i.5, i64 %9)
%10 = load i64, ptr %arrayidx22.8, align 16, !tbaa !5
%cond.i.7 = tail call i64 @llvm.umin.i64(i64 %cond.i.6, i64 %10)
%11 = load i64, ptr %arrayidx22.9, align 8, !tbaa !5
%cond.i.8 = tail call i64 @llvm.umin.i64(i64 %cond.i.7, i64 %11)
%12 = load i64, ptr %arrayidx22.10, align 16, !tbaa !5
%cond.i.9 = tail call i64 @llvm.umin.i64(i64 %cond.i.8, i64 %12)
%13 = load i64, ptr %arrayidx22.11, align 8, !tbaa !5
%cond.i.10 = tail call i64 @llvm.umin.i64(i64 %cond.i.9, i64 %13)
%14 = load i64, ptr %arrayidx22.12, align 16, !tbaa !5
%cond.i.11 = tail call i64 @llvm.umin.i64(i64 %cond.i.10, i64 %14)
%15 = load i64, ptr %arrayidx22.13, align 8, !tbaa !5
%cond.i.12 = tail call i64 @llvm.umin.i64(i64 %cond.i.11, i64 %15)
%16 = load i64, ptr %arrayidx22.14, align 16, !tbaa !5
%cond.i.13 = tail call i64 @llvm.umin.i64(i64 %cond.i.12, i64 %16)
%17 = load i64, ptr %arrayidx22.15, align 8, !tbaa !5
%cond.i.14 = tail call i64 @llvm.umin.i64(i64 %cond.i.13, i64 %17)
%18 = load i64, ptr %arrayidx22.16, align 16, !tbaa !5
%cond.i.15 = tail call i64 @llvm.umin.i64(i64 %cond.i.14, i64 %18)
%19 = load i64, ptr %arrayidx22.17, align 8, !tbaa !5
%cond.i.16 = tail call i64 @llvm.umin.i64(i64 %cond.i.15, i64 %19)
%20 = load i64, ptr %arrayidx22.18, align 16, !tbaa !5
%cond.i.17 = tail call i64 @llvm.umin.i64(i64 %cond.i.16, i64 %20)
%21 = load i64, ptr %arrayidx22.19, align 8, !tbaa !5
%cond.i.18 = tail call i64 @llvm.umin.i64(i64 %cond.i.17, i64 %21)
%22 = load i64, ptr %arrayidx22.20, align 16, !tbaa !5
%cond.i.19 = tail call i64 @llvm.umin.i64(i64 %cond.i.18, i64 %22)
%23 = load i64, ptr %arrayidx22.21, align 8, !tbaa !5
%cond.i.20 = tail call i64 @llvm.umin.i64(i64 %cond.i.19, i64 %23)
%24 = load i64, ptr %arrayidx22.22, align 16, !tbaa !5
%cond.i.21 = tail call i64 @llvm.umin.i64(i64 %cond.i.20, i64 %24)
%25 = load i64, ptr %arrayidx22.23, align 8, !tbaa !5
%cond.i.22 = tail call i64 @llvm.umin.i64(i64 %cond.i.21, i64 %25)
%26 = load i64, ptr %arrayidx22.24, align 16, !tbaa !5
%cond.i.23 = tail call i64 @llvm.umin.i64(i64 %cond.i.22, i64 %26)
%27 = load i64, ptr %arrayidx22.25, align 8, !tbaa !5
%cond.i.24 = tail call i64 @llvm.umin.i64(i64 %cond.i.23, i64 %27)
%cond.i.25 = tail call i64 @llvm.umin.i64(i64 %cond.i.24, i64 2000000007)
%add27 = add nuw nsw i64 %cond.i.25, 1
br label %for.inc30
if.then: ; preds = %for.body7
%arrayidx13 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1.in137, i64 %j.0134
%28 = load i64, ptr %arrayidx13, align 8, !tbaa !5
br label %for.inc30
for.inc30: ; preds = %for.body19.preheader, %if.then
%add27.sink = phi i64 [ %add27, %for.body19.preheader ], [ %28, %if.then ]
%arrayidx29 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %i.1138, i64 %j.0134
store i64 %add27.sink, ptr %arrayidx29, align 8, !tbaa !5
%inc31 = add nuw nsw i64 %j.0134, 1
%exitcond.not = icmp eq i64 %inc31, 26
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !21
for.cond49.preheader.preheader: ; preds = %for.cond2.loopexit, %entry
%29 = load i64, ptr @dp, align 16, !tbaa !5
%30 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 1), align 8, !tbaa !5
%cond.i130 = tail call i64 @llvm.umin.i64(i64 %29, i64 %30)
%31 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 2), align 16, !tbaa !5
%cond.i130.1 = tail call i64 @llvm.umin.i64(i64 %cond.i130, i64 %31)
%32 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 3), align 8, !tbaa !5
%cond.i130.2 = tail call i64 @llvm.umin.i64(i64 %cond.i130.1, i64 %32)
%33 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 4), align 16, !tbaa !5
%cond.i130.3 = tail call i64 @llvm.umin.i64(i64 %cond.i130.2, i64 %33)
%34 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 5), align 8, !tbaa !5
%cond.i130.4 = tail call i64 @llvm.umin.i64(i64 %cond.i130.3, i64 %34)
%35 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 6), align 16, !tbaa !5
%cond.i130.5 = tail call i64 @llvm.umin.i64(i64 %cond.i130.4, i64 %35)
%36 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 7), align 8, !tbaa !5
%cond.i130.6 = tail call i64 @llvm.umin.i64(i64 %cond.i130.5, i64 %36)
%37 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 8), align 16, !tbaa !5
%cond.i130.7 = tail call i64 @llvm.umin.i64(i64 %cond.i130.6, i64 %37)
%38 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 9), align 8, !tbaa !5
%cond.i130.8 = tail call i64 @llvm.umin.i64(i64 %cond.i130.7, i64 %38)
%39 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 10), align 16, !tbaa !5
%cond.i130.9 = tail call i64 @llvm.umin.i64(i64 %cond.i130.8, i64 %39)
%40 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 11), align 8, !tbaa !5
%cond.i130.10 = tail call i64 @llvm.umin.i64(i64 %cond.i130.9, i64 %40)
%41 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 12), align 16, !tbaa !5
%cond.i130.11 = tail call i64 @llvm.umin.i64(i64 %cond.i130.10, i64 %41)
%42 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 13), align 8, !tbaa !5
%cond.i130.12 = tail call i64 @llvm.umin.i64(i64 %cond.i130.11, i64 %42)
%43 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 14), align 16, !tbaa !5
%cond.i130.13 = tail call i64 @llvm.umin.i64(i64 %cond.i130.12, i64 %43)
%44 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 15), align 8, !tbaa !5
%cond.i130.14 = tail call i64 @llvm.umin.i64(i64 %cond.i130.13, i64 %44)
%45 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 16), align 16, !tbaa !5
%cond.i130.15 = tail call i64 @llvm.umin.i64(i64 %cond.i130.14, i64 %45)
%46 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 17), align 8, !tbaa !5
%cond.i130.16 = tail call i64 @llvm.umin.i64(i64 %cond.i130.15, i64 %46)
%47 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 18), align 16, !tbaa !5
%cond.i130.17 = tail call i64 @llvm.umin.i64(i64 %cond.i130.16, i64 %47)
%48 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 19), align 8, !tbaa !5
%cond.i130.18 = tail call i64 @llvm.umin.i64(i64 %cond.i130.17, i64 %48)
%49 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 20), align 16, !tbaa !5
%cond.i130.19 = tail call i64 @llvm.umin.i64(i64 %cond.i130.18, i64 %49)
%50 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 21), align 8, !tbaa !5
%cond.i130.20 = tail call i64 @llvm.umin.i64(i64 %cond.i130.19, i64 %50)
%51 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 22), align 16, !tbaa !5
%cond.i130.21 = tail call i64 @llvm.umin.i64(i64 %cond.i130.20, i64 %51)
%52 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 23), align 8, !tbaa !5
%cond.i130.22 = tail call i64 @llvm.umin.i64(i64 %cond.i130.21, i64 %52)
%53 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 24), align 16, !tbaa !5
%cond.i130.23 = tail call i64 @llvm.umin.i64(i64 %cond.i130.22, i64 %53)
%54 = load i64, ptr getelementptr inbounds ([300001 x [26 x i64]], ptr @dp, i64 0, i64 0, i64 25), align 8, !tbaa !5
%cond.i130.24 = tail call i64 @llvm.umin.i64(i64 %cond.i130.23, i64 %54)
%cond.i130.25 = tail call i64 @llvm.umin.i64(i64 %cond.i130.24, i64 2000000007)
%inc44 = add nuw nsw i64 %cond.i130.25, 1
br label %for.cond49.preheader
for.cond49.preheader: ; preds = %while.end, %for.cond49.preheader.preheader
%i.3144 = phi i64 [ %inc80, %while.end ], [ 0, %for.cond49.preheader.preheader ]
%j.1143 = phi i64 [ %inc77, %while.end ], [ 0, %for.cond49.preheader.preheader ]
%sub55 = sub nsw i64 %inc44, %i.3144
%arrayidx54 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 0
%55 = load i64, ptr %arrayidx54, align 16, !tbaa !5
%cmp56 = icmp ult i64 %55, %sub55
br i1 %cmp56, label %for.end62, label %for.inc60
for.inc60: ; preds = %for.cond49.preheader
%arrayidx54.1 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 1
%56 = load i64, ptr %arrayidx54.1, align 8, !tbaa !5
%cmp56.1 = icmp ult i64 %56, %sub55
br i1 %cmp56.1, label %for.end62, label %for.inc60.1
for.inc60.1: ; preds = %for.inc60
%arrayidx54.2 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 2
%57 = load i64, ptr %arrayidx54.2, align 16, !tbaa !5
%cmp56.2 = icmp ult i64 %57, %sub55
br i1 %cmp56.2, label %for.end62, label %for.inc60.2
for.inc60.2: ; preds = %for.inc60.1
%arrayidx54.3 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 3
%58 = load i64, ptr %arrayidx54.3, align 8, !tbaa !5
%cmp56.3 = icmp ult i64 %58, %sub55
br i1 %cmp56.3, label %for.end62, label %for.inc60.3
for.inc60.3: ; preds = %for.inc60.2
%arrayidx54.4 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 4
%59 = load i64, ptr %arrayidx54.4, align 16, !tbaa !5
%cmp56.4 = icmp ult i64 %59, %sub55
br i1 %cmp56.4, label %for.end62, label %for.inc60.4
for.inc60.4: ; preds = %for.inc60.3
%arrayidx54.5 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 5
%60 = load i64, ptr %arrayidx54.5, align 8, !tbaa !5
%cmp56.5 = icmp ult i64 %60, %sub55
br i1 %cmp56.5, label %for.end62, label %for.inc60.5
for.inc60.5: ; preds = %for.inc60.4
%arrayidx54.6 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 6
%61 = load i64, ptr %arrayidx54.6, align 16, !tbaa !5
%cmp56.6 = icmp ult i64 %61, %sub55
br i1 %cmp56.6, label %for.end62, label %for.inc60.6
for.inc60.6: ; preds = %for.inc60.5
%arrayidx54.7 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 7
%62 = load i64, ptr %arrayidx54.7, align 8, !tbaa !5
%cmp56.7 = icmp ult i64 %62, %sub55
br i1 %cmp56.7, label %for.end62, label %for.inc60.7
for.inc60.7: ; preds = %for.inc60.6
%arrayidx54.8 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 8
%63 = load i64, ptr %arrayidx54.8, align 16, !tbaa !5
%cmp56.8 = icmp ult i64 %63, %sub55
br i1 %cmp56.8, label %for.end62, label %for.inc60.8
for.inc60.8: ; preds = %for.inc60.7
%arrayidx54.9 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 9
%64 = load i64, ptr %arrayidx54.9, align 8, !tbaa !5
%cmp56.9 = icmp ult i64 %64, %sub55
br i1 %cmp56.9, label %for.end62, label %for.inc60.9
for.inc60.9: ; preds = %for.inc60.8
%arrayidx54.10 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 10
%65 = load i64, ptr %arrayidx54.10, align 16, !tbaa !5
%cmp56.10 = icmp ult i64 %65, %sub55
br i1 %cmp56.10, label %for.end62, label %for.inc60.10
for.inc60.10: ; preds = %for.inc60.9
%arrayidx54.11 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 11
%66 = load i64, ptr %arrayidx54.11, align 8, !tbaa !5
%cmp56.11 = icmp ult i64 %66, %sub55
br i1 %cmp56.11, label %for.end62, label %for.inc60.11
for.inc60.11: ; preds = %for.inc60.10
%arrayidx54.12 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 12
%67 = load i64, ptr %arrayidx54.12, align 16, !tbaa !5
%cmp56.12 = icmp ult i64 %67, %sub55
br i1 %cmp56.12, label %for.end62, label %for.inc60.12
for.inc60.12: ; preds = %for.inc60.11
%arrayidx54.13 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 13
%68 = load i64, ptr %arrayidx54.13, align 8, !tbaa !5
%cmp56.13 = icmp ult i64 %68, %sub55
br i1 %cmp56.13, label %for.end62, label %for.inc60.13
for.inc60.13: ; preds = %for.inc60.12
%arrayidx54.14 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 14
%69 = load i64, ptr %arrayidx54.14, align 16, !tbaa !5
%cmp56.14 = icmp ult i64 %69, %sub55
br i1 %cmp56.14, label %for.end62, label %for.inc60.14
for.inc60.14: ; preds = %for.inc60.13
%arrayidx54.15 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 15
%70 = load i64, ptr %arrayidx54.15, align 8, !tbaa !5
%cmp56.15 = icmp ult i64 %70, %sub55
br i1 %cmp56.15, label %for.end62, label %for.inc60.15
for.inc60.15: ; preds = %for.inc60.14
%arrayidx54.16 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 16
%71 = load i64, ptr %arrayidx54.16, align 16, !tbaa !5
%cmp56.16 = icmp ult i64 %71, %sub55
br i1 %cmp56.16, label %for.end62, label %for.inc60.16
for.inc60.16: ; preds = %for.inc60.15
%arrayidx54.17 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 17
%72 = load i64, ptr %arrayidx54.17, align 8, !tbaa !5
%cmp56.17 = icmp ult i64 %72, %sub55
br i1 %cmp56.17, label %for.end62, label %for.inc60.17
for.inc60.17: ; preds = %for.inc60.16
%arrayidx54.18 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 18
%73 = load i64, ptr %arrayidx54.18, align 16, !tbaa !5
%cmp56.18 = icmp ult i64 %73, %sub55
br i1 %cmp56.18, label %for.end62, label %for.inc60.18
for.inc60.18: ; preds = %for.inc60.17
%arrayidx54.19 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 19
%74 = load i64, ptr %arrayidx54.19, align 8, !tbaa !5
%cmp56.19 = icmp ult i64 %74, %sub55
br i1 %cmp56.19, label %for.end62, label %for.inc60.19
for.inc60.19: ; preds = %for.inc60.18
%arrayidx54.20 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 20
%75 = load i64, ptr %arrayidx54.20, align 16, !tbaa !5
%cmp56.20 = icmp ult i64 %75, %sub55
br i1 %cmp56.20, label %for.end62, label %for.inc60.20
for.inc60.20: ; preds = %for.inc60.19
%arrayidx54.21 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 21
%76 = load i64, ptr %arrayidx54.21, align 8, !tbaa !5
%cmp56.21 = icmp ult i64 %76, %sub55
br i1 %cmp56.21, label %for.end62, label %for.inc60.21
for.inc60.21: ; preds = %for.inc60.20
%arrayidx54.22 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 22
%77 = load i64, ptr %arrayidx54.22, align 16, !tbaa !5
%cmp56.22 = icmp ult i64 %77, %sub55
br i1 %cmp56.22, label %for.end62, label %for.inc60.22
for.inc60.22: ; preds = %for.inc60.21
%arrayidx54.23 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 23
%78 = load i64, ptr %arrayidx54.23, align 8, !tbaa !5
%cmp56.23 = icmp ult i64 %78, %sub55
br i1 %cmp56.23, label %for.end62, label %for.inc60.23
for.inc60.23: ; preds = %for.inc60.22
%arrayidx54.24 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 24
%79 = load i64, ptr %arrayidx54.24, align 16, !tbaa !5
%cmp56.24 = icmp ult i64 %79, %sub55
br i1 %cmp56.24, label %for.end62, label %for.inc60.24
for.inc60.24: ; preds = %for.inc60.23
%arrayidx54.25 = getelementptr inbounds [300001 x [26 x i64]], ptr @dp, i64 0, i64 %j.1143, i64 25
%80 = load i64, ptr %arrayidx54.25, align 8, !tbaa !5
%cmp56.25 = icmp ult i64 %80, %sub55
%spec.select = select i1 %cmp56.25, i8 122, i8 123
br label %for.end62
for.end62: ; preds = %for.inc60.24, %for.inc60.23, %for.inc60.22, %for.inc60.21, %for.inc60.20, %for.inc60.19, %for.inc60.18, %for.inc60.17, %for.inc60.16, %for.inc60.15, %for.inc60.14, %for.inc60.13, %for.inc60.12, %for.inc60.11, %for.inc60.10, %for.inc60.9, %for.inc60.8, %for.inc60.7, %for.inc60.6, %for.inc60.5, %for.inc60.4, %for.inc60.3, %for.inc60.2, %for.inc60.1, %for.inc60, %for.cond49.preheader
%ki.1.lcssa = phi i8 [ 97, %for.cond49.preheader ], [ 98, %for.inc60 ], [ 99, %for.inc60.1 ], [ 100, %for.inc60.2 ], [ 101, %for.inc60.3 ], [ 102, %for.inc60.4 ], [ 103, %for.inc60.5 ], [ 104, %for.inc60.6 ], [ 105, %for.inc60.7 ], [ 106, %for.inc60.8 ], [ 107, %for.inc60.9 ], [ 108, %for.inc60.10 ], [ 109, %for.inc60.11 ], [ 110, %for.inc60.12 ], [ 111, %for.inc60.13 ], [ 112, %for.inc60.14 ], [ 113, %for.inc60.15 ], [ 114, %for.inc60.16 ], [ 115, %for.inc60.17 ], [ 116, %for.inc60.18 ], [ 117, %for.inc60.19 ], [ 118, %for.inc60.20 ], [ 119, %for.inc60.21 ], [ 120, %for.inc60.22 ], [ 121, %for.inc60.23 ], [ %spec.select, %for.inc60.24 ]
%arrayidx65 = getelementptr inbounds [300001 x i8], ptr @t, i64 0, i64 %i.3144
store i8 %ki.1.lcssa, ptr %arrayidx65, align 1, !tbaa !20
%cmp67 = icmp eq i64 %i.3144, %cond.i130.25
br i1 %cmp67, label %for.end81, label %while.cond
while.cond: ; preds = %for.end62, %while.cond
%j.2 = phi i64 [ %inc77, %while.cond ], [ %j.1143, %for.end62 ]
%arrayidx71 = getelementptr inbounds [300001 x i8], ptr @s, i64 0, i64 %j.2
%81 = load i8, ptr %arrayidx71, align 1, !tbaa !20
%cmp75.not = icmp eq i8 %81, %ki.1.lcssa
%inc77 = add nsw i64 %j.2, 1
br i1 %cmp75.not, label %while.end, label %while.cond, !llvm.loop !22
while.end: ; preds = %while.cond
%inc80 = add nuw nsw i64 %i.3144, 1
br label %for.cond49.preheader
for.end81: ; preds = %for.end62
%call82 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @t)
ret i64 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @s)
%call1 = tail call i64 @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #6
; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #14
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #15
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 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(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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { 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 #10 = { 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 #11 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #12 = { 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 #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #15 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #16 = { nounwind }
attributes #17 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!17 = !{i64 0, i64 8, !5}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
//set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;}
void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
void getperm(long long a[],long long n){
long long i,p;
for(i=0;i<n;i++){
a[i]=i;
}
for(i=n-1;i>=1;i--){
p=rand()%(i+1);
swap(&a[p],&a[i]);
}
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
void coordinate_comp(int a[],int n){
int i,c=0;
sd dat[524288];
for(i=0;i<n;i++){
dat[i].val=a[i];
dat[i].node=i;
}
qsort(dat,n,sizeof(dat[0]),sdsortfnc);
a[dat[0].node]=c;
for(i=1;i<n;i++){
if(dat[i-1].val!=dat[i].val){c++;}
a[dat[i].node]=c;
}
}
typedef struct{
long long st;
long long fi;
long long kr;
}rs;
typedef struct{
long long st;
long long kz;
}mkj;
int sortfnc(const void *a,const void *b){
if(((rs*)a)->st == ((rs*)b)->st){return 0;}
if(((rs*)a)->st < ((rs*)b)->st){return -1;}
return 1;
}
void makemkj(rs g[],mkj x[],long long n){
long long i,ms=0,nst=g[0].st;
for(i=1;i<n;i++){
if(g[i].st!=g[i-1].st){
x[nst].kz=i-ms;
x[nst].st=ms;
nst=g[i].st;ms=i;
}
}
x[nst].kz=n-ms;
x[nst].st=ms;
}
long long fl[4096]={0},pfl=0,n;
long long cvrt[4096];
long long rev[4096];
long long st;
rs g[4096],revg[4096];
mkj x[4096],revx[4096];
void rep(long long v,long long bk,long long cnt){
long long i;
if(pfl==1){return;}
long long *lfl=malloc(sizeof(long long)*2048);
long long *mfl=malloc(sizeof(long long)*2048);
if(v==st && cnt!=0){
printf("%lld\n",cnt);
for(i=1;i<=n;i++){
if(fl[i]==1){printf("%lld\n",rev[i]);}
}
pfl=1;
return;
}
for(i=x[v].st;i<x[v].st+x[v].kz;i++){
lfl[i]=0;
if(fl[g[i].fi]!=0 || g[i].fi<st){lfl[i]=1;}
mfl[g[i].fi]=fl[g[i].fi];
fl[g[i].fi]=2;
}
if(v!=st){
for(i=revx[v].st;i<revx[v].st+revx[v].kz;i++){
//printf("to %lld\n",revg[i].fi);
if(revg[i].fi==bk){continue;}
mfl[revg[i].fi]=fl[revg[i].fi];
fl[revg[i].fi]=2;
}
}
for(i=x[v].st;i<x[v].st+x[v].kz;i++){
//printf("<%lld %lld>\n",lfl[i],g[i].fi);
if(lfl[i]==0){
fl[g[i].fi]=1;
rep(g[i].fi,v,cnt+1);
fl[g[i].fi]=2;
}
}
for(i=x[v].st;i<x[v].st+x[v].kz;i++){
fl[g[i].fi]=mfl[g[i].fi];
}
if(v!=st){
for(i=revx[v].st;i<revx[v].st+revx[v].kz;i++){
if(revg[i].fi==bk){continue;}
fl[revg[i].fi]=mfl[revg[i].fi];
}
}
free(lfl);
free(mfl);
}
int main(void){
srand(time(0));
long long i,j,m,k,a,b,c,h,w,r=0,l,t;
scanf("%lld%lld",&n,&m);
getperm(cvrt,n);
for(i=n;i>0;i--){
cvrt[i]=cvrt[i-1]+1;
rev[cvrt[i]]=i;
}
for(i=0;i<m;i++){
scanf("%lld%lld",&g[i].st,&g[i].fi);
g[i].st=cvrt[g[i].st];
g[i].fi=cvrt[g[i].fi];
revg[i].st=g[i].fi;
revg[i].fi=g[i].st;
}
qsort(g,m,sizeof(g[0]),sortfnc);
makemkj(g,x,m);
qsort(revg,m,sizeof(g[0]),sortfnc);
makemkj(revg,revx,m);
for(i=1;i<=llceil(n*3,4);i++){
st=i;
rep(i,-1,0);
}
if(pfl==0){printf("-1\n");}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105850/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105850/source.c"
target datalayout = "e-m:e-p270: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.mkj = type { i64, i64 }
%struct.rs = type { i64, i64, i64 }
%struct.sd = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@fl = dso_local local_unnamed_addr global [4096 x i64] zeroinitializer, align 16
@pfl = dso_local local_unnamed_addr global i64 0, align 8
@st = dso_local local_unnamed_addr global i64 0, align 8
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@n = dso_local global i64 0, align 8
@rev = dso_local local_unnamed_addr global [4096 x i64] zeroinitializer, align 16
@x = dso_local local_unnamed_addr global [4096 x %struct.mkj] zeroinitializer, align 16
@g = dso_local global [4096 x %struct.rs] zeroinitializer, align 16
@revx = dso_local local_unnamed_addr global [4096 x %struct.mkj] zeroinitializer, align 16
@revg = dso_local global [4096 x %struct.rs] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@cvrt = dso_local local_unnamed_addr global [4096 x i64] zeroinitializer, align 16
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
store i32 %1, ptr %a, align 4, !tbaa !16
store i32 %0, ptr %b, align 4, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !20
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
store i64 %1, ptr %a, align 8, !tbaa !29
store i64 %0, ptr %b, align 8, !tbaa !29
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
store double %1, ptr %a, align 8, !tbaa !31
store double %0, ptr %b, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
store i8 %1, ptr %a, align 1, !tbaa !33
store i8 %0, ptr %b, align 1, !tbaa !33
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #19
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #19
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 {
entry:
%b = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #20
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader57, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57
for.body.preheader57: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp40, label %for.body3.preheader, label %for.end25
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader57, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !35
for.cond15.preheader: ; preds = %for.body3
br i1 %cmp40, label %for.body17.preheader, label %for.end25
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count54 = zext i32 %n to i64
br label %for.body17
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ]
%call = tail call i32 @rand() #20
%5 = trunc i64 %indvars.iv47 to i32
%rem = srem i32 %call, %5
%indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
%idxprom4 = and i64 %indvars.iv.next48, 4294967295
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%idxprom6 = sext i32 %rem to i64
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv47, 1
br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ]
%arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !16
%idxprom20 = sext i32 %8 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20
%call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54
br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37
for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #20
ret void
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !16
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nounwind uwtable
define dso_local void @getperm(ptr nocapture noundef %a, i64 noundef %n) local_unnamed_addr #8 {
entry:
%cmp18 = icmp sgt i64 %n, 0
br i1 %cmp18, label %for.body.preheader, label %for.end7
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader24, 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>
%0 = getelementptr inbounds i64, ptr %a, i64 %index
store <2 x i64> %vec.ind, ptr %0, align 8, !tbaa !29
%1 = getelementptr inbounds i64, ptr %0, i64 2
store <2 x i64> %step.add, ptr %1, align 8, !tbaa !29
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader24
for.body.preheader24: ; preds = %for.body.preheader, %middle.block
%i.019.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
%cmp220 = icmp sgt i64 %n, 1
br i1 %cmp220, label %for.body3, label %for.end7
for.body: ; preds = %for.body.preheader24, %for.body
%i.019 = phi i64 [ %inc, %for.body ], [ %i.019.ph, %for.body.preheader24 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.019
store i64 %i.019, ptr %arrayidx, align 8, !tbaa !29
%inc = add nuw nsw i64 %i.019, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !42
for.body3: ; preds = %for.cond1.preheader, %for.body3
%i.1.in21 = phi i64 [ %i.1, %for.body3 ], [ %n, %for.cond1.preheader ]
%i.1 = add nsw i64 %i.1.in21, -1
%call = tail call i32 @rand() #20
%conv = sext i32 %call to i64
%rem = srem i64 %conv, %i.1.in21
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %rem
%arrayidx5 = getelementptr inbounds i64, ptr %a, i64 %i.1
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !16
%4 = load i32, ptr %arrayidx5, align 4, !tbaa !16
store i32 %4, ptr %arrayidx4, align 4, !tbaa !16
store i32 %3, ptr %arrayidx5, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %i.1.in21, 2
br i1 %cmp2, label %for.body3, label %for.end7, !llvm.loop !43
for.end7: ; preds = %for.body3, %entry, %for.cond1.preheader
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !44
%1 = load i32, ptr %b, align 4, !tbaa !44
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 {
entry:
%dat = alloca [524288 x %struct.sd], align 16
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #20
%cmp46 = icmp sgt i32 %n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = or i64 %index, 2
%1 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16
%3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index
%4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0
%interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16
%interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx2, align 8, !tbaa !44
%node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %node, align 4, !tbaa !47
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !48
for.end: ; preds = %for.body, %middle.block, %entry
%conv = sext i32 %n to i64
call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #20
%node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1
%8 = load i32, ptr %node6, align 4, !tbaa !47
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 0, ptr %arrayidx8, align 4, !tbaa !16
%cmp1048 = icmp sgt i32 %n, 1
br i1 %cmp1048, label %for.body12.preheader, label %for.end29
for.body12.preheader: ; preds = %for.end
%wide.trip.count56 = zext i32 %n to i64
%.pre = load i32, ptr %dat, align 16, !tbaa !44
%9 = add nsw i64 %wide.trip.count56, -1
%xtraiter = and i64 %9, 1
%10 = icmp eq i32 %n, 2
br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %9, -2
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ]
%indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ]
%arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52
%12 = load i32, ptr %arrayidx17, align 8, !tbaa !44
%cmp19.not = icmp ne i32 %11, %12
%inc21 = zext i1 %cmp19.not to i32
%spec.select = add nuw nsw i32 %c.050, %inc21
%node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1
%13 = load i32, ptr %node24, align 4, !tbaa !47
%idxprom25 = sext i32 %13 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25
store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53
%14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44
%cmp19.not.1 = icmp ne i32 %12, %14
%inc21.1 = zext i1 %cmp19.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1
%node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1
%15 = load i32, ptr %node24.1, align 4, !tbaa !47
%idxprom25.1 = sext i32 %15 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1
store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16
%indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49
for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ]
%indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil
for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr
%16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44
%cmp19.not.epil = icmp ne i32 %.unr, %16
%inc21.epil = zext i1 %cmp19.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil
%node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1
%17 = load i32, ptr %node24.epil, align 4, !tbaa !47
%idxprom25.epil = sext i32 %17 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil
store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16
br label %for.end29
for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #20
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !50
%1 = load i64, ptr %b, align 8, !tbaa !50
%cmp = icmp eq i64 %0, %1
%cmp4 = icmp slt i64 %0, %1
%. = select i1 %cmp4, i32 -1, i32 1
%retval.0 = select i1 %cmp, i32 0, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @makemkj(ptr nocapture noundef readonly %g, ptr nocapture noundef writeonly %x, i64 noundef %n) local_unnamed_addr #14 {
entry:
%0 = load i64, ptr %g, align 8, !tbaa !50
%cmp36 = icmp sgt i64 %n, 1
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%nst.039 = phi i64 [ %nst.1, %for.inc ], [ %0, %entry ]
%ms.038 = phi i64 [ %ms.1, %for.inc ], [ 0, %entry ]
%i.037 = phi i64 [ %inc, %for.inc ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.037
%1 = load i64, ptr %arrayidx1, align 8, !tbaa !50
%arrayidx3 = getelementptr %struct.rs, ptr %arrayidx1, i64 -1
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !50
%cmp5.not = icmp eq i64 %1, %2
br i1 %cmp5.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%sub6 = sub nsw i64 %i.037, %ms.038
%arrayidx7 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039
%kz = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039, i32 1
store i64 %sub6, ptr %kz, align 8, !tbaa !52
store i64 %ms.038, ptr %arrayidx7, align 8, !tbaa !54
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%ms.1 = phi i64 [ %i.037, %if.then ], [ %ms.038, %for.body ]
%nst.1 = phi i64 [ %1, %if.then ], [ %nst.039, %for.body ]
%inc = add nuw nsw i64 %i.037, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !55
for.end: ; preds = %for.inc, %entry
%ms.0.lcssa = phi i64 [ 0, %entry ], [ %ms.1, %for.inc ]
%nst.0.lcssa = phi i64 [ %0, %entry ], [ %nst.1, %for.inc ]
%sub12 = sub nsw i64 %n, %ms.0.lcssa
%arrayidx13 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa
%kz14 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa, i32 1
store i64 %sub12, ptr %kz14, align 8, !tbaa !52
store i64 %ms.0.lcssa, ptr %arrayidx13, align 8, !tbaa !54
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @rep(i64 noundef %v, i64 noundef %bk, i64 noundef %cnt) local_unnamed_addr #8 {
entry:
%0 = load i64, ptr @pfl, align 8, !tbaa !29
%cmp = icmp eq i64 %0, 1
br i1 %cmp, label %cleanup145, label %if.end
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #21
%call1 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #21
%1 = load i64, ptr @st, align 8
%cmp2 = icmp eq i64 %1, %v
%cmp3 = icmp ne i64 %cnt, 0
%or.cond = and i1 %cmp3, %cmp2
br i1 %or.cond, label %if.then4, label %if.end12
if.then4: ; preds = %if.end
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %cnt)
%2 = load i64, ptr @n, align 8, !tbaa !29
%cmp6.not222 = icmp slt i64 %2, 1
br i1 %cmp6.not222, label %for.end, label %for.body
for.body: ; preds = %if.then4, %for.inc
%3 = phi i64 [ %6, %for.inc ], [ %2, %if.then4 ]
%i.0223 = phi i64 [ %inc, %for.inc ], [ 1, %if.then4 ]
%arrayidx = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %i.0223
%4 = load i64, ptr %arrayidx, align 8, !tbaa !29
%cmp7 = icmp eq i64 %4, 1
br i1 %cmp7, label %if.then8, label %for.inc
if.then8: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [4096 x i64], ptr @rev, i64 0, i64 %i.0223
%5 = load i64, ptr %arrayidx9, align 8, !tbaa !29
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %5)
%.pre227 = load i64, ptr @n, align 8, !tbaa !29
br label %for.inc
for.inc: ; preds = %for.body, %if.then8
%6 = phi i64 [ %3, %for.body ], [ %.pre227, %if.then8 ]
%inc = add nuw nsw i64 %i.0223, 1
%cmp6.not.not = icmp slt i64 %i.0223, %6
br i1 %cmp6.not.not, label %for.body, label %for.end, !llvm.loop !56
for.end: ; preds = %for.inc, %if.then4
store i64 1, ptr @pfl, align 8, !tbaa !29
br label %cleanup145
if.end12: ; preds = %if.end
%arrayidx13 = getelementptr inbounds [4096 x %struct.mkj], ptr @x, i64 0, i64 %v
%7 = load i64, ptr %arrayidx13, align 16, !tbaa !54
%kz = getelementptr inbounds [4096 x %struct.mkj], ptr @x, i64 0, i64 %v, i32 1
%8 = load i64, ptr %kz, align 8, !tbaa !52
%add = add nsw i64 %8, %7
%cmp18209 = icmp sgt i64 %8, 0
br i1 %cmp18209, label %for.body19, label %for.end41
for.body19: ; preds = %if.end12, %for.body19
%i.1210 = phi i64 [ %inc40, %for.body19 ], [ %7, %if.end12 ]
%arrayidx20 = getelementptr inbounds i64, ptr %call, i64 %i.1210
%fi = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %i.1210, i32 1
%9 = load i64, ptr %fi, align 8, !tbaa !57
%arrayidx22 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %9
%10 = load i64, ptr %arrayidx22, align 8, !tbaa !29
%cmp23.not = icmp ne i64 %10, 0
%cmp26 = icmp slt i64 %9, %1
%or.cond208 = or i1 %cmp26, %cmp23.not
%spec.store.select = zext i1 %or.cond208 to i64
store i64 %spec.store.select, ptr %arrayidx20, align 8
%arrayidx35 = getelementptr inbounds i64, ptr %call1, i64 %9
store i64 %10, ptr %arrayidx35, align 8, !tbaa !29
store i64 2, ptr %arrayidx22, align 8, !tbaa !29
%inc40 = add nsw i64 %i.1210, 1
%cmp18 = icmp slt i64 %inc40, %add
br i1 %cmp18, label %for.body19, label %for.end41, !llvm.loop !58
for.end41: ; preds = %for.body19, %if.end12
br i1 %cmp2, label %if.end71, label %if.then43
if.then43: ; preds = %for.end41
%arrayidx44 = getelementptr inbounds [4096 x %struct.mkj], ptr @revx, i64 0, i64 %v
%11 = load i64, ptr %arrayidx44, align 16, !tbaa !54
%kz50 = getelementptr inbounds [4096 x %struct.mkj], ptr @revx, i64 0, i64 %v, i32 1
%12 = load i64, ptr %kz50, align 8, !tbaa !52
%add51 = add nsw i64 %12, %11
%cmp52211 = icmp sgt i64 %12, 0
br i1 %cmp52211, label %for.body53, label %if.end71
for.body53: ; preds = %if.then43, %for.inc68
%i.2212 = phi i64 [ %inc69, %for.inc68 ], [ %11, %if.then43 ]
%fi55 = getelementptr inbounds [4096 x %struct.rs], ptr @revg, i64 0, i64 %i.2212, i32 1
%13 = load i64, ptr %fi55, align 8, !tbaa !57
%cmp56 = icmp eq i64 %13, %bk
br i1 %cmp56, label %for.inc68, label %if.end58
if.end58: ; preds = %for.body53
%arrayidx61 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %13
%14 = load i64, ptr %arrayidx61, align 8, !tbaa !29
%arrayidx64 = getelementptr inbounds i64, ptr %call1, i64 %13
store i64 %14, ptr %arrayidx64, align 8, !tbaa !29
store i64 2, ptr %arrayidx61, align 8, !tbaa !29
br label %for.inc68
for.inc68: ; preds = %for.body53, %if.end58
%inc69 = add nsw i64 %i.2212, 1
%cmp52 = icmp slt i64 %inc69, %add51
br i1 %cmp52, label %for.body53, label %if.end71, !llvm.loop !59
if.end71: ; preds = %for.inc68, %if.then43, %for.end41
%cmp80214 = icmp sgt i64 %8, 0
br i1 %cmp80214, label %for.body81.lr.ph, label %for.cond100.preheader
for.body81.lr.ph: ; preds = %if.end71
%add90 = add nsw i64 %cnt, 1
br label %for.body81
for.cond100.preheader: ; preds = %for.inc95, %if.end71
%.lcssa = phi i64 [ %7, %if.end71 ], [ %25, %for.inc95 ]
%add79.lcssa = phi i64 [ %add, %if.end71 ], [ %add79, %for.inc95 ]
%cmp106218 = icmp slt i64 %.lcssa, %add79.lcssa
br i1 %cmp106218, label %for.body107.preheader, label %for.end116
for.body107.preheader: ; preds = %for.cond100.preheader
%15 = sub i64 %add79.lcssa, %.lcssa
%.neg = add i64 %.lcssa, 1
%xtraiter = and i64 %15, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body107.prol.loopexit, label %for.body107.prol
for.body107.prol: ; preds = %for.body107.preheader
%fi109.prol = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %.lcssa, i32 1
%16 = load i64, ptr %fi109.prol, align 8, !tbaa !57
%arrayidx110.prol = getelementptr inbounds i64, ptr %call1, i64 %16
%17 = load i64, ptr %arrayidx110.prol, align 8, !tbaa !29
%arrayidx113.prol = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %16
store i64 %17, ptr %arrayidx113.prol, align 8, !tbaa !29
%inc115.prol = add nsw i64 %.lcssa, 1
br label %for.body107.prol.loopexit
for.body107.prol.loopexit: ; preds = %for.body107.prol, %for.body107.preheader
%i.4219.unr = phi i64 [ %.lcssa, %for.body107.preheader ], [ %inc115.prol, %for.body107.prol ]
%18 = icmp eq i64 %add79.lcssa, %.neg
br i1 %18, label %for.end116, label %for.body107
for.body81: ; preds = %for.body81.lr.ph, %for.inc95
%19 = phi i64 [ %8, %for.body81.lr.ph ], [ %24, %for.inc95 ]
%20 = phi i64 [ %7, %for.body81.lr.ph ], [ %25, %for.inc95 ]
%i.3215 = phi i64 [ %7, %for.body81.lr.ph ], [ %inc96, %for.inc95 ]
%arrayidx82 = getelementptr inbounds i64, ptr %call, i64 %i.3215
%21 = load i64, ptr %arrayidx82, align 8, !tbaa !29
%cmp83 = icmp eq i64 %21, 0
br i1 %cmp83, label %if.then84, label %for.inc95
if.then84: ; preds = %for.body81
%fi86 = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %i.3215, i32 1
%22 = load i64, ptr %fi86, align 8, !tbaa !57
%arrayidx87 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %22
store i64 1, ptr %arrayidx87, align 8, !tbaa !29
tail call void @rep(i64 noundef %22, i64 noundef %v, i64 noundef %add90)
%23 = load i64, ptr %fi86, align 8, !tbaa !57
%arrayidx93 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %23
store i64 2, ptr %arrayidx93, align 8, !tbaa !29
%.pre = load i64, ptr %arrayidx13, align 16, !tbaa !54
%.pre226 = load i64, ptr %kz, align 8, !tbaa !52
br label %for.inc95
for.inc95: ; preds = %for.body81, %if.then84
%24 = phi i64 [ %19, %for.body81 ], [ %.pre226, %if.then84 ]
%25 = phi i64 [ %20, %for.body81 ], [ %.pre, %if.then84 ]
%inc96 = add nsw i64 %i.3215, 1
%add79 = add nsw i64 %24, %25
%cmp80 = icmp slt i64 %inc96, %add79
br i1 %cmp80, label %for.body81, label %for.cond100.preheader, !llvm.loop !60
for.body107: ; preds = %for.body107.prol.loopexit, %for.body107
%i.4219 = phi i64 [ %inc115.1, %for.body107 ], [ %i.4219.unr, %for.body107.prol.loopexit ]
%fi109 = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %i.4219, i32 1
%26 = load i64, ptr %fi109, align 8, !tbaa !57
%arrayidx110 = getelementptr inbounds i64, ptr %call1, i64 %26
%27 = load i64, ptr %arrayidx110, align 8, !tbaa !29
%arrayidx113 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %26
store i64 %27, ptr %arrayidx113, align 8, !tbaa !29
%inc115 = add nsw i64 %i.4219, 1
%fi109.1 = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %inc115, i32 1
%28 = load i64, ptr %fi109.1, align 8, !tbaa !57
%arrayidx110.1 = getelementptr inbounds i64, ptr %call1, i64 %28
%29 = load i64, ptr %arrayidx110.1, align 8, !tbaa !29
%arrayidx113.1 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %28
store i64 %29, ptr %arrayidx113.1, align 8, !tbaa !29
%inc115.1 = add nsw i64 %i.4219, 2
%exitcond.not.1 = icmp eq i64 %inc115.1, %add79.lcssa
br i1 %exitcond.not.1, label %for.end116, label %for.body107, !llvm.loop !61
for.end116: ; preds = %for.body107.prol.loopexit, %for.body107, %for.cond100.preheader
%30 = load i64, ptr @st, align 8, !tbaa !29
%cmp117.not = icmp eq i64 %30, %v
br i1 %cmp117.not, label %if.end143, label %if.then118
if.then118: ; preds = %for.end116
%arrayidx119 = getelementptr inbounds [4096 x %struct.mkj], ptr @revx, i64 0, i64 %v
%31 = load i64, ptr %arrayidx119, align 16, !tbaa !54
%kz125 = getelementptr inbounds [4096 x %struct.mkj], ptr @revx, i64 0, i64 %v, i32 1
%32 = load i64, ptr %kz125, align 8, !tbaa !52
%add126 = add nsw i64 %32, %31
%cmp127220 = icmp sgt i64 %32, 0
br i1 %cmp127220, label %for.body128, label %if.end143
for.body128: ; preds = %if.then118, %for.inc140
%i.5221 = phi i64 [ %inc141, %for.inc140 ], [ %31, %if.then118 ]
%fi130 = getelementptr inbounds [4096 x %struct.rs], ptr @revg, i64 0, i64 %i.5221, i32 1
%33 = load i64, ptr %fi130, align 8, !tbaa !57
%cmp131 = icmp eq i64 %33, %bk
br i1 %cmp131, label %for.inc140, label %if.end133
if.end133: ; preds = %for.body128
%arrayidx136 = getelementptr inbounds i64, ptr %call1, i64 %33
%34 = load i64, ptr %arrayidx136, align 8, !tbaa !29
%arrayidx139 = getelementptr inbounds [4096 x i64], ptr @fl, i64 0, i64 %33
store i64 %34, ptr %arrayidx139, align 8, !tbaa !29
br label %for.inc140
for.inc140: ; preds = %for.body128, %if.end133
%inc141 = add nsw i64 %i.5221, 1
%cmp127 = icmp slt i64 %inc141, %add126
br i1 %cmp127, label %for.body128, label %if.end143, !llvm.loop !62
if.end143: ; preds = %for.inc140, %if.then118, %for.end116
tail call void @free(ptr noundef %call) #20
tail call void @free(ptr noundef %call1) #20
br label %cleanup145
cleanup145: ; preds = %for.end, %if.end143, %entry
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 #15
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #16
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%m = alloca i64, align 8
%call = tail call i64 @time(ptr noundef null) #20
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #20
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #20
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull %m)
%0 = load i64, ptr @n, align 8, !tbaa !29
%cmp18.i = icmp sgt i64 %0, 0
br i1 %cmp18.i, label %for.body.i.preheader, label %for.cond6.preheader
for.body.i.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %0, 4
br i1 %min.iters.check, label %for.body.i.preheader109, label %vector.ph
vector.ph: ; preds = %for.body.i.preheader
%n.vec = and i64 %0, -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 i64, ptr @cvrt, i64 %index
store <2 x i64> %vec.ind, ptr %1, align 16, !tbaa !29
%2 = getelementptr inbounds i64, ptr %1, i64 2
store <2 x i64> %step.add, ptr %2, align 16, !tbaa !29
%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 !63
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond1.preheader.i, label %for.body.i.preheader109
for.body.i.preheader109: ; preds = %for.body.i.preheader, %middle.block
%i.019.i.ph = phi i64 [ 0, %for.body.i.preheader ], [ %n.vec, %middle.block ]
br label %for.body.i
for.cond1.preheader.i: ; preds = %for.body.i, %middle.block
%cmp220.i = icmp sgt i64 %0, 1
br i1 %cmp220.i, label %for.body3.i, label %getperm.exit
for.body.i: ; preds = %for.body.i.preheader109, %for.body.i
%i.019.i = phi i64 [ %inc.i, %for.body.i ], [ %i.019.i.ph, %for.body.i.preheader109 ]
%arrayidx.i = getelementptr inbounds i64, ptr @cvrt, i64 %i.019.i
store i64 %i.019.i, ptr %arrayidx.i, align 8, !tbaa !29
%inc.i = add nuw nsw i64 %i.019.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %0
br i1 %exitcond.not.i, label %for.cond1.preheader.i, label %for.body.i, !llvm.loop !64
for.body3.i: ; preds = %for.cond1.preheader.i, %for.body3.i
%i.1.in21.i = phi i64 [ %i.1.i, %for.body3.i ], [ %0, %for.cond1.preheader.i ]
%i.1.i = add nsw i64 %i.1.in21.i, -1
%call.i = call i32 @rand() #20
%conv.i = sext i32 %call.i to i64
%rem.i = srem i64 %conv.i, %i.1.in21.i
%arrayidx4.i = getelementptr inbounds i64, ptr @cvrt, i64 %rem.i
%arrayidx5.i = getelementptr inbounds i64, ptr @cvrt, i64 %i.1.i
%4 = load i32, ptr %arrayidx4.i, align 8, !tbaa !16
%5 = load i32, ptr %arrayidx5.i, align 8, !tbaa !16
store i32 %5, ptr %arrayidx4.i, align 8, !tbaa !16
store i32 %4, ptr %arrayidx5.i, align 8, !tbaa !16
%cmp2.i = icmp ugt i64 %i.1.in21.i, 2
br i1 %cmp2.i, label %for.body3.i, label %getperm.exit.loopexit, !llvm.loop !43
getperm.exit.loopexit: ; preds = %for.body3.i
%.pre = load i64, ptr @n, align 8, !tbaa !29
br label %getperm.exit
getperm.exit: ; preds = %getperm.exit.loopexit, %for.cond1.preheader.i
%6 = phi i64 [ %.pre, %getperm.exit.loopexit ], [ %0, %for.cond1.preheader.i ]
%cmp92 = icmp sgt i64 %6, 0
br i1 %cmp92, label %for.body.preheader, label %for.cond6.preheader
for.body.preheader: ; preds = %getperm.exit
%xtraiter = and i64 %6, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%sub.prol = add nsw i64 %6, -1
%arrayidx.prol = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %sub.prol
%7 = load i64, ptr %arrayidx.prol, align 8, !tbaa !29
%add.prol = add nsw i64 %7, 1
%arrayidx3.prol = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %6
store i64 %add.prol, ptr %arrayidx3.prol, align 8, !tbaa !29
%arrayidx5.prol = getelementptr inbounds [4096 x i64], ptr @rev, i64 0, i64 %add.prol
store i64 %6, ptr %arrayidx5.prol, align 8, !tbaa !29
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%i.093.unr = phi i64 [ %6, %for.body.preheader ], [ %sub.prol, %for.body.prol ]
%8 = icmp eq i64 %6, 1
br i1 %8, label %for.cond6.preheader, label %for.body
for.cond6.preheader: ; preds = %for.body.prol.loopexit, %for.body, %entry, %getperm.exit
%9 = load i64, ptr %m, align 8, !tbaa !29
%cmp794 = icmp sgt i64 %9, 0
br i1 %cmp794, label %for.body9, label %for.end32
for.body: ; preds = %for.body.prol.loopexit, %for.body
%i.093 = phi i64 [ %sub.1, %for.body ], [ %i.093.unr, %for.body.prol.loopexit ]
%sub = add nsw i64 %i.093, -1
%arrayidx = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %sub
%10 = load i64, ptr %arrayidx, align 8, !tbaa !29
%add = add nsw i64 %10, 1
%arrayidx3 = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %i.093
store i64 %add, ptr %arrayidx3, align 8, !tbaa !29
%arrayidx5 = getelementptr inbounds [4096 x i64], ptr @rev, i64 0, i64 %add
store i64 %i.093, ptr %arrayidx5, align 8, !tbaa !29
%sub.1 = add nsw i64 %i.093, -2
%arrayidx.1 = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %sub.1
%11 = load i64, ptr %arrayidx.1, align 8, !tbaa !29
%add.1 = add nsw i64 %11, 1
%arrayidx3.1 = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %sub
store i64 %add.1, ptr %arrayidx3.1, align 8, !tbaa !29
%arrayidx5.1 = getelementptr inbounds [4096 x i64], ptr @rev, i64 0, i64 %add.1
store i64 %sub, ptr %arrayidx5.1, align 8, !tbaa !29
%cmp.1 = icmp ugt i64 %sub, 1
br i1 %cmp.1, label %for.body, label %for.cond6.preheader, !llvm.loop !65
for.body9: ; preds = %for.cond6.preheader, %for.body9
%i.195 = phi i64 [ %inc, %for.body9 ], [ 0, %for.cond6.preheader ]
%arrayidx10 = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %i.195
%fi = getelementptr inbounds [4096 x %struct.rs], ptr @g, i64 0, i64 %i.195, i32 1
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %fi)
%12 = load i64, ptr %arrayidx10, align 8, !tbaa !50
%arrayidx15 = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %12
%13 = load i64, ptr %arrayidx15, align 8, !tbaa !29
store i64 %13, ptr %arrayidx10, align 8, !tbaa !50
%14 = load i64, ptr %fi, align 8, !tbaa !57
%arrayidx20 = getelementptr inbounds [4096 x i64], ptr @cvrt, i64 0, i64 %14
%15 = load i64, ptr %arrayidx20, align 8, !tbaa !29
store i64 %15, ptr %fi, align 8, !tbaa !57
%arrayidx25 = getelementptr inbounds [4096 x %struct.rs], ptr @revg, i64 0, i64 %i.195
store i64 %15, ptr %arrayidx25, align 8, !tbaa !50
%fi30 = getelementptr inbounds [4096 x %struct.rs], ptr @revg, i64 0, i64 %i.195, i32 1
store i64 %13, ptr %fi30, align 8, !tbaa !57
%inc = add nuw nsw i64 %i.195, 1
%16 = load i64, ptr %m, align 8, !tbaa !29
%cmp7 = icmp slt i64 %inc, %16
br i1 %cmp7, label %for.body9, label %for.end32, !llvm.loop !66
for.end32: ; preds = %for.body9, %for.cond6.preheader
%.lcssa = phi i64 [ %9, %for.cond6.preheader ], [ %16, %for.body9 ]
call void @qsort(ptr noundef nonnull @g, i64 noundef %.lcssa, i64 noundef 24, ptr noundef nonnull @sortfnc) #20
%17 = load i64, ptr %m, align 8, !tbaa !29
%18 = load i64, ptr @g, align 16, !tbaa !50
%cmp36.i = icmp sgt i64 %17, 1
br i1 %cmp36.i, label %for.body.i65, label %makemkj.exit
for.body.i65: ; preds = %for.end32, %for.inc.i
%nst.039.i = phi i64 [ %nst.1.i, %for.inc.i ], [ %18, %for.end32 ]
%ms.038.i = phi i64 [ %ms.1.i, %for.inc.i ], [ 0, %for.end32 ]
%i.037.i = phi i64 [ %inc.i66, %for.inc.i ], [ 1, %for.end32 ]
%arrayidx1.i = getelementptr inbounds %struct.rs, ptr @g, i64 %i.037.i
%19 = load i64, ptr %arrayidx1.i, align 8, !tbaa !50
%arrayidx3.i = getelementptr %struct.rs, ptr %arrayidx1.i, i64 -1
%20 = load i64, ptr %arrayidx3.i, align 8, !tbaa !50
%cmp5.not.i = icmp eq i64 %19, %20
br i1 %cmp5.not.i, label %for.inc.i, label %if.then.i
if.then.i: ; preds = %for.body.i65
%sub6.i = sub nsw i64 %i.037.i, %ms.038.i
%arrayidx7.i = getelementptr inbounds %struct.mkj, ptr @x, i64 %nst.039.i
%kz.i = getelementptr inbounds %struct.mkj, ptr @x, i64 %nst.039.i, i32 1
store i64 %sub6.i, ptr %kz.i, align 8, !tbaa !52
store i64 %ms.038.i, ptr %arrayidx7.i, align 16, !tbaa !54
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i65
%ms.1.i = phi i64 [ %i.037.i, %if.then.i ], [ %ms.038.i, %for.body.i65 ]
%nst.1.i = phi i64 [ %19, %if.then.i ], [ %nst.039.i, %for.body.i65 ]
%inc.i66 = add nuw nsw i64 %i.037.i, 1
%exitcond.not.i67 = icmp eq i64 %inc.i66, %17
br i1 %exitcond.not.i67, label %makemkj.exit, label %for.body.i65, !llvm.loop !55
makemkj.exit: ; preds = %for.inc.i, %for.end32
%ms.0.lcssa.i = phi i64 [ 0, %for.end32 ], [ %ms.1.i, %for.inc.i ]
%nst.0.lcssa.i = phi i64 [ %18, %for.end32 ], [ %nst.1.i, %for.inc.i ]
%sub12.i = sub nsw i64 %17, %ms.0.lcssa.i
%arrayidx13.i = getelementptr inbounds %struct.mkj, ptr @x, i64 %nst.0.lcssa.i
%kz14.i = getelementptr inbounds %struct.mkj, ptr @x, i64 %nst.0.lcssa.i, i32 1
store i64 %sub12.i, ptr %kz14.i, align 8, !tbaa !52
store i64 %ms.0.lcssa.i, ptr %arrayidx13.i, align 16, !tbaa !54
call void @qsort(ptr noundef nonnull @revg, i64 noundef %17, i64 noundef 24, ptr noundef nonnull @sortfnc) #20
%21 = load i64, ptr %m, align 8, !tbaa !29
%22 = load i64, ptr @revg, align 16, !tbaa !50
%cmp36.i68 = icmp sgt i64 %21, 1
br i1 %cmp36.i68, label %for.body.i74, label %makemkj.exit90
for.body.i74: ; preds = %makemkj.exit, %for.inc.i85
%nst.039.i75 = phi i64 [ %nst.1.i87, %for.inc.i85 ], [ %22, %makemkj.exit ]
%ms.038.i76 = phi i64 [ %ms.1.i86, %for.inc.i85 ], [ 0, %makemkj.exit ]
%i.037.i77 = phi i64 [ %inc.i88, %for.inc.i85 ], [ 1, %makemkj.exit ]
%arrayidx1.i78 = getelementptr inbounds %struct.rs, ptr @revg, i64 %i.037.i77
%23 = load i64, ptr %arrayidx1.i78, align 8, !tbaa !50
%arrayidx3.i79 = getelementptr %struct.rs, ptr %arrayidx1.i78, i64 -1
%24 = load i64, ptr %arrayidx3.i79, align 8, !tbaa !50
%cmp5.not.i80 = icmp eq i64 %23, %24
br i1 %cmp5.not.i80, label %for.inc.i85, label %if.then.i81
if.then.i81: ; preds = %for.body.i74
%sub6.i82 = sub nsw i64 %i.037.i77, %ms.038.i76
%arrayidx7.i83 = getelementptr inbounds %struct.mkj, ptr @revx, i64 %nst.039.i75
%kz.i84 = getelementptr inbounds %struct.mkj, ptr @revx, i64 %nst.039.i75, i32 1
store i64 %sub6.i82, ptr %kz.i84, align 8, !tbaa !52
store i64 %ms.038.i76, ptr %arrayidx7.i83, align 16, !tbaa !54
br label %for.inc.i85
for.inc.i85: ; preds = %if.then.i81, %for.body.i74
%ms.1.i86 = phi i64 [ %i.037.i77, %if.then.i81 ], [ %ms.038.i76, %for.body.i74 ]
%nst.1.i87 = phi i64 [ %23, %if.then.i81 ], [ %nst.039.i75, %for.body.i74 ]
%inc.i88 = add nuw nsw i64 %i.037.i77, 1
%exitcond.not.i89 = icmp eq i64 %inc.i88, %21
br i1 %exitcond.not.i89, label %makemkj.exit90, label %for.body.i74, !llvm.loop !55
makemkj.exit90: ; preds = %for.inc.i85, %makemkj.exit
%ms.0.lcssa.i69 = phi i64 [ 0, %makemkj.exit ], [ %ms.1.i86, %for.inc.i85 ]
%nst.0.lcssa.i70 = phi i64 [ %22, %makemkj.exit ], [ %nst.1.i87, %for.inc.i85 ]
%sub12.i71 = sub nsw i64 %21, %ms.0.lcssa.i69
%arrayidx13.i72 = getelementptr inbounds %struct.mkj, ptr @revx, i64 %nst.0.lcssa.i70
%kz14.i73 = getelementptr inbounds %struct.mkj, ptr @revx, i64 %nst.0.lcssa.i70, i32 1
store i64 %sub12.i71, ptr %kz14.i73, align 8, !tbaa !52
store i64 %ms.0.lcssa.i69, ptr %arrayidx13.i72, align 16, !tbaa !54
%25 = load i64, ptr @n, align 8, !tbaa !29
%mul96 = mul nsw i64 %25, 3
%26 = and i64 %mul96, 3
%cmp.i97 = icmp ne i64 %26, 0
%div.i98 = sdiv i64 %mul96, 4
%add.i99 = zext i1 %cmp.i97 to i64
%retval.0.i100 = add nsw i64 %div.i98, %add.i99
%cmp35.not101 = icmp slt i64 %retval.0.i100, 1
br i1 %cmp35.not101, label %for.end40, label %for.body37
for.body37: ; preds = %makemkj.exit90, %for.body37
%i.2102 = phi i64 [ %inc39, %for.body37 ], [ 1, %makemkj.exit90 ]
store i64 %i.2102, ptr @st, align 8, !tbaa !29
call void @rep(i64 noundef %i.2102, i64 noundef -1, i64 noundef 0)
%inc39 = add nuw nsw i64 %i.2102, 1
%27 = load i64, ptr @n, align 8, !tbaa !29
%mul = mul nsw i64 %27, 3
%28 = and i64 %mul, 3
%cmp.i = icmp ne i64 %28, 0
%div.i = sdiv i64 %mul, 4
%add.i = zext i1 %cmp.i to i64
%retval.0.i = add nsw i64 %div.i, %add.i
%cmp35.not.not = icmp slt i64 %i.2102, %retval.0.i
br i1 %cmp35.not.not, label %for.body37, label %for.end40, !llvm.loop !67
for.end40: ; preds = %for.body37, %makemkj.exit90
%29 = load i64, ptr @pfl, align 8, !tbaa !29
%cmp41 = icmp eq i64 %29, 0
br i1 %cmp41, label %if.then, label %if.end
if.then: ; preds = %for.end40
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.then, %for.end40
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #20
ret i32 0
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #9
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #17
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #17
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #18
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #18
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { 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 #16 = { 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 #17 = { nofree nounwind }
attributes #18 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #19 = { nounwind willreturn memory(read) }
attributes #20 = { nounwind }
attributes #21 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !18, i64 0}
!18 = !{!"omnipotent char", !19, i64 0}
!19 = !{!"Simple C/C++ TBAA"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !18, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !18, i64 0}
!33 = !{!18, !18, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = distinct !{!41, !6, !9, !10}
!42 = distinct !{!42, !6, !10, !9}
!43 = distinct !{!43, !6}
!44 = !{!45, !17, i64 0}
!45 = !{!"", !17, i64 0, !17, i64 4}
!46 = distinct !{!46, !6, !9, !10}
!47 = !{!45, !17, i64 4}
!48 = distinct !{!48, !6, !10, !9}
!49 = distinct !{!49, !6}
!50 = !{!51, !30, i64 0}
!51 = !{!"", !30, i64 0, !30, i64 8, !30, i64 16}
!52 = !{!53, !30, i64 8}
!53 = !{!"", !30, i64 0, !30, i64 8}
!54 = !{!53, !30, i64 0}
!55 = distinct !{!55, !6}
!56 = distinct !{!56, !6}
!57 = !{!51, !30, i64 8}
!58 = distinct !{!58, !6}
!59 = distinct !{!59, !6}
!60 = distinct !{!60, !6}
!61 = distinct !{!61, !6}
!62 = distinct !{!62, !6}
!63 = distinct !{!63, !6, !9, !10}
!64 = distinct !{!64, !6, !10, !9}
!65 = distinct !{!65, !6}
!66 = distinct !{!66, !6}
!67 = distinct !{!67, !6}
|
#include <stdio.h>
int main(void){
// Your code here!
int x;
scanf("%d",&x);
printf("%d\n",x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105894/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105894/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main( void )
{
int x,y;
scanf("%d",&x);
y = x * x * x;
printf("%d\n",y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105944/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105944/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main()
{
int a;
scanf("%d", &a); fflush(stdin);
a = pow(a,3);
printf("%d\n", a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105988/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105988/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@stdin = external local_unnamed_addr global ptr, align 8
@.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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1 = call i32 @fflush(ptr noundef %0)
%1 = load i32, ptr %a, align 4, !tbaa !9
%conv = sitofp i32 %1 to double
%call2 = call double @pow(double noundef %conv, double noundef 3.000000e+00) #4
%conv3 = fptosi double %call2 to i32
store i32 %conv3, ptr %a, align 4, !tbaa !9
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv3)
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 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
int main(){
int x;
scanf("%d",&x);
printf("%d\n",x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106037/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106037/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.