Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int parent;
int left;
int right;
};
struct Node T[MAX];
void Preorder(int u){
if(u==NIL)return;
printf(" %d",u);
Preorder(T[u].left);
Preorder(T[u].right);
}
void Inorder(int u){
if(u==NIL)return;
Inorder(T[u].left);
printf(" %d",u);
Inorder(T[u].right);
}
void Postorder(int u){
if(u==NIL)return;
Postorder(T[u].left);
Postorder(T[u].right);
printf(" %d",u);
}
int main(){
int i,n,v,l,r,root;
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",&v,&l,&r);
T[v].left=l;
T[v].right=r;
if(l!=NIL)T[l].parent=v;
if(r!=NIL)T[r].parent=v;
}
for(i=0;i<n;i++){if(T[i].parent==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_102112/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102112/source.c"
target datalayout = "e-m:e-p270: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
@.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 [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
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @Preorder(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, 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)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @Postorder(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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:
%n = alloca i32, align 4
%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 %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%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
call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !11
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.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%4 = load i32, ptr %l, align 4, !tbaa !11
%5 = load i32, ptr %v, align 4, !tbaa !11
%idxprom9 = sext i32 %5 to i64
%left11 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 1
store i32 %4, ptr %left11, align 4, !tbaa !5
%6 = load i32, ptr %r, align 4, !tbaa !11
%right14 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 2
store i32 %6, ptr %right14, align 4, !tbaa !10
%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 [10000 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 [10000 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 %n, align 4, !tbaa !11
%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 ]
%root.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 [10000 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 %root.069
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx32.1 = getelementptr inbounds [10000 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 [10000 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 [10000 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 ]
%root.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 ]
%root.069.epil = phi i32 [ %spec.select.epil, %for.body30.epil ], [ %root.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 [10000 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 %root.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
%root.0.lcssa = phi i32 [ undef, %for.cond28.preheader ], [ undef, %entry ], [ %root.069.unr, %for.end39.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body30.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %root.0.lcssa)
%putchar60 = call i32 @putchar(i32 10)
%puts61 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %root.0.lcssa)
%putchar62 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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 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
; 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 = { nofree nounwind "no-trapping-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 = { 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, !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.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <stdlib.h>
//#define DEBUG
typedef struct node{
int left;
int right;
int parent;
}node;
void Preorder(int);
void Inorder(int);
void Postorder(int);
node* tree;
int n;
int main(){
int i,n,id,left,right,root;
scanf("%d",&n);
tree = (node *)malloc(sizeof(node)*n);
for(i=0;i<n;i++) tree[i].parent = -1;
for(i=0;i<n;i++){
scanf("%d %d %d",&id,&left,&right);
tree[id].left=left;
tree[id].right=right;
if(left!=-1) tree[left].parent=id;
if(right!=-1) tree[right].parent=id;
}
for(i=0;i<n;i++){
if(tree[i].parent==-1) break;
}
root=i;
#ifdef DEBUG
printf("debug\n");
printf("n=%d\n",n);
for(i=0;i<n;i++){
printf("%d %d %d parent=%d\n",i,tree[i].left,tree[i].right,tree[i].parent);
}
#endif
printf("Preorder\n");
Preorder(root);
printf("\n");
printf("Inorder\n");
Inorder(root);
printf("\n");
printf("Postorder\n");
Postorder(root);
printf("\n");
return 0;
}
void Preorder(int c){
printf(" %d",c);
if(tree[c].left != -1) Preorder(tree[c].left);
if(tree[c].right != -1) Preorder(tree[c].right);
return;
}
void Inorder(int c){
if(tree[c].left != -1) Inorder(tree[c].left);
printf(" %d",c);
if(tree[c].right != -1) Inorder(tree[c].right);
return;
}
void Postorder(int c){
if(tree[c].left != -1) Postorder(tree[c].left);
if(tree[c].right != -1) Postorder(tree[c].right);
printf(" %d",c);
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102156/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102156/source.c"
target datalayout = "e-m:e-p270: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
@tree = dso_local local_unnamed_addr global ptr null, align 8
@.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
@n = dso_local local_unnamed_addr global i32 0, align 4
@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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #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
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 12
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
store ptr %call1, ptr @tree, align 8, !tbaa !9
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body.lr.ph, label %for.end42
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.node, ptr %call1, i64 %indvars.iv.epil, i32 2
store i32 -1, ptr %parent.epil, align 4, !tbaa !11
%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 !13
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp64, label %for.body6, label %for.end42
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.node, ptr %call1, i64 %indvars.iv, i32 2
store i32 -1, ptr %parent, align 4, !tbaa !11
%indvars.iv.next = or i64 %indvars.iv, 1
%parent.1 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next, i32 2
store i32 -1, ptr %parent.1, align 4, !tbaa !11
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%parent.2 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next.1, i32 2
store i32 -1, ptr %parent.2, align 4, !tbaa !11
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%parent.3 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next.2, i32 2
store i32 -1, ptr %parent.3, align 4, !tbaa !11
%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 !15
for.cond29.preheader: ; preds = %for.inc26
%cmp3068 = icmp sgt i32 %11, 0
br i1 %cmp3068, label %for.body32.lr.ph, label %for.end42
for.body32.lr.ph: ; preds = %for.cond29.preheader
%wide.trip.count77 = zext i32 %11 to i64
br label %for.body32
for.body6: ; preds = %for.cond3.preheader, %for.inc26
%i.167 = phi i32 [ %inc27, %for.inc26 ], [ 0, %for.cond3.preheader ]
%call7 = 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 ptr, ptr @tree, align 8, !tbaa !9
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom8 = sext i32 %4 to i64
%arrayidx9 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom8
store i32 %2, ptr %arrayidx9, align 4, !tbaa !17
%5 = load i32, ptr %right, align 4, !tbaa !5
%6 = load i32, ptr %id, align 4, !tbaa !5
%idxprom11 = sext i32 %6 to i64
%right13 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom11, i32 1
store i32 %5, ptr %right13, align 4, !tbaa !18
%7 = load i32, ptr %left, align 4, !tbaa !5
%cmp14.not = icmp eq i32 %7, -1
br i1 %cmp14.not, label %if.end, label %if.then
if.then: ; preds = %for.body6
%8 = load i32, ptr %id, align 4, !tbaa !5
%idxprom16 = sext i32 %7 to i64
%parent18 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom16, i32 2
store i32 %8, ptr %parent18, align 4, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %for.body6
%9 = load i32, ptr %right, align 4, !tbaa !5
%cmp19.not = icmp eq i32 %9, -1
br i1 %cmp19.not, label %for.inc26, label %if.then21
if.then21: ; preds = %if.end
%10 = load i32, ptr %id, align 4, !tbaa !5
%idxprom22 = sext i32 %9 to i64
%parent24 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom22, i32 2
store i32 %10, ptr %parent24, align 4, !tbaa !11
br label %for.inc26
for.inc26: ; preds = %if.end, %if.then21
%inc27 = add nuw nsw i32 %i.167, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc27, %11
br i1 %cmp4, label %for.body6, label %for.cond29.preheader, !llvm.loop !19
for.body32: ; preds = %for.body32.lr.ph, %for.inc40
%indvars.iv74 = phi i64 [ 0, %for.body32.lr.ph ], [ %indvars.iv.next75, %for.inc40 ]
%parent35 = getelementptr inbounds %struct.node, ptr %3, i64 %indvars.iv74, i32 2
%12 = load i32, ptr %parent35, align 4, !tbaa !11
%cmp36 = icmp eq i32 %12, -1
br i1 %cmp36, label %for.end42.loopexit.split.loop.exit, label %for.inc40
for.inc40: ; preds = %for.body32
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond78.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count77
br i1 %exitcond78.not, label %for.end42, label %for.body32, !llvm.loop !20
for.end42.loopexit.split.loop.exit: ; preds = %for.body32
%13 = trunc i64 %indvars.iv74 to i32
br label %for.end42
for.end42: ; preds = %for.inc40, %for.end42.loopexit.split.loop.exit, %entry, %for.cond3.preheader, %for.cond29.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond29.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %13, %for.end42.loopexit.split.loop.exit ], [ %11, %for.inc40 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %i.2.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts60 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %i.2.lcssa)
%putchar61 = call i32 @putchar(i32 10)
%puts62 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %i.2.lcssa)
%putchar63 = 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 %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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %c) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%c.tr = phi i32 [ %c, %entry ], [ %3, %if.end ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %c.tr)
%0 = load ptr, ptr @tree, align 8, !tbaa !9
%idxprom = sext i32 %c.tr to i64
%arrayidx = getelementptr inbounds %struct.node, ptr %0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !17
%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 @tree, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%2 = phi ptr [ %.pre, %if.then ], [ %0, %tailrecurse ]
%right = getelementptr inbounds %struct.node, ptr %2, i64 %idxprom, i32 1
%3 = load i32, ptr %right, align 4, !tbaa !18
%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 @Inorder(i32 noundef %c) local_unnamed_addr #0 {
entry:
%.pre = load ptr, ptr @tree, align 8, !tbaa !9
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%0 = phi ptr [ %.pre, %entry ], [ %2, %if.end ]
%c.tr = phi i32 [ %c, %entry ], [ %3, %if.end ]
%idxprom = sext i32 %c.tr to i64
%arrayidx = getelementptr inbounds %struct.node, ptr %0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !17
%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.6, i32 noundef %c.tr)
%2 = load ptr, ptr @tree, align 8, !tbaa !9
%right = getelementptr inbounds %struct.node, ptr %2, i64 %idxprom, i32 1
%3 = load i32, ptr %right, align 4, !tbaa !18
%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 %c) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @tree, align 8, !tbaa !9
%idxprom = sext i32 %c to i64
%arrayidx = getelementptr inbounds %struct.node, ptr %0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !17
%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 @tree, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi ptr [ %.pre, %if.then ], [ %0, %entry ]
%right = getelementptr inbounds %struct.node, ptr %2, i64 %idxprom, i32 1
%3 = load i32, ptr %right, align 4, !tbaa !18
%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.6, i32 noundef %c)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"node", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !6, i64 0}
!18 = !{!12, !6, i64 4}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
|
/*
* Binary Tree
* output 1)node_number, 2)parent_number, 3)depth, 4)kind_of_node, 5)child_list
*/
/* inclution */
#include <stdio.h>
/* Definition */
#define MAX 100000
#define NIL -1
/* Prototype */
void preOrder(int);
void inOrder(int);
void postOrder(int);
void printTree(int);
/* Global Variables */
struct node {
int parent, left, right;
};
typedef struct node Node;
Node T[MAX]; //array for tree
int n; //number of tree array
/* main */
int main(){
int i,j,key,left,right,root=0;
/* input the number of A[] */
scanf("%d",&n);
/* initialize array */
for(i=0;i<n;i++) { //??¨??????NIL??§?????????
T[i].parent = NIL;
T[i].left = NIL;
T[i].right = NIL;
}
/* input datas */
for(i=0;i<n;i++){
scanf("%d", &key);
scanf("%d %d",&left, &right);
//??????????´?
T[key].left = left;
T[key].right = right;
//???????????¨????????????????????????????¨????
if(left != NIL) {
T[left].parent = key;
}
if(right != NIL) {
T[right].parent = key;
}
}
// /* print out */
// for(i=0;i<n;i++) {
// printTree(i); //print????????????
// }
//
/* set root node */
for(i=0;i<n;i++){
if(T[i].parent == NIL) {
root = i;
}
}
/* printing */
printf("Preorder\n");
preOrder(root);
printf("\n");
printf("Inorder\n");
inOrder(root);
printf("\n");
printf("Postorder\n");
postOrder(root);
printf("\n");
return 0;
}
/* Print ???????????? */
void printTree(int u) { //u???node??????
int i, c;
/* each elements */
printf("node %d: ",u); //node
printf("parent = %d, ", T[u].parent);
/* print child list */
printf("[");
c = T[u].left; //??????????????????
while(c!=NIL){ //?????????????????¨????????????????????????????????????
if(c==T[u].left){ //???????????????????????´
printf("%d",c);
}else {
printf(", %d", c);
}
c = T[c].right; //?????????????????????
}
printf("]\n");
}
/*????????????*/
void preOrder(int u){
if (u != NIL) {
//????????????
printf(" ");
printf("%d",u);
//???
preOrder(T[u].left);
//???
preOrder(T[u].right);
}
}
/*????????????*/
void inOrder(int u){
if(u != NIL){
//???????????¨?????¨
inOrder(T[u].left);
printf(" ");
//???????????¨?????????(?????????)
printf("%d",u);
//?????¨?????¨
inOrder(T[u].right);
}
}
/*????????????*/
void postOrder(int u){
if (u != NIL) {
postOrder(T[u].left);
postOrder(T[u].right);
printf(" ");
printf("%d",u);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102206/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102206/source.c"
target datalayout = "e-m:e-p270: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
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.6 = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.9 = private unnamed_addr constant [5 x i8] c", %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.12 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.13 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
@str.14 = 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:
%key = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #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 @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body9.preheader, label %for.end42
for.body9.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.body9
for.cond31.preheader: ; preds = %for.inc28
%cmp3270 = icmp sgt i32 %7, 0
br i1 %cmp3270, label %for.body33.preheader, label %for.end42
for.body33.preheader: ; preds = %for.cond31.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.end42.loopexit.unr-lcssa, label %for.body33.preheader.new
for.body33.preheader.new: ; preds = %for.body33.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body33
for.body9: ; preds = %for.body9.preheader, %for.inc28
%i.169 = phi i32 [ %inc29, %for.inc28 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom12 = sext i32 %5 to i64
%left14 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom12, i32 1
store i32 %4, ptr %left14, align 4, !tbaa !9
%6 = load i32, ptr %right, align 4, !tbaa !5
%right17 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom12, i32 2
store i32 %6, ptr %right17, align 4, !tbaa !11
%cmp18.not = icmp eq i32 %4, -1
br i1 %cmp18.not, label %if.end, label %if.then
if.then: ; preds = %for.body9
%idxprom19 = sext i32 %4 to i64
%arrayidx20 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body9
%cmp22.not = icmp eq i32 %6, -1
br i1 %cmp22.not, label %for.inc28, label %if.then23
if.then23: ; preds = %if.end
%idxprom24 = sext i32 %6 to i64
%arrayidx25 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom24
store i32 %5, ptr %arrayidx25, align 4, !tbaa !12
br label %for.inc28
for.inc28: ; preds = %if.end, %if.then23
%inc29 = add nuw nsw i32 %i.169, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc29, %7
br i1 %cmp8, label %for.body9, label %for.cond31.preheader, !llvm.loop !13
for.body33: ; preds = %for.body33, %for.body33.preheader.new
%indvars.iv = phi i64 [ 0, %for.body33.preheader.new ], [ %indvars.iv.next.3, %for.body33 ]
%root.072 = phi i32 [ 0, %for.body33.preheader.new ], [ %spec.select.3, %for.body33 ]
%niter = phi i64 [ 0, %for.body33.preheader.new ], [ %niter.next.3, %for.body33 ]
%arrayidx35 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx35, align 16, !tbaa !12
%cmp37 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp37, i32 %9, i32 %root.072
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx35.1 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx35.1, align 4, !tbaa !12
%cmp37.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp37.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx35.2 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx35.2, align 8, !tbaa !12
%cmp37.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp37.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx35.3 = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx35.3, align 4, !tbaa !12
%cmp37.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp37.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.end42.loopexit.unr-lcssa, label %for.body33, !llvm.loop !15
for.end42.loopexit.unr-lcssa: ; preds = %for.body33, %for.body33.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body33.preheader ], [ %spec.select.3, %for.body33 ]
%indvars.iv.unr = phi i64 [ 0, %for.body33.preheader ], [ %indvars.iv.next.3, %for.body33 ]
%root.072.unr = phi i32 [ 0, %for.body33.preheader ], [ %spec.select.3, %for.body33 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end42, label %for.body33.epil
for.body33.epil: ; preds = %for.end42.loopexit.unr-lcssa, %for.body33.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body33.epil ], [ %indvars.iv.unr, %for.end42.loopexit.unr-lcssa ]
%root.072.epil = phi i32 [ %spec.select.epil, %for.body33.epil ], [ %root.072.unr, %for.end42.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body33.epil ], [ 0, %for.end42.loopexit.unr-lcssa ]
%arrayidx35.epil = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx35.epil, align 4, !tbaa !12
%cmp37.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp37.epil, i32 %17, i32 %root.072.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.end42, label %for.body33.epil, !llvm.loop !16
for.end42: ; preds = %for.end42.loopexit.unr-lcssa, %for.body33.epil, %entry, %for.cond31.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond31.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end42.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body33.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preOrder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts62 = call i32 @puts(ptr nonnull dereferenceable(1) @str.12)
call void @inOrder(i32 noundef %root.0.lcssa)
%putchar63 = call i32 @putchar(i32 10)
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.13)
call void @postOrder(i32 noundef %root.0.lcssa)
%putchar65 = 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 %key) #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:
%cmp.not7 = icmp eq i32 %u, -1
br i1 %cmp.not7, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr8 = phi i32 [ %1, %if.then ], [ %u, %entry ]
%putchar = tail call i32 @putchar(i32 32)
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr8)
%idxprom = sext i32 %u.tr8 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 !9
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 !11
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inOrder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp.not7 = icmp eq i32 %u, -1
br i1 %cmp.not7, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr8 = phi i32 [ %1, %if.then ], [ %u, %entry ]
%idxprom = sext i32 %u.tr8 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 !9
tail call void @inOrder(i32 noundef %0)
%putchar = tail call i32 @putchar(i32 32)
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr8)
%right = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postOrder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp.not = icmp eq i32 %u, -1
br i1 %cmp.not, label %common.ret7, label %if.then
common.ret7: ; preds = %entry, %if.then
ret void
if.then: ; 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 !9
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 !11
tail call void @postOrder(i32 noundef %1)
%putchar = tail call i32 @putchar(i32 32)
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret7
}
; 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 @printTree(i32 noundef %u) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %0)
%putchar = tail call i32 @putchar(i32 91)
%left = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1
%c.021 = load i32, ptr %left, align 4, !tbaa !5
%cmp.not22 = icmp eq i32 %c.021, -1
br i1 %cmp.not22, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%c.023 = phi i32 [ %c.0, %while.body ], [ %c.021, %entry ]
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp8 = icmp eq i32 %c.023, %1
%.str..str.9 = select i1 %cmp8, ptr @.str, ptr @.str.9
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.9, i32 noundef %c.023)
%idxprom11 = sext i32 %c.023 to i64
%right = getelementptr inbounds [100000 x %struct.node], ptr @T, i64 0, i64 %idxprom11, i32 2
%c.0 = load i32, ptr %right, align 4, !tbaa !5
%cmp.not = icmp eq i32 %c.0, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.14)
ret void
}
; 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"}
!18 = distinct !{!18, !14}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int p, l, r;
};
struct 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_102271/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102271/source.c"
target datalayout = "e-m:e-p270: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>
int Sibling(int);
int degree(int);
int Depth(int);
int height(int);
void inorder(int);
void preorder(int);
void postorder(int);
typedef struct{
int id;
int parent;
int left;
int right;
}tree;
tree *TREE;
int N;
#define fr -1
int main(){
int id,i,j,de,depth,ro,l,r;
scanf("%d",&N);
TREE = (tree *)malloc(sizeof(tree)*N);
for(i=0;i<N;i++){
//TREE[i].id = fr;
TREE[i].parent = fr;
//TREE[i].left = fr;
//TREE[i].right = fr;
}
for(i=0;i<N;i++){
scanf("%d %d %d",&j,&l,&r);
TREE[j].id=j;
TREE[j].left = l;
TREE[j].right = r;
if(TREE[j].left!=fr){
TREE[TREE[j].left].parent = TREE[j].id;
}
if(TREE[j].right!=fr){
TREE[TREE[j].right].parent = TREE[j].id;
}
}
for(i=0;i<N;i++){
if(TREE[i].parent == fr)ro = i;
}
printf("Preorder\n");
preorder(ro);
printf("\nInorder\n");
inorder(ro);
printf("\nPostorder\n");
postorder(ro);
printf("\n");
return 0;
}
//Sibling Function!<f>
int Sibling(int id){
int i;
for(i=0;i<N;i++){
if(TREE[id].parent == TREE[i].parent && id != i){
return i;
}
}
return -1;
}
//degree Function!<f>
int degree(int id){
int i;
if(TREE[id].left != -1 && TREE[id].right != -1){
return 2;
}
else if(TREE[id].left != -1 || TREE[id].right != -1){
return 1;
}
else return 0;
}
//depth Function!<f>
int Depth(int id){
int i = TREE[id].parent;
int depth = 0;
while(i!=fr){
i = TREE[i].parent;
depth++;
}
return depth;
}
//height Function
int height(int id){
int lheight=0,rheight=0;
if(TREE[id].left != fr){
lheight = height(TREE[id].left) + 1;
}
if(TREE[id].right != fr){
rheight = height(TREE[id].right) + 1;
}
if(lheight > rheight){
return lheight;
}
else{
return rheight;
}
}
void preorder(int x){
if(x==fr){
return;
}
printf(" %d",x);
if(TREE[x].left!=-1){
preorder(TREE[x].left);
}
if(TREE[x].right!=-1){
preorder(TREE[x].right);
}
}
void inorder(int x){
if(x==fr){
return;
}
if(TREE[x].left != -1)
{
inorder(TREE[x].left);
}
printf(" %d",x);
if(TREE[x].right != -1){
inorder(TREE[x].right);
}
}
void postorder(int x){
if(x==fr){
return;
}
if(TREE[x].left != -1) {
postorder(TREE[x].left);
}
if(TREE[x].right != -1) {
postorder(TREE[x].right);
}
printf(" %d",x);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102314/source.c"
target datalayout = "e-m:e-p270: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 [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@TREE = dso_local local_unnamed_addr global ptr null, align 8
@.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:
%j = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #9
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 4
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #10
store ptr %call1, ptr @TREE, align 8, !tbaa !9
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body.preheader, label %for.end61
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.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%parent.epil = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv.epil, i32 1
store i32 -1, ptr %parent.epil, align 4, !tbaa !11
%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 !13
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp79, label %for.body6, label %for.end61
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 ]
%parent = getelementptr inbounds %struct.tree, ptr %call1, i64 %indvars.iv, i32 1
store i32 -1, ptr %parent, align 4, !tbaa !11
%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 !11
%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 !11
%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 !11
%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 !15
for.cond48.preheader: ; preds = %for.inc45
%cmp4983 = icmp sgt i32 %14, 0
br i1 %cmp4983, label %for.body51.lr.ph, label %for.end61
for.body51.lr.ph: ; preds = %for.cond48.preheader
%wide.trip.count92 = zext i32 %14 to i64
%xtraiter100 = and i64 %wide.trip.count92, 3
%2 = icmp ult i32 %14, 4
br i1 %2, label %for.end61.loopexit.unr-lcssa, label %for.body51.lr.ph.new
for.body51.lr.ph.new: ; preds = %for.body51.lr.ph
%unroll_iter104 = and i64 %wide.trip.count92, 4294967292
br label %for.body51
for.body6: ; preds = %for.cond3.preheader, %for.inc45
%i.182 = phi i32 [ %inc46, %for.inc45 ], [ 0, %for.cond3.preheader ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %j, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %j, align 4, !tbaa !5
%4 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom8 = sext i32 %3 to i64
%arrayidx9 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom8
store i32 %3, ptr %arrayidx9, align 4, !tbaa !17
%5 = load i32, ptr %l, align 4, !tbaa !5
%6 = load i32, ptr %j, align 4, !tbaa !5
%idxprom11 = sext i32 %6 to i64
%left = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom11, i32 2
store i32 %5, ptr %left, align 4, !tbaa !18
%7 = load i32, ptr %r, align 4, !tbaa !5
%8 = load i32, ptr %j, align 4, !tbaa !5
%idxprom13 = sext i32 %8 to i64
%right = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom13, i32 3
store i32 %7, ptr %right, align 4, !tbaa !19
%9 = load i32, ptr %j, align 4, !tbaa !5
%idxprom15 = sext i32 %9 to i64
%left17 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom15, i32 2
%10 = load i32, ptr %left17, align 4, !tbaa !18
%cmp18.not = icmp eq i32 %10, -1
br i1 %cmp18.not, label %if.end, label %if.then
if.then: ; preds = %for.body6
%arrayidx16 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom15
%11 = load i32, ptr %arrayidx16, align 4, !tbaa !17
%idxprom26 = sext i32 %10 to i64
%parent28 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom26, i32 1
store i32 %11, ptr %parent28, align 4, !tbaa !11
%.pre = load i32, ptr %j, align 4, !tbaa !5
%.pre94 = sext i32 %.pre to i64
br label %if.end
if.end: ; preds = %if.then, %for.body6
%idxprom29.pre-phi = phi i64 [ %.pre94, %if.then ], [ %idxprom15, %for.body6 ]
%right31 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom29.pre-phi, i32 3
%12 = load i32, ptr %right31, align 4, !tbaa !19
%cmp32.not = icmp eq i32 %12, -1
br i1 %cmp32.not, label %for.inc45, label %if.then34
if.then34: ; preds = %if.end
%arrayidx30 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom29.pre-phi
%13 = load i32, ptr %arrayidx30, align 4, !tbaa !17
%idxprom41 = sext i32 %12 to i64
%parent43 = getelementptr inbounds %struct.tree, ptr %4, i64 %idxprom41, i32 1
store i32 %13, ptr %parent43, align 4, !tbaa !11
br label %for.inc45
for.inc45: ; preds = %if.end, %if.then34
%inc46 = add nuw nsw i32 %i.182, 1
%14 = load i32, ptr @N, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc46, %14
br i1 %cmp4, label %for.body6, label %for.cond48.preheader, !llvm.loop !20
for.body51: ; preds = %for.body51, %for.body51.lr.ph.new
%indvars.iv89 = phi i64 [ 0, %for.body51.lr.ph.new ], [ %indvars.iv.next90.3, %for.body51 ]
%ro.085 = phi i32 [ undef, %for.body51.lr.ph.new ], [ %spec.select.3, %for.body51 ]
%niter105 = phi i64 [ 0, %for.body51.lr.ph.new ], [ %niter105.next.3, %for.body51 ]
%parent54 = getelementptr inbounds %struct.tree, ptr %4, i64 %indvars.iv89, i32 1
%15 = load i32, ptr %parent54, align 4, !tbaa !11
%cmp55 = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv89 to i32
%spec.select = select i1 %cmp55, i32 %16, i32 %ro.085
%indvars.iv.next90 = or i64 %indvars.iv89, 1
%parent54.1 = getelementptr inbounds %struct.tree, ptr %4, i64 %indvars.iv.next90, i32 1
%17 = load i32, ptr %parent54.1, align 4, !tbaa !11
%cmp55.1 = icmp eq i32 %17, -1
%18 = trunc i64 %indvars.iv.next90 to i32
%spec.select.1 = select i1 %cmp55.1, i32 %18, i32 %spec.select
%indvars.iv.next90.1 = or i64 %indvars.iv89, 2
%parent54.2 = getelementptr inbounds %struct.tree, ptr %4, i64 %indvars.iv.next90.1, i32 1
%19 = load i32, ptr %parent54.2, align 4, !tbaa !11
%cmp55.2 = icmp eq i32 %19, -1
%20 = trunc i64 %indvars.iv.next90.1 to i32
%spec.select.2 = select i1 %cmp55.2, i32 %20, i32 %spec.select.1
%indvars.iv.next90.2 = or i64 %indvars.iv89, 3
%parent54.3 = getelementptr inbounds %struct.tree, ptr %4, i64 %indvars.iv.next90.2, i32 1
%21 = load i32, ptr %parent54.3, align 4, !tbaa !11
%cmp55.3 = icmp eq i32 %21, -1
%22 = trunc i64 %indvars.iv.next90.2 to i32
%spec.select.3 = select i1 %cmp55.3, i32 %22, i32 %spec.select.2
%indvars.iv.next90.3 = add nuw nsw i64 %indvars.iv89, 4
%niter105.next.3 = add i64 %niter105, 4
%niter105.ncmp.3 = icmp eq i64 %niter105.next.3, %unroll_iter104
br i1 %niter105.ncmp.3, label %for.end61.loopexit.unr-lcssa, label %for.body51, !llvm.loop !21
for.end61.loopexit.unr-lcssa: ; preds = %for.body51, %for.body51.lr.ph
%indvars.iv89.unr = phi i64 [ 0, %for.body51.lr.ph ], [ %indvars.iv.next90.3, %for.body51 ]
%ro.085.unr = phi i32 [ undef, %for.body51.lr.ph ], [ %spec.select.3, %for.body51 ]
%lcmp.mod102.not = icmp eq i64 %xtraiter100, 0
br i1 %lcmp.mod102.not, label %for.end61, label %for.body51.epil
for.body51.epil: ; preds = %for.end61.loopexit.unr-lcssa, %for.body51.epil
%indvars.iv89.epil = phi i64 [ %indvars.iv.next90.epil, %for.body51.epil ], [ %indvars.iv89.unr, %for.end61.loopexit.unr-lcssa ]
%ro.085.epil = phi i32 [ %spec.select.epil, %for.body51.epil ], [ %ro.085.unr, %for.end61.loopexit.unr-lcssa ]
%epil.iter101 = phi i64 [ %epil.iter101.next, %for.body51.epil ], [ 0, %for.end61.loopexit.unr-lcssa ]
%parent54.epil = getelementptr inbounds %struct.tree, ptr %4, i64 %indvars.iv89.epil, i32 1
%23 = load i32, ptr %parent54.epil, align 4, !tbaa !11
%cmp55.epil = icmp eq i32 %23, -1
%24 = trunc i64 %indvars.iv89.epil to i32
%spec.select.epil = select i1 %cmp55.epil, i32 %24, i32 %ro.085.epil
%indvars.iv.next90.epil = add nuw nsw i64 %indvars.iv89.epil, 1
%epil.iter101.next = add i64 %epil.iter101, 1
%epil.iter101.cmp.not = icmp eq i64 %epil.iter101.next, %xtraiter100
br i1 %epil.iter101.cmp.not, label %for.end61, label %for.body51.epil, !llvm.loop !22
for.end61: ; preds = %for.end61.loopexit.unr-lcssa, %for.body51.epil, %entry, %for.cond3.preheader, %for.cond48.preheader
%ro.0.lcssa = phi i32 [ undef, %for.cond48.preheader ], [ undef, %for.cond3.preheader ], [ undef, %entry ], [ %ro.085.unr, %for.end61.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body51.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preorder(i32 noundef %ro.0.lcssa)
%puts77 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inorder(i32 noundef %ro.0.lcssa)
%puts78 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postorder(i32 noundef %ro.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end6, %entry
%x.tr = phi i32 [ %x, %entry ], [ %3, %if.end6 ]
%cmp = icmp eq i32 %x.tr, -1
br i1 %cmp, label %if.end14, label %if.end
if.end: ; preds = %tailrecurse
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr)
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %x.tr to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !18
%cmp1.not = icmp eq i32 %1, -1
br i1 %cmp1.not, label %if.end6, label %if.then2
if.then2: ; preds = %if.end
tail call void @preorder(i32 noundef %1)
%.pre = load ptr, ptr @TREE, align 8, !tbaa !9
br label %if.end6
if.end6: ; preds = %if.then2, %if.end
%2 = phi ptr [ %.pre, %if.then2 ], [ %0, %if.end ]
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !19
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end14, label %tailrecurse
if.end14: ; preds = %tailrecurse, %if.end6
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end6, %entry
%x.tr = phi i32 [ %x, %entry ], [ %3, %if.end6 ]
%cmp = icmp eq i32 %x.tr, -1
br i1 %cmp, label %if.end14, label %if.end
if.end: ; preds = %tailrecurse
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %x.tr to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !18
%cmp1.not = icmp eq i32 %1, -1
br i1 %cmp1.not, label %if.end6, label %if.then2
if.then2: ; preds = %if.end
tail call void @inorder(i32 noundef %1)
br label %if.end6
if.end6: ; preds = %if.then2, %if.end
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr)
%2 = load ptr, ptr @TREE, align 8, !tbaa !9
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !19
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end14, label %tailrecurse
if.end14: ; preds = %tailrecurse, %if.end6
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 %return, label %if.end
if.end: ; preds = %entry
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %x to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !18
%cmp1.not = icmp eq i32 %1, -1
br i1 %cmp1.not, label %if.end6, label %if.then2
if.then2: ; preds = %if.end
tail call void @postorder(i32 noundef %1)
%.pre = load ptr, ptr @TREE, align 8, !tbaa !9
br label %if.end6
if.end6: ; preds = %if.then2, %if.end
%2 = phi ptr [ %.pre, %if.then2 ], [ %0, %if.end ]
%right = getelementptr inbounds %struct.tree, ptr %2, i64 %idxprom, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !19
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end14, label %if.then10
if.then10: ; preds = %if.end6
tail call void @postorder(i32 noundef %3)
br label %if.end14
if.end14: ; preds = %if.then10, %if.end6
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x)
br label %return
return: ; preds = %entry, %if.end14
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @Sibling(i32 noundef %id) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %id to i64
%parent = getelementptr inbounds %struct.tree, ptr %1, i64 %idxprom, i32 1
%2 = load i32, ptr %parent, align 4, !tbaa !11
%3 = zext i32 %id to i64
%wide.trip.count = zext i32 %0 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 ]
%parent3 = getelementptr inbounds %struct.tree, ptr %1, i64 %indvars.iv, i32 1
%4 = load i32, ptr %parent3, align 4, !tbaa !11
%cmp4 = icmp ne i32 %2, %4
%cmp5.not = icmp eq i64 %indvars.iv, %3
%or.cond = or i1 %cmp5.not, %cmp4
br i1 %or.cond, label %for.inc, label %cleanup.loopexit.split.loop.exit15
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 !23
cleanup.loopexit.split.loop.exit15: ; preds = %for.body
%5 = trunc i64 %indvars.iv to i32
br label %cleanup
cleanup: ; preds = %for.inc, %cleanup.loopexit.split.loop.exit15, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %5, %cleanup.loopexit.split.loop.exit15 ], [ -1, %for.inc ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @degree(i32 noundef %id) local_unnamed_addr #5 {
entry:
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %id to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !18
%cmp.not = icmp eq i32 %1, -1
%right10 = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 3
%2 = load i32, ptr %right10, align 4, !tbaa !19
%cmp11.not = icmp ne i32 %2, -1
%spec.select = zext i1 %cmp11.not to i32
%cmp3.not = icmp eq i32 %2, -1
%spec.select17 = select i1 %cmp3.not, i32 1, i32 2
%retval.0 = select i1 %cmp.not, i32 %spec.select, i32 %spec.select17
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @Depth(i32 noundef %id) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%idxprom.pn.in = phi i32 [ %id, %entry ], [ %i.0, %while.cond ]
%depth.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%idxprom.pn = sext i32 %idxprom.pn.in to i64
%i.0.in = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom.pn, i32 1
%i.0 = load i32, ptr %i.0.in, align 4, !tbaa !11
%cmp.not = icmp eq i32 %i.0, -1
%inc = add nuw nsw i32 %depth.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !24
while.end: ; preds = %while.cond
ret i32 %depth.0
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @height(i32 noundef %id) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr @TREE, align 8, !tbaa !9
%idxprom = sext i32 %id to i64
%left = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !18
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @height(i32 noundef %1)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%lheight.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds %struct.tree, ptr %0, i64 %idxprom, i32 3
%2 = load i32, ptr %right, align 4, !tbaa !19
%cmp6.not = icmp eq i32 %2, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @height(i32 noundef %2)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%rheight.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%lheight.0.rheight.0 = tail call i32 @llvm.smax.i32(i32 %lheight.0, i32 %rheight.0)
ret i32 %lheight.0.rheight.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 4}
!12 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !6, i64 0}
!18 = !{!12, !6, i64 8}
!19 = !{!12, !6, i64 12}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{int p, l, r;};
struct 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_102365/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102365/source.c"
target datalayout = "e-m:e-p270: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>
#define MAX 100005
#define NIL -1
struct Node{ int p, l, r;};
struct Node T[MAX];
void inorder(int u){
if(u != NIL){
inorder(T[u].l);
printf(" %d",u);
inorder(T[u].r);
}
}
void preorder(int u){
if(u != NIL){
printf(" %d",u);
preorder(T[u].l);
preorder(T[u].r);
}
}
void postorder(int u){
if(u != NIL){
postorder(T[u].l);
postorder(T[u].r);
printf(" %d",u);
}
}
int main(){
int i, v,n;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
T[i].p = T[i].l = T[i].r = NIL;
}
for ( i = 0; i < n; i++ ){
scanf("%d",&v);
scanf("%d %d",&T[v].l,&T[v].r);
T[T[v].l].p = v;
T[T[v].r].p = v;
}
printf("Preorder\n");
for(i=0; i<n; i++){
if(T[i].p == NIL)
preorder(i);
}
printf("\nInorder\n");
for(i=0; i<n; i++){
if(T[i].p == NIL)
inorder(i);
}
printf("\nPostorder\n");
for(i=0; i<n; i++){
if(T[i].p == NIL)
postorder(i);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102408/source.c"
target datalayout = "e-m:e-p270: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 }
@T = dso_local global [100005 x %struct.Node] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c" %d\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"%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 @inorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp eq i32 %u, -1
br i1 %cmp.not6, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr7 = phi i32 [ %1, %if.then ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [100005 x %struct.Node], 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 [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %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 @preorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp eq i32 %u, -1
br i1 %cmp.not6, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr7 = phi i32 [ %1, %if.then ], [ %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 [100005 x %struct.Node], 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 [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postorder(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp.not = icmp eq i32 %u, -1
br i1 %cmp.not, label %common.ret6, label %if.then
common.ret6: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [100005 x %struct.Node], 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 [100005 x %struct.Node], 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
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp89 = icmp sgt i32 %0, 0
br i1 %cmp89, label %for.body7.preheader, label %for.end30
for.body7.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 !11
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%i.192 = phi i32 [ %inc29, %for.body7 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%3 = load i32, ptr %v, align 4, !tbaa !11
%idxprom9 = sext i32 %3 to i64
%l11 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 1
%r14 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 2
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %l11, ptr noundef nonnull %r14)
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom16 = sext i32 %4 to i64
%l18 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom16, i32 1
%5 = load i32, ptr %l18, align 4, !tbaa !5
%idxprom19 = sext i32 %5 to i64
%arrayidx20 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom19
store i32 %4, ptr %arrayidx20, align 4, !tbaa !12
%r24 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom16, i32 2
%6 = load i32, ptr %r24, align 4, !tbaa !10
%idxprom25 = sext i32 %6 to i64
%arrayidx26 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom25
store i32 %4, ptr %arrayidx26, align 4, !tbaa !12
%inc29 = add nuw nsw i32 %i.192, 1
%7 = load i32, ptr %n, align 4, !tbaa !11
%cmp6 = icmp slt i32 %inc29, %7
br i1 %cmp6, label %for.body7, label %for.end30, !llvm.loop !13
for.end30: ; preds = %for.body7, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%8 = load i32, ptr %n, align 4, !tbaa !11
%cmp3393 = icmp sgt i32 %8, 0
br i1 %cmp3393, label %for.body34, label %for.end41
for.body34: ; preds = %for.end30, %for.inc39
%9 = phi i32 [ %12, %for.inc39 ], [ %8, %for.end30 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc39 ], [ 0, %for.end30 ]
%arrayidx36 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx36, align 4, !tbaa !12
%cmp38 = icmp eq i32 %10, -1
br i1 %cmp38, label %if.then, label %for.inc39
if.then: ; preds = %for.body34
%11 = trunc i64 %indvars.iv to i32
call void @preorder(i32 noundef %11)
%.pre = load i32, ptr %n, align 4, !tbaa !11
br label %for.inc39
for.inc39: ; preds = %for.body34, %if.then
%12 = phi i32 [ %9, %for.body34 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = sext i32 %12 to i64
%cmp33 = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp33, label %for.body34, label %for.end41, !llvm.loop !15
for.end41: ; preds = %for.inc39, %for.end30
%puts87 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%14 = load i32, ptr %n, align 4, !tbaa !11
%cmp4495 = icmp sgt i32 %14, 0
br i1 %cmp4495, label %for.body45, label %for.end54
for.body45: ; preds = %for.end41, %for.inc52
%15 = phi i32 [ %18, %for.inc52 ], [ %14, %for.end41 ]
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.inc52 ], [ 0, %for.end41 ]
%arrayidx47 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv101
%16 = load i32, ptr %arrayidx47, align 4, !tbaa !12
%cmp49 = icmp eq i32 %16, -1
br i1 %cmp49, label %if.then50, label %for.inc52
if.then50: ; preds = %for.body45
%17 = trunc i64 %indvars.iv101 to i32
call void @inorder(i32 noundef %17)
%.pre107 = load i32, ptr %n, align 4, !tbaa !11
br label %for.inc52
for.inc52: ; preds = %for.body45, %if.then50
%18 = phi i32 [ %15, %for.body45 ], [ %.pre107, %if.then50 ]
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%19 = sext i32 %18 to i64
%cmp44 = icmp slt i64 %indvars.iv.next102, %19
br i1 %cmp44, label %for.body45, label %for.end54, !llvm.loop !16
for.end54: ; preds = %for.inc52, %for.end41
%puts88 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%20 = load i32, ptr %n, align 4, !tbaa !11
%cmp5797 = icmp sgt i32 %20, 0
br i1 %cmp5797, label %for.body58, label %for.end67
for.body58: ; preds = %for.end54, %for.inc65
%21 = phi i32 [ %24, %for.inc65 ], [ %20, %for.end54 ]
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc65 ], [ 0, %for.end54 ]
%arrayidx60 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv104
%22 = load i32, ptr %arrayidx60, align 4, !tbaa !12
%cmp62 = icmp eq i32 %22, -1
br i1 %cmp62, label %if.then63, label %for.inc65
if.then63: ; preds = %for.body58
%23 = trunc i64 %indvars.iv104 to i32
call void @postorder(i32 noundef %23)
%.pre108 = load i32, ptr %n, align 4, !tbaa !11
br label %for.inc65
for.inc65: ; preds = %for.body58, %if.then63
%24 = phi i32 [ %21, %for.body58 ], [ %.pre108, %if.then63 ]
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%25 = sext i32 %24 to i64
%cmp57 = icmp slt i64 %indvars.iv.next105, %25
br i1 %cmp57, label %for.body58, label %for.end67, !llvm.loop !17
for.end67: ; preds = %for.inc65, %for.end54
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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 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
; 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 = { nofree nounwind "no-trapping-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 = { 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, !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.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
|
#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(void){
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;
puts("Preorder");
preParse(root);
puts("");
puts("Inorder");
inParse(root);
puts("");
puts("Postorder");
postParse(root);
puts("");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102466/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102466/source.c"
target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@.str.5 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@.str.6 = 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
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, 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 %cmp55, 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
%cmp2559 = icmp sgt i32 %6, 0
br i1 %cmp2559, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.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.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter76 = and i64 %wide.trip.count68, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.158 = 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.158, 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.iv65 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next66.3, %for.body26 ]
%root.061 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter77 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter77.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv65
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv65 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.061
%indvars.iv.next66 = or i64 %indvars.iv65, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next66
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next66 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next66.1 = or i64 %indvars.iv65, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next66.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next66.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next66.2 = or i64 %indvars.iv65, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next66.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next66.2 to i32
%spec.select.3 = select i1 %cmp30.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.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv65.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next66.3, %for.body26 ]
%root.061.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod74.not = icmp eq i64 %xtraiter72, 0
br i1 %lcmp.mod74.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv65.epil = phi i64 [ %indvars.iv.next66.epil, %for.body26.epil ], [ %indvars.iv65.unr, %for.end35.loopexit.unr-lcssa ]
%root.061.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.061.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter73 = phi i64 [ %epil.iter73.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %indvars.iv65.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv65.epil to i32
%spec.select.epil = select i1 %cmp30.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.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.061.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%call36 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%call38 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar53 = call i32 @putchar(i32 10)
%call40 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar54 = 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: nofree nounwind
declare noundef i32 @puts(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 @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 N 10000
#define NIL -1
struct Node{
int id;
int left;
int right;
};
struct Node Tree[N];
int n;
void preorder(int x){
if(x == NIL) return;
printf(" %d", x);
preorder(Tree[x].left);
preorder(Tree[x].right);
}
void inorder(int x){
if(x == NIL) return;
inorder(Tree[x].left);
printf(" %d", x);
inorder(Tree[x].right);
}
void postorder(int x){
if(x == NIL) return;
postorder(Tree[x].left);
postorder(Tree[x].right);
printf(" %d", x);
}
int main(){
int i, v, left, right, root;
scanf("%d", &n);
for(i = 0; i < n; i++){
Tree[i].id = NIL;
}
for(i = 0; i < n; i++){
scanf("%d %d %d", &v, &left, &right);
Tree[v].left = left;
Tree[v].right = right;
if(left != NIL){
Tree[left].id = v;
}
if(right != NIL){
Tree[right].id = v;
}
}
for(i = 0; i < n; i++){
if(Tree[i].id == 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_102509/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102509/source.c"
target datalayout = "e-m:e-p270: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 %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, i32 noundef %x.tr7)
%idxprom = sext i32 %x.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @preorder(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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 %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 [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, 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 %x.tr7)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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 %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 [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @postorder(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, 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 %x)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%left = alloca i32, align 4
%right = 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 %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
%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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 %left, ptr noundef nonnull %right)
%3 = load i32, ptr %left, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%left7 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %left7, align 4, !tbaa !5
%5 = load i32, ptr %right, align 4, !tbaa !11
%right10 = getelementptr inbounds [10000 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %right10, 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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 @Tree, 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 @preorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inorder(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postorder(i32 noundef %root.0.lcssa)
%putchar56 = 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 %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>
#define MAX 100000000
#define noParent -1
struct Node{
int id, l, r;
};
struct Node box[MAX];
void preParse(int u){
if ( u == noParent ) return;
printf(" %d", u);
preParse(box[u].l);
preParse(box[u].r);
}
void inParse(int u){
if ( u == noParent ) return;
inParse(box[u].l);
printf(" %d", u);
inParse(box[u].r);
}
void postParse(int u){
if ( u == noParent ) return;
postParse(box[u].l);
postParse(box[u].r);
printf(" %d", u);
}
int main () {
int i,n,id,left,right,root;
scanf("%d",&n);
for(i=0;i<n;i++) {
box[i].id = noParent;
}
for(i=0;i<n;i++) {
scanf("%d %d %d",&id,&left,&right);
box[id].l = left;
box[id].r = right;
if ( left != noParent ) box[left].id = id;
if ( right != noParent ) box[right].id = id;
}
for ( i = 0; i < n; i++ ) {
if ( box[i].id == noParent ) root = i;
}
for (i = 0;i < n; i++) if ( box[id].id == noParent ) 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_102552/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102552/source.c"
target datalayout = "e-m:e-p270: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
@box = dso_local local_unnamed_addr global [100000000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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:
%n = alloca i32, align 4
%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 %n) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, 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.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 [100000000 x %struct.Node], ptr @box, 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.cond2.preheader, label %for.body.epil, !llvm.loop !13
for.cond2.preheader: ; preds = %for.body.epil, %for.cond2.preheader.unr-lcssa
br i1 %cmp72, label %for.body4, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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 [100000000 x %struct.Node], ptr @box, 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.cond2.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond23.preheader: ; preds = %for.inc20
%2 = sext i32 %5 to i64
%cmp2476 = icmp sgt i32 %7, 0
br i1 %cmp2476, label %for.body25.preheader, label %for.end46
for.body25.preheader: ; preds = %for.cond23.preheader
%wide.trip.count90 = zext i32 %7 to i64
%xtraiter109 = and i64 %wide.trip.count90, 3
%3 = icmp ult i32 %7, 4
br i1 %3, label %for.cond35.preheader.unr-lcssa, label %for.body25.preheader.new
for.body25.preheader.new: ; preds = %for.body25.preheader
%unroll_iter113 = and i64 %wide.trip.count90, 4294967292
br label %for.body25
for.body4: ; preds = %for.cond2.preheader, %for.inc20
%i.175 = phi i32 [ %inc21, %for.inc20 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !11
%5 = load i32, ptr %id, align 4, !tbaa !11
%idxprom6 = sext i32 %5 to i64
%l = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %idxprom6, i32 1
store i32 %4, ptr %l, align 4, !tbaa !5
%6 = load i32, ptr %right, align 4, !tbaa !11
%r = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %idxprom6, i32 2
store i32 %6, ptr %r, align 4, !tbaa !10
%cmp10.not = icmp eq i32 %4, -1
br i1 %cmp10.not, label %if.end, label %if.then
if.then: ; preds = %for.body4
%idxprom11 = sext i32 %4 to i64
%arrayidx12 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %idxprom11
store i32 %5, ptr %arrayidx12, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body4
%cmp14.not = icmp eq i32 %6, -1
br i1 %cmp14.not, label %for.inc20, label %if.then15
if.then15: ; preds = %if.end
%idxprom16 = sext i32 %6 to i64
%arrayidx17 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !12
br label %for.inc20
for.inc20: ; preds = %if.end, %if.then15
%inc21 = add nuw nsw i32 %i.175, 1
%7 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc21, %7
br i1 %cmp3, label %for.body4, label %for.cond23.preheader, !llvm.loop !17
for.cond35.preheader.unr-lcssa: ; preds = %for.body25, %for.body25.preheader
%indvars.iv87.unr = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next88.3, %for.body25 ]
%root.078.unr = phi i32 [ undef, %for.body25.preheader ], [ %spec.select.3, %for.body25 ]
%lcmp.mod111.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod111.not, label %for.cond35.preheader, label %for.body25.epil
for.body25.epil: ; preds = %for.cond35.preheader.unr-lcssa, %for.body25.epil
%indvars.iv87.epil = phi i64 [ %indvars.iv.next88.epil, %for.body25.epil ], [ %indvars.iv87.unr, %for.cond35.preheader.unr-lcssa ]
%root.078.epil = phi i32 [ %spec.select.epil, %for.body25.epil ], [ %root.078.unr, %for.cond35.preheader.unr-lcssa ]
%epil.iter110 = phi i64 [ %epil.iter110.next, %for.body25.epil ], [ 0, %for.cond35.preheader.unr-lcssa ]
%arrayidx27.epil = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %indvars.iv87.epil
%8 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !12
%cmp29.epil = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv87.epil to i32
%spec.select.epil = select i1 %cmp29.epil, i32 %9, i32 %root.078.epil
%indvars.iv.next88.epil = add nuw nsw i64 %indvars.iv87.epil, 1
%epil.iter110.next = add i64 %epil.iter110, 1
%epil.iter110.cmp.not = icmp eq i64 %epil.iter110.next, %xtraiter109
br i1 %epil.iter110.cmp.not, label %for.cond35.preheader, label %for.body25.epil, !llvm.loop !18
for.cond35.preheader: ; preds = %for.body25.epil, %for.cond35.preheader.unr-lcssa
%spec.select.lcssa = phi i32 [ %root.078.unr, %for.cond35.preheader.unr-lcssa ], [ %spec.select.epil, %for.body25.epil ]
br i1 %cmp2476, label %for.body37.lr.ph, label %for.end46
for.body37.lr.ph: ; preds = %for.cond35.preheader
%arrayidx39 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %2
%10 = load i32, ptr %arrayidx39, align 4, !tbaa !12
%.fr = freeze i32 %10
%cmp41 = icmp eq i32 %.fr, -1
%11 = add nsw i32 %7, -1
%spec.select106 = select i1 %cmp41, i32 %11, i32 %spec.select.lcssa
br label %for.end46
for.body25: ; preds = %for.body25, %for.body25.preheader.new
%indvars.iv87 = phi i64 [ 0, %for.body25.preheader.new ], [ %indvars.iv.next88.3, %for.body25 ]
%root.078 = phi i32 [ undef, %for.body25.preheader.new ], [ %spec.select.3, %for.body25 ]
%niter114 = phi i64 [ 0, %for.body25.preheader.new ], [ %niter114.next.3, %for.body25 ]
%arrayidx27 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %indvars.iv87
%12 = load i32, ptr %arrayidx27, align 16, !tbaa !12
%cmp29 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv87 to i32
%spec.select = select i1 %cmp29, i32 %13, i32 %root.078
%indvars.iv.next88 = or i64 %indvars.iv87, 1
%arrayidx27.1 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %indvars.iv.next88
%14 = load i32, ptr %arrayidx27.1, align 4, !tbaa !12
%cmp29.1 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next88 to i32
%spec.select.1 = select i1 %cmp29.1, i32 %15, i32 %spec.select
%indvars.iv.next88.1 = or i64 %indvars.iv87, 2
%arrayidx27.2 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %indvars.iv.next88.1
%16 = load i32, ptr %arrayidx27.2, align 8, !tbaa !12
%cmp29.2 = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.next88.1 to i32
%spec.select.2 = select i1 %cmp29.2, i32 %17, i32 %spec.select.1
%indvars.iv.next88.2 = or i64 %indvars.iv87, 3
%arrayidx27.3 = getelementptr inbounds [100000000 x %struct.Node], ptr @box, i64 0, i64 %indvars.iv.next88.2
%18 = load i32, ptr %arrayidx27.3, align 4, !tbaa !12
%cmp29.3 = icmp eq i32 %18, -1
%19 = trunc i64 %indvars.iv.next88.2 to i32
%spec.select.3 = select i1 %cmp29.3, i32 %19, i32 %spec.select.2
%indvars.iv.next88.3 = add nuw nsw i64 %indvars.iv87, 4
%niter114.next.3 = add i64 %niter114, 4
%niter114.ncmp.3 = icmp eq i64 %niter114.next.3, %unroll_iter113
br i1 %niter114.ncmp.3, label %for.cond35.preheader.unr-lcssa, label %for.body25, !llvm.loop !19
for.end46: ; preds = %for.body37.lr.ph, %for.cond23.preheader, %entry, %for.cond2.preheader, %for.cond35.preheader
%root.2.lcssa = phi i32 [ %spec.select.lcssa, %for.cond35.preheader ], [ undef, %for.cond2.preheader ], [ undef, %entry ], [ undef, %for.cond23.preheader ], [ %spec.select106, %for.body37.lr.ph ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.2.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts67 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.2.lcssa)
%putchar68 = call i32 @putchar(i32 10)
%puts69 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.2.lcssa)
%putchar70 = 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
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) #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, !14}
!19 = distinct !{!19, !16}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node { int p, l, r;};
struct 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_102596/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102596/source.c"
target datalayout = "e-m:e-p270: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>
#define MAX 25
typedef struct{
int l,r,par;
} node;
node N[MAX];
void init(int);
void Preorder(int);
void Inorder(int);
void Postorder(int);
int main(){
int n,i,id,l,r;
int p;
scanf("%d" ,&n);
init(n);
for(i = 0 ; i < n ; i++){
scanf("%d%d%d" ,&id ,&l ,&r);
if(l != -1){
N[id].l = l;
N[l].par = id;
}
if(r != -1){
N[id].r = r;
N[r].par = id;
}
}
for(i = 0 ; i < n ; i++){
if(N[i].par == -1){
p = i;
break;
}
}
puts("Preorder");
Preorder(p);
puts("");
puts("Inorder");
Inorder(p);
puts("");
puts("Postorder");
Postorder(p);
puts("");
return 0;
}
void init(int n){
int i;
for(i = 0 ; i < n ; i++){
N[i].par = N[i].l = N[i].r = -1;
}
}
void Preorder(int p){
if(p != -1){
printf(" %d" ,p);
Preorder(N[p].l);
Preorder(N[p].r);
}
}
void Inorder(int p){
if(p != -1){
Inorder(N[p].l);
printf(" %d" ,p);
Inorder(N[p].r);
}
}
void Postorder(int p){
if(p != -1){
Postorder(N[p].l);
Postorder(N[p].r);
printf(" %d" ,p);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102639/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102639/source.c"
target datalayout = "e-m:e-p270: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 [7 x i8] c"%d%d%d\00", align 1
@N = dso_local local_unnamed_addr global [25 x %struct.node] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@.str.5 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9.i = icmp sgt i32 %0, 0
br i1 %cmp9.i, label %for.body.preheader, label %for.end26
for.body.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 @N, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body
for.cond15.preheader: ; preds = %for.inc
%cmp1645 = icmp sgt i32 %7, 0
br i1 %cmp1645, label %for.body17.preheader, label %for.end26
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count = zext i32 %7 to i64
br label %for.body17
for.body: ; preds = %for.body.preheader, %for.inc
%i.044 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %3, -1
br i1 %cmp2.not, label %if.end, label %if.then
if.then: ; preds = %for.body
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom = sext i32 %4 to i64
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom
store i32 %3, ptr %arrayidx, align 4, !tbaa !9
%idxprom4 = sext i32 %3 to i64
%par = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom4, i32 2
store i32 %4, ptr %par, align 4, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %for.body
%5 = load i32, ptr %r, align 4, !tbaa !5
%cmp6.not = icmp eq i32 %5, -1
br i1 %cmp6.not, label %for.inc, label %if.then7
if.then7: ; preds = %if.end
%6 = load i32, ptr %id, align 4, !tbaa !5
%idxprom8 = sext i32 %6 to i64
%r10 = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom8, i32 1
store i32 %5, ptr %r10, align 4, !tbaa !12
%idxprom11 = sext i32 %5 to i64
%par13 = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom11, i32 2
store i32 %6, ptr %par13, align 4, !tbaa !11
br label %for.inc
for.inc: ; preds = %if.end, %if.then7
%inc = add nuw nsw i32 %i.044, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.cond15.preheader, !llvm.loop !13
for.body17: ; preds = %for.body17.preheader, %for.inc24
%indvars.iv = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next, %for.inc24 ]
%par20 = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %indvars.iv, i32 2
%8 = load i32, ptr %par20, align 4, !tbaa !11
%cmp21 = icmp eq i32 %8, -1
br i1 %cmp21, label %for.end26.loopexit.split.loop.exit, label %for.inc24
for.inc24: ; preds = %for.body17
%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.end26, label %for.body17, !llvm.loop !15
for.end26.loopexit.split.loop.exit: ; preds = %for.body17
%9 = trunc i64 %indvars.iv to i32
br label %for.end26
for.end26: ; preds = %for.inc24, %for.end26.loopexit.split.loop.exit, %entry, %for.cond15.preheader
%i.1.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ 0, %entry ], [ %9, %for.end26.loopexit.split.loop.exit ], [ %7, %for.inc24 ]
%call27 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @Preorder(i32 noundef %i.1.lcssa)
%putchar = call i32 @putchar(i32 10)
%call29 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
call void @Inorder(i32 noundef %i.1.lcssa)
%putchar41 = call i32 @putchar(i32 10)
%call31 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
call void @Postorder(i32 noundef %i.1.lcssa)
%putchar42 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @init(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp9 = icmp sgt i32 %n, 0
br i1 %cmp9, label %for.body.preheader, label %for.end
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 nonnull align 16 @N, i8 -1, i64 %1, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %p) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp eq i32 %p, -1
br i1 %cmp.not6, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%p.tr7 = phi i32 [ %1, %if.then ], [ %p, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %p.tr7)
%idxprom = sext i32 %p.tr7 to i64
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
tail call void @Preorder(i32 noundef %0)
%r = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !12
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %p) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp eq i32 %p, -1
br i1 %cmp.not6, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%p.tr7 = phi i32 [ %1, %if.then ], [ %p, %entry ]
%idxprom = sext i32 %p.tr7 to i64
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, 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 %p.tr7)
%r = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !12
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %p) local_unnamed_addr #0 {
entry:
%cmp.not = icmp eq i32 %p, -1
br i1 %cmp.not, label %common.ret6, label %if.then
common.ret6: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%idxprom = sext i32 %p to i64
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
tail call void @Postorder(i32 noundef %0)
%r = getelementptr inbounds [25 x %struct.node], ptr @N, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %r, align 4, !tbaa !12
tail call void @Postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %p)
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
#define N 25
typedef struct{
int p;
int l;
int r;
}Node;
void preorder(int);
void inorder(int);
void postorder(int);
Node T[N];
int main(){
int num, i, j, id, le, ri;
scanf("%d\n",&num);
for(i = 0 ; i < num ; i++){
T[i].p =T[i].l =T[i].r =-1;
}
for(i = 0 ; i < num ; i++){
scanf("%d%d%d", &id, &le, &ri);
T[id].l = le;
T[le].p = id;
T[id].r = ri;
T[ri].p = id;
}
printf("Preorder\n");
for(i = 0 ; i < num ; i++){
if(T[i].p == -1){
preorder(i);
}
}
printf("\n");
printf("Inorder\n");
for(i = 0 ; i < num ; i++){
if(T[i].p == -1){
inorder(i);
}
}
printf("\n");
printf("Postorder\n");
for(i = 0 ; i < num ; i++){
if(T[i].p == -1){
postorder(i);
}
}
printf("\n");
return 0;
}
void preorder(int u)
{
if(u == -1) return;
printf(" %d", u);
preorder(T[u].l);
preorder(T[u].r);
}
void inorder(int u)
{
if(u == -1) return;
inorder(T[u].l);
printf(" %d", u);
inorder(T[u].r);
}
void postorder(int u)
{
if(u == -1) return;
postorder(T[u].l);
postorder(T[u].r);
printf(" %d", u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102682/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102682/source.c"
target datalayout = "e-m:e-p270: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\0A\00", align 1
@T = dso_local local_unnamed_addr global [25 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 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:
%num = alloca i32, align 4
%id = alloca i32, align 4
%le = alloca i32, align 4
%ri = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %le) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ri) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp86 = icmp sgt i32 %0, 0
br i1 %cmp86, label %for.body7.preheader, label %for.end23
for.body7.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.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%i.189 = phi i32 [ %inc22, %for.body7 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %le, ptr noundef nonnull %ri)
%3 = load i32, ptr %le, align 4, !tbaa !5
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom9 = sext i32 %4 to i64
%l11 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 1
store i32 %3, ptr %l11, align 4, !tbaa !9
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !11
%5 = load i32, ptr %ri, align 4, !tbaa !5
%r17 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom9, i32 2
store i32 %5, ptr %r17, align 4, !tbaa !12
%idxprom18 = sext i32 %5 to i64
%arrayidx19 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom18
store i32 %4, ptr %arrayidx19, align 4, !tbaa !11
%inc22 = add nuw nsw i32 %i.189, 1
%6 = load i32, ptr %num, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc22, %6
br i1 %cmp6, label %for.body7, label %for.end23, !llvm.loop !13
for.end23: ; preds = %for.body7, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%7 = load i32, ptr %num, align 4, !tbaa !5
%cmp2690 = icmp sgt i32 %7, 0
br i1 %cmp2690, label %for.body27, label %for.end34
for.body27: ; preds = %for.end23, %for.inc32
%8 = phi i32 [ %11, %for.inc32 ], [ %7, %for.end23 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc32 ], [ 0, %for.end23 ]
%arrayidx29 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx29, align 4, !tbaa !11
%cmp31 = icmp eq i32 %9, -1
br i1 %cmp31, label %if.then, label %for.inc32
if.then: ; preds = %for.body27
%10 = trunc i64 %indvars.iv to i32
call void @preorder(i32 noundef %10)
%.pre = load i32, ptr %num, align 4, !tbaa !5
br label %for.inc32
for.inc32: ; preds = %for.body27, %if.then
%11 = phi i32 [ %8, %for.body27 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = sext i32 %11 to i64
%cmp26 = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp26, label %for.body27, label %for.end34, !llvm.loop !15
for.end34: ; preds = %for.inc32, %for.end23
%putchar = call i32 @putchar(i32 10)
%puts82 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%13 = load i32, ptr %num, align 4, !tbaa !5
%cmp3892 = icmp sgt i32 %13, 0
br i1 %cmp3892, label %for.body39, label %for.end48
for.body39: ; preds = %for.end34, %for.inc46
%14 = phi i32 [ %17, %for.inc46 ], [ %13, %for.end34 ]
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %for.inc46 ], [ 0, %for.end34 ]
%arrayidx41 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv98
%15 = load i32, ptr %arrayidx41, align 4, !tbaa !11
%cmp43 = icmp eq i32 %15, -1
br i1 %cmp43, label %if.then44, label %for.inc46
if.then44: ; preds = %for.body39
%16 = trunc i64 %indvars.iv98 to i32
call void @inorder(i32 noundef %16)
%.pre104 = load i32, ptr %num, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body39, %if.then44
%17 = phi i32 [ %14, %for.body39 ], [ %.pre104, %if.then44 ]
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%18 = sext i32 %17 to i64
%cmp38 = icmp slt i64 %indvars.iv.next99, %18
br i1 %cmp38, label %for.body39, label %for.end48, !llvm.loop !16
for.end48: ; preds = %for.inc46, %for.end34
%putchar83 = call i32 @putchar(i32 10)
%puts84 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%19 = load i32, ptr %num, align 4, !tbaa !5
%cmp5294 = icmp sgt i32 %19, 0
br i1 %cmp5294, label %for.body53, label %for.end62
for.body53: ; preds = %for.end48, %for.inc60
%20 = phi i32 [ %23, %for.inc60 ], [ %19, %for.end48 ]
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.inc60 ], [ 0, %for.end48 ]
%arrayidx55 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv101
%21 = load i32, ptr %arrayidx55, align 4, !tbaa !11
%cmp57 = icmp eq i32 %21, -1
br i1 %cmp57, label %if.then58, label %for.inc60
if.then58: ; preds = %for.body53
%22 = trunc i64 %indvars.iv101 to i32
call void @postorder(i32 noundef %22)
%.pre105 = load i32, ptr %num, align 4, !tbaa !5
br label %for.inc60
for.inc60: ; preds = %for.body53, %if.then58
%23 = phi i32 [ %20, %for.body53 ], [ %.pre105, %if.then58 ]
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%24 = sext i32 %23 to i64
%cmp52 = icmp slt i64 %indvars.iv.next102, %24
br i1 %cmp52, label %for.body53, label %for.end62, !llvm.loop !17
for.end62: ; preds = %for.inc60, %for.end48
%putchar85 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ri) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %le) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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: 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.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
tail call void @preorder(i32 noundef %0)
%r = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, 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
%l = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, 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 %u.tr7)
%r = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, 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
%l = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
tail call void @postorder(i32 noundef %0)
%r = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !12
tail call void @postorder(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 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
|
#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("\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].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_102725/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102725/source.c"
target datalayout = "e-m:e-p270: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 [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:
%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
%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 !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 %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 !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
%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.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.160, 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.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 !9
%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 !9
%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 !9
%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 !9
%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 !9
%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) #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 N -1
struct tree {int m, l, r;};
struct tree T[10000];
int n;
void preorder(int b){
if(b == N) return;
printf(" %d", b);
preorder(T[b].l);
preorder(T[b].r);
}
void inorder(int b){
if(b == N) return;
inorder(T[b].l);
printf(" %d", b);
inorder(T[b].r);
}
void postorder(int b){
if(b == N) return;
postorder(T[b].l);
postorder(T[b].r);
printf(" %d", b);
}
int main()
{
int i, j, l, r, b;
scanf("%d", &n);
for(i = 0; i < n; i++){
T[i].m = N;
}
for(i = 0; i < n; i++){
scanf("%d %d %d", &j, &l, &r );
T[j].l = l;
T[j].r = r;
if(l != N) T[l].m = j;
if(r != N) T[r].m = j;
}
for(i = 0; i < n; i++) if(T[i].m == N) b = i;
printf("Preorder\n");
preorder(b);
printf("\n");
printf("Inorder\n");
inorder(b);
printf("\n");
printf("Postorder\n");
postorder(b);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102776/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102776/source.c"
target datalayout = "e-m:e-p270: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 [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 %b) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %b, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr7 = phi i32 [ %1, %if.end ], [ %b, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %b.tr7)
%idxprom = sext i32 %b.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 %b) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %b, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr7 = phi i32 [ %1, %if.end ], [ %b, %entry ]
%idxprom = sext i32 %b.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 %b.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 %b) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %b, -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 %b 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 %b)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%j = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #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.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 %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.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
%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 %j, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %j, 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.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 ]
%b.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.tree], 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 %b.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.tree], 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.tree], 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.tree], 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 ]
%b.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 ]
%b.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %b.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.tree], 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 %b.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
%b.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %b.063.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 %b.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inorder(i32 noundef %b.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postorder(i32 noundef %b.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 %j) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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>
#define MAX 10000
#define NIL -1
struct Node{int p,l,r;};
struct 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("\nInorder\n");
inParse(root);
printf("\nPostorder\n");
postParse(root);printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102819/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102819/source.c"
target datalayout = "e-m:e-p270: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 [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 @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
%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 !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.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
%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.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.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.Node], 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.Node], 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.Node], 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.Node], 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.Node], 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 @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) #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 20001
#define nNIL -1
typedef struct{
int p, l, r;
}Tree;
Tree node[MAX];
int n;
void preParse(int u) {
if (u == nNIL) return;
printf(" %d", u);
preParse(node[u].l);
preParse(node[u].r);
}
void inParse(int u) {
if (u == nNIL ) return;
inParse(node[u].l);
printf(" %d", u);
inParse(node[u].r);
}
void postParse(int u) {
if (u == nNIL ) return;
postParse(node[u].l);
postParse(node[u].r);
printf(" %d", u);
}
int main(int argc, char const* argv[])
{
int i, v, l, r, root;
scanf("%d", &n);
for (i = 0; i < n; i++) {
node[i].p = nNIL;
}
for ( i = 0; i < n; i++) {
scanf("%d %d %d", &v, &l, &r);
node[v].l = l;
node[v].r = r;
if(l != nNIL) node[l].p = v;
if(r != nNIL) node[r].p = v;
}
for ( i = 0; i < n; i++) {
if (node[i].p == nNIL) {
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_102884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102884/source.c"
target datalayout = "e-m:e-p270: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
@node = dso_local local_unnamed_addr global [20001 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 [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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 [20001 x %struct.Tree], ptr @node, 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 = !{!"", !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()
{
while(1){
int flag[21][21],n,x,y,m,i,j,k,px=10,py=10;
char direction;
int count=0;
for(i=0;i<21;i++){
for(j=0;j<21;j++){
flag[i][j]=0;
}
}
scanf("%d",&n);
if(n==0) break;
for(i=0; i<n; i++){
scanf("%d%d",&x,&y);
flag[x][y]=1;
}
scanf("%d",&m);
for(i=0; i<m; i++){
char tmp;
scanf("%c",&tmp);
scanf("%c%d",&direction,&k);
for(j=0; j<k; j++){
switch(direction){
case'N':
py=py+1;
break;
case'E':
px=px+1;
break;
case'W':
px=px-1;
break;
case'S':
py=py-1;
break;
}
if(flag[px][py]){
flag[px][py]=0;
count+=1;
}
}
}
if(count==n){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [5 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:
%flag = alloca [21 x [21 x i32]], align 16
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
%direction = alloca i8, align 1
%tmp = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %flag) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %direction) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %flag, i8 0, i64 1764, i1 false), !tbaa !5
%call108 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9109 = icmp eq i32 %0, 0
br i1 %cmp9109, label %while.end, label %for.cond10.preheader
for.cond10.preheader: ; preds = %entry, %for.end51
%1 = phi i32 [ %11, %for.end51 ], [ %0, %entry ]
%cmp1191 = icmp sgt i32 %1, 0
br i1 %cmp1191, label %for.body12, label %for.end20
for.body12: ; preds = %for.cond10.preheader, %for.body12
%i.192 = phi i32 [ %inc19, %for.body12 ], [ 0, %for.cond10.preheader ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i32, ptr %x, align 4, !tbaa !5
%idxprom14 = sext i32 %2 to i64
%3 = load i32, ptr %y, align 4, !tbaa !5
%idxprom16 = sext i32 %3 to i64
%arrayidx17 = getelementptr inbounds [21 x [21 x i32]], ptr %flag, i64 0, i64 %idxprom14, i64 %idxprom16
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
%inc19 = add nuw nsw i32 %i.192, 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.cond10.preheader
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp23100 = icmp sgt i32 %5, 0
br i1 %cmp23100, label %for.body24, label %for.end51
for.body24: ; preds = %for.end20, %for.end48
%count.0104 = phi i32 [ %count.1.lcssa, %for.end48 ], [ 0, %for.end20 ]
%py.0103 = phi i32 [ %py.1.lcssa, %for.end48 ], [ 10, %for.end20 ]
%px.0102 = phi i32 [ %px.1.lcssa, %for.end48 ], [ 10, %for.end20 ]
%i.2101 = phi i32 [ %inc50, %for.end48 ], [ 0, %for.end20 ]
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %tmp) #5
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %tmp)
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %direction, ptr noundef nonnull %k)
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp2893 = icmp sgt i32 %6, 0
br i1 %cmp2893, label %for.body29.lr.ph, label %for.end48
for.body29.lr.ph: ; preds = %for.body24
%7 = load i8, ptr %direction, align 1, !tbaa !11
%conv = sext i8 %7 to i32
br label %for.body29
for.body29: ; preds = %for.body29.lr.ph, %for.inc46
%count.197 = phi i32 [ %count.0104, %for.body29.lr.ph ], [ %count.2, %for.inc46 ]
%py.196 = phi i32 [ %py.0103, %for.body29.lr.ph ], [ %py.2, %for.inc46 ]
%px.195 = phi i32 [ %px.0102, %for.body29.lr.ph ], [ %px.2, %for.inc46 ]
%j.194 = phi i32 [ 0, %for.body29.lr.ph ], [ %inc47, %for.inc46 ]
switch i32 %conv, label %sw.epilog [
i32 78, label %sw.bb
i32 69, label %sw.bb30
i32 87, label %sw.bb32
i32 83, label %sw.bb33
]
sw.bb: ; preds = %for.body29
%add = add nsw i32 %py.196, 1
br label %sw.epilog
sw.bb30: ; preds = %for.body29
%add31 = add nsw i32 %px.195, 1
br label %sw.epilog
sw.bb32: ; preds = %for.body29
%sub = add nsw i32 %px.195, -1
br label %sw.epilog
sw.bb33: ; preds = %for.body29
%sub34 = add nsw i32 %py.196, -1
br label %sw.epilog
sw.epilog: ; preds = %for.body29, %sw.bb33, %sw.bb32, %sw.bb30, %sw.bb
%px.2 = phi i32 [ %px.195, %for.body29 ], [ %px.195, %sw.bb33 ], [ %sub, %sw.bb32 ], [ %add31, %sw.bb30 ], [ %px.195, %sw.bb ]
%py.2 = phi i32 [ %py.196, %for.body29 ], [ %sub34, %sw.bb33 ], [ %py.196, %sw.bb32 ], [ %py.196, %sw.bb30 ], [ %add, %sw.bb ]
%idxprom35 = sext i32 %px.2 to i64
%idxprom37 = sext i32 %py.2 to i64
%arrayidx38 = getelementptr inbounds [21 x [21 x i32]], ptr %flag, i64 0, i64 %idxprom35, i64 %idxprom37
%8 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %for.inc46, label %if.then39
if.then39: ; preds = %sw.epilog
store i32 0, ptr %arrayidx38, align 4, !tbaa !5
%add44 = add nsw i32 %count.197, 1
br label %for.inc46
for.inc46: ; preds = %sw.epilog, %if.then39
%count.2 = phi i32 [ %add44, %if.then39 ], [ %count.197, %sw.epilog ]
%inc47 = add nuw nsw i32 %j.194, 1
%exitcond.not = icmp eq i32 %inc47, %6
br i1 %exitcond.not, label %for.end48, label %for.body29, !llvm.loop !12
for.end48: ; preds = %for.inc46, %for.body24
%px.1.lcssa = phi i32 [ %px.0102, %for.body24 ], [ %px.2, %for.inc46 ]
%py.1.lcssa = phi i32 [ %py.0103, %for.body24 ], [ %py.2, %for.inc46 ]
%count.1.lcssa = phi i32 [ %count.0104, %for.body24 ], [ %count.2, %for.inc46 ]
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %tmp) #5
%inc50 = add nuw nsw i32 %i.2101, 1
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc50, %9
br i1 %cmp23, label %for.body24, label %for.end51, !llvm.loop !13
for.end51: ; preds = %for.end48, %for.end20
%count.0.lcssa = phi i32 [ 0, %for.end20 ], [ %count.1.lcssa, %for.end48 ]
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp eq i32 %count.0.lcssa, %10
%str.6.str = select i1 %cmp52, ptr @str.6, ptr @str
%puts86 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.str)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %direction) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %flag) #5
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %flag) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %direction) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %flag, i8 0, i64 1764, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp eq i32 %11, 0
br i1 %cmp9, label %while.end, label %for.cond10.preheader
while.end: ; preds = %for.end51, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %direction) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %flag) #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>
long *tree[100001];
int main(void) {
long n;
scanf("%ld\n", &n);
long tree_s[n+1];
for (long i = 0; i <= n; i++) {
tree_s[i] = 0;
}
long a,b;
for (long i = 0; i < n-1; i++) {
scanf("%ld %ld", &a, &b);
tree[a] = realloc(tree[a], sizeof(long)*(tree_s[a]+1));
tree[a][tree_s[a]] = b;
tree_s[a]++;
tree[b] = realloc(tree[b], sizeof(long)*(tree_s[b]+1));
tree[b][tree_s[b]] = a;
tree_s[b]++;
}
long parent[n+1],depth[n+1],color[n+1];
for (long i = 0; i <= n; i++) {
parent[i] = -1;
depth[i] = -1;
color[i] = -1;
}
parent[1] = 0;
depth[1] = 0;
color[1] = 1;
color[n] = 0;
long queue[n];
queue[0] = 1;
long start = 0, end = 0, tail = 0;
long cur,next;
while (tail < n-1) {
for (long i = start; i <= end; i++) {
cur = queue[i];
for (long j = 0; j < tree_s[cur]; j++) {
next = tree[cur][j];
if (next == parent[cur]) {
continue;
}
parent[next] = cur;
depth[next] = depth[cur]+1;
tail++;
queue[tail] = next;
}
}
start = end+1;
end = tail;
}
cur = n;
for (long i = depth[n]-1; i > depth[n]/2; i--) {
cur = parent[cur];
color[cur] = 0;
}
for (long i = depth[n]/2; i > 0; i--) {
cur = parent[cur];
color[cur] = 1;
}
for (long i = 1; i < n; i++) {
cur = queue[i];
if (color[cur] == -1) {
color[cur] = color[parent[cur]];
}
}
long black = 0, white = 0;
for (long i = 2; i < n; i++) {
if (color[i] == 1) {
black++;
} else {
white++;
}
}
if (black > white) {
printf("Fennec\n");
} else {
printf("Snuke\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102985/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102985/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\0A\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@tree = dso_local local_unnamed_addr global [100001 x ptr] zeroinitializer, align 16
@str = private unnamed_addr constant [6 x i8] c"Snuke\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"Fennec\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not182 = icmp slt i64 %2, 0
br i1 %cmp.not182, label %for.cond.cleanup4.thread, label %for.cond.cleanup
for.cond.cleanup4.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #8
%sub184224 = add nsw i64 %2, -1
%add31228 = add nsw i64 %2, 1
%vla32229 = alloca i64, i64 %add31228, align 16
%vla34230 = alloca i64, i64 %add31228, align 16
%vla36231 = alloca i64, i64 %add31228, align 16
br label %for.cond.cleanup40
for.cond.cleanup: ; preds = %entry
%3 = shl i64 %2, 3
%4 = add i64 %3, 8
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %4, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #8
%cmp3185 = icmp ugt i64 %2, 1
br i1 %cmp3185, label %for.body5, label %for.cond.cleanup4.thread238
for.cond.cleanup4.thread238: ; preds = %for.cond.cleanup
%sub184 = add nsw i64 %2, -1
%add31241 = add nuw nsw i64 %2, 1
%vla32242 = alloca i64, i64 %add31241, align 16
%vla34243 = alloca i64, i64 %add31241, align 16
%vla36244 = alloca i64, i64 %add31241, align 16
br label %for.body41.preheader
for.cond.cleanup4: ; preds = %for.body5
%add31 = add nsw i64 %18, 1
%vla32 = alloca i64, i64 %add31, align 16
%vla34 = alloca i64, i64 %add31, align 16
%vla36 = alloca i64, i64 %add31, align 16
%cmp39.not188 = icmp slt i64 %18, 0
br i1 %cmp39.not188, label %for.cond.cleanup40, label %for.body41.preheader
for.body41.preheader: ; preds = %for.cond.cleanup4.thread238, %for.cond.cleanup4
%vla36250 = phi ptr [ %vla36244, %for.cond.cleanup4.thread238 ], [ %vla36, %for.cond.cleanup4 ]
%vla34249 = phi ptr [ %vla34243, %for.cond.cleanup4.thread238 ], [ %vla34, %for.cond.cleanup4 ]
%vla32248 = phi ptr [ %vla32242, %for.cond.cleanup4.thread238 ], [ %vla32, %for.cond.cleanup4 ]
%sub.lcssa247 = phi i64 [ %sub184, %for.cond.cleanup4.thread238 ], [ %sub, %for.cond.cleanup4 ]
%.lcssa246 = phi i64 [ %2, %for.cond.cleanup4.thread238 ], [ %18, %for.cond.cleanup4 ]
%5 = shl i64 %.lcssa246, 3
%6 = add i64 %5, 8
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla32248, i8 -1, i64 %6, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla34249, i8 -1, i64 %6, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla36250, i8 -1, i64 %6, i1 false), !tbaa !5
br label %for.cond.cleanup40
for.body5: ; preds = %for.cond.cleanup, %for.body5
%i1.0186 = phi i64 [ %inc29, %for.body5 ], [ 0, %for.cond.cleanup ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%7 = load i64, ptr %a, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds [100001 x ptr], ptr @tree, i64 0, i64 %7
%8 = load ptr, ptr %arrayidx7, align 8, !tbaa !9
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %7
%9 = load i64, ptr %arrayidx8, align 8, !tbaa !5
%add9 = shl i64 %9, 3
%mul = add i64 %add9, 8
%call10 = call ptr @realloc(ptr noundef %8, i64 noundef %mul) #9
%10 = load i64, ptr %a, align 8, !tbaa !5
%arrayidx11 = getelementptr inbounds [100001 x ptr], ptr @tree, i64 0, i64 %10
store ptr %call10, ptr %arrayidx11, align 8, !tbaa !9
%11 = load i64, ptr %b, align 8, !tbaa !5
%arrayidx13 = getelementptr inbounds i64, ptr %vla, i64 %10
%12 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%arrayidx14 = getelementptr inbounds i64, ptr %call10, i64 %12
store i64 %11, ptr %arrayidx14, align 8, !tbaa !5
%inc16 = add nsw i64 %12, 1
store i64 %inc16, ptr %arrayidx13, align 8, !tbaa !5
%arrayidx17 = getelementptr inbounds [100001 x ptr], ptr @tree, i64 0, i64 %11
%13 = load ptr, ptr %arrayidx17, align 8, !tbaa !9
%arrayidx18 = getelementptr inbounds i64, ptr %vla, i64 %11
%14 = load i64, ptr %arrayidx18, align 8, !tbaa !5
%add19 = shl i64 %14, 3
%mul20 = add i64 %add19, 8
%call21 = call ptr @realloc(ptr noundef %13, i64 noundef %mul20) #9
%15 = load i64, ptr %b, align 8, !tbaa !5
%arrayidx22 = getelementptr inbounds [100001 x ptr], ptr @tree, i64 0, i64 %15
store ptr %call21, ptr %arrayidx22, align 8, !tbaa !9
%16 = load i64, ptr %a, align 8, !tbaa !5
%arrayidx24 = getelementptr inbounds i64, ptr %vla, i64 %15
%17 = load i64, ptr %arrayidx24, align 8, !tbaa !5
%arrayidx25 = getelementptr inbounds i64, ptr %call21, i64 %17
store i64 %16, ptr %arrayidx25, align 8, !tbaa !5
%inc27 = add nsw i64 %17, 1
store i64 %inc27, ptr %arrayidx24, align 8, !tbaa !5
%inc29 = add nuw nsw i64 %i1.0186, 1
%18 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %18, -1
%cmp3 = icmp slt i64 %inc29, %sub
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !11
for.cond.cleanup40: ; preds = %for.cond.cleanup4.thread, %for.body41.preheader, %for.cond.cleanup4
%vla36237 = phi ptr [ %vla36231, %for.cond.cleanup4.thread ], [ %vla36250, %for.body41.preheader ], [ %vla36, %for.cond.cleanup4 ]
%vla34236 = phi ptr [ %vla34230, %for.cond.cleanup4.thread ], [ %vla34249, %for.body41.preheader ], [ %vla34, %for.cond.cleanup4 ]
%vla32235 = phi ptr [ %vla32229, %for.cond.cleanup4.thread ], [ %vla32248, %for.body41.preheader ], [ %vla32, %for.cond.cleanup4 ]
%sub.lcssa234 = phi i64 [ %sub184224, %for.cond.cleanup4.thread ], [ %sub.lcssa247, %for.body41.preheader ], [ %sub, %for.cond.cleanup4 ]
%.lcssa233 = phi i64 [ %2, %for.cond.cleanup4.thread ], [ %.lcssa246, %for.body41.preheader ], [ %18, %for.cond.cleanup4 ]
%arrayidx48 = getelementptr inbounds i64, ptr %vla32235, i64 1
store i64 0, ptr %arrayidx48, align 8, !tbaa !5
%arrayidx49 = getelementptr inbounds i64, ptr %vla34236, i64 1
store i64 0, ptr %arrayidx49, align 8, !tbaa !5
%arrayidx50 = getelementptr inbounds i64, ptr %vla36237, i64 1
store i64 1, ptr %arrayidx50, align 8, !tbaa !5
%arrayidx51 = getelementptr inbounds i64, ptr %vla36237, i64 %.lcssa233
store i64 0, ptr %arrayidx51, align 8, !tbaa !5
%vla52 = alloca i64, i64 %.lcssa233, align 16
store i64 1, ptr %vla52, align 16, !tbaa !5
%cmp55198 = icmp sgt i64 %sub.lcssa234, 0
br i1 %cmp55198, label %for.cond57.preheader, label %while.end
for.cond57.preheader: ; preds = %for.cond.cleanup40, %for.cond.cleanup59
%tail.0200 = phi i64 [ %tail.1.lcssa, %for.cond.cleanup59 ], [ 0, %for.cond.cleanup40 ]
%start.0199 = phi i64 [ %add83.pre-phi, %for.cond.cleanup59 ], [ 0, %for.cond.cleanup40 ]
%cmp58.not194 = icmp sgt i64 %start.0199, %tail.0200
br i1 %cmp58.not194, label %for.cond.cleanup59, label %for.body60
for.cond.cleanup59: ; preds = %for.cond.cleanup65, %for.cond57.preheader
%tail.1.lcssa = phi i64 [ %tail.0200, %for.cond57.preheader ], [ %tail.2.lcssa, %for.cond.cleanup65 ]
%add83.pre-phi = add i64 %tail.0200, 1
%cmp55 = icmp slt i64 %tail.1.lcssa, %sub.lcssa234
br i1 %cmp55, label %for.cond57.preheader, label %while.end, !llvm.loop !13
for.body60: ; preds = %for.cond57.preheader, %for.cond.cleanup65
%i56.0196 = phi i64 [ %inc81, %for.cond.cleanup65 ], [ %start.0199, %for.cond57.preheader ]
%tail.1195 = phi i64 [ %tail.2.lcssa, %for.cond.cleanup65 ], [ %tail.0200, %for.cond57.preheader ]
%arrayidx61 = getelementptr inbounds i64, ptr %vla52, i64 %i56.0196
%19 = load i64, ptr %arrayidx61, align 8, !tbaa !5
%arrayidx63 = getelementptr inbounds i64, ptr %vla, i64 %19
%20 = load i64, ptr %arrayidx63, align 8, !tbaa !5
%cmp64190 = icmp sgt i64 %20, 0
br i1 %cmp64190, label %for.body66.lr.ph, label %for.cond.cleanup65
for.body66.lr.ph: ; preds = %for.body60
%arrayidx67 = getelementptr inbounds [100001 x ptr], ptr @tree, i64 0, i64 %19
%21 = load ptr, ptr %arrayidx67, align 8, !tbaa !9
%arrayidx69 = getelementptr inbounds i64, ptr %vla32235, i64 %19
%arrayidx72 = getelementptr inbounds i64, ptr %vla34236, i64 %19
br label %for.body66
for.cond.cleanup65: ; preds = %for.inc77, %for.body60
%tail.2.lcssa = phi i64 [ %tail.1195, %for.body60 ], [ %tail.3, %for.inc77 ]
%inc81 = add i64 %i56.0196, 1
%exitcond221.not = icmp eq i64 %i56.0196, %tail.0200
br i1 %exitcond221.not, label %for.cond.cleanup59, label %for.body60, !llvm.loop !14
for.body66: ; preds = %for.body66.lr.ph, %for.inc77
%j.0192 = phi i64 [ 0, %for.body66.lr.ph ], [ %inc78, %for.inc77 ]
%tail.2191 = phi i64 [ %tail.1195, %for.body66.lr.ph ], [ %tail.3, %for.inc77 ]
%arrayidx68 = getelementptr inbounds i64, ptr %21, i64 %j.0192
%22 = load i64, ptr %arrayidx68, align 8, !tbaa !5
%23 = load i64, ptr %arrayidx69, align 8, !tbaa !5
%cmp70 = icmp eq i64 %22, %23
br i1 %cmp70, label %for.inc77, label %if.end
if.end: ; preds = %for.body66
%arrayidx71 = getelementptr inbounds i64, ptr %vla32235, i64 %22
store i64 %19, ptr %arrayidx71, align 8, !tbaa !5
%24 = load i64, ptr %arrayidx72, align 8, !tbaa !5
%add73 = add nsw i64 %24, 1
%arrayidx74 = getelementptr inbounds i64, ptr %vla34236, i64 %22
store i64 %add73, ptr %arrayidx74, align 8, !tbaa !5
%inc75 = add nsw i64 %tail.2191, 1
%arrayidx76 = getelementptr inbounds i64, ptr %vla52, i64 %inc75
store i64 %22, ptr %arrayidx76, align 8, !tbaa !5
br label %for.inc77
for.inc77: ; preds = %for.body66, %if.end
%tail.3 = phi i64 [ %tail.2191, %for.body66 ], [ %inc75, %if.end ]
%inc78 = add nuw nsw i64 %j.0192, 1
%exitcond.not = icmp eq i64 %inc78, %20
br i1 %exitcond.not, label %for.cond.cleanup65, label %for.body66, !llvm.loop !15
while.end: ; preds = %for.cond.cleanup59, %for.cond.cleanup40
%arrayidx85 = getelementptr inbounds i64, ptr %vla34236, i64 %.lcssa233
%25 = load i64, ptr %arrayidx85, align 8, !tbaa !5
%div = sdiv i64 %25, 2
%i84.0201 = add nsw i64 %25, -1
%cmp89202 = icmp sgt i64 %i84.0201, %div
br i1 %cmp89202, label %for.body91.preheader, label %for.cond99.preheader
for.body91.preheader: ; preds = %while.end
%26 = xor i64 %div, -1
%27 = add i64 %25, %26
%28 = add i64 %25, -2
%29 = sub i64 %28, %div
%xtraiter = and i64 %27, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body91.prol.loopexit, label %for.body91.prol
for.body91.prol: ; preds = %for.body91.preheader, %for.body91.prol
%i84.0204.prol = phi i64 [ %i84.0.prol, %for.body91.prol ], [ %i84.0201, %for.body91.preheader ]
%cur.0203.prol = phi i64 [ %30, %for.body91.prol ], [ %.lcssa233, %for.body91.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body91.prol ], [ 0, %for.body91.preheader ]
%arrayidx92.prol = getelementptr inbounds i64, ptr %vla32235, i64 %cur.0203.prol
%30 = load i64, ptr %arrayidx92.prol, align 8, !tbaa !5
%arrayidx93.prol = getelementptr inbounds i64, ptr %vla36237, i64 %30
store i64 0, ptr %arrayidx93.prol, align 8, !tbaa !5
%i84.0.prol = add nsw i64 %i84.0204.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.body91.prol.loopexit, label %for.body91.prol, !llvm.loop !16
for.body91.prol.loopexit: ; preds = %for.body91.prol, %for.body91.preheader
%i84.0204.unr = phi i64 [ %i84.0201, %for.body91.preheader ], [ %i84.0.prol, %for.body91.prol ]
%cur.0203.unr = phi i64 [ %.lcssa233, %for.body91.preheader ], [ %30, %for.body91.prol ]
%.lcssa269.unr = phi i64 [ undef, %for.body91.preheader ], [ %30, %for.body91.prol ]
%31 = icmp ult i64 %29, 3
br i1 %31, label %for.cond99.preheader, label %for.body91
for.cond99.preheader: ; preds = %for.body91.prol.loopexit, %for.body91, %while.end
%cur.0.lcssa = phi i64 [ %.lcssa233, %while.end ], [ %.lcssa269.unr, %for.body91.prol.loopexit ], [ %38, %for.body91 ]
%cmp100207 = icmp sgt i64 %25, 1
br i1 %cmp100207, label %for.body102.preheader, label %for.cond109.preheader
for.body102.preheader: ; preds = %for.cond99.preheader
%32 = add nsw i64 %div, -1
%xtraiter271 = and i64 %div, 3
%lcmp.mod272.not = icmp eq i64 %xtraiter271, 0
br i1 %lcmp.mod272.not, label %for.body102.prol.loopexit, label %for.body102.prol
for.body102.prol: ; preds = %for.body102.preheader, %for.body102.prol
%i96.0209.prol = phi i64 [ %dec106.prol, %for.body102.prol ], [ %div, %for.body102.preheader ]
%cur.1208.prol = phi i64 [ %33, %for.body102.prol ], [ %cur.0.lcssa, %for.body102.preheader ]
%prol.iter273 = phi i64 [ %prol.iter273.next, %for.body102.prol ], [ 0, %for.body102.preheader ]
%arrayidx103.prol = getelementptr inbounds i64, ptr %vla32235, i64 %cur.1208.prol
%33 = load i64, ptr %arrayidx103.prol, align 8, !tbaa !5
%arrayidx104.prol = getelementptr inbounds i64, ptr %vla36237, i64 %33
store i64 1, ptr %arrayidx104.prol, align 8, !tbaa !5
%dec106.prol = add nsw i64 %i96.0209.prol, -1
%prol.iter273.next = add i64 %prol.iter273, 1
%prol.iter273.cmp.not = icmp eq i64 %prol.iter273.next, %xtraiter271
br i1 %prol.iter273.cmp.not, label %for.body102.prol.loopexit, label %for.body102.prol, !llvm.loop !18
for.body102.prol.loopexit: ; preds = %for.body102.prol, %for.body102.preheader
%i96.0209.unr = phi i64 [ %div, %for.body102.preheader ], [ %dec106.prol, %for.body102.prol ]
%cur.1208.unr = phi i64 [ %cur.0.lcssa, %for.body102.preheader ], [ %33, %for.body102.prol ]
%34 = icmp ult i64 %32, 3
br i1 %34, label %for.cond109.preheader, label %for.body102
for.body91: ; preds = %for.body91.prol.loopexit, %for.body91
%i84.0204 = phi i64 [ %i84.0.3, %for.body91 ], [ %i84.0204.unr, %for.body91.prol.loopexit ]
%cur.0203 = phi i64 [ %38, %for.body91 ], [ %cur.0203.unr, %for.body91.prol.loopexit ]
%arrayidx92 = getelementptr inbounds i64, ptr %vla32235, i64 %cur.0203
%35 = load i64, ptr %arrayidx92, align 8, !tbaa !5
%arrayidx93 = getelementptr inbounds i64, ptr %vla36237, i64 %35
store i64 0, ptr %arrayidx93, align 8, !tbaa !5
%arrayidx92.1 = getelementptr inbounds i64, ptr %vla32235, i64 %35
%36 = load i64, ptr %arrayidx92.1, align 8, !tbaa !5
%arrayidx93.1 = getelementptr inbounds i64, ptr %vla36237, i64 %36
store i64 0, ptr %arrayidx93.1, align 8, !tbaa !5
%arrayidx92.2 = getelementptr inbounds i64, ptr %vla32235, i64 %36
%37 = load i64, ptr %arrayidx92.2, align 8, !tbaa !5
%arrayidx93.2 = getelementptr inbounds i64, ptr %vla36237, i64 %37
store i64 0, ptr %arrayidx93.2, align 8, !tbaa !5
%arrayidx92.3 = getelementptr inbounds i64, ptr %vla32235, i64 %37
%38 = load i64, ptr %arrayidx92.3, align 8, !tbaa !5
%arrayidx93.3 = getelementptr inbounds i64, ptr %vla36237, i64 %38
store i64 0, ptr %arrayidx93.3, align 8, !tbaa !5
%i84.0.3 = add nsw i64 %i84.0204, -4
%cmp89.3 = icmp sgt i64 %i84.0.3, %div
br i1 %cmp89.3, label %for.body91, label %for.cond99.preheader, !llvm.loop !19
for.cond109.preheader: ; preds = %for.body102.prol.loopexit, %for.body102, %for.cond99.preheader
%cmp110210 = icmp sgt i64 %.lcssa233, 1
br i1 %cmp110210, label %for.body112.preheader, label %if.else141
for.body112.preheader: ; preds = %for.cond109.preheader
%39 = add i64 %.lcssa233, -1
%xtraiter274 = and i64 %39, 1
%40 = icmp eq i64 %.lcssa233, 2
br i1 %40, label %for.cond125.preheader.unr-lcssa, label %for.body112.preheader.new
for.body112.preheader.new: ; preds = %for.body112.preheader
%unroll_iter = and i64 %39, -2
%invariant.gep = getelementptr i64, ptr %vla52, i64 1
br label %for.body112
for.body102: ; preds = %for.body102.prol.loopexit, %for.body102
%i96.0209 = phi i64 [ %dec106.3, %for.body102 ], [ %i96.0209.unr, %for.body102.prol.loopexit ]
%cur.1208 = phi i64 [ %44, %for.body102 ], [ %cur.1208.unr, %for.body102.prol.loopexit ]
%arrayidx103 = getelementptr inbounds i64, ptr %vla32235, i64 %cur.1208
%41 = load i64, ptr %arrayidx103, align 8, !tbaa !5
%arrayidx104 = getelementptr inbounds i64, ptr %vla36237, i64 %41
store i64 1, ptr %arrayidx104, align 8, !tbaa !5
%arrayidx103.1 = getelementptr inbounds i64, ptr %vla32235, i64 %41
%42 = load i64, ptr %arrayidx103.1, align 8, !tbaa !5
%arrayidx104.1 = getelementptr inbounds i64, ptr %vla36237, i64 %42
store i64 1, ptr %arrayidx104.1, align 8, !tbaa !5
%arrayidx103.2 = getelementptr inbounds i64, ptr %vla32235, i64 %42
%43 = load i64, ptr %arrayidx103.2, align 8, !tbaa !5
%arrayidx104.2 = getelementptr inbounds i64, ptr %vla36237, i64 %43
store i64 1, ptr %arrayidx104.2, align 8, !tbaa !5
%arrayidx103.3 = getelementptr inbounds i64, ptr %vla32235, i64 %43
%44 = load i64, ptr %arrayidx103.3, align 8, !tbaa !5
%arrayidx104.3 = getelementptr inbounds i64, ptr %vla36237, i64 %44
store i64 1, ptr %arrayidx104.3, align 8, !tbaa !5
%dec106.3 = add nsw i64 %i96.0209, -4
%cmp100.3 = icmp sgt i64 %i96.0209, 4
br i1 %cmp100.3, label %for.body102, label %for.cond109.preheader, !llvm.loop !20
for.cond125.preheader.unr-lcssa: ; preds = %for.inc121.1, %for.body112.preheader
%i108.0211.unr = phi i64 [ 1, %for.body112.preheader ], [ %inc122.1, %for.inc121.1 ]
%lcmp.mod275.not = icmp eq i64 %xtraiter274, 0
br i1 %lcmp.mod275.not, label %for.cond125.preheader, label %for.body112.epil
for.body112.epil: ; preds = %for.cond125.preheader.unr-lcssa
%arrayidx113.epil = getelementptr inbounds i64, ptr %vla52, i64 %i108.0211.unr
%45 = load i64, ptr %arrayidx113.epil, align 8, !tbaa !5
%arrayidx114.epil = getelementptr inbounds i64, ptr %vla36237, i64 %45
%46 = load i64, ptr %arrayidx114.epil, align 8, !tbaa !5
%cmp115.epil = icmp eq i64 %46, -1
br i1 %cmp115.epil, label %if.then116.epil, label %for.cond125.preheader
if.then116.epil: ; preds = %for.body112.epil
%arrayidx117.epil = getelementptr inbounds i64, ptr %vla32235, i64 %45
%47 = load i64, ptr %arrayidx117.epil, align 8, !tbaa !5
%arrayidx118.epil = getelementptr inbounds i64, ptr %vla36237, i64 %47
%48 = load i64, ptr %arrayidx118.epil, align 8, !tbaa !5
store i64 %48, ptr %arrayidx114.epil, align 8, !tbaa !5
br label %for.cond125.preheader
for.cond125.preheader: ; preds = %for.body112.epil, %if.then116.epil, %for.cond125.preheader.unr-lcssa
%cmp126212 = icmp sgt i64 %.lcssa233, 2
br i1 %cmp126212, label %for.body128.preheader, label %if.else141
for.body128.preheader: ; preds = %for.cond125.preheader
%49 = add i64 %.lcssa233, -2
%min.iters.check = icmp ult i64 %49, 4
br i1 %min.iters.check, label %for.body128.preheader263, label %vector.ph
vector.ph: ; preds = %for.body128.preheader
%n.vec = and i64 %49, -4
%ind.end = or i64 %n.vec, 2
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> [ zeroinitializer, %vector.ph ], [ %62, %vector.body ]
%vec.phi257 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %63, %vector.body ]
%vec.phi258 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %56, %vector.body ]
%vec.phi259 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %57, %vector.body ]
%offset.idx = or i64 %index, 2
%50 = getelementptr inbounds i64, ptr %vla36237, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %50, align 8, !tbaa !5
%51 = getelementptr inbounds i64, ptr %50, i64 2
%wide.load260 = load <2 x i64>, ptr %51, align 8, !tbaa !5
%52 = icmp eq <2 x i64> %wide.load, <i64 1, i64 1>
%53 = icmp eq <2 x i64> %wide.load260, <i64 1, i64 1>
%54 = zext <2 x i1> %52 to <2 x i64>
%55 = zext <2 x i1> %53 to <2 x i64>
%56 = add <2 x i64> %vec.phi258, %54
%57 = add <2 x i64> %vec.phi259, %55
%58 = xor <2 x i1> %52, <i1 true, i1 true>
%59 = xor <2 x i1> %53, <i1 true, i1 true>
%60 = zext <2 x i1> %58 to <2 x i64>
%61 = zext <2 x i1> %59 to <2 x i64>
%62 = add <2 x i64> %vec.phi, %60
%63 = add <2 x i64> %vec.phi257, %61
%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 !21
middle.block: ; preds = %vector.body
%bin.rdx261 = add <2 x i64> %57, %56
%65 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx261)
%bin.rdx = add <2 x i64> %63, %62
%66 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %49, %n.vec
br i1 %cmp.n, label %for.cond.cleanup127, label %for.body128.preheader263
for.body128.preheader263: ; preds = %for.body128.preheader, %middle.block
%i124.0215.ph = phi i64 [ 2, %for.body128.preheader ], [ %ind.end, %middle.block ]
%white.0214.ph = phi i64 [ 0, %for.body128.preheader ], [ %66, %middle.block ]
%black.0213.ph = phi i64 [ 0, %for.body128.preheader ], [ %65, %middle.block ]
br label %for.body128
for.body112: ; preds = %for.inc121.1, %for.body112.preheader.new
%i108.0211 = phi i64 [ 1, %for.body112.preheader.new ], [ %inc122.1, %for.inc121.1 ]
%niter = phi i64 [ 0, %for.body112.preheader.new ], [ %niter.next.1, %for.inc121.1 ]
%arrayidx113 = getelementptr inbounds i64, ptr %vla52, i64 %i108.0211
%67 = load i64, ptr %arrayidx113, align 8, !tbaa !5
%arrayidx114 = getelementptr inbounds i64, ptr %vla36237, i64 %67
%68 = load i64, ptr %arrayidx114, align 8, !tbaa !5
%cmp115 = icmp eq i64 %68, -1
br i1 %cmp115, label %if.then116, label %for.inc121
if.then116: ; preds = %for.body112
%arrayidx117 = getelementptr inbounds i64, ptr %vla32235, i64 %67
%69 = load i64, ptr %arrayidx117, align 8, !tbaa !5
%arrayidx118 = getelementptr inbounds i64, ptr %vla36237, i64 %69
%70 = load i64, ptr %arrayidx118, align 8, !tbaa !5
store i64 %70, ptr %arrayidx114, align 8, !tbaa !5
br label %for.inc121
for.inc121: ; preds = %for.body112, %if.then116
%gep = getelementptr i64, ptr %invariant.gep, i64 %i108.0211
%71 = load i64, ptr %gep, align 8, !tbaa !5
%arrayidx114.1 = getelementptr inbounds i64, ptr %vla36237, i64 %71
%72 = load i64, ptr %arrayidx114.1, align 8, !tbaa !5
%cmp115.1 = icmp eq i64 %72, -1
br i1 %cmp115.1, label %if.then116.1, label %for.inc121.1
if.then116.1: ; preds = %for.inc121
%arrayidx117.1 = getelementptr inbounds i64, ptr %vla32235, i64 %71
%73 = load i64, ptr %arrayidx117.1, align 8, !tbaa !5
%arrayidx118.1 = getelementptr inbounds i64, ptr %vla36237, i64 %73
%74 = load i64, ptr %arrayidx118.1, align 8, !tbaa !5
store i64 %74, ptr %arrayidx114.1, align 8, !tbaa !5
br label %for.inc121.1
for.inc121.1: ; preds = %if.then116.1, %for.inc121
%inc122.1 = add nuw nsw i64 %i108.0211, 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.cond125.preheader.unr-lcssa, label %for.body112, !llvm.loop !24
for.cond.cleanup127: ; preds = %for.body128, %middle.block
%black.1.lcssa = phi i64 [ %65, %middle.block ], [ %black.1, %for.body128 ]
%white.1.lcssa = phi i64 [ %66, %middle.block ], [ %white.1, %for.body128 ]
%cmp138 = icmp ugt i64 %black.1.lcssa, %white.1.lcssa
br i1 %cmp138, label %if.end143, label %if.else141
for.body128: ; preds = %for.body128.preheader263, %for.body128
%i124.0215 = phi i64 [ %inc136, %for.body128 ], [ %i124.0215.ph, %for.body128.preheader263 ]
%white.0214 = phi i64 [ %white.1, %for.body128 ], [ %white.0214.ph, %for.body128.preheader263 ]
%black.0213 = phi i64 [ %black.1, %for.body128 ], [ %black.0213.ph, %for.body128.preheader263 ]
%arrayidx129 = getelementptr inbounds i64, ptr %vla36237, i64 %i124.0215
%75 = load i64, ptr %arrayidx129, align 8, !tbaa !5
%cmp130 = icmp eq i64 %75, 1
%inc132 = zext i1 %cmp130 to i64
%black.1 = add nuw nsw i64 %black.0213, %inc132
%not.cmp130 = xor i1 %cmp130, true
%inc133 = zext i1 %not.cmp130 to i64
%white.1 = add nuw nsw i64 %white.0214, %inc133
%inc136 = add nuw nsw i64 %i124.0215, 1
%exitcond223.not = icmp eq i64 %inc136, %.lcssa233
br i1 %exitcond223.not, label %for.cond.cleanup127, label %for.body128, !llvm.loop !25
if.else141: ; preds = %for.cond109.preheader, %for.cond125.preheader, %for.cond.cleanup127
br label %if.end143
if.end143: ; preds = %for.cond.cleanup127, %if.else141
%str.sink = phi ptr [ @str, %if.else141 ], [ @str.4, %for.cond.cleanup127 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #8
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12, !22, !23}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12, !23, !22}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
int c[510][510];
int d[510][510];
int deque[300000],*p0=deque,*p1=deque;
void push(int n,int f){
if(f==0){
if(p0==deque)p0=deque+29000-1;
else p0--;
*p0=n;
}else{
*p1=n;
p1++;
if(p1==deque+29000)p1=deque;
}
}
int pop(){
int ret=*p0;
p0++;
if(p0==deque+29000)p0=deque;
return ret;
}
#define chmin(x,y)(x>y?x=y,1:0)
int main(){
int n;
scanf("%d",&n);
rep(i,0,n)rep(j,0,n){
c[i][j]=1;
d[i][j]=min(min(i,n-1-i),min(j,n-1-j));
}
ll ans=0;
rep(_,0,n*n){
int t;
scanf("%d",&t);
t--;
int x=t/n;
int y=t%n;
ans+=d[x][y];
c[x][y]=0;
push(x*n+y,0);
while(p0!=p1){
int tt=pop();
int xx=tt/n;
int yy=tt%n;
if(xx!= 0&&chmin(d[xx-1][yy],d[xx][yy]+c[xx][yy]))push((xx-1)*n+yy,c[xx-1][yy]);
if(xx!=n-1&&chmin(d[xx+1][yy],d[xx][yy]+c[xx][yy]))push((xx+1)*n+yy,c[xx+1][yy]);
if(yy!= 0&&chmin(d[xx][yy-1],d[xx][yy]+c[xx][yy]))push(xx*n+(yy-1),c[xx][yy-1]);
if(yy!=n-1&&chmin(d[xx][yy+1],d[xx][yy]+c[xx][yy]))push(xx*n+(yy+1),c[xx][yy+1]);
}
}
printf("%lld\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103027/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103027/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@deque = dso_local global [300000 x i32] zeroinitializer, align 16
@p0 = dso_local local_unnamed_addr global ptr @deque, align 8
@p1 = dso_local local_unnamed_addr global ptr @deque, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@c = dso_local local_unnamed_addr global [510 x [510 x i32]] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [510 x [510 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #9
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #9
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pom(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #3 {
entry:
%conv = sext i32 %m to i64
%tobool.not16 = icmp eq i64 %n, 0
br i1 %tobool.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %cond.end
%mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ]
%x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ]
%a.addr.019 = srem i64 %mul4.pn, %conv
%and = and i64 %n.addr.017, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %cond.end, label %cond.true
cond.true: ; preds = %for.body
%mul = mul nsw i64 %a.addr.019, %x.018
%rem3 = srem i64 %mul, %conv
br label %cond.end
cond.end: ; preds = %for.body, %cond.true
%x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ]
%mul4 = mul nsw i64 %a.addr.019, %a.addr.019
%div = sdiv i64 %n.addr.017, 2
%n.addr.017.off = add i64 %n.addr.017, 1
%tobool.not = icmp ult i64 %n.addr.017.off, 3
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %cond.end, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ]
ret i64 %x.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %n, i32 noundef %f) local_unnamed_addr #5 {
entry:
%cmp = icmp eq i32 %f, 0
br i1 %cmp, label %if.then, label %if.else3
if.then: ; preds = %entry
%0 = load ptr, ptr @p0, align 8, !tbaa !11
%cmp1 = icmp eq ptr %0, @deque
%incdec.ptr = getelementptr inbounds i32, ptr %0, i64 -1
%storemerge = select i1 %cmp1, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr
store ptr %storemerge, ptr @p0, align 8, !tbaa !11
store i32 %n, ptr %storemerge, align 4, !tbaa !13
br label %if.end8
if.else3: ; preds = %entry
%1 = load ptr, ptr @p1, align 8, !tbaa !11
store i32 %n, ptr %1, align 4, !tbaa !13
%incdec.ptr4 = getelementptr inbounds i32, ptr %1, i64 1
%cmp5 = icmp eq ptr %incdec.ptr4, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select = select i1 %cmp5, ptr @deque, ptr %incdec.ptr4
store ptr %spec.store.select, ptr @p1, align 8
br label %if.end8
if.end8: ; preds = %if.else3, %if.then
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr @p0, align 8, !tbaa !11
%1 = load i32, ptr %0, align 4, !tbaa !13
%incdec.ptr = getelementptr inbounds i32, ptr %0, i64 1
%cmp = icmp eq ptr %incdec.ptr, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select = select i1 %cmp, ptr @deque, ptr %incdec.ptr
store ptr %spec.store.select, ptr @p0, align 8
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%conv = sext i32 %0 to i64
%cmp402 = icmp sgt i32 %0, 0
br i1 %cmp402, label %for.cond2.preheader.lr.ph, label %for.cond64.preheader
for.cond2.preheader.lr.ph: ; preds = %entry
%sub = add nsw i32 %0, -1
%conv9 = zext i32 %sub to i64
%min.iters.check = icmp ult i32 %0, 4
%n.vec = and i64 %conv, -4
%broadcast.splatinsert = insertelement <4 x i64> poison, i64 %conv9, i64 0
%broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i64 %n.vec, %conv
br label %for.cond2.preheader.us
for.cond2.preheader.us: ; preds = %for.cond2.for.cond.cleanup6_crit_edge.us, %for.cond2.preheader.lr.ph
%i.0403.us = phi i64 [ 0, %for.cond2.preheader.lr.ph ], [ %inc62.us, %for.cond2.for.cond.cleanup6_crit_edge.us ]
%sub10.us = sub nsw i64 %conv9, %i.0403.us
%i.0.sub10.us = call i64 @llvm.smin.i64(i64 %i.0403.us, i64 %sub10.us)
br i1 %min.iters.check, label %for.body7.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond2.preheader.us
%broadcast.splatinsert411 = insertelement <4 x i64> poison, i64 %i.0.sub10.us, i64 0
%broadcast.splat412 = shufflevector <4 x i64> %broadcast.splatinsert411, <4 x i64> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %i.0403.us, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !tbaa !13
%2 = sub nsw <4 x i64> %broadcast.splat, %vec.ind
%3 = call <4 x i64> @llvm.smin.v4i64(<4 x i64> %vec.ind, <4 x i64> %2)
%4 = call <4 x i64> @llvm.smin.v4i64(<4 x i64> %broadcast.splat412, <4 x i64> %3)
%5 = trunc <4 x i64> %4 to <4 x i32>
%6 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %i.0403.us, i64 %index
store <4 x i32> %5, ptr %6, align 8, !tbaa !13
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond2.for.cond.cleanup6_crit_edge.us, label %for.body7.us.preheader
for.body7.us.preheader: ; preds = %for.cond2.preheader.us, %middle.block
%j.0401.us.ph = phi i64 [ 0, %for.cond2.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body7.us
for.body7.us: ; preds = %for.body7.us.preheader, %for.body7.us
%j.0401.us = phi i64 [ %inc.us, %for.body7.us ], [ %j.0401.us.ph, %for.body7.us.preheader ]
%arrayidx8.us = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %i.0403.us, i64 %j.0401.us
store i32 1, ptr %arrayidx8.us, align 4, !tbaa !13
%sub18.us = sub nsw i64 %conv9, %j.0401.us
%cond27.us = call i64 @llvm.smin.i64(i64 %j.0401.us, i64 %sub18.us)
%spec.select.us = call i64 @llvm.smin.i64(i64 %i.0.sub10.us, i64 %cond27.us)
%conv58.us = trunc i64 %spec.select.us to i32
%arrayidx60.us = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %i.0403.us, i64 %j.0401.us
store i32 %conv58.us, ptr %arrayidx60.us, align 4, !tbaa !13
%inc.us = add nuw nsw i64 %j.0401.us, 1
%exitcond.not = icmp eq i64 %inc.us, %conv
br i1 %exitcond.not, label %for.cond2.for.cond.cleanup6_crit_edge.us, label %for.body7.us, !llvm.loop !18
for.cond2.for.cond.cleanup6_crit_edge.us: ; preds = %for.body7.us, %middle.block
%inc62.us = add nuw nsw i64 %i.0403.us, 1
%exitcond410.not = icmp eq i64 %inc62.us, %conv
br i1 %exitcond410.not, label %for.cond64.preheader, label %for.cond2.preheader.us, !llvm.loop !19
for.cond64.preheader: ; preds = %for.cond2.for.cond.cleanup6_crit_edge.us, %entry
%cmp66407.not = icmp eq i32 %0, 0
br i1 %cmp66407.not, label %for.cond.cleanup68, label %for.body69
for.cond.cleanup68: ; preds = %while.end, %for.cond64.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond64.preheader ], [ %add, %while.end ]
%call268 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body69: ; preds = %for.cond64.preheader, %while.end
%ans.0409 = phi i64 [ %add, %while.end ], [ 0, %for.cond64.preheader ]
%_.0408 = phi i64 [ %inc266, %while.end ], [ 0, %for.cond64.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #9
%call70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%8 = load i32, ptr %t, align 4, !tbaa !13
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %t, align 4, !tbaa !13
%9 = load i32, ptr %n, align 4, !tbaa !13
%div = sdiv i32 %dec, %9
%rem = srem i32 %dec, %9
%idxprom = sext i32 %div to i64
%idxprom72 = sext i32 %rem to i64
%arrayidx73 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom, i64 %idxprom72
%10 = load i32, ptr %arrayidx73, align 4, !tbaa !13
%conv74 = sext i32 %10 to i64
%add = add nsw i64 %ans.0409, %conv74
%arrayidx78 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom, i64 %idxprom72
store i32 0, ptr %arrayidx78, align 4, !tbaa !13
%mul79 = mul nsw i32 %div, %9
%add80 = add nsw i32 %mul79, %rem
%11 = load ptr, ptr @p0, align 8, !tbaa !11
%cmp1.i = icmp eq ptr %11, @deque
%incdec.ptr.i = getelementptr inbounds i32, ptr %11, i64 -1
%storemerge.i = select i1 %cmp1.i, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr.i
store ptr %storemerge.i, ptr @p0, align 8, !tbaa !11
store i32 %add80, ptr %storemerge.i, align 4, !tbaa !13
%12 = load ptr, ptr @p1, align 8, !tbaa !11
%cmp81.not404 = icmp eq ptr %storemerge.i, %12
br i1 %cmp81.not404, label %while.end, label %while.body
while.body: ; preds = %for.body69, %if.end264
%13 = phi ptr [ %42, %if.end264 ], [ %12, %for.body69 ]
%14 = phi ptr [ %43, %if.end264 ], [ %storemerge.i, %for.body69 ]
%15 = load i32, ptr %14, align 4, !tbaa !13
%incdec.ptr.i364 = getelementptr inbounds i32, ptr %14, i64 1
%cmp.i = icmp eq ptr %incdec.ptr.i364, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select.i = select i1 %cmp.i, ptr @deque, ptr %incdec.ptr.i364
store ptr %spec.store.select.i, ptr @p0, align 8
%16 = load i32, ptr %n, align 4, !tbaa !13
%div84 = sdiv i32 %15, %16
%rem85 = srem i32 %15, %16
%cmp86.not = icmp eq i32 %div84, 0
br i1 %cmp86.not, label %if.end, label %land.lhs.true
land.lhs.true: ; preds = %while.body
%sub88 = add nsw i32 %div84, -1
%idxprom89 = sext i32 %sub88 to i64
%idxprom91 = sext i32 %rem85 to i64
%arrayidx92 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom89, i64 %idxprom91
%17 = load i32, ptr %arrayidx92, align 4, !tbaa !13
%idxprom93 = sext i32 %div84 to i64
%arrayidx96 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom93, i64 %idxprom91
%18 = load i32, ptr %arrayidx96, align 4, !tbaa !13
%arrayidx100 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom93, i64 %idxprom91
%19 = load i32, ptr %arrayidx100, align 4, !tbaa !13
%add101 = add nsw i32 %19, %18
%cmp102 = icmp sgt i32 %17, %add101
br i1 %cmp102, label %cond.true104, label %if.end
cond.true104: ; preds = %land.lhs.true
store i32 %add101, ptr %arrayidx92, align 4, !tbaa !13
%mul121 = mul nsw i32 %sub88, %16
%add122 = add nsw i32 %mul121, %rem85
%arrayidx127 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom89, i64 %idxprom91
%20 = load i32, ptr %arrayidx127, align 4, !tbaa !13
%cmp.i365 = icmp eq i32 %20, 0
br i1 %cmp.i365, label %if.then.i, label %if.else3.i
if.then.i: ; preds = %cond.true104
%cmp1.i367 = icmp eq ptr %spec.store.select.i, @deque
%incdec.ptr.i368 = getelementptr inbounds i32, ptr %spec.store.select.i, i64 -1
%storemerge.i369 = select i1 %cmp1.i367, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr.i368
store ptr %storemerge.i369, ptr @p0, align 8, !tbaa !11
store i32 %add122, ptr %storemerge.i369, align 4, !tbaa !13
br label %if.end
if.else3.i: ; preds = %cond.true104
store i32 %add122, ptr %13, align 4, !tbaa !13
%incdec.ptr4.i = getelementptr inbounds i32, ptr %13, i64 1
%cmp5.i = icmp eq ptr %incdec.ptr4.i, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select.i366 = select i1 %cmp5.i, ptr @deque, ptr %incdec.ptr4.i
store ptr %spec.store.select.i366, ptr @p1, align 8
br label %if.end
if.end: ; preds = %if.else3.i, %if.then.i, %land.lhs.true, %while.body
%21 = phi ptr [ %spec.store.select.i366, %if.else3.i ], [ %13, %if.then.i ], [ %13, %land.lhs.true ], [ %13, %while.body ]
%22 = phi ptr [ %spec.store.select.i, %if.else3.i ], [ %storemerge.i369, %if.then.i ], [ %spec.store.select.i, %land.lhs.true ], [ %spec.store.select.i, %while.body ]
%23 = load i32, ptr %n, align 4, !tbaa !13
%sub128 = add nsw i32 %23, -1
%cmp129.not = icmp eq i32 %div84, %sub128
br i1 %cmp129.not, label %if.end173, label %land.lhs.true131
land.lhs.true131: ; preds = %if.end
%add132 = add nsw i32 %div84, 1
%idxprom133 = sext i32 %add132 to i64
%idxprom135 = sext i32 %rem85 to i64
%arrayidx136 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom133, i64 %idxprom135
%24 = load i32, ptr %arrayidx136, align 4, !tbaa !13
%idxprom137 = sext i32 %div84 to i64
%arrayidx140 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom137, i64 %idxprom135
%25 = load i32, ptr %arrayidx140, align 4, !tbaa !13
%arrayidx144 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom137, i64 %idxprom135
%26 = load i32, ptr %arrayidx144, align 4, !tbaa !13
%add145 = add nsw i32 %26, %25
%cmp146 = icmp sgt i32 %24, %add145
br i1 %cmp146, label %cond.true148, label %if.end173
cond.true148: ; preds = %land.lhs.true131
store i32 %add145, ptr %arrayidx136, align 4, !tbaa !13
%mul166 = mul nsw i32 %23, %add132
%add167 = add nsw i32 %mul166, %rem85
%arrayidx172 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom133, i64 %idxprom135
%27 = load i32, ptr %arrayidx172, align 4, !tbaa !13
%cmp.i370 = icmp eq i32 %27, 0
br i1 %cmp.i370, label %if.then.i375, label %if.else3.i371
if.then.i375: ; preds = %cond.true148
%cmp1.i376 = icmp eq ptr %22, @deque
%incdec.ptr.i377 = getelementptr inbounds i32, ptr %22, i64 -1
%storemerge.i378 = select i1 %cmp1.i376, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr.i377
store ptr %storemerge.i378, ptr @p0, align 8, !tbaa !11
store i32 %add167, ptr %storemerge.i378, align 4, !tbaa !13
br label %if.end173
if.else3.i371: ; preds = %cond.true148
store i32 %add167, ptr %21, align 4, !tbaa !13
%incdec.ptr4.i372 = getelementptr inbounds i32, ptr %21, i64 1
%cmp5.i373 = icmp eq ptr %incdec.ptr4.i372, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select.i374 = select i1 %cmp5.i373, ptr @deque, ptr %incdec.ptr4.i372
store ptr %spec.store.select.i374, ptr @p1, align 8
br label %if.end173
if.end173: ; preds = %if.else3.i371, %if.then.i375, %land.lhs.true131, %if.end
%28 = phi ptr [ %spec.store.select.i374, %if.else3.i371 ], [ %21, %if.then.i375 ], [ %21, %land.lhs.true131 ], [ %21, %if.end ]
%29 = phi ptr [ %22, %if.else3.i371 ], [ %storemerge.i378, %if.then.i375 ], [ %22, %land.lhs.true131 ], [ %22, %if.end ]
%cmp174.not = icmp eq i32 %rem85, 0
br i1 %cmp174.not, label %if.end218, label %land.lhs.true176
land.lhs.true176: ; preds = %if.end173
%idxprom177 = sext i32 %div84 to i64
%sub179 = add nsw i32 %rem85, -1
%idxprom180 = sext i32 %sub179 to i64
%arrayidx181 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom177, i64 %idxprom180
%30 = load i32, ptr %arrayidx181, align 4, !tbaa !13
%idxprom184 = sext i32 %rem85 to i64
%arrayidx185 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom177, i64 %idxprom184
%31 = load i32, ptr %arrayidx185, align 4, !tbaa !13
%arrayidx189 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom177, i64 %idxprom184
%32 = load i32, ptr %arrayidx189, align 4, !tbaa !13
%add190 = add nsw i32 %32, %31
%cmp191 = icmp sgt i32 %30, %add190
br i1 %cmp191, label %cond.true193, label %if.end218
cond.true193: ; preds = %land.lhs.true176
store i32 %add190, ptr %arrayidx181, align 4, !tbaa !13
%33 = load i32, ptr %n, align 4, !tbaa !13
%mul210 = mul nsw i32 %33, %div84
%add212 = add nsw i32 %mul210, %sub179
%arrayidx217 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom177, i64 %idxprom180
%34 = load i32, ptr %arrayidx217, align 4, !tbaa !13
%cmp.i380 = icmp eq i32 %34, 0
br i1 %cmp.i380, label %if.then.i385, label %if.else3.i381
if.then.i385: ; preds = %cond.true193
%cmp1.i386 = icmp eq ptr %29, @deque
%incdec.ptr.i387 = getelementptr inbounds i32, ptr %29, i64 -1
%storemerge.i388 = select i1 %cmp1.i386, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr.i387
store ptr %storemerge.i388, ptr @p0, align 8, !tbaa !11
store i32 %add212, ptr %storemerge.i388, align 4, !tbaa !13
br label %if.end218
if.else3.i381: ; preds = %cond.true193
store i32 %add212, ptr %28, align 4, !tbaa !13
%incdec.ptr4.i382 = getelementptr inbounds i32, ptr %28, i64 1
%cmp5.i383 = icmp eq ptr %incdec.ptr4.i382, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select.i384 = select i1 %cmp5.i383, ptr @deque, ptr %incdec.ptr4.i382
store ptr %spec.store.select.i384, ptr @p1, align 8
br label %if.end218
if.end218: ; preds = %if.else3.i381, %if.then.i385, %land.lhs.true176, %if.end173
%35 = phi ptr [ %spec.store.select.i384, %if.else3.i381 ], [ %28, %if.then.i385 ], [ %28, %land.lhs.true176 ], [ %28, %if.end173 ]
%36 = phi ptr [ %29, %if.else3.i381 ], [ %storemerge.i388, %if.then.i385 ], [ %29, %land.lhs.true176 ], [ %29, %if.end173 ]
%37 = load i32, ptr %n, align 4, !tbaa !13
%sub219 = add nsw i32 %37, -1
%cmp220.not = icmp eq i32 %rem85, %sub219
br i1 %cmp220.not, label %if.end264, label %land.lhs.true222
land.lhs.true222: ; preds = %if.end218
%idxprom223 = sext i32 %div84 to i64
%add225 = add nsw i32 %rem85, 1
%idxprom226 = sext i32 %add225 to i64
%arrayidx227 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom223, i64 %idxprom226
%38 = load i32, ptr %arrayidx227, align 4, !tbaa !13
%idxprom230 = sext i32 %rem85 to i64
%arrayidx231 = getelementptr inbounds [510 x [510 x i32]], ptr @d, i64 0, i64 %idxprom223, i64 %idxprom230
%39 = load i32, ptr %arrayidx231, align 4, !tbaa !13
%arrayidx235 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom223, i64 %idxprom230
%40 = load i32, ptr %arrayidx235, align 4, !tbaa !13
%add236 = add nsw i32 %40, %39
%cmp237 = icmp sgt i32 %38, %add236
br i1 %cmp237, label %cond.true239, label %if.end264
cond.true239: ; preds = %land.lhs.true222
store i32 %add236, ptr %arrayidx227, align 4, !tbaa !13
%mul256 = mul nsw i32 %37, %div84
%add258 = add nsw i32 %mul256, %add225
%arrayidx263 = getelementptr inbounds [510 x [510 x i32]], ptr @c, i64 0, i64 %idxprom223, i64 %idxprom226
%41 = load i32, ptr %arrayidx263, align 4, !tbaa !13
%cmp.i390 = icmp eq i32 %41, 0
br i1 %cmp.i390, label %if.then.i395, label %if.else3.i391
if.then.i395: ; preds = %cond.true239
%cmp1.i396 = icmp eq ptr %36, @deque
%incdec.ptr.i397 = getelementptr inbounds i32, ptr %36, i64 -1
%storemerge.i398 = select i1 %cmp1.i396, ptr getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 28999), ptr %incdec.ptr.i397
store ptr %storemerge.i398, ptr @p0, align 8, !tbaa !11
store i32 %add258, ptr %storemerge.i398, align 4, !tbaa !13
br label %if.end264
if.else3.i391: ; preds = %cond.true239
store i32 %add258, ptr %35, align 4, !tbaa !13
%incdec.ptr4.i392 = getelementptr inbounds i32, ptr %35, i64 1
%cmp5.i393 = icmp eq ptr %incdec.ptr4.i392, getelementptr inbounds ([300000 x i32], ptr @deque, i64 0, i64 29000)
%spec.store.select.i394 = select i1 %cmp5.i393, ptr @deque, ptr %incdec.ptr4.i392
store ptr %spec.store.select.i394, ptr @p1, align 8
br label %if.end264
if.end264: ; preds = %if.else3.i391, %if.then.i395, %land.lhs.true222, %if.end218
%42 = phi ptr [ %spec.store.select.i394, %if.else3.i391 ], [ %35, %if.then.i395 ], [ %35, %land.lhs.true222 ], [ %35, %if.end218 ]
%43 = phi ptr [ %36, %if.else3.i391 ], [ %storemerge.i398, %if.then.i395 ], [ %36, %land.lhs.true222 ], [ %36, %if.end218 ]
%cmp81.not = icmp eq ptr %43, %42
br i1 %cmp81.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %if.end264, %for.body69
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #9
%inc266 = add nuw nsw i64 %_.0408, 1
%44 = load i32, ptr %n, align 4, !tbaa !13
%mul = mul nsw i32 %44, %44
%conv65 = zext i32 %mul to i64
%cmp66 = icmp ult i64 %inc266, %conv65
br i1 %cmp66, label %for.body69, label %for.cond.cleanup68, !llvm.loop !21
}
; 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 i64 @llvm.smin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i64> @llvm.smin.v4i64(<4 x i64>, <4 x i64>) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree norecurse nosync nounwind willreturn 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 #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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10, !17, !16}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
int main(){
int a, b; scanf("%d%d", &a, &b);
char s[33]; scanf("%s", s);
for(int i=0; i<a+b+1; i++){
if((i!=a && s[i]=='-') || (i==a && s[i]!='-')){
printf("No\n");
return 0;
}
}
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103085/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103085/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = 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 [33 x i8], align 16
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)
call void @llvm.lifetime.start.p0(i64 33, ptr nonnull %s) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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.not25 = icmp slt i32 %add, 0
br i1 %cmp.not25, label %cleanup16, 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
%arrayidx10 = getelementptr inbounds [33 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 ]
%cmp3.not = icmp eq i64 %indvars.iv, %2
br i1 %cmp3.not, label %land.lhs.true8, label %land.lhs.true
land.lhs.true: ; preds = %for.body
%arrayidx = getelementptr inbounds [33 x i8], ptr %s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp4 = icmp eq i8 %4, 45
br i1 %cmp4, label %cleanup16, label %for.inc
land.lhs.true8: ; preds = %for.body
%5 = load i8, ptr %arrayidx10, align 1, !tbaa !9
%cmp12.not = icmp eq i8 %5, 45
br i1 %cmp12.not, label %for.inc, label %cleanup16
for.inc: ; preds = %land.lhs.true, %land.lhs.true8
%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 %cleanup16, label %for.body, !llvm.loop !10
cleanup16: ; preds = %for.inc, %land.lhs.true, %land.lhs.true8, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str, %land.lhs.true8 ], [ @str, %land.lhs.true ], [ @str.4, %for.inc ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 33, 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>
int main(){
int a, b;
scanf("%d %d", &a, &b);
char s[a + b + 2];
scanf("%s\n", s);
for(int i = 0; i < a+b+1; i++){
if((i == a && s[i] != '-') || ((i != a) && (s[i] < '0' || s[i] > '9'))){
printf("%s\n", "No");
return 0;
}
}
printf("%s\n", "Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = 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 = 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 %0, 2
%add1 = add i32 %add, %1
%2 = zext i32 %add1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%add3 = add i32 %5, %4
%cmp.not34 = icmp slt i32 %add3, 0
br i1 %cmp.not34, label %cleanup24, label %for.body.preheader
for.body.preheader: ; preds = %entry
%6 = zext i32 %4 to i64
%7 = add nuw i32 %add3, 1
%wide.trip.count = zext i32 %7 to i64
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %6
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 ]
%cmp5 = icmp eq i64 %indvars.iv, %6
br i1 %cmp5, label %land.lhs.true, label %land.lhs.true10
land.lhs.true: ; preds = %for.body
%8 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp6.not = icmp eq i8 %8, 45
br i1 %cmp6.not, label %for.inc, label %cleanup24
land.lhs.true10: ; preds = %for.body
%arrayidx12 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%9 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%10 = add i8 %9, -58
%or.cond = icmp ult i8 %10, -10
br i1 %or.cond, label %cleanup24, label %for.inc
for.inc: ; preds = %land.lhs.true, %land.lhs.true10
%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 %cleanup24, label %for.body, !llvm.loop !10
cleanup24: ; preds = %for.inc, %land.lhs.true, %land.lhs.true10, %entry
%.str.2.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %land.lhs.true10 ], [ @.str.2, %land.lhs.true ], [ @.str.3, %for.inc ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.stackrestore.p0(ptr %3)
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 willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int A,B,i,length;
char s[2000];
scanf("%d%d",&A,&B);
scanf("%s",s);
length=strlen(s);
for(i=0;i<length;i++){
if(s[A]!='-'){
printf("No");
break;
}
if(i==A){
i++;
}
if(s[A]=='-'&&s[i]>=48&&s[i]<=57){
if(i==(length-1)){
printf("Yes");
break;
}
else{
continue;
}
}
if(s[i]=='-'&&s[A]=='-'){
printf("No");
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%s = alloca [2000 x i8], align 16
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 2000, ptr nonnull %s) #4
%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) #5
%conv = trunc i64 %call3 to i32
%cmp58 = icmp sgt i32 %conv, 0
br i1 %cmp58, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %A, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [2000 x i8], ptr %s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp6.not = icmp eq i8 %1, 45
%sub = add nsw i32 %conv, -1
br i1 %cmp6.not, label %for.body, label %for.end.sink.split
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.059 = phi i32 [ %inc49, %for.inc ], [ 0, %for.body.lr.ph ]
%cmp9 = icmp eq i32 %i.059, %0
%inc = zext i1 %cmp9 to i32
%spec.select = add nsw i32 %i.059, %inc
%idxprom18 = sext i32 %spec.select to i64
%arrayidx19 = getelementptr inbounds [2000 x i8], ptr %s, i64 0, i64 %idxprom18
%2 = load i8, ptr %arrayidx19, align 1, !tbaa !9
%3 = add i8 %2, -48
%or.cond = icmp ult i8 %3, 10
br i1 %or.cond, label %if.then29, label %if.end34
if.then29: ; preds = %for.body
%cmp30 = icmp eq i32 %spec.select, %sub
br i1 %cmp30, label %for.end.sink.split, label %for.inc
if.end34: ; preds = %for.body
%cmp38 = icmp eq i8 %2, 45
br i1 %cmp38, label %for.end.sink.split, label %for.inc
for.inc: ; preds = %if.end34, %if.then29
%inc49 = add nsw i32 %spec.select, 1
%cmp = icmp slt i32 %inc49, %conv
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end.sink.split: ; preds = %if.end34, %if.then29, %for.body.lr.ph
%.str.2.sink = phi ptr [ @.str.2, %for.body.lr.ph ], [ @.str.3, %if.then29 ], [ @.str.2, %if.end34 ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
br label %for.end
for.end: ; preds = %for.inc, %for.end.sink.split, %entry
call void @llvm.lifetime.end.p0(i64 2000, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int A, B, hoge_count = 0;
char *S;
scanf("%d%d", &A, &B);
S = (char *)malloc(sizeof(char) * (A + B + 2));
scanf("%s", S);
for(int i = 0; i < (A + B + 2); i++) if(S[i] == '-') hoge_count++;
if(hoge_count == 1){
if(S[A] == '-') printf("Yes");
else printf("No");
}else{
printf("No");
}
free(S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #6
%call = 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 %0, 2
%add1 = add i32 %add, %1
%conv = sext i32 %add1 to i64
%call2 = call noalias ptr @malloc(i64 noundef %conv) #7
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call2)
%2 = load i32, ptr %A, align 4, !tbaa !5
%3 = load i32, ptr %B, align 4, !tbaa !5
%add4 = add i32 %2, 2
%add5 = add i32 %add4, %3
%cmp32 = icmp sgt i32 %add5, 0
br i1 %cmp32, label %for.body.preheader, label %if.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %add5 to i64
%min.iters.check = icmp ult i32 %add5, 8
br i1 %min.iters.check, label %for.body.preheader40, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi38 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%4 = getelementptr inbounds i8, ptr %call2, i64 %index
%wide.load = load <4 x i8>, ptr %4, align 1, !tbaa !9
%5 = getelementptr inbounds i8, ptr %4, i64 4
%wide.load39 = load <4 x i8>, ptr %5, align 1, !tbaa !9
%6 = icmp eq <4 x i8> %wide.load, <i8 45, i8 45, i8 45, i8 45>
%7 = icmp eq <4 x i8> %wide.load39, <i8 45, i8 45, i8 45, i8 45>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = add <4 x i32> %vec.phi, %8
%11 = add <4 x i32> %vec.phi38, %9
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = 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.cleanup, label %for.body.preheader40
for.body.preheader40: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%hoge_count.033.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %13, %middle.block ], [ %spec.select, %for.body ]
%14 = icmp eq i32 %spec.select.lcssa, 1
br i1 %14, label %if.then13, label %if.end25
for.body: ; preds = %for.body.preheader40, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader40 ]
%hoge_count.033 = phi i32 [ %spec.select, %for.body ], [ %hoge_count.033.ph, %for.body.preheader40 ]
%arrayidx = getelementptr inbounds i8, ptr %call2, i64 %indvars.iv
%15 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp8 = icmp eq i8 %15, 45
%inc = zext i1 %cmp8 to i32
%spec.select = add nuw nsw i32 %hoge_count.033, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
if.then13: ; preds = %for.cond.cleanup
%idxprom14 = sext i32 %2 to i64
%arrayidx15 = getelementptr inbounds i8, ptr %call2, i64 %idxprom14
%16 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%cmp17 = icmp eq i8 %16, 45
%.str.2..str.3 = select i1 %cmp17, ptr @.str.2, ptr @.str.3
br label %if.end25
if.end25: ; preds = %for.cond.cleanup, %entry, %if.then13
%.str.2.sink = phi ptr [ %.str.2..str.3, %if.then13 ], [ @.str.3, %entry ], [ @.str.3, %for.cond.cleanup ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @free(ptr noundef %call2) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include <stdio.h>
int main(){
char ch[250]={0};
char a[250]={0};
int h;
int i,j,k,m;
while(1){
i=0;
while(1){
scanf("%c",&ch[i]);
if(ch[i]=='\n'){
break;
}
i++;
}
if (i==1 && ch[0]=='-') break;
scanf("%d",&m);
for(j=0;j<m;j++){
scanf("%d",&h);
for(k=0;k<i-h;k++){
a[k]=ch[h+k];
}
for(k=0;k<h;k++){
a[i-h+k]=ch[k];
}
for(k=0;k<i;k++){
ch[k]=a[k];
}
}
for(k=0;k<i;k++){
printf("%c",ch[k]);
}
printf("\n");
scanf("%c",&ch[0]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca [250 x i8], align 16
%a = alloca [250 x i8], align 16
%h = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 250, ptr nonnull %ch) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(250) %ch, i8 0, i64 250, i1 false)
call void @llvm.lifetime.start.p0(i64 250, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(250) %a, i8 0, i64 250, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
br label %while.cond1
while.cond1: ; preds = %while.cond1.backedge, %entry
%indvars.iv118 = phi i32 [ 0, %entry ], [ %indvars.iv118.be, %while.cond1.backedge ]
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.be, %while.cond1.backedge ]
%arrayidx = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next119 = add nuw i32 %indvars.iv118, 1
br i1 %cmp, label %while.end, label %while.cond1.backedge
while.cond1.backedge: ; preds = %while.cond1, %for.end64
%indvars.iv118.be = phi i32 [ %indvars.iv.next119, %while.cond1 ], [ 0, %for.end64 ]
%indvars.iv.be = phi i64 [ %indvars.iv.next, %while.cond1 ], [ 0, %for.end64 ]
br label %while.cond1
while.end: ; preds = %while.cond1
%1 = trunc i64 %indvars.iv to i32
%cmp6 = icmp eq i32 %1, 1
%2 = load i8, ptr %ch, align 16
%cmp10 = icmp eq i8 %2, 45
%or.cond = select i1 %cmp6, i1 %cmp10, i1 false
br i1 %or.cond, label %while.end68, label %if.end13
if.end13: ; preds = %while.end
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !8
%cmp1599 = icmp sgt i32 %3, 0
br i1 %cmp1599, label %for.body.lr.ph, label %for.cond54.preheader
for.body.lr.ph: ; preds = %if.end13
%cmp4197.not = icmp eq i32 %1, 0
%4 = trunc i64 %indvars.iv to i32
br label %for.body
for.cond54.preheader: ; preds = %for.inc51, %if.end13
%cmp55101.not = icmp eq i32 %1, 0
br i1 %cmp55101.not, label %for.end64, label %for.body57.preheader
for.body57.preheader: ; preds = %for.cond54.preheader
%wide.trip.count120 = zext i32 %indvars.iv118 to i64
br label %for.body57
for.body: ; preds = %for.body.lr.ph, %for.inc51
%j.0100 = phi i32 [ 0, %for.body.lr.ph ], [ %inc52, %for.inc51 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%5 = load i32, ptr %h, align 4, !tbaa !8
%sub = sub nsw i32 %1, %5
%cmp1992 = icmp sgt i32 %sub, 0
br i1 %cmp1992, label %for.body21.preheader, label %for.cond27.preheader
for.body21.preheader: ; preds = %for.body
%6 = sext i32 %5 to i64
%scevgep = getelementptr i8, ptr %ch, i64 %6
%7 = xor i32 %5, -1
%8 = add i32 %7, %4
%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) %a, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %10, i1 false), !tbaa !5
br label %for.cond27.preheader
for.cond27.preheader: ; preds = %for.body21.preheader, %for.body
%cmp2895 = icmp sgt i32 %5, 0
br i1 %cmp2895, label %iter.check, label %for.cond40.preheader
iter.check: ; preds = %for.cond27.preheader
%wide.trip.count = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body30.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.body30.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check122 = icmp ult i32 %5, 32
br i1 %min.iters.check122, 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 [250 x i8], ptr %ch, i64 0, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i8, ptr %18, i64 16
%wide.load123 = load <16 x i8>, ptr %19, align 16, !tbaa !5
%20 = add nsw i32 %sub, %17
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %21
store <16 x i8> %wide.load, ptr %22, align 1, !tbaa !5
%23 = getelementptr inbounds i8, ptr %22, i64 16
store <16 x i8> %wide.load123, ptr %23, align 1, !tbaa !5
%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.cond40.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.body30.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.vec125 = 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.idx127 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next129, %vec.epilog.vector.body ]
%25 = trunc i64 %offset.idx127 to i32
%26 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %offset.idx127
%wide.load128 = load <8 x i8>, ptr %26, align 8, !tbaa !5
%27 = add nsw i32 %sub, %25
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %28
store <8 x i8> %wide.load128, ptr %29, align 1, !tbaa !5
%index.next129 = add nuw i64 %offset.idx127, 8
%30 = icmp eq i64 %index.next129, %n.vec125
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.n126 = icmp eq i64 %n.vec125, %wide.trip.count
br i1 %cmp.n126, label %for.cond40.preheader, label %for.body30.preheader
for.body30.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv108.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec125, %vec.epilog.middle.block ]
%31 = xor i64 %indvars.iv108.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.body30.prol.loopexit, label %for.body30.prol
for.body30.prol: ; preds = %for.body30.preheader, %for.body30.prol
%indvars.iv108.prol = phi i64 [ %indvars.iv.next109.prol, %for.body30.prol ], [ %indvars.iv108.ph, %for.body30.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body30.prol ], [ 0, %for.body30.preheader ]
%indvars111.prol = trunc i64 %indvars.iv108.prol to i32
%arrayidx32.prol = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv108.prol
%33 = load i8, ptr %arrayidx32.prol, align 1, !tbaa !5
%add34.prol = add nsw i32 %sub, %indvars111.prol
%idxprom35.prol = sext i32 %add34.prol to i64
%arrayidx36.prol = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.prol
store i8 %33, ptr %arrayidx36.prol, align 1, !tbaa !5
%indvars.iv.next109.prol = add nuw nsw i64 %indvars.iv108.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.body30.prol.loopexit, label %for.body30.prol, !llvm.loop !15
for.body30.prol.loopexit: ; preds = %for.body30.prol, %for.body30.preheader
%indvars.iv108.unr = phi i64 [ %indvars.iv108.ph, %for.body30.preheader ], [ %indvars.iv.next109.prol, %for.body30.prol ]
%34 = icmp ult i64 %32, 3
br i1 %34, label %for.cond40.preheader, label %for.body30
for.cond40.preheader: ; preds = %for.body30.prol.loopexit, %for.body30, %middle.block, %vec.epilog.middle.block, %for.cond27.preheader
br i1 %cmp4197.not, label %for.inc51, label %for.body43.preheader
for.body43.preheader: ; preds = %for.cond40.preheader
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %ch, ptr nonnull align 16 %a, i64 %indvars.iv, i1 false), !tbaa !5
br label %for.inc51
for.body30: ; preds = %for.body30.prol.loopexit, %for.body30
%indvars.iv108 = phi i64 [ %indvars.iv.next109.3, %for.body30 ], [ %indvars.iv108.unr, %for.body30.prol.loopexit ]
%indvars111 = trunc i64 %indvars.iv108 to i32
%arrayidx32 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv108
%35 = load i8, ptr %arrayidx32, align 1, !tbaa !5
%add34 = add nsw i32 %sub, %indvars111
%idxprom35 = sext i32 %add34 to i64
%arrayidx36 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35
store i8 %35, ptr %arrayidx36, align 1, !tbaa !5
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%indvars111.1 = trunc i64 %indvars.iv.next109 to i32
%arrayidx32.1 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109
%36 = load i8, ptr %arrayidx32.1, align 1, !tbaa !5
%add34.1 = add nsw i32 %sub, %indvars111.1
%idxprom35.1 = sext i32 %add34.1 to i64
%arrayidx36.1 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.1
store i8 %36, ptr %arrayidx36.1, align 1, !tbaa !5
%indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108, 2
%indvars111.2 = trunc i64 %indvars.iv.next109.1 to i32
%arrayidx32.2 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109.1
%37 = load i8, ptr %arrayidx32.2, align 1, !tbaa !5
%add34.2 = add nsw i32 %sub, %indvars111.2
%idxprom35.2 = sext i32 %add34.2 to i64
%arrayidx36.2 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.2
store i8 %37, ptr %arrayidx36.2, align 1, !tbaa !5
%indvars.iv.next109.2 = add nuw nsw i64 %indvars.iv108, 3
%indvars111.3 = trunc i64 %indvars.iv.next109.2 to i32
%arrayidx32.3 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109.2
%38 = load i8, ptr %arrayidx32.3, align 1, !tbaa !5
%add34.3 = add nsw i32 %sub, %indvars111.3
%idxprom35.3 = sext i32 %add34.3 to i64
%arrayidx36.3 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.3
store i8 %38, ptr %arrayidx36.3, align 1, !tbaa !5
%indvars.iv.next109.3 = add nuw nsw i64 %indvars.iv108, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next109.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond40.preheader, label %for.body30, !llvm.loop !17
for.inc51: ; preds = %for.body43.preheader, %for.cond40.preheader
%inc52 = add nuw nsw i32 %j.0100, 1
%39 = load i32, ptr %m, align 4, !tbaa !8
%cmp15 = icmp slt i32 %inc52, %39
br i1 %cmp15, label %for.body, label %for.cond54.preheader, !llvm.loop !18
for.body57: ; preds = %for.body57.preheader, %for.body57
%indvars.iv115 = phi i64 [ 0, %for.body57.preheader ], [ %indvars.iv.next116, %for.body57 ]
%arrayidx59 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv115
%40 = load i8, ptr %arrayidx59, align 1, !tbaa !5
%conv60 = sext i8 %40 to i32
%putchar91 = call i32 @putchar(i32 %conv60)
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count120
br i1 %exitcond121.not, label %for.end64, label %for.body57, !llvm.loop !19
for.end64: ; preds = %for.body57, %for.cond54.preheader
%putchar = call i32 @putchar(i32 10)
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
br label %while.cond1.backedge
while.end68: ; preds = %while.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 250, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 250, ptr nonnull %ch) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: 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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, 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}
!19 = distinct !{!19, !11}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[400];
int count[100];
int n,i,j=0;
while(1){
scanf("%s",str);
if(str[0]=='-'){
break;
}
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&count[i]);
}
for(i=0;i<n;i++){
strncat(str,str,count[i]);
int j=0;
while(str[j] != '\0'){
str[j] = str[j + count[i]];
j++;
}
}
printf("%s\n",str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103300/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103300/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [400 x i8], align 16
%count = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %str) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %count) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp55 = icmp eq i8 %0, 45
br i1 %cmp55, label %while.end37, label %if.end
if.end: ; preds = %entry, %for.end34
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !8
%cmp347 = icmp sgt i32 %1, 0
br i1 %cmp347, label %for.body, label %for.end34
for.cond7.preheader: ; preds = %for.body
%cmp852 = icmp sgt i32 %2, 0
br i1 %cmp852, label %for.body10.preheader, label %for.end34
for.body10.preheader: ; preds = %for.cond7.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body10
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr %count, i64 0, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !8
%3 = sext i32 %2 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp3, label %for.body, label %for.cond7.preheader, !llvm.loop !10
for.body10: ; preds = %for.body10.preheader, %while.end
%indvars.iv62 = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next63, %while.end ]
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %count, i64 0, i64 %indvars.iv62
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !8
%conv15 = sext i32 %4 to i64
%call16 = call ptr @strncat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull %str, i64 noundef %conv15) #5
%5 = load i8, ptr %str, align 16, !tbaa !5
%cmp22.not49 = icmp eq i8 %5, 0
br i1 %cmp22.not49, label %while.end, label %while.body24
while.body24: ; preds = %for.body10, %while.body24
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %while.body24 ], [ 0, %for.body10 ]
%arrayidx2051 = phi ptr [ %arrayidx20, %while.body24 ], [ %str, %for.body10 ]
%6 = add nsw i64 %indvars.iv58, %conv15
%arrayidx28 = getelementptr inbounds [400 x i8], ptr %str, i64 0, i64 %6
%7 = load i8, ptr %arrayidx28, align 1, !tbaa !5
store i8 %7, ptr %arrayidx2051, align 1, !tbaa !5
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%arrayidx20 = getelementptr inbounds [400 x i8], ptr %str, i64 0, i64 %indvars.iv.next59
%8 = load i8, ptr %arrayidx20, align 1, !tbaa !5
%cmp22.not = icmp eq i8 %8, 0
br i1 %cmp22.not, label %while.end, label %while.body24, !llvm.loop !12
while.end: ; preds = %while.body24, %for.body10
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.end34, label %for.body10, !llvm.loop !13
for.end34: ; preds = %while.end, %if.end, %for.cond7.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%9 = load i8, ptr %str, align 16, !tbaa !5
%cmp = icmp eq i8 %9, 45
br i1 %cmp, label %while.end37, label %if.end
while.end37: ; preds = %for.end34, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %count) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
char ch[200];
int m;
int h,i,j,k;
char str[200];
while(1){
scanf("%s", ch);
if(ch[0]=='-')
break;
scanf("%d", &m);
for(i=0; i<m; i++){
scanf("%d", &h);
strncpy(str,ch,h);
for(j=h; j<strlen(ch); j++){
ch[j-h] = ch[j];
}
for(k=0; k<h; k++){
ch[strlen(ch)-h+k] = str[k];
}
}
printf("%s\n",ch);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103351/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%ch = alloca [200 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
%str = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %ch) #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
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str) #6
%call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 16, !tbaa !5
%cmp57 = icmp eq i8 %0, 45
br i1 %cmp57, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end37
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp354 = icmp sgt i32 %1, 0
br i1 %cmp354, label %for.body, label %for.end37
for.body: ; preds = %if.end, %for.inc35
%i.055 = phi i32 [ %inc36, %for.inc35 ], [ 0, %if.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%2 = load i32, ptr %h, align 4, !tbaa !8
%conv8 = sext i32 %2 to i64
%call9 = call ptr @strncpy(ptr noundef nonnull %str, ptr noundef nonnull %ch, i64 noundef %conv8) #6
%call1348 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #7
%cmp1449 = icmp ugt i64 %call1348, %conv8
br i1 %cmp1449, label %for.body16, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body16, %for.body
%cmp2152 = icmp sgt i32 %2, 0
br i1 %cmp2152, 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 ], [ %conv8, %for.body ]
%arrayidx17 = getelementptr inbounds [200 x i8], ptr %ch, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%4 = sub nsw i64 %indvars.iv, %conv8
%arrayidx19 = getelementptr inbounds [200 x i8], ptr %ch, 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) %ch) #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.iv60 = phi i64 [ 0, %for.body23.lr.ph ], [ %indvars.iv.next61, %for.body23 ]
%arrayidx25 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv60
%5 = load i8, ptr %arrayidx25, align 1, !tbaa !5
%call27 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #7
%sub29 = sub nsw i64 %indvars.iv60, %conv8
%add = add i64 %sub29, %call27
%arrayidx31 = getelementptr inbounds [200 x i8], ptr %ch, i64 0, i64 %add
store i8 %5, ptr %arrayidx31, align 1, !tbaa !5
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond.not = icmp eq i64 %indvars.iv.next61, %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 %i.055, 1
%6 = load i32, ptr %m, align 4, !tbaa !8
%cmp3 = icmp slt i32 %inc36, %6
br i1 %cmp3, label %for.body, label %for.end37, !llvm.loop !13
for.end37: ; preds = %for.inc35, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %ch)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%7 = load i8, ptr %ch, align 16, !tbaa !5
%cmp = icmp eq i8 %7, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end37, %entry
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str) #6
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 200, ptr nonnull %ch) #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 @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: 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}
|
#include <stdio.h>
#include <string.h>
int main()
{
int i, m, h, len;
char cards[201], temp[201];
for(;;) {
scanf("%s",cards);
if(strcmp(cards,"-") == 0) break;
len = strlen(cards);
scanf("%d",&m);
for (i=0; i<m; i++) {
scanf("%d",&h);
strcpy(temp,cards);
strcpy(cards,&temp[h]);
strncpy(&cards[len - h],temp,h);
cards[len] = '\0';
}
printf("%s\n",cards);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%m = alloca i32, align 4
%h = alloca i32, align 4
%cards = alloca [201 x i8], align 16
%temp = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %cards) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %temp) #6
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%lhsv31 = load i16, ptr %cards, align 16
%.not32 = icmp eq i16 %lhsv31, 45
br i1 %.not32, label %for.end24, label %if.end
if.end: ; preds = %entry, %for.end
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #7
%conv = trunc i64 %call4 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
%cmp728 = icmp sgt i32 %0, 0
br i1 %cmp728, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %if.end
%sext = shl i64 %call4, 32
%idxprom20 = ashr exact i64 %sext, 32
%arrayidx21 = getelementptr inbounds [201 x i8], ptr %cards, i64 0, i64 %idxprom20
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.029 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%call12 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %cards) #6
%1 = load i32, ptr %h, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [201 x i8], ptr %temp, i64 0, i64 %idxprom
%call14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %cards, ptr noundef nonnull dereferenceable(1) %arrayidx) #6
%sub = sub nsw i32 %conv, %1
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [201 x i8], ptr %cards, i64 0, i64 %idxprom15
%call19 = call ptr @strncpy(ptr noundef nonnull %arrayidx16, ptr noundef nonnull %temp, i64 noundef %idxprom) #6
store i8 0, ptr %arrayidx21, align 1, !tbaa !9
%inc = add nuw nsw i32 %i.029, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %2
br i1 %cmp7, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cards)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%lhsv = load i16, ptr %cards, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %for.end24, label %if.end
for.end24: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %temp) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %cards) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 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: 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"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char str[201] = { 0 };
char str1[201] = { 0 };
char str2[201] = { 0 };
int n;
int m;
int h;
int i;
while (1){
scanf("%s", str);
if (strcmp(str, "-") == 0){
break;
}
n = strlen(str);
scanf("%d", &m);
for (i = 0; i < m; i++){
scanf("%d", &h);
strncpy(str2, str, h);
strncpy(str1, str+h, n - h);
strcpy(str, strcat(str1, str2));
memset(str1, '\0', n);
memset(str2, '\0', h);
}
printf("%s\n", str);
memset(str, '\0', n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%str = alloca [201 x i8], align 16
%str1 = alloca [201 x i8], align 16
%str2 = 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 %str) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %str, i8 0, i64 201, i1 false)
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str1) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %str1, i8 0, i64 201, i1 false)
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str2) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %str2, i8 0, i64 201, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #7
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%lhsv38 = load i16, ptr %str, align 16
%.not39 = icmp eq i16 %lhsv38, 45
br i1 %.not39, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #8
%conv = trunc i64 %call4 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
%cmp635 = icmp sgt i32 %0, 0
%sext34 = shl i64 %call4, 32
%conv23 = ashr exact i64 %sext34, 32
br i1 %cmp635, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.036 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%conv11 = sext i32 %1 to i64
%call12 = call ptr @strncpy(ptr noundef nonnull %str2, ptr noundef nonnull %str, i64 noundef %conv11) #7
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %conv11
%sub = sub nsw i32 %conv, %1
%conv15 = sext i32 %sub to i64
%call16 = call ptr @strncpy(ptr noundef nonnull %str1, ptr noundef nonnull %add.ptr, i64 noundef %conv15) #7
%call20 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str1, ptr noundef nonnull dereferenceable(1) %str2) #7
%call21 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %str1) #7
call void @llvm.memset.p0.i64(ptr nonnull align 16 %str1, i8 0, i64 %conv23, i1 false)
call void @llvm.memset.p0.i64(ptr nonnull align 16 %str2, i8 0, i64 %conv11, i1 false)
%inc = add nuw nsw i32 %i.036, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %2
br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
call void @llvm.memset.p0.i64(ptr nonnull align 16 %str, i8 0, i64 %conv23, i1 false)
%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 4, ptr nonnull %h) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str2) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str1) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; 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 #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int i, n, m, h;
char N[201], Nw[201];
while(1){
scanf("%s", N);
n = strlen(N);
if(!strcmp(N, "-")) break;
scanf("%d", &m);
for(i = 0; i < m; i++){
scanf("%d", &h);
memcpy(Nw, N, h);
memcpy(N, &N[h], n-h);
memcpy(&N[n-h], Nw, h);
}
printf("%s\n", N);
}
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103489/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103489/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%m = alloca i32, align 4
%h = alloca i32, align 4
%N = alloca [201 x i8], align 16
%Nw = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %Nw)
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%lhsv28 = load i16, ptr %N, align 16
%.not29 = icmp eq i16 %lhsv28, 45
br i1 %.not29, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%call226 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %N) #7
br label %if.end
if.end: ; preds = %if.end.preheader, %for.end
%conv30.in = phi i64 [ %call2, %for.end ], [ %call226, %if.end.preheader ]
%conv30 = trunc i64 %conv30.in 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
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.024 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%conv10 = sext i32 %1 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %Nw, ptr nonnull align 16 %N, i64 %conv10, i1 false)
%arrayidx = getelementptr inbounds [201 x i8], ptr %N, i64 0, i64 %conv10
%sub = sub nsw i32 %conv30, %1
%conv12 = sext i32 %sub to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %N, ptr nonnull align 1 %arrayidx, i64 %conv12, i1 false)
%arrayidx15 = getelementptr inbounds [201 x i8], ptr %N, i64 0, i64 %conv12
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %arrayidx15, ptr nonnull align 16 %Nw, i64 %conv10, i1 false)
%inc = add nuw nsw i32 %i.024, 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 !9
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %N)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %N) #7
%lhsv = load i16, ptr %N, 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 %Nw)
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
char cards[400];
int h, i, j, l, m;
while (1) {
scanf("%s", cards);
if (cards[0] == '-' && cards[1] == '\0')
break;
l = 0;
while (cards[l] != '\0')
l++;
scanf("%d", &m);
for (i = 0; i < m; i++) {
scanf("%d", &h);
for (j = 0; j < h; j++)
cards[l + j] = cards[j];
for (j = 0; j < l; j++)
cards[j] = cards[j + h];
}
cards[l] = '\n'; cards[l + 1] = '\0';
printf("%s", cards);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103539/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103539/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%cards = alloca [400 x i8], align 16
%h = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %cards) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%0 = load i8, ptr %cards, align 16, !tbaa !5
%cmp68 = icmp eq i8 %0, 45
%arrayidx2 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1
%cmp469 = icmp eq i8 %1, 0
%or.cond70 = select i1 %cmp68, i1 %cmp469, i1 false
br i1 %or.cond70, label %while.end47, label %while.cond6
while.cond6: ; preds = %entry, %while.cond6.backedge
%l.0 = phi i32 [ %l.0.be, %while.cond6.backedge ], [ 0, %entry ]
%idxprom = zext i32 %l.0 to i64
%arrayidx7 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9.not = icmp eq i8 %2, 0
%inc = add i32 %l.0, 1
br i1 %cmp9.not, label %while.end, label %while.cond6.backedge
while.cond6.backedge: ; preds = %while.cond6, %for.end39
%l.0.be = phi i32 [ %inc, %while.cond6 ], [ 0, %for.end39 ]
br label %while.cond6, !llvm.loop !8
while.end: ; preds = %while.cond6
%arrayidx7.le = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %idxprom
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !10
%cmp1365 = icmp sgt i32 %3, 0
br i1 %cmp1365, label %for.body.lr.ph, label %for.end39
for.body.lr.ph: ; preds = %while.end
%cmp2663.not = icmp eq i32 %l.0, 0
br i1 %cmp2663.not, label %for.body, label %for.body.us.preheader
for.body.us.preheader: ; preds = %for.body.lr.ph
%diff.check100 = icmp ult i32 %l.0, 32
%min.iters.check = icmp ult i32 %l.0, 8
%min.iters.check91 = icmp ult i32 %l.0, 32
%n.vec = and i64 %idxprom, 4294967264
%cmp.n = icmp eq i64 %n.vec, %idxprom
%n.vec.remaining = and i64 %idxprom, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
%n.vec94 = and i64 %idxprom, 4294967288
%cmp.n95 = icmp eq i64 %n.vec94, %idxprom
%xtraiter134 = and i64 %idxprom, 3
%lcmp.mod135.not = icmp eq i64 %xtraiter134, 0
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond25.for.inc37_crit_edge.us
%i.066.us = phi i32 [ %inc38.us, %for.cond25.for.inc37_crit_edge.us ], [ 0, %for.body.us.preheader ]
%call15.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%4 = load i32, ptr %h, align 4, !tbaa !10
%cmp1761.us = icmp sgt i32 %4, 0
br i1 %cmp1761.us, label %iter.check104, label %iter.check
iter.check104: ; preds = %for.body.us
%wide.trip.count = zext i32 %4 to i64
%min.iters.check102 = icmp ult i32 %4, 8
%or.cond131 = or i1 %min.iters.check102, %diff.check100
br i1 %or.cond131, label %for.body19.us.preheader, label %vector.main.loop.iter.check106
vector.main.loop.iter.check106: ; preds = %iter.check104
%min.iters.check105 = icmp ult i32 %4, 32
br i1 %min.iters.check105, label %vec.epilog.ph119, label %vector.ph107
vector.ph107: ; preds = %vector.main.loop.iter.check106
%n.vec109 = and i64 %wide.trip.count, 4294967264
br label %vector.body111
vector.body111: ; preds = %vector.body111, %vector.ph107
%index112 = phi i64 [ 0, %vector.ph107 ], [ %index.next115, %vector.body111 ]
%5 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %index112
%wide.load113 = load <16 x i8>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i8, ptr %5, i64 16
%wide.load114 = load <16 x i8>, ptr %6, align 16, !tbaa !5
%7 = add nuw nsw i64 %index112, %idxprom
%8 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %7
store <16 x i8> %wide.load113, ptr %8, align 1, !tbaa !5
%9 = getelementptr inbounds i8, ptr %8, i64 16
store <16 x i8> %wide.load114, ptr %9, align 1, !tbaa !5
%index.next115 = add nuw i64 %index112, 32
%10 = icmp eq i64 %index.next115, %n.vec109
br i1 %10, label %middle.block101, label %vector.body111, !llvm.loop !12
middle.block101: ; preds = %vector.body111
%cmp.n110 = icmp eq i64 %n.vec109, %wide.trip.count
br i1 %cmp.n110, label %iter.check, label %vec.epilog.iter.check118
vec.epilog.iter.check118: ; preds = %middle.block101
%n.vec.remaining120 = and i64 %wide.trip.count, 24
%min.epilog.iters.check121 = icmp eq i64 %n.vec.remaining120, 0
br i1 %min.epilog.iters.check121, label %for.body19.us.preheader, label %vec.epilog.ph119
vec.epilog.ph119: ; preds = %vector.main.loop.iter.check106, %vec.epilog.iter.check118
%vec.epilog.resume.val122 = phi i64 [ %n.vec109, %vec.epilog.iter.check118 ], [ 0, %vector.main.loop.iter.check106 ]
%n.vec124 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body127
vec.epilog.vector.body127: ; preds = %vec.epilog.vector.body127, %vec.epilog.ph119
%index128 = phi i64 [ %vec.epilog.resume.val122, %vec.epilog.ph119 ], [ %index.next130, %vec.epilog.vector.body127 ]
%11 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %index128
%wide.load129 = load <8 x i8>, ptr %11, align 8, !tbaa !5
%12 = add nuw nsw i64 %index128, %idxprom
%13 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %12
store <8 x i8> %wide.load129, ptr %13, align 1, !tbaa !5
%index.next130 = add nuw i64 %index128, 8
%14 = icmp eq i64 %index.next130, %n.vec124
br i1 %14, label %vec.epilog.middle.block116, label %vec.epilog.vector.body127, !llvm.loop !15
vec.epilog.middle.block116: ; preds = %vec.epilog.vector.body127
%cmp.n126 = icmp eq i64 %n.vec124, %wide.trip.count
br i1 %cmp.n126, label %iter.check, label %for.body19.us.preheader
for.body19.us.preheader: ; preds = %iter.check104, %vec.epilog.iter.check118, %vec.epilog.middle.block116
%indvars.iv.ph = phi i64 [ 0, %iter.check104 ], [ %n.vec109, %vec.epilog.iter.check118 ], [ %n.vec124, %vec.epilog.middle.block116 ]
%15 = xor i64 %indvars.iv.ph, -1
%16 = add nsw i64 %15, %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.body19.us.prol.loopexit, label %for.body19.us.prol
for.body19.us.prol: ; preds = %for.body19.us.preheader, %for.body19.us.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body19.us.prol ], [ %indvars.iv.ph, %for.body19.us.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body19.us.prol ], [ 0, %for.body19.us.preheader ]
%arrayidx21.us.prol = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.prol
%17 = load i8, ptr %arrayidx21.us.prol, align 1, !tbaa !5
%18 = add nuw nsw i64 %indvars.iv.prol, %idxprom
%arrayidx23.us.prol = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %18
store i8 %17, ptr %arrayidx23.us.prol, align 1, !tbaa !5
%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.body19.us.prol.loopexit, label %for.body19.us.prol, !llvm.loop !16
for.body19.us.prol.loopexit: ; preds = %for.body19.us.prol, %for.body19.us.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body19.us.preheader ], [ %indvars.iv.next.prol, %for.body19.us.prol ]
%19 = icmp ult i64 %16, 3
br i1 %19, label %iter.check, label %for.body19.us
for.body28.us: ; preds = %for.body28.us.prol.loopexit, %for.body28.us
%indvars.iv74 = phi i64 [ %indvars.iv.next75.3, %for.body28.us ], [ %indvars.iv74.unr, %for.body28.us.prol.loopexit ]
%20 = add nsw i64 %indvars.iv74, %36
%arrayidx31.us = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %20
%21 = load i8, ptr %arrayidx31.us, align 1, !tbaa !5
%arrayidx33.us = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv74
store i8 %21, ptr %arrayidx33.us, align 1, !tbaa !5
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%22 = add nsw i64 %indvars.iv.next75, %36
%arrayidx31.us.1 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %22
%23 = load i8, ptr %arrayidx31.us.1, align 1, !tbaa !5
%arrayidx33.us.1 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next75
store i8 %23, ptr %arrayidx33.us.1, align 1, !tbaa !5
%indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
%24 = add nsw i64 %indvars.iv.next75.1, %36
%arrayidx31.us.2 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %24
%25 = load i8, ptr %arrayidx31.us.2, align 1, !tbaa !5
%arrayidx33.us.2 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next75.1
store i8 %25, ptr %arrayidx33.us.2, align 1, !tbaa !5
%indvars.iv.next75.2 = add nuw nsw i64 %indvars.iv74, 3
%26 = add nsw i64 %indvars.iv.next75.2, %36
%arrayidx31.us.3 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %26
%27 = load i8, ptr %arrayidx31.us.3, align 1, !tbaa !5
%arrayidx33.us.3 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next75.2
store i8 %27, ptr %arrayidx33.us.3, align 1, !tbaa !5
%indvars.iv.next75.3 = add nuw nsw i64 %indvars.iv74, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next75.3, %idxprom
br i1 %exitcond80.not.3, label %for.cond25.for.inc37_crit_edge.us, label %for.body28.us, !llvm.loop !18
for.body19.us: ; preds = %for.body19.us.prol.loopexit, %for.body19.us
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body19.us ], [ %indvars.iv.unr, %for.body19.us.prol.loopexit ]
%arrayidx21.us = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv
%28 = load i8, ptr %arrayidx21.us, align 1, !tbaa !5
%29 = add nuw nsw i64 %indvars.iv, %idxprom
%arrayidx23.us = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %29
store i8 %28, ptr %arrayidx23.us, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx21.us.1 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next
%30 = load i8, ptr %arrayidx21.us.1, align 1, !tbaa !5
%31 = add nuw nsw i64 %indvars.iv.next, %idxprom
%arrayidx23.us.1 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %31
store i8 %30, ptr %arrayidx23.us.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx21.us.2 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next.1
%32 = load i8, ptr %arrayidx21.us.2, align 1, !tbaa !5
%33 = add nuw nsw i64 %indvars.iv.next.1, %idxprom
%arrayidx23.us.2 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %33
store i8 %32, ptr %arrayidx23.us.2, align 1, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx21.us.3 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv.next.2
%34 = load i8, ptr %arrayidx21.us.3, align 1, !tbaa !5
%35 = add nuw nsw i64 %indvars.iv.next.2, %idxprom
%arrayidx23.us.3 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %35
store i8 %34, ptr %arrayidx23.us.3, align 1, !tbaa !5
%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 %iter.check, label %for.body19.us, !llvm.loop !19
iter.check: ; preds = %for.body19.us.prol.loopexit, %for.body19.us, %middle.block101, %vec.epilog.middle.block116, %for.body.us
%36 = sext i32 %4 to i64
%37 = add nsw i64 %36, 31
%diff.check = icmp ult i64 %37, 32
%or.cond132 = select i1 %min.iters.check, i1 true, i1 %diff.check
br i1 %or.cond132, label %for.body28.us.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
br i1 %min.iters.check91, label %vec.epilog.ph, label %vector.body
vector.body: ; preds = %vector.main.loop.iter.check, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
%38 = add nsw i64 %index, %36
%39 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %38
%wide.load = load <16 x i8>, ptr %39, align 1, !tbaa !5
%40 = getelementptr inbounds i8, ptr %39, i64 16
%wide.load92 = load <16 x i8>, ptr %40, align 1, !tbaa !5
%41 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %index
store <16 x i8> %wide.load, ptr %41, align 16, !tbaa !5
%42 = getelementptr inbounds i8, ptr %41, i64 16
store <16 x i8> %wide.load92, ptr %42, align 16, !tbaa !5
%index.next = add nuw i64 %index, 32
%43 = icmp eq i64 %index.next, %n.vec
br i1 %43, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond25.for.inc37_crit_edge.us, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
br i1 %min.epilog.iters.check, label %for.body28.us.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index96 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next98, %vec.epilog.vector.body ]
%44 = add nsw i64 %index96, %36
%45 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %44
%wide.load97 = load <8 x i8>, ptr %45, align 1, !tbaa !5
%46 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %index96
store <8 x i8> %wide.load97, ptr %46, align 8, !tbaa !5
%index.next98 = add nuw i64 %index96, 8
%47 = icmp eq i64 %index.next98, %n.vec94
br i1 %47, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !21
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
br i1 %cmp.n95, label %for.cond25.for.inc37_crit_edge.us, label %for.body28.us.preheader
for.body28.us.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv74.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec94, %vec.epilog.middle.block ]
%48 = xor i64 %indvars.iv74.ph, -1
%49 = add nsw i64 %48, %idxprom
br i1 %lcmp.mod135.not, label %for.body28.us.prol.loopexit, label %for.body28.us.prol
for.body28.us.prol: ; preds = %for.body28.us.preheader, %for.body28.us.prol
%indvars.iv74.prol = phi i64 [ %indvars.iv.next75.prol, %for.body28.us.prol ], [ %indvars.iv74.ph, %for.body28.us.preheader ]
%prol.iter136 = phi i64 [ %prol.iter136.next, %for.body28.us.prol ], [ 0, %for.body28.us.preheader ]
%50 = add nsw i64 %indvars.iv74.prol, %36
%arrayidx31.us.prol = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %50
%51 = load i8, ptr %arrayidx31.us.prol, align 1, !tbaa !5
%arrayidx33.us.prol = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %indvars.iv74.prol
store i8 %51, ptr %arrayidx33.us.prol, align 1, !tbaa !5
%indvars.iv.next75.prol = add nuw nsw i64 %indvars.iv74.prol, 1
%prol.iter136.next = add i64 %prol.iter136, 1
%prol.iter136.cmp.not = icmp eq i64 %prol.iter136.next, %xtraiter134
br i1 %prol.iter136.cmp.not, label %for.body28.us.prol.loopexit, label %for.body28.us.prol, !llvm.loop !22
for.body28.us.prol.loopexit: ; preds = %for.body28.us.prol, %for.body28.us.preheader
%indvars.iv74.unr = phi i64 [ %indvars.iv74.ph, %for.body28.us.preheader ], [ %indvars.iv.next75.prol, %for.body28.us.prol ]
%52 = icmp ult i64 %49, 3
br i1 %52, label %for.cond25.for.inc37_crit_edge.us, label %for.body28.us
for.cond25.for.inc37_crit_edge.us: ; preds = %for.body28.us.prol.loopexit, %for.body28.us, %vec.epilog.middle.block, %middle.block
%inc38.us = add nuw nsw i32 %i.066.us, 1
%53 = load i32, ptr %m, align 4, !tbaa !10
%cmp13.us = icmp slt i32 %inc38.us, %53
br i1 %cmp13.us, label %for.body.us, label %for.end39, !llvm.loop !23
for.body: ; preds = %for.body.lr.ph, %for.body
%i.066 = phi i32 [ %inc38, %for.body ], [ 0, %for.body.lr.ph ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%inc38 = add nuw nsw i32 %i.066, 1
%54 = load i32, ptr %m, align 4, !tbaa !10
%cmp13 = icmp slt i32 %inc38, %54
br i1 %cmp13, label %for.body, label %for.end39, !llvm.loop !23
for.end39: ; preds = %for.cond25.for.inc37_crit_edge.us, %for.body, %while.end
store i8 10, ptr %arrayidx7.le, align 1, !tbaa !5
%idxprom43 = zext i32 %inc to i64
%arrayidx44 = getelementptr inbounds [400 x i8], ptr %cards, i64 0, i64 %idxprom43
store i8 0, ptr %arrayidx44, align 1, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %cards)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%55 = load i8, ptr %cards, align 16, !tbaa !5
%cmp = icmp eq i8 %55, 45
%56 = load i8, ptr %arrayidx2, align 1
%cmp4 = icmp eq i8 %56, 0
%or.cond = select i1 %cmp, i1 %cmp4, i1 false
br i1 %or.cond, label %while.end47, label %while.cond6.backedge
while.end47: ; preds = %for.end39, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %cards) #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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !9, !13, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !9, !13}
!19 = distinct !{!19, !9, !13}
!20 = distinct !{!20, !9, !13, !14}
!21 = distinct !{!21, !9, !13, !14}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !9}
|
#include<stdio.h>
#include<string.h>
int main(){
char str[2][205];
int n;
int x;
scanf("%s",str[0]);
while(str[0][0] != '-'){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&x);
strcpy(str[(i+1)%2],&str[i%2][x]);
str[i%2][x] ='\0';
strcat(str[(i+1)%2],str[i%2]);
}
printf("%s\n",str[(n)%2]);
scanf("%s",str[0]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103582/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103582/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [2 x [205 x i8]], align 16
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 410, ptr nonnull %str) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not47 = icmp eq i8 %0, 45
br i1 %cmp.not47, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !8
%cmp545 = icmp sgt i32 %1, 0
br i1 %cmp545, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %while.body
%.lcssa = phi i32 [ %1, %while.body ], [ %4, %for.body ]
%rem31 = srem i32 %.lcssa, 2
%idxprom32 = sext i32 %rem31 to i64
%arrayidx33 = getelementptr inbounds [2 x [205 x i8]], ptr %str, i64 0, i64 %idxprom32
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx33)
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%2 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not = icmp eq i8 %2, 45
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
for.body: ; preds = %while.body, %for.body
%i.046 = phi i32 [ %add, %for.body ], [ 0, %while.body ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%add = add nuw nsw i32 %i.046, 1
%rem = and i32 %add, 1
%idxprom = zext i32 %rem to i64
%arrayidx8 = getelementptr inbounds [2 x [205 x i8]], ptr %str, i64 0, i64 %idxprom
%rem10 = and i32 %i.046, 1
%idxprom11 = zext i32 %rem10 to i64
%arrayidx12 = getelementptr inbounds [2 x [205 x i8]], ptr %str, i64 0, i64 %idxprom11
%3 = load i32, ptr %x, align 4, !tbaa !8
%idxprom13 = sext i32 %3 to i64
%arrayidx14 = getelementptr inbounds [2 x [205 x i8]], ptr %str, i64 0, i64 %idxprom11, i64 %idxprom13
%call15 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx8, ptr noundef nonnull dereferenceable(1) %arrayidx14) #5
store i8 0, ptr %arrayidx14, align 1, !tbaa !5
%call30 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %arrayidx8, ptr noundef nonnull dereferenceable(1) %arrayidx12) #5
%4 = load i32, ptr %n, align 4, !tbaa !8
%cmp5 = icmp slt i32 %add, %4
br i1 %cmp5, label %for.body, label %for.cond.cleanup, !llvm.loop !12
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 410, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree 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: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
#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_103625/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103625/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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>
int main() {
char ch[250]={0};
char a[250] ={0};
int h;
int i,j,k,l,n,m;
while(1){
i=0;
while(1){
scanf("%c",&ch[i]);
if(ch[i] == '\n') {
break;
}
i++;
}
if ( i == 1 && ch[0] == '-' ) break;
// printf("%d",i);
scanf("%d",&m);
for(j=0;j<m;j++){
scanf("%d", &h );
for(k=0;k<i-h;k++) {
a[k] = ch[h+k];
// printf("a[%d] = ch[%d]の%c\n",k ,h+k,ch[h+k]);
}
for(k=0;k<h;k++){
a[i-h+k] = ch[k];
// printf("a[%d] = ch[%d]の%c\n",i-h+k,k,ch[k]);
}
for(k=0; k<i; k++){
ch[k] = a[k];
// printf("ch[%d] = a[%d]の%c\n",k,k,a[k]);
}
}
for(k=0;k<i;k++) {
printf("%c",ch[k]);
}
printf("\n");
scanf("%c",&ch[0]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103676/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca [250 x i8], align 16
%a = alloca [250 x i8], align 16
%h = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 250, ptr nonnull %ch) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(250) %ch, i8 0, i64 250, i1 false)
call void @llvm.lifetime.start.p0(i64 250, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(250) %a, i8 0, i64 250, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
br label %while.cond1
while.cond1: ; preds = %while.cond1.backedge, %entry
%indvars.iv118 = phi i32 [ 0, %entry ], [ %indvars.iv118.be, %while.cond1.backedge ]
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.be, %while.cond1.backedge ]
%arrayidx = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next119 = add nuw i32 %indvars.iv118, 1
br i1 %cmp, label %while.end, label %while.cond1.backedge
while.cond1.backedge: ; preds = %while.cond1, %for.end64
%indvars.iv118.be = phi i32 [ %indvars.iv.next119, %while.cond1 ], [ 0, %for.end64 ]
%indvars.iv.be = phi i64 [ %indvars.iv.next, %while.cond1 ], [ 0, %for.end64 ]
br label %while.cond1
while.end: ; preds = %while.cond1
%1 = trunc i64 %indvars.iv to i32
%cmp6 = icmp eq i32 %1, 1
%2 = load i8, ptr %ch, align 16
%cmp10 = icmp eq i8 %2, 45
%or.cond = select i1 %cmp6, i1 %cmp10, i1 false
br i1 %or.cond, label %while.end68, label %if.end13
if.end13: ; preds = %while.end
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !8
%cmp1599 = icmp sgt i32 %3, 0
br i1 %cmp1599, label %for.body.lr.ph, label %for.cond54.preheader
for.body.lr.ph: ; preds = %if.end13
%cmp4197.not = icmp eq i32 %1, 0
%4 = trunc i64 %indvars.iv to i32
br label %for.body
for.cond54.preheader: ; preds = %for.inc51, %if.end13
%cmp55101.not = icmp eq i32 %1, 0
br i1 %cmp55101.not, label %for.end64, label %for.body57.preheader
for.body57.preheader: ; preds = %for.cond54.preheader
%wide.trip.count120 = zext i32 %indvars.iv118 to i64
br label %for.body57
for.body: ; preds = %for.body.lr.ph, %for.inc51
%j.0100 = phi i32 [ 0, %for.body.lr.ph ], [ %inc52, %for.inc51 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%5 = load i32, ptr %h, align 4, !tbaa !8
%sub = sub nsw i32 %1, %5
%cmp1992 = icmp sgt i32 %sub, 0
br i1 %cmp1992, label %for.body21.preheader, label %for.cond27.preheader
for.body21.preheader: ; preds = %for.body
%6 = sext i32 %5 to i64
%scevgep = getelementptr i8, ptr %ch, i64 %6
%7 = xor i32 %5, -1
%8 = add i32 %7, %4
%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) %a, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %10, i1 false), !tbaa !5
br label %for.cond27.preheader
for.cond27.preheader: ; preds = %for.body21.preheader, %for.body
%cmp2895 = icmp sgt i32 %5, 0
br i1 %cmp2895, label %iter.check, label %for.cond40.preheader
iter.check: ; preds = %for.cond27.preheader
%wide.trip.count = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body30.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.body30.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check122 = icmp ult i32 %5, 32
br i1 %min.iters.check122, 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 [250 x i8], ptr %ch, i64 0, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i8, ptr %18, i64 16
%wide.load123 = load <16 x i8>, ptr %19, align 16, !tbaa !5
%20 = add nsw i32 %sub, %17
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %21
store <16 x i8> %wide.load, ptr %22, align 1, !tbaa !5
%23 = getelementptr inbounds i8, ptr %22, i64 16
store <16 x i8> %wide.load123, ptr %23, align 1, !tbaa !5
%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.cond40.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.body30.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.vec125 = 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.idx127 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next129, %vec.epilog.vector.body ]
%25 = trunc i64 %offset.idx127 to i32
%26 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %offset.idx127
%wide.load128 = load <8 x i8>, ptr %26, align 8, !tbaa !5
%27 = add nsw i32 %sub, %25
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %28
store <8 x i8> %wide.load128, ptr %29, align 1, !tbaa !5
%index.next129 = add nuw i64 %offset.idx127, 8
%30 = icmp eq i64 %index.next129, %n.vec125
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.n126 = icmp eq i64 %n.vec125, %wide.trip.count
br i1 %cmp.n126, label %for.cond40.preheader, label %for.body30.preheader
for.body30.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv108.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec125, %vec.epilog.middle.block ]
%31 = xor i64 %indvars.iv108.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.body30.prol.loopexit, label %for.body30.prol
for.body30.prol: ; preds = %for.body30.preheader, %for.body30.prol
%indvars.iv108.prol = phi i64 [ %indvars.iv.next109.prol, %for.body30.prol ], [ %indvars.iv108.ph, %for.body30.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body30.prol ], [ 0, %for.body30.preheader ]
%indvars111.prol = trunc i64 %indvars.iv108.prol to i32
%arrayidx32.prol = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv108.prol
%33 = load i8, ptr %arrayidx32.prol, align 1, !tbaa !5
%add34.prol = add nsw i32 %sub, %indvars111.prol
%idxprom35.prol = sext i32 %add34.prol to i64
%arrayidx36.prol = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.prol
store i8 %33, ptr %arrayidx36.prol, align 1, !tbaa !5
%indvars.iv.next109.prol = add nuw nsw i64 %indvars.iv108.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.body30.prol.loopexit, label %for.body30.prol, !llvm.loop !15
for.body30.prol.loopexit: ; preds = %for.body30.prol, %for.body30.preheader
%indvars.iv108.unr = phi i64 [ %indvars.iv108.ph, %for.body30.preheader ], [ %indvars.iv.next109.prol, %for.body30.prol ]
%34 = icmp ult i64 %32, 3
br i1 %34, label %for.cond40.preheader, label %for.body30
for.cond40.preheader: ; preds = %for.body30.prol.loopexit, %for.body30, %middle.block, %vec.epilog.middle.block, %for.cond27.preheader
br i1 %cmp4197.not, label %for.inc51, label %for.body43.preheader
for.body43.preheader: ; preds = %for.cond40.preheader
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %ch, ptr nonnull align 16 %a, i64 %indvars.iv, i1 false), !tbaa !5
br label %for.inc51
for.body30: ; preds = %for.body30.prol.loopexit, %for.body30
%indvars.iv108 = phi i64 [ %indvars.iv.next109.3, %for.body30 ], [ %indvars.iv108.unr, %for.body30.prol.loopexit ]
%indvars111 = trunc i64 %indvars.iv108 to i32
%arrayidx32 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv108
%35 = load i8, ptr %arrayidx32, align 1, !tbaa !5
%add34 = add nsw i32 %sub, %indvars111
%idxprom35 = sext i32 %add34 to i64
%arrayidx36 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35
store i8 %35, ptr %arrayidx36, align 1, !tbaa !5
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%indvars111.1 = trunc i64 %indvars.iv.next109 to i32
%arrayidx32.1 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109
%36 = load i8, ptr %arrayidx32.1, align 1, !tbaa !5
%add34.1 = add nsw i32 %sub, %indvars111.1
%idxprom35.1 = sext i32 %add34.1 to i64
%arrayidx36.1 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.1
store i8 %36, ptr %arrayidx36.1, align 1, !tbaa !5
%indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108, 2
%indvars111.2 = trunc i64 %indvars.iv.next109.1 to i32
%arrayidx32.2 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109.1
%37 = load i8, ptr %arrayidx32.2, align 1, !tbaa !5
%add34.2 = add nsw i32 %sub, %indvars111.2
%idxprom35.2 = sext i32 %add34.2 to i64
%arrayidx36.2 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.2
store i8 %37, ptr %arrayidx36.2, align 1, !tbaa !5
%indvars.iv.next109.2 = add nuw nsw i64 %indvars.iv108, 3
%indvars111.3 = trunc i64 %indvars.iv.next109.2 to i32
%arrayidx32.3 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv.next109.2
%38 = load i8, ptr %arrayidx32.3, align 1, !tbaa !5
%add34.3 = add nsw i32 %sub, %indvars111.3
%idxprom35.3 = sext i32 %add34.3 to i64
%arrayidx36.3 = getelementptr inbounds [250 x i8], ptr %a, i64 0, i64 %idxprom35.3
store i8 %38, ptr %arrayidx36.3, align 1, !tbaa !5
%indvars.iv.next109.3 = add nuw nsw i64 %indvars.iv108, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next109.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond40.preheader, label %for.body30, !llvm.loop !17
for.inc51: ; preds = %for.body43.preheader, %for.cond40.preheader
%inc52 = add nuw nsw i32 %j.0100, 1
%39 = load i32, ptr %m, align 4, !tbaa !8
%cmp15 = icmp slt i32 %inc52, %39
br i1 %cmp15, label %for.body, label %for.cond54.preheader, !llvm.loop !18
for.body57: ; preds = %for.body57.preheader, %for.body57
%indvars.iv115 = phi i64 [ 0, %for.body57.preheader ], [ %indvars.iv.next116, %for.body57 ]
%arrayidx59 = getelementptr inbounds [250 x i8], ptr %ch, i64 0, i64 %indvars.iv115
%40 = load i8, ptr %arrayidx59, align 1, !tbaa !5
%conv60 = sext i8 %40 to i32
%putchar91 = call i32 @putchar(i32 %conv60)
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count120
br i1 %exitcond121.not, label %for.end64, label %for.body57, !llvm.loop !19
for.end64: ; preds = %for.body57, %for.cond54.preheader
%putchar = call i32 @putchar(i32 10)
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
br label %while.cond1.backedge
while.end68: ; preds = %while.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 250, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 250, ptr nonnull %ch) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: 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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, 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}
!19 = distinct !{!19, !11}
|
#include <stdio.h>
#include <string.h>
int main(void){
char cards[201],sub[200];
int i,m,h,len;
while(scanf("%s",cards),strcmp(cards,"-")){
scanf("%d",&m);
len=strlen(cards);
for(i=0;i<m;i++) {
scanf("%d",&h);
strcpy(sub,&cards[h]);
strcat(sub,cards);
sub[len]='\0';
strcpy(cards,sub);
}
printf("%s\n",cards);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103719/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103719/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%cards = alloca [201 x i8], align 16
%sub = alloca [200 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %cards) #6
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %sub) #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
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%lhsv25 = load i16, ptr %cards, align 16
%.not26 = icmp eq i16 %lhsv25, 45
br i1 %.not26, label %while.end, label %while.body
while.body: ; 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
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %while.body
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #7
%sext = shl i64 %call5, 32
%idxprom13 = ashr exact i64 %sext, 32
%arrayidx14 = getelementptr inbounds [200 x i8], ptr %sub, i64 0, i64 %idxprom13
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.023 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [201 x i8], ptr %cards, i64 0, i64 %idxprom
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %sub, ptr noundef nonnull dereferenceable(1) %arrayidx) #6
%call12 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %sub, ptr noundef nonnull dereferenceable(1) %cards) #6
store i8 0, ptr %arrayidx14, align 1, !tbaa !9
%call17 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %cards, ptr noundef nonnull dereferenceable(1) %sub) #6
%inc = add nuw nsw i32 %i.023, 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, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cards)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards)
%lhsv = load i16, ptr %cards, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.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 200, ptr nonnull %sub) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %cards) #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 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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>
#define LEN 201
#define END "-"
void shuffle(char[],int);
int main(void)
{
int i;
int h;
int m;
char str[LEN];
for(;;)
{
scanf("%s",str);
if(strcmp(END,str)==0) break;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&h);
shuffle(str,h);
}
printf("%s\n",str);
}
return 0;
}
void shuffle(char str[],int h)
{
char temp[LEN*2+1];
strcpy(temp,str+h);
strcpy(temp+strlen(str)-h,str);
temp[strlen(str)]='\0';
strcpy(str,temp);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103762/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103762/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%temp.i = alloca [403 x i8], align 16
%h = alloca i32, align 4
%m = alloca i32, align 4
%str = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str) #7
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%rhsv16 = load i16, ptr %str, align 16
%.not17 = icmp eq i16 %rhsv16, 45
br i1 %.not17, label %for.end10, 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
%cmp513 = icmp sgt i32 %0, 0
br i1 %cmp513, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.014 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 403, ptr nonnull %temp.i) #7
%idx.ext.i = sext i32 %1 to i64
%add.ptr.i = getelementptr inbounds i8, ptr %str, i64 %idx.ext.i
%call.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp.i, ptr noundef nonnull dereferenceable(1) %add.ptr.i) #7
%call2.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #8
%add.ptr3.i = getelementptr inbounds i8, ptr %temp.i, i64 %call2.i
%idx.neg.i = sub nsw i64 0, %idx.ext.i
%add.ptr5.i = getelementptr inbounds i8, ptr %add.ptr3.i, i64 %idx.neg.i
%call6.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr5.i, ptr noundef nonnull dereferenceable(1) %str) #7
store i8 0, ptr %add.ptr3.i, align 1, !tbaa !9
%call9.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %temp.i) #7
call void @llvm.lifetime.end.p0(i64 403, ptr nonnull %temp.i) #7
%inc = add nuw nsw i32 %i.014, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %2
br i1 %cmp5, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%rhsv = load i16, ptr %str, align 16
%.not = icmp eq i16 %rhsv, 45
br i1 %.not, label %for.end10, label %if.end
for.end10: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @shuffle(ptr noundef %str, i32 noundef %h) local_unnamed_addr #3 {
entry:
%temp = alloca [403 x i8], align 16
call void @llvm.lifetime.start.p0(i64 403, ptr nonnull %temp) #7
%idx.ext = sext i32 %h to i64
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %idx.ext
%call = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %add.ptr) #7
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #8
%add.ptr3 = getelementptr inbounds i8, ptr %temp, i64 %call2
%idx.neg = sub nsw i64 0, %idx.ext
%add.ptr5 = getelementptr inbounds i8, ptr %add.ptr3, i64 %idx.neg
%call6 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr5, ptr noundef nonnull dereferenceable(1) %str) #7
store i8 0, ptr %add.ptr3, align 1, !tbaa !9
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %temp) #7
call void @llvm.lifetime.end.p0(i64 403, ptr nonnull %temp) #7
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress 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: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>
#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int
#define MOD 1000000007
#define MAX 100001
long long int fac[MAX], finv[MAX], inv[MAX];
void MOD_COM_init(){
fac[0] = 1;
fac[1] = 1;
finv[0] = 1;
finv[1] = 1;
inv[1] = 1;
for(int i=2; i<MAX; i++){
fac[i] = fac[i-1]*i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
finv[i] = finv[i-1] * inv[i] % MOD;
}
}
long long int MOD_combination(long long int n,long long int r){
if(r<0||n<0){
return 0;
}
if(n < r){
return 0;
}
return (fac[n] * (finv[r] * finv[n-r] % MOD)) % MOD;
}
long long int MOD_pow(long long int a, long long int n){
long long int res = 1;
while(n>0){
if(n&1){
res = res*a % MOD;
}
a = a*a % MOD;
n >>= 1;
}
return res;
}
int cmpAsc(const void* a, const void* b){
long long int x = *(long long int*)a, y = *(long long int*)b;
if(x > y){
return 1;
}
if(x < y){
return -1;
}
return 0;
}
int main(){
int n, k;
scanf("%d %d", &n, &k);
lld a[n];
rep(i, 0, n){
scanf("%lld", &a[i]);
}
qsort(a, n, sizeof(lld), cmpAsc);
MOD_COM_init();
lld sum_max = 0;
lld sum_min = 0;
rep(i, 0, n){
sum_max += MOD_combination((lld)(i), (lld)(k-1)) * a[i];
if(sum_max < 0){
sum_max += (-1 * sum_max + MOD - 1) / MOD * MOD;
}
sum_max %= MOD;
sum_min += MOD_combination((lld)(n-i-1), (lld)(k-1)) * a[i];
if(sum_min < 0){
sum_min += (-1 * sum_min + MOD - 1) / MOD * MOD;
}
sum_min %= MOD;
}
lld ans = sum_max - sum_min;
while(ans < 0){
ans += MOD;
}
printf("%lld", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103827/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103827/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@fac = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@finv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @MOD_COM_init() local_unnamed_addr #0 {
entry:
store i64 1, ptr @fac, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @fac, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr @finv, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
br label %for.body
for.cond.cleanup: ; preds = %for.body
ret void
for.body: ; preds = %entry, %for.body
%0 = phi i64 [ 1, %entry ], [ %rem18, %for.body ]
%1 = phi i64 [ 1, %entry ], [ %rem, %for.body ]
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.body ]
%mul = mul nsw i64 %1, %indvars.iv
%rem = srem i64 %mul, 1000000007
%arrayidx2 = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %indvars.iv
store i64 %rem, ptr %arrayidx2, align 8, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%rem3 = urem i32 1000000007, %2
%idxprom4 = zext i32 %rem3 to i64
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%div = udiv i32 1000000007, %2
%conv6 = zext i32 %div to i64
%mul7 = mul nsw i64 %3, %conv6
%rem8 = srem i64 %mul7, 1000000007
%sub9 = sub nsw i64 1000000007, %rem8
%arrayidx11 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %indvars.iv
store i64 %sub9, ptr %arrayidx11, align 8, !tbaa !5
%mul17 = mul nuw nsw i64 %sub9, %0
%rem18 = urem i64 %mul17, 1000000007
%arrayidx20 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %indvars.iv
store i64 %rem18, ptr %arrayidx20, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 100001
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) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @MOD_combination(i64 noundef %n, i64 noundef %r) local_unnamed_addr #2 {
entry:
%0 = or i64 %r, %n
%or.cond.not = icmp slt i64 %0, 0
%cmp2 = icmp slt i64 %n, %r
%or.cond = or i1 %cmp2, %or.cond.not
br i1 %or.cond, label %return, label %if.end4
if.end4: ; preds = %entry
%arrayidx = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %n
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %r
%2 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%sub = sub nsw i64 %n, %r
%arrayidx6 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %sub
%3 = load i64, ptr %arrayidx6, align 8, !tbaa !5
%mul = mul nsw i64 %3, %2
%rem = srem i64 %mul, 1000000007
%mul7 = mul nsw i64 %rem, %1
%rem8 = srem i64 %mul7, 1000000007
br label %return
return: ; preds = %entry, %if.end4
%retval.0 = phi i64 [ %rem8, %if.end4 ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @MOD_pow(i64 noundef %a, i64 noundef %n) local_unnamed_addr #3 {
entry:
%cmp8 = icmp sgt i64 %n, 0
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%res.011 = phi i64 [ %res.1, %if.end ], [ 1, %entry ]
%n.addr.010 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%a.addr.09 = phi i64 [ %rem2, %if.end ], [ %a, %entry ]
%and = and i64 %n.addr.010, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %res.011, %a.addr.09
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%res.1 = phi i64 [ %rem, %if.then ], [ %res.011, %while.body ]
%mul1 = mul nsw i64 %a.addr.09, %a.addr.09
%rem2 = urem i64 %mul1, 1000000007
%shr = lshr i64 %n.addr.010, 1
%cmp.not = icmp ult i64 %n.addr.010, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
%res.0.lcssa = phi i64 [ 1, %entry ], [ %res.1, %if.end ]
ret i64 %res.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpAsc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #10
%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 !12
%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 !12
%cmp88 = icmp sgt i32 %3, 0
br i1 %cmp88, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %11, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmpAsc) #10
store i64 1, ptr @fac, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @fac, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr @finv, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.cond.cleanup
%4 = phi i64 [ 1, %for.cond.cleanup ], [ %rem18.i, %for.body.i ]
%5 = phi i64 [ 1, %for.cond.cleanup ], [ %rem.i, %for.body.i ]
%indvars.iv.i = phi i64 [ 2, %for.cond.cleanup ], [ %indvars.iv.next.i, %for.body.i ]
%mul.i = mul nsw i64 %indvars.iv.i, %5
%rem.i = srem i64 %mul.i, 1000000007
%arrayidx2.i = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %indvars.iv.i
store i64 %rem.i, ptr %arrayidx2.i, align 8, !tbaa !5
%6 = trunc i64 %indvars.iv.i to i32
%rem3.i = urem i32 1000000007, %6
%idxprom4.i = zext i32 %rem3.i to i64
%arrayidx5.i = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %idxprom4.i
%7 = load i64, ptr %arrayidx5.i, align 8, !tbaa !5
%div.i = udiv i32 1000000007, %6
%conv6.i = zext i32 %div.i to i64
%mul7.i = mul nsw i64 %7, %conv6.i
%rem8.i = srem i64 %mul7.i, 1000000007
%sub9.i = sub nsw i64 1000000007, %rem8.i
%arrayidx11.i = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %indvars.iv.i
store i64 %sub9.i, ptr %arrayidx11.i, align 8, !tbaa !5
%mul17.i = mul nuw nsw i64 %sub9.i, %4
%rem18.i = urem i64 %mul17.i, 1000000007
%arrayidx20.i = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %indvars.iv.i
store i64 %rem18.i, ptr %arrayidx20.i, align 8, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 100001
br i1 %exitcond.not.i, label %for.cond3.preheader, label %for.body.i, !llvm.loop !9
for.cond3.preheader: ; preds = %for.body.i
%8 = load i32, ptr %n, align 4, !tbaa !12
%cmp490 = icmp sgt i32 %8, 0
br i1 %cmp490, label %for.body7.lr.ph, label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond3.preheader
%9 = load i32, ptr %k, align 4, !tbaa !12
%sub = add nsw i32 %9, -1
%conv9 = sext i32 %sub to i64
%or.cond.not.i = icmp slt i32 %9, 1
%arrayidx5.i68 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %conv9
%wide.trip.count = zext i32 %8 to i64
br label %for.body7
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
%10 = load i32, ptr %n, align 4, !tbaa !12
%11 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !14
for.cond.cleanup6: ; preds = %if.end39, %for.cond3.preheader
%sum_max.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ %rem101, %if.end39 ]
%sum_min.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ %rem40102, %if.end39 ]
%sub44 = sub nsw i64 %sum_max.0.lcssa, %sum_min.0.lcssa
%smax = call i64 @llvm.smax.i64(i64 %sub44, i64 0)
%12 = add nuw nsw i64 %sum_min.0.lcssa, %smax
%13 = icmp ne i64 %12, %sum_max.0.lcssa
%umin = zext i1 %13 to i64
%14 = add nuw nsw i64 %sum_max.0.lcssa, %umin
%15 = sub nsw i64 %12, %14
%16 = udiv i64 %15, 1000000007
%17 = add nuw nsw i64 %16, %umin
%18 = mul i64 %17, 1000000007
%19 = add i64 %sum_max.0.lcssa, %18
%20 = sub i64 %19, %sum_min.0.lcssa
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %20)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
for.body7: ; preds = %for.body7.lr.ph, %if.end39
%indvars.iv98 = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next99, %if.end39 ]
%sum_min.092 = phi i64 [ 0, %for.body7.lr.ph ], [ %rem40102, %if.end39 ]
%sum_max.091 = phi i64 [ 0, %for.body7.lr.ph ], [ %rem101, %if.end39 ]
%cmp2.i = icmp slt i64 %indvars.iv98, %conv9
%or.cond.i = or i1 %or.cond.not.i, %cmp2.i
br i1 %or.cond.i, label %MOD_combination.exit, label %if.end4.i
if.end4.i: ; preds = %for.body7
%arrayidx.i = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %indvars.iv98
%21 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%22 = load i64, ptr %arrayidx5.i68, align 8, !tbaa !5
%sub.i = sub nsw i64 %indvars.iv98, %conv9
%arrayidx6.i = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %sub.i
%23 = load i64, ptr %arrayidx6.i, align 8, !tbaa !5
%mul.i69 = mul nsw i64 %23, %22
%rem.i70 = srem i64 %mul.i69, 1000000007
%mul7.i71 = mul nsw i64 %rem.i70, %21
%rem8.i72 = srem i64 %mul7.i71, 1000000007
br label %MOD_combination.exit
MOD_combination.exit: ; preds = %for.body7, %if.end4.i
%retval.0.i = phi i64 [ %rem8.i72, %if.end4.i ], [ 0, %for.body7 ]
%arrayidx12 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv98
%24 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%mul = mul nsw i64 %24, %retval.0.i
%add = add nsw i64 %mul, %sum_max.091
%add.fr = freeze i64 %add
%cmp13 = icmp slt i64 %add.fr, 0
br i1 %cmp13, label %if.then, label %if.end
if.then: ; preds = %MOD_combination.exit
%sub17 = sub i64 1000000006, %add.fr
%25 = srem i64 %sub17, 1000000007
%add19 = sub nsw i64 1000000006, %25
br label %if.end
if.end: ; preds = %if.then, %MOD_combination.exit
%sum_max.1 = phi i64 [ %add19, %if.then ], [ %add.fr, %MOD_combination.exit ]
%rem101 = urem i64 %sum_max.1, 1000000007
%26 = trunc i64 %indvars.iv98 to i32
%27 = xor i32 %26, -1
%sub21 = add i32 %8, %27
%conv22 = sext i32 %sub21 to i64
%28 = or i64 %conv9, %conv22
%or.cond.not.i73 = icmp slt i64 %28, 0
%cmp2.i74 = icmp slt i32 %sub21, %sub
%or.cond.i75 = or i1 %cmp2.i74, %or.cond.not.i73
br i1 %or.cond.i75, label %MOD_combination.exit86, label %if.end4.i76
if.end4.i76: ; preds = %if.end
%arrayidx.i77 = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %conv22
%29 = load i64, ptr %arrayidx.i77, align 8, !tbaa !5
%30 = load i64, ptr %arrayidx5.i68, align 8, !tbaa !5
%sub.i79 = sub nsw i64 %conv22, %conv9
%arrayidx6.i80 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %sub.i79
%31 = load i64, ptr %arrayidx6.i80, align 8, !tbaa !5
%mul.i81 = mul nsw i64 %31, %30
%rem.i82 = srem i64 %mul.i81, 1000000007
%mul7.i83 = mul nsw i64 %rem.i82, %29
%rem8.i84 = srem i64 %mul7.i83, 1000000007
br label %MOD_combination.exit86
MOD_combination.exit86: ; preds = %if.end, %if.end4.i76
%retval.0.i85 = phi i64 [ %rem8.i84, %if.end4.i76 ], [ 0, %if.end ]
%mul28 = mul nsw i64 %retval.0.i85, %24
%add29 = add nsw i64 %mul28, %sum_min.092
%add29.fr = freeze i64 %add29
%cmp30 = icmp slt i64 %add29.fr, 0
br i1 %cmp30, label %if.then32, label %if.end39
if.then32: ; preds = %MOD_combination.exit86
%sub35 = sub i64 1000000006, %add29.fr
%32 = srem i64 %sub35, 1000000007
%add38 = sub nsw i64 1000000006, %32
br label %if.end39
if.end39: ; preds = %if.then32, %MOD_combination.exit86
%sum_min.1 = phi i64 [ %add38, %if.then32 ], [ %add29.fr, %MOD_combination.exit86 ]
%rem40102 = urem i64 %sum_min.1, 1000000007
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%exitcond.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !15
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #7
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #9
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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: 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 uwtable "min-legal-vector-width"="0" "no-trapping-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 nocallback nofree nosync nounwind willreturn }
attributes #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main()
{
int N,i,j,flag=0;
int A[200]={0};
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d",&A[i]);
}
for(j=0;j<30;j++)
{
for(i=0;i<N;i++)
{
if(A[i]%2==1)
{
flag=1;
}
A[i]=A[i]/2;
}
if(flag==1)
{
printf("%d",j);
return 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103870/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103870/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [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 void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %A, i8 0, i64 800, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %cleanup
for.cond2.preheader: ; preds = %for.body
%cmp641 = icmp sgt i32 %15, 0
br i1 %cmp641, label %for.cond5.preheader.us.preheader, label %cleanup
for.cond5.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.inc22.us
%j.045.us = phi i32 [ %inc23.us, %for.inc22.us ], [ 0, %for.cond5.preheader.us.preheader ]
br i1 %min.iters.check, label %for.body7.us.preheader, label %vector.body
vector.body: ; preds = %for.cond5.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond5.preheader.us ]
%vec.phi = phi <4 x i32> [ %7, %vector.body ], [ zeroinitializer, %for.cond5.preheader.us ]
%vec.phi58 = phi <4 x i32> [ %8, %vector.body ], [ zeroinitializer, %for.cond5.preheader.us ]
%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.load59 = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = and <4 x i32> %wide.load, <i32 -2147483647, i32 -2147483647, i32 -2147483647, i32 -2147483647>
%4 = and <4 x i32> %wide.load59, <i32 -2147483647, i32 -2147483647, i32 -2147483647, i32 -2147483647>
%5 = icmp eq <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1>
%6 = icmp eq <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1>
%7 = select <4 x i1> %5, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%8 = select <4 x i1> %6, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi58
%9 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2>
%10 = sdiv <4 x i32> %wide.load59, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %9, ptr %1, align 16, !tbaa !5
store <4 x i32> %10, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %7, zeroinitializer
%rdx.select.cmp6062 = icmp ne <4 x i32> %8, zeroinitializer
%rdx.select.cmp60 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp6062
%12 = bitcast <4 x i1> %rdx.select.cmp60 to i4
%.not = icmp ne i4 %12, 0
%rdx.select61 = zext i1 %.not to i32
br i1 %cmp.n, label %for.cond5.for.end17_crit_edge.us, label %for.body7.us.preheader
for.body7.us.preheader: ; preds = %for.cond5.preheader.us, %middle.block
%indvars.iv50.ph = phi i64 [ 0, %for.cond5.preheader.us ], [ %n.vec, %middle.block ]
%flag.143.us.ph = phi i32 [ 0, %for.cond5.preheader.us ], [ %rdx.select61, %middle.block ]
br label %for.body7.us
for.inc22.us: ; preds = %for.cond5.for.end17_crit_edge.us
%inc23.us = add nuw nsw i32 %j.045.us, 1
%exitcond53.not = icmp eq i32 %inc23.us, 30
br i1 %exitcond53.not, label %cleanup, label %for.cond5.preheader.us, !llvm.loop !13
for.body7.us: ; preds = %for.body7.us.preheader, %for.body7.us
%indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body7.us ], [ %indvars.iv50.ph, %for.body7.us.preheader ]
%flag.143.us = phi i32 [ %spec.select.us, %for.body7.us ], [ %flag.143.us.ph, %for.body7.us.preheader ]
%arrayidx9.us = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv50
%13 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%14 = and i32 %13, -2147483647
%cmp10.us = icmp eq i32 %14, 1
%spec.select.us = select i1 %cmp10.us, i32 1, i32 %flag.143.us
%div.us = sdiv i32 %13, 2
store i32 %div.us, ptr %arrayidx9.us, align 4, !tbaa !5
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.cond5.for.end17_crit_edge.us, label %for.body7.us, !llvm.loop !14
for.cond5.for.end17_crit_edge.us: ; preds = %for.body7.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %rdx.select61, %middle.block ], [ %spec.select.us, %for.body7.us ]
%cmp18.us = icmp eq i32 %spec.select.us.lcssa, 1
br i1 %cmp18.us, label %if.then19, label %for.inc22.us
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
%15 = load i32, ptr %N, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !15
if.then19: ; preds = %for.cond5.for.end17_crit_edge.us
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %j.045.us)
br label %cleanup
cleanup: ; preds = %for.inc22.us, %entry, %for.cond2.preheader, %if.then19
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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !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}
|
#include<stdio.h>
int N;
int A[201];
int main()
{
int i;
int res = 0;
int odd_flg;
//数値の数の設定
scanf("%d", &N);
// 整数の入力
for(i=0;i<N;i++)
{
scanf("%d", &A[i]);
}
//奇数が出てくるまで2で割り続ける
odd_flg = 0;
while(1)
{
for(i=0;i<N;i++)
{
if(A[i] % 2 != 0)
{
odd_flg = 1;
}
else
{
A[i] /= 2;
}
}
// 奇数が存在していたら抜ける
if(odd_flg == 1)
{
break;
}
// 操作回数を加算
res++;
}
printf("%d\n",res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103913/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103913/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@A = dso_local global [201 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %while.cond.preheader61
while.cond.preheader: ; preds = %for.body
%cmp327 = icmp sgt i32 %3, 0
br i1 %cmp327, label %while.cond.us.preheader, label %while.cond.preheader61
while.cond.preheader61: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %3 to i64
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %for.cond2.for.end12_crit_edge.us
%res.0.us = phi i32 [ %inc16.us, %for.cond2.for.end12_crit_edge.us ], [ 0, %while.cond.us.preheader ]
br label %for.body4.us.outer
for.body4.us.outer: ; preds = %for.inc10.us.thread, %while.cond.us
%indvars.iv34.ph = phi i64 [ %indvars.iv.next3540, %for.inc10.us.thread ], [ 0, %while.cond.us ]
%cmp13.us = phi i1 [ true, %for.inc10.us.thread ], [ false, %while.cond.us ]
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.outer, %for.inc10.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.inc10.us ], [ %indvars.iv34.ph, %for.body4.us.outer ]
%arrayidx6.us = getelementptr inbounds [201 x i32], ptr @A, i64 0, i64 %indvars.iv34
%1 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp7.not.us = icmp eq i32 %2, 0
br i1 %cmp7.not.us, label %for.inc10.us, label %for.inc10.us.thread
for.inc10.us: ; preds = %for.body4.us
%div.us = sdiv i32 %1, 2
store i32 %div.us, ptr %arrayidx6.us, align 4, !tbaa !5
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%exitcond.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.for.end12_crit_edge.us, label %for.body4.us, !llvm.loop !9
for.inc10.us.thread: ; preds = %for.body4.us
%indvars.iv.next3540 = add nuw nsw i64 %indvars.iv34, 1
%exitcond.not41 = icmp eq i64 %indvars.iv.next3540, %wide.trip.count
br i1 %exitcond.not41, label %while.end, label %for.body4.us.outer, !llvm.loop !9
for.cond2.for.end12_crit_edge.us: ; preds = %for.inc10.us
%inc16.us = add nuw nsw i32 %res.0.us, 1
br i1 %cmp13.us, label %while.end, label %while.cond.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [201 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 !11
while.cond: ; preds = %while.cond.preheader61, %while.cond
br label %while.cond
while.end: ; preds = %for.cond2.for.end12_crit_edge.us, %for.inc10.us.thread
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0.us)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void) {
//入力される数字の数
int num;
//入力された数字を格納する配列
int array[200];
int i;
int count = 0;
//偶奇判定のフラグ
int flag = 0;
//入力1
scanf("%d", &num);
//入力2 数字を配列に格納
for ( i = 0; i < num; i++)
{
scanf("%d", &array[i]);
}
//処理関数
while (1)
{
for (i = 0; i < num; i++)
{
if (array[i] % 2 != 0) flag = 1;
}
//奇数があれば終了
if (flag) break;
for ( i = 0; i < num; i++)
{
array[i] = array[i] / 2;
}
count++;
}
printf("%d", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103957/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%array = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %array) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %0, 0
br i1 %cmp35, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %19, %for.body ]
%.lcssa.fr = freeze i32 %.lcssa
%cmp337 = icmp sgt i32 %.lcssa.fr, 0
br i1 %cmp337, label %while.cond.us.us.preheader, label %while.cond
while.cond.us.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count79 = zext i32 %.lcssa.fr to i64
%min.iters.check92 = icmp ult i32 %.lcssa.fr, 8
%n.vec95 = and i64 %wide.trip.count79, 4294967288
%cmp.n97 = icmp eq i64 %n.vec95, %wide.trip.count79
%min.iters.check = icmp ult i32 %.lcssa.fr, 8
%n.vec = and i64 %wide.trip.count79, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count79
br label %while.cond.us.us
while.cond.us.us: ; preds = %while.cond.us.us.preheader, %for.cond13.for.end22_crit_edge.us.us
%count.0.us.us = phi i32 [ %inc23.us.us, %for.cond13.for.end22_crit_edge.us.us ], [ 0, %while.cond.us.us.preheader ]
br i1 %min.iters.check92, label %for.body4.us.us.preheader, label %vector.body98
vector.body98: ; preds = %while.cond.us.us, %vector.body98
%index99 = phi i64 [ %index.next103, %vector.body98 ], [ 0, %while.cond.us.us ]
%vec.phi = phi <4 x i32> [ %7, %vector.body98 ], [ zeroinitializer, %while.cond.us.us ]
%vec.phi100 = phi <4 x i32> [ %8, %vector.body98 ], [ zeroinitializer, %while.cond.us.us ]
%1 = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %index99
%wide.load101 = load <4 x i32>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load102 = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = and <4 x i32> %wide.load101, <i32 1, i32 1, i32 1, i32 1>
%4 = and <4 x i32> %wide.load102, <i32 1, i32 1, i32 1, i32 1>
%5 = icmp eq <4 x i32> %3, zeroinitializer
%6 = icmp eq <4 x i32> %4, zeroinitializer
%7 = select <4 x i1> %5, <4 x i32> %vec.phi, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%8 = select <4 x i1> %6, <4 x i32> %vec.phi100, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%index.next103 = add nuw i64 %index99, 8
%9 = icmp eq i64 %index.next103, %n.vec95
br i1 %9, label %middle.block90, label %vector.body98, !llvm.loop !9
middle.block90: ; preds = %vector.body98
%rdx.select.cmp.not = icmp ne <4 x i32> %7, zeroinitializer
%rdx.select.cmp104106 = icmp ne <4 x i32> %8, zeroinitializer
%rdx.select.cmp104 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp104106
%10 = bitcast <4 x i1> %rdx.select.cmp104 to i4
%.not = icmp ne i4 %10, 0
%rdx.select105 = zext i1 %.not to i32
br i1 %cmp.n97, label %for.cond2.for.end10_crit_edge.us.us, label %for.body4.us.us.preheader
for.body4.us.us.preheader: ; preds = %while.cond.us.us, %middle.block90
%indvars.iv76.ph = phi i64 [ 0, %while.cond.us.us ], [ %n.vec95, %middle.block90 ]
%flag.139.us.us.ph = phi i32 [ 0, %while.cond.us.us ], [ %rdx.select105, %middle.block90 ]
br label %for.body4.us.us
for.body15.us.us: ; preds = %for.body15.us.us.preheader107, %for.body15.us.us
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body15.us.us ], [ %indvars.iv81.ph, %for.body15.us.us.preheader107 ]
%arrayidx17.us.us = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %indvars.iv81
%11 = load i32, ptr %arrayidx17.us.us, align 4, !tbaa !5
%div.us.us = sdiv i32 %11, 2
store i32 %div.us.us, ptr %arrayidx17.us.us, align 4, !tbaa !5
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count79
br i1 %exitcond85.not, label %for.cond13.for.end22_crit_edge.us.us, label %for.body15.us.us, !llvm.loop !13
for.body4.us.us: ; preds = %for.body4.us.us.preheader, %for.body4.us.us
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body4.us.us ], [ %indvars.iv76.ph, %for.body4.us.us.preheader ]
%flag.139.us.us = phi i32 [ %spec.select.us.us, %for.body4.us.us ], [ %flag.139.us.us.ph, %for.body4.us.us.preheader ]
%arrayidx6.us.us = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %indvars.iv76
%12 = load i32, ptr %arrayidx6.us.us, align 4, !tbaa !5
%13 = and i32 %12, 1
%cmp7.not.us.us = icmp eq i32 %13, 0
%spec.select.us.us = select i1 %cmp7.not.us.us, i32 %flag.139.us.us, i32 1
%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.cond2.for.end10_crit_edge.us.us, label %for.body4.us.us, !llvm.loop !14
for.cond2.for.end10_crit_edge.us.us: ; preds = %for.body4.us.us, %middle.block90
%spec.select.us.us.lcssa = phi i32 [ %rdx.select105, %middle.block90 ], [ %spec.select.us.us, %for.body4.us.us ]
%tobool.not.us.us = icmp eq i32 %spec.select.us.us.lcssa, 0
br i1 %tobool.not.us.us, label %for.body15.us.us.preheader, label %while.end
for.body15.us.us.preheader: ; preds = %for.cond2.for.end10_crit_edge.us.us
br i1 %min.iters.check, label %for.body15.us.us.preheader107, label %vector.body
vector.body: ; preds = %for.body15.us.us.preheader, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body15.us.us.preheader ]
%14 = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
%wide.load89 = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2>
%17 = sdiv <4 x i32> %wide.load89, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %16, ptr %14, align 16, !tbaa !5
store <4 x i32> %17, ptr %15, align 16, !tbaa !5
%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 !15
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond13.for.end22_crit_edge.us.us, label %for.body15.us.us.preheader107
for.body15.us.us.preheader107: ; preds = %for.body15.us.us.preheader, %middle.block
%indvars.iv81.ph = phi i64 [ 0, %for.body15.us.us.preheader ], [ %n.vec, %middle.block ]
br label %for.body15.us.us
for.cond13.for.end22_crit_edge.us.us: ; preds = %for.body15.us.us, %middle.block
%inc23.us.us = add nuw nsw i32 %count.0.us.us, 1
br label %while.cond.us.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%19 = load i32, ptr %num, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp = icmp slt i64 %indvars.iv.next, %20
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !16
while.cond: ; preds = %while.cond.preheader, %while.cond
br label %while.cond
while.end: ; preds = %for.cond2.for.end10_crit_edge.us.us
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.us.us)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %array) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
int jj(int n)
{
return n+1;
}
int main()
{
int t,i,n,q=1,p=1;
int a[10000];
int b[10000];
int c[10000];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]%2!=0)
{
b[q]=a[i];
q=jj(q);
}
else
{
c[p]=a[i];
p=jj(p);
}
}
for(i=1;i<=q-1;i++)
{
if(i!=q-1)
printf("%d ",b[i]);
else
printf("%d",b[i]);
}
for(i=1;i<=p-1;i++){
printf(" %d",c[i]);
}
printf("\n");
q=1;
p=1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1040/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1040/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @jj(i32 noundef %n) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %n, 1
ret i32 %add
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [10000 x i32], align 16
%b = alloca [10000 x i32], align 16
%c = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec72 = add nsw i32 %0, -1
store i32 %dec72, ptr %t, align 4, !tbaa !5
%tobool.not73 = icmp eq i32 %0, 0
br i1 %tobool.not73, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end42
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not63 = icmp slt i32 %1, 1
br i1 %cmp.not63, label %for.end42, label %for.body
for.cond16.preheader: ; preds = %for.inc
%cmp17.not.not68 = icmp sgt i32 %q.2, 1
br i1 %cmp17.not.not68, label %for.body18.lr.ph, label %for.cond33.preheader
for.body18.lr.ph: ; preds = %for.cond16.preheader
%sub = add nsw i32 %q.2, -1
%2 = zext i32 %sub to i64
%wide.trip.count = zext i32 %q.2 to i64
%arrayidx27 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %2
br label %for.body18
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %while.body ]
%p.166 = phi i32 [ %p.2, %for.inc ], [ 1, %while.body ]
%q.165 = phi i32 [ %q.2, %for.inc ], [ 1, %while.body ]
%arrayidx = getelementptr inbounds [10000 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
%idxprom8 = sext i32 %q.165 to i64
%arrayidx9 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom8
store i32 %3, ptr %arrayidx9, align 4, !tbaa !5
%add.i = add nsw i32 %q.165, 1
br label %for.inc
if.else: ; preds = %for.body
%idxprom13 = sext i32 %p.166 to i64
%arrayidx14 = getelementptr inbounds [10000 x i32], ptr %c, i64 0, i64 %idxprom13
store i32 %3, ptr %arrayidx14, align 4, !tbaa !5
%add.i62 = add nsw i32 %p.166, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%q.2 = phi i32 [ %add.i, %if.then ], [ %q.165, %if.else ]
%p.2 = phi i32 [ %p.166, %if.then ], [ %add.i62, %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.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp.not.not, label %for.body, label %for.cond16.preheader, !llvm.loop !9
for.cond33.preheader: ; preds = %for.body18, %for.cond16.preheader
%cmp35.not.not70 = icmp sgt i32 %p.2, 1
br i1 %cmp35.not.not70, label %for.body36.preheader, label %for.end42
for.body36.preheader: ; preds = %for.cond33.preheader
%wide.trip.count81 = zext i32 %p.2 to i64
br label %for.body36
for.body18: ; preds = %for.body18.lr.ph, %for.body18
%indvars.iv75 = phi i64 [ 1, %for.body18.lr.ph ], [ %indvars.iv.next76, %for.body18 ]
%cmp20.not = icmp eq i64 %indvars.iv75, %2
%arrayidx23 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %indvars.iv75
%arrayidx23.sink = select i1 %cmp20.not, ptr %arrayidx27, ptr %arrayidx23
%.str.1.sink = select i1 %cmp20.not, ptr @.str, ptr @.str.1
%7 = load i32, ptr %arrayidx23.sink, align 4, !tbaa !5
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink, i32 noundef %7)
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count
br i1 %exitcond.not, label %for.cond33.preheader, label %for.body18, !llvm.loop !11
for.body36: ; preds = %for.body36.preheader, %for.body36
%indvars.iv78 = phi i64 [ 1, %for.body36.preheader ], [ %indvars.iv.next79, %for.body36 ]
%arrayidx38 = getelementptr inbounds [10000 x i32], ptr %c, i64 0, i64 %indvars.iv78
%8 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count81
br i1 %exitcond82.not, label %for.end42, label %for.body36, !llvm.loop !12
for.end42: ; preds = %for.body36, %while.body, %for.cond33.preheader
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %for.end42, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int t,k;
int b[1000],e[1000];
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d %d",&b[i],&e[i]);
}
scanf("%d",&k);
for(int i=0;i<t;i++)
{
if(k>=b[i]&&k<=e[i])
printf("%d",t-i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10405/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10405/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%k = alloca i32, align 4
%b = alloca [1000 x i32], align 16
%e = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %e) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %t, align 4, !tbaa !5
%cmp730 = icmp sgt i32 %1, 0
br i1 %cmp730, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %e, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %t, 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.cond.cleanup, !llvm.loop !9
for.cond.cleanup8: ; preds = %for.inc17, %for.cond.cleanup
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.inc17
%4 = phi i32 [ %9, %for.inc17 ], [ %1, %for.cond.cleanup ]
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.inc17 ], [ 0, %for.cond.cleanup ]
%5 = load i32, ptr %k, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv33
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not = icmp slt i32 %5, %6
br i1 %cmp12.not, label %for.inc17, label %land.lhs.true
land.lhs.true: ; preds = %for.body9
%arrayidx14 = getelementptr inbounds [1000 x i32], ptr %e, i64 0, i64 %indvars.iv33
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp sgt i32 %5, %7
br i1 %cmp15.not, label %for.inc17, label %if.then
if.then: ; preds = %land.lhs.true
%8 = trunc i64 %indvars.iv33 to i32
%sub = sub nsw i32 %4, %8
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
%.pre = load i32, ptr %t, align 4, !tbaa !5
br label %for.inc17
for.inc17: ; preds = %for.body9, %land.lhs.true, %if.then
%9 = phi i32 [ %4, %for.body9 ], [ %4, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%10 = sext i32 %9 to i64
%cmp7 = icmp slt i64 %indvars.iv.next34, %10
br i1 %cmp7, label %for.body9, label %for.cond.cleanup8, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void) {
int n, count = 0, check = 0;
int a[210];
scanf("%d", &n);
for ( int i = 0; i < n; i++ ) {
scanf("%d", &a[i]);
}
while(1) {
for ( int i = 0; i < n; i++ ) {
if ( a[i]%2 != 0 ) {
check = 1;
break;
} else a[i] /= 2;
}
if ( check == 1 ) break;
else count++;
}
printf("%d", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104093/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104093/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [210 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 840, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %while.cond.preheader43
while.cond.preheader: ; preds = %for.body
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %while.cond.us.preheader, label %while.cond.preheader43
while.cond.preheader43: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %3 to i64
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %for.cond3.if.else17_crit_edge.us
%count.0.us = phi i32 [ %inc18.us, %for.cond3.if.else17_crit_edge.us ], [ 0, %while.cond.us.preheader ]
br label %for.body6.us
for.body6.us: ; preds = %while.cond.us, %if.else.us
%indvars.iv38 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next39, %if.else.us ]
%arrayidx8.us = getelementptr inbounds [210 x i32], ptr %a, i64 0, i64 %indvars.iv38
%1 = load i32, ptr %arrayidx8.us, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp9.not.us = icmp eq i32 %2, 0
br i1 %cmp9.not.us, label %if.else.us, label %while.end
if.else.us: ; preds = %for.body6.us
%div.us = sdiv i32 %1, 2
store i32 %div.us, ptr %arrayidx8.us, align 4, !tbaa !5
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.if.else17_crit_edge.us, label %for.body6.us, !llvm.loop !9
for.cond3.if.else17_crit_edge.us: ; preds = %if.else.us
%inc18.us = add nuw nsw i32 %count.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 [210 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.cond: ; preds = %while.cond.preheader43, %while.cond
br label %while.cond
while.end: ; preds = %for.body6.us
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.us)
call void @llvm.lifetime.end.p0(i64 840, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main() {
int n, result = 0, memo = 0,min=100;
char str[105];
int num[20000]={};
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &num[i]);
memo = 0;
while (num[i] % 2 == 0) {
memo++;
num[i] /= 2;
}
if (memo < min) { min = memo; }
}
printf("%d", min);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104143/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104143/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%num = alloca [20000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %num) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80000) %num, i8 0, i64 80000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %while.end, %entry
%min.0.lcssa = phi i32 [ 100, %entry ], [ %spec.select, %while.end ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %while.end
%indvars.iv = phi i64 [ %indvars.iv.next, %while.end ], [ 0, %entry ]
%min.022 = phi i32 [ %spec.select, %while.end ], [ 100, %entry ]
%arrayidx = getelementptr inbounds [20000 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx.promoted = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = and i32 %arrayidx.promoted, 1
%cmp418 = icmp eq i32 %1, 0
br i1 %cmp418, label %while.body, label %while.end
while.body: ; preds = %for.body, %while.body
%memo.020 = phi i32 [ %inc, %while.body ], [ 0, %for.body ]
%div1719 = phi i32 [ %div, %while.body ], [ %arrayidx.promoted, %for.body ]
%inc = add nuw nsw i32 %memo.020, 1
%div = sdiv i32 %div1719, 2
%2 = and i32 %div, 1
%cmp4 = icmp eq i32 %2, 0
br i1 %cmp4, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div, ptr %arrayidx, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.body
%memo.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %for.body ]
%spec.select = call i32 @llvm.smin.i32(i32 %memo.0.lcssa, i32 %min.022)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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}
|
#include<stdio.h>
int main(void){
int n,a[201],i,cnt=-1,flag=1;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
while(flag==1){
for(i=0;i<n;i++){
if(a[i]%2==1)flag=0;
a[i]/=2;
}
cnt++;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104187/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104187/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.cond3.preheader.preheader
while.cond.preheader: ; preds = %for.body
%cmp425 = icmp sgt i32 %15, 0
br i1 %cmp425, label %for.cond3.preheader.us.preheader, label %for.cond3.preheader.preheader
for.cond3.preheader.preheader: ; preds = %entry, %while.cond.preheader
br label %for.cond3.preheader
for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond3.preheader.us
for.cond3.preheader.us: ; preds = %for.cond3.preheader.us.preheader, %for.cond3.for.end13_crit_edge.us
%cnt.029.us = phi i32 [ %inc14.us, %for.cond3.for.end13_crit_edge.us ], [ -1, %for.cond3.preheader.us.preheader ]
br i1 %min.iters.check, label %for.body5.us.preheader, label %vector.body
vector.body: ; preds = %for.cond3.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond3.preheader.us ]
%vec.phi = phi <4 x i32> [ %7, %vector.body ], [ <i32 1, i32 1, i32 1, i32 1>, %for.cond3.preheader.us ]
%vec.phi37 = phi <4 x i32> [ %8, %vector.body ], [ <i32 1, i32 1, i32 1, i32 1>, %for.cond3.preheader.us ]
%1 = getelementptr inbounds [201 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.load38 = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = and <4 x i32> %wide.load, <i32 -2147483647, i32 -2147483647, i32 -2147483647, i32 -2147483647>
%4 = and <4 x i32> %wide.load38, <i32 -2147483647, i32 -2147483647, i32 -2147483647, i32 -2147483647>
%5 = icmp eq <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1>
%6 = icmp eq <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1>
%7 = select <4 x i1> %5, <4 x i32> zeroinitializer, <4 x i32> %vec.phi
%8 = select <4 x i1> %6, <4 x i32> zeroinitializer, <4 x i32> %vec.phi37
%9 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2>
%10 = sdiv <4 x i32> %wide.load38, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %9, ptr %1, align 16, !tbaa !5
store <4 x i32> %10, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp3941 = icmp ne <4 x i32> %8, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp39 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp3941
%12 = bitcast <4 x i1> %rdx.select.cmp39 to i4
%.not = icmp eq i4 %12, 0
%rdx.select40 = zext i1 %.not to i32
br i1 %cmp.n, label %for.cond3.for.end13_crit_edge.us, label %for.body5.us.preheader
for.body5.us.preheader: ; preds = %for.cond3.preheader.us, %middle.block
%indvars.iv32.ph = phi i64 [ 0, %for.cond3.preheader.us ], [ %n.vec, %middle.block ]
%flag.127.us.ph = phi i32 [ 1, %for.cond3.preheader.us ], [ %rdx.select40, %middle.block ]
br label %for.body5.us
for.body5.us: ; preds = %for.body5.us.preheader, %for.body5.us
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body5.us ], [ %indvars.iv32.ph, %for.body5.us.preheader ]
%flag.127.us = phi i32 [ %spec.select.us, %for.body5.us ], [ %flag.127.us.ph, %for.body5.us.preheader ]
%arrayidx7.us = getelementptr inbounds [201 x i32], ptr %a, i64 0, i64 %indvars.iv32
%13 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%14 = and i32 %13, -2147483647
%cmp8.us = icmp eq i32 %14, 1
%spec.select.us = select i1 %cmp8.us, i32 0, i32 %flag.127.us
%div.us = sdiv i32 %13, 2
store i32 %div.us, ptr %arrayidx7.us, align 4, !tbaa !5
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.for.end13_crit_edge.us, label %for.body5.us, !llvm.loop !13
for.cond3.for.end13_crit_edge.us: ; preds = %for.body5.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %rdx.select40, %middle.block ], [ %spec.select.us, %for.body5.us ]
%inc14.us = add nsw i32 %cnt.029.us, 1
%cmp2.us = icmp eq i32 %spec.select.us.lcssa, 1
br i1 %cmp2.us, label %for.cond3.preheader.us, label %while.end, !llvm.loop !14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [201 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
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !15
for.cond3.preheader: ; preds = %for.cond3.preheader.preheader, %for.cond3.preheader
br label %for.cond3.preheader
while.end: ; preds = %for.cond3.for.end13_crit_edge.us
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc14.us)
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int n;
int c;
int sol;
struct st {
int f, l;
};
struct st a[1000];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d %d", &a[i].f, &a[i].l);
}
scanf("%d", &c);
for (int i = 0; i < n; i++) {
if (c > a[i].l) sol++;
else if (c >= a[i].f&&c <= a[i].l) break;
else;
}
printf("%d", n - sol);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10423/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10423/source.c"
target datalayout = "e-m:e-p270: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.st = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@a = dso_local global [1000 x %struct.st] zeroinitializer, align 16
@c = dso_local global i32 0, align 4
@sol = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @c)
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp742 = icmp sgt i32 %1, 0
%sol.promoted = load i32, ptr @sol, align 4, !tbaa !5
br i1 %cmp742, label %for.body9.lr.ph, label %cleanup
for.body9.lr.ph: ; preds = %for.cond.cleanup
%2 = load i32, ptr @c, align 4, !tbaa !5
%wide.trip.count = zext i32 %1 to i64
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x %struct.st], ptr @a, i64 0, i64 %indvars.iv
%l = getelementptr inbounds [1000 x %struct.st], ptr @a, i64 0, i64 %indvars.iv, i32 1
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %l)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr @n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body9: ; preds = %for.body9.lr.ph, %for.inc26
%indvars.iv47 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next48, %for.inc26 ]
%inc144143 = phi i32 [ %sol.promoted, %for.body9.lr.ph ], [ %inc1440, %for.inc26 ]
%l12 = getelementptr inbounds [1000 x %struct.st], ptr @a, i64 0, i64 %indvars.iv47, i32 1
%5 = load i32, ptr %l12, align 4, !tbaa !11
%cmp13 = icmp sgt i32 %2, %5
br i1 %cmp13, label %if.then, label %if.else
if.then: ; preds = %for.body9
%inc14 = add nsw i32 %inc144143, 1
store i32 %inc14, ptr @sol, align 4, !tbaa !5
br label %for.inc26
if.else: ; preds = %for.body9
%arrayidx11 = getelementptr inbounds [1000 x %struct.st], ptr @a, i64 0, i64 %indvars.iv47
%6 = load i32, ptr %arrayidx11, align 8, !tbaa !13
%cmp18.not = icmp slt i32 %2, %6
br i1 %cmp18.not, label %for.inc26, label %cleanup
for.inc26: ; preds = %if.then, %if.else
%inc1440 = phi i32 [ %inc14, %if.then ], [ %inc144143, %if.else ]
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body9, !llvm.loop !14
cleanup: ; preds = %for.inc26, %if.else, %for.cond.cleanup
%7 = phi i32 [ %sol.promoted, %for.cond.cleanup ], [ %inc1440, %for.inc26 ], [ %inc144143, %if.else ]
%sub = sub nsw i32 %1, %7
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"st", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int i, n, *blackboard, cnt, min_cnt = 100000;
scanf("%d", &n);
blackboard = (int *)malloc(sizeof(int) * n);
for (i = 0; i < n; i++) {
scanf("%d", &blackboard[i]);
}
for (i = 0; i < n; i++) {
cnt = 0;
while (blackboard[i] % 2 == 0) {
cnt++;
blackboard[i] /= 2;
}
if (min_cnt > cnt) {
min_cnt = cnt;
}
}
printf("%d", min_cnt);
free(blackboard);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104273/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.end19
for.cond4.preheader: ; preds = %for.body
%cmp540 = icmp sgt i32 %1, 0
br i1 %cmp540, label %while.cond.preheader.preheader, label %for.end19
while.cond.preheader.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %1 to i64
br label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %while.end
%indvars.iv46 = phi i64 [ 0, %while.cond.preheader.preheader ], [ %indvars.iv.next47, %while.end ]
%min_cnt.042 = phi i32 [ 100000, %while.cond.preheader.preheader ], [ %spec.select, %while.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv46
%arrayidx9.promoted = load i32, ptr %arrayidx9, align 4, !tbaa !5
%3 = and i32 %arrayidx9.promoted, 1
%cmp1036 = icmp eq i32 %3, 0
br i1 %cmp1036, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.body
%cnt.038 = phi i32 [ %inc12, %while.body ], [ 0, %while.cond.preheader ]
%div3537 = phi i32 [ %div, %while.body ], [ %arrayidx9.promoted, %while.cond.preheader ]
%inc12 = add nuw nsw i32 %cnt.038, 1
%div = sdiv i32 %div3537, 2
%4 = and i32 %div, 1
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !11
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div, ptr %arrayidx9, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %while.cond.preheader
%cnt.0.lcssa = phi i32 [ %inc12, %while.cond.while.end_crit_edge ], [ 0, %while.cond.preheader ]
%spec.select = call i32 @llvm.smin.i32(i32 %min_cnt.042, i32 %cnt.0.lcssa)
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %while.cond.preheader, !llvm.loop !12
for.end19: ; preds = %while.end, %entry, %for.cond4.preheader
%min_cnt.0.lcssa = phi i32 [ 100000, %for.cond4.preheader ], [ 100000, %entry ], [ %spec.select, %while.end ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min_cnt.0.lcssa)
call void @free(ptr noundef %call1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define POW_10_5 100100
#define MAX_INPUTSTR_LEN POW_10_5 // 読み込む文字列の長さの最大値
#define MAX_Q_LEN (2 * POW_10_5) // Q の最大値
// #define GBN6500_DEBUG
char *buffer, *prevPtr, *postPtr;
int Q;
bool isReversed; // 反転状態なら true
void InvertString(char *str)
{
int len = strlen(str);
char *tmp = (char *)malloc(len + 10);
for (int i = 0; i < len; ++i)
tmp[i] = str[len - i - 1];
tmp[len] = '\0';
strcpy(str, tmp);
free(tmp);
}
void Solve()
{
int T, F;
char C;
for (int i = 0; i < Q; ++i){
scanf("%d", &T);
if (T == 1){
isReversed = !isReversed;
} else {
scanf("%d %c", &F, &C);
if (F == 1)
if (!isReversed) *prevPtr = C, --prevPtr; // 一文で書けると思うけどよくわからないのでカンマで誤魔化した
else *postPtr = C, ++postPtr;
else
if (!isReversed) *postPtr = C, ++postPtr;
else *prevPtr = C, --prevPtr;
}
#ifdef GBN6500_DEBUG
printf("i = %d, type = %d, isReversed = %d, ans = [%s]\n", i, T, isReversed, prevPtr + 1);
#endif
} // end for
*postPtr = '\0';
char *ans = (char *)(prevPtr + 1);
if (isReversed) InvertString(ans);
puts(ans);
}
void Init()
{
#define ALLOC_MEM_SIZE (MAX_Q_LEN + MAX_INPUTSTR_LEN + MAX_Q_LEN)
// 制約の最大値(+α)でヒープにメモリーを確保
// これだけ確保しても約 800KB なので、メモリー制限にはひっかからない(と思う)
buffer = (char *)malloc(ALLOC_MEM_SIZE);
#ifdef GBN6500_DEBUG
memset(buffer, 0, ALLOC_MEM_SIZE); // 46行目の printfデバッグ用
#endif
isReversed = false;
scanf("%s %d", buffer, &Q);
prevPtr = buffer + MAX_Q_LEN;
postPtr = prevPtr + strlen(buffer) + 1;
strcpy(prevPtr + 1, buffer); // buffer の前に MAX_Q ぶんのスペースを開ける。文字を前に追加する時はこのスペースを利用。
}
void Clean()
{
free(buffer);
}
int main(){ Init(); Solve(); Clean(); return 0; }
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104316/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104316/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@Q = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@isReversed = dso_local local_unnamed_addr global i8 0, align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %c\00", align 1
@prevPtr = dso_local local_unnamed_addr global ptr null, align 8
@postPtr = dso_local local_unnamed_addr global ptr null, align 8
@buffer = dso_local local_unnamed_addr global ptr null, align 8
@.str.2 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local void @InvertString(ptr noundef %str) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%conv = trunc i64 %call to i32
%add = shl i64 %call, 32
%sext = add i64 %add, 42949672960
%conv1 = ashr exact i64 %sext, 32
%call2 = tail call noalias ptr @malloc(i64 noundef %conv1) #10
%cmp22 = icmp sgt i32 %conv, 0
br i1 %cmp22, label %iter.check, label %for.cond.cleanup
iter.check: ; preds = %entry
%wide.trip.count = and i64 %call, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%0 = add nsw i64 %wide.trip.count, -1
%1 = add i32 %conv, -1
%2 = trunc i64 %0 to i32
%3 = sub i32 %1, %2
%4 = icmp sgt i32 %3, %1
%5 = icmp ugt i64 %0, 4294967295
%6 = or i1 %4, %5
br i1 %6, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check26 = icmp ult i64 %wide.trip.count, 32
br i1 %min.iters.check26, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call, 31
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%7 = xor i64 %index, -1
%8 = add i64 %call, %7
%9 = shl i64 %8, 32
%10 = ashr exact i64 %9, 32
%11 = getelementptr inbounds i8, ptr %str, i64 %10
%12 = getelementptr inbounds i8, ptr %11, i64 -15
%wide.load = load <16 x i8>, ptr %12, align 1, !tbaa !5
%reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%13 = getelementptr inbounds i8, ptr %11, i64 -31
%wide.load27 = load <16 x i8>, ptr %13, align 1, !tbaa !5
%reverse28 = shufflevector <16 x i8> %wide.load27, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%14 = getelementptr inbounds i8, ptr %call2, i64 %index
store <16 x i8> %reverse, ptr %14, align 1, !tbaa !5
%15 = getelementptr inbounds i8, ptr %14, i64 16
store <16 x i8> %reverse28, ptr %15, align 1, !tbaa !5
%index.next = add nuw i64 %index, 32
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body.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.mod.vf29 = and i64 %call, 7
%n.vec30 = sub nsw i64 %wide.trip.count, %n.mod.vf29
%invariant.gep = getelementptr i8, ptr %str, i64 -7
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index32 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next35, %vec.epilog.vector.body ]
%17 = xor i64 %index32, -1
%18 = add i64 %call, %17
%19 = shl i64 %18, 32
%20 = ashr exact i64 %19, 32
%gep = getelementptr i8, ptr %invariant.gep, i64 %20
%wide.load33 = load <8 x i8>, ptr %gep, align 1, !tbaa !5
%reverse34 = shufflevector <8 x i8> %wide.load33, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%21 = getelementptr inbounds i8, ptr %call2, i64 %index32
store <8 x i8> %reverse34, ptr %21, align 1, !tbaa !5
%index.next35 = add nuw i64 %index32, 8
%22 = icmp eq i64 %index.next35, %n.vec30
br i1 %22, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n31 = icmp eq i64 %n.mod.vf29, 0
br i1 %cmp.n31, label %for.cond.cleanup, label %for.body.preheader
for.body.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.vec30, %vec.epilog.middle.block ]
%23 = sub i64 %call, %indvars.iv.ph
%.neg = add nsw i64 %indvars.iv.ph, 1
%xtraiter = and i64 %23, 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
%24 = xor i64 %indvars.iv.ph, -1
%sub4.prol = add i64 %call, %24
%sext25.prol = shl i64 %sub4.prol, 32
%idxprom.prol = ashr exact i64 %sext25.prol, 32
%arrayidx.prol = getelementptr inbounds i8, ptr %str, i64 %idxprom.prol
%25 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5
%arrayidx6.prol = getelementptr inbounds i8, ptr %call2, i64 %indvars.iv.ph
store i8 %25, ptr %arrayidx6.prol, align 1, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%26 = icmp eq i64 %wide.trip.count, %.neg
br i1 %26, label %for.cond.cleanup, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.prol.loopexit
%invariant.gep36 = getelementptr i8, ptr %call2, i64 1
br label %for.body
for.cond.cleanup: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry
%idxprom7 = ashr exact i64 %add, 32
%arrayidx8 = getelementptr inbounds i8, ptr %call2, i64 %idxprom7
store i8 0, ptr %arrayidx8, align 1, !tbaa !5
%call9 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %call2) #11
tail call void @free(ptr noundef %call2) #11
ret void
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ %indvars.iv.unr, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%27 = xor i64 %indvars.iv, -1
%sub4 = add i64 %call, %27
%sext25 = shl i64 %sub4, 32
%idxprom = ashr exact i64 %sext25, 32
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %idxprom
%28 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds i8, ptr %call2, i64 %indvars.iv
store i8 %28, ptr %arrayidx6, align 1, !tbaa !5
%reass.sub = sub i64 %call, %indvars.iv
%sub4.1 = shl i64 %reass.sub, 32
%sext25.1 = add i64 %sub4.1, -8589934592
%idxprom.1 = ashr exact i64 %sext25.1, 32
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %idxprom.1
%29 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%gep37 = getelementptr i8, ptr %invariant.gep36, i64 %indvars.iv
store i8 %29, ptr %gep37, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nounwind uwtable
define dso_local void @Solve() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%F = alloca i32, align 4
%C = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %F) #11
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %C) #11
%0 = load i32, ptr @Q, align 4, !tbaa !14
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%1 = load ptr, ptr @postPtr, align 8, !tbaa !16
store i8 0, ptr %1, align 1, !tbaa !5
%2 = load ptr, ptr @prevPtr, align 8, !tbaa !16
%add.ptr = getelementptr inbounds i8, ptr %2, i64 1
%3 = load i8, ptr @isReversed, align 1, !tbaa !18, !range !20, !noundef !21
%tobool18.not = icmp eq i8 %3, 0
br i1 %tobool18.not, label %if.end20, label %if.then19
for.body: ; preds = %entry, %for.inc
%i.025 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%4 = load i32, ptr %T, align 4, !tbaa !14
%cmp1 = icmp eq i32 %4, 1
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
%5 = load i8, ptr @isReversed, align 1, !tbaa !18, !range !20, !noundef !21
%frombool = xor i8 %5, 1
store i8 %frombool, ptr @isReversed, align 1, !tbaa !18
br label %for.inc
if.else: ; preds = %for.body
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %F, ptr noundef nonnull %C)
%6 = load i32, ptr %F, align 4, !tbaa !14
%cmp3 = icmp eq i32 %6, 1
%7 = load i8, ptr @isReversed, align 1, !tbaa !18, !range !20, !noundef !21
%tobool5.not = icmp eq i8 %7, 0
%8 = load i8, ptr %C, align 1, !tbaa !5
br i1 %cmp3, label %if.then4, label %if.else9
if.then4: ; preds = %if.else
br i1 %tobool5.not, label %if.then6, label %if.else7
if.then6: ; preds = %if.then4
%9 = load ptr, ptr @prevPtr, align 8, !tbaa !16
store i8 %8, ptr %9, align 1, !tbaa !5
%10 = load ptr, ptr @prevPtr, align 8, !tbaa !16
%incdec.ptr = getelementptr inbounds i8, ptr %10, i64 -1
store ptr %incdec.ptr, ptr @prevPtr, align 8, !tbaa !16
br label %for.inc
if.else7: ; preds = %if.then4
%11 = load ptr, ptr @postPtr, align 8, !tbaa !16
store i8 %8, ptr %11, align 1, !tbaa !5
%12 = load ptr, ptr @postPtr, align 8, !tbaa !16
%incdec.ptr8 = getelementptr inbounds i8, ptr %12, i64 1
store ptr %incdec.ptr8, ptr @postPtr, align 8, !tbaa !16
br label %for.inc
if.else9: ; preds = %if.else
br i1 %tobool5.not, label %if.then11, label %if.else13
if.then11: ; preds = %if.else9
%13 = load ptr, ptr @postPtr, align 8, !tbaa !16
store i8 %8, ptr %13, align 1, !tbaa !5
%14 = load ptr, ptr @postPtr, align 8, !tbaa !16
%incdec.ptr12 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr12, ptr @postPtr, align 8, !tbaa !16
br label %for.inc
if.else13: ; preds = %if.else9
%15 = load ptr, ptr @prevPtr, align 8, !tbaa !16
store i8 %8, ptr %15, align 1, !tbaa !5
%16 = load ptr, ptr @prevPtr, align 8, !tbaa !16
%incdec.ptr14 = getelementptr inbounds i8, ptr %16, i64 -1
store ptr %incdec.ptr14, ptr @prevPtr, align 8, !tbaa !16
br label %for.inc
for.inc: ; preds = %if.then, %if.then11, %if.else13, %if.then6, %if.else7
%inc = add nuw nsw i32 %i.025, 1
%17 = load i32, ptr @Q, align 4, !tbaa !14
%cmp = icmp slt i32 %inc, %17
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !22
if.then19: ; preds = %for.cond.cleanup
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %add.ptr) #9
%conv.i = trunc i64 %call.i to i32
%add.i = shl i64 %call.i, 32
%sext.i = add i64 %add.i, 42949672960
%conv1.i = ashr exact i64 %sext.i, 32
%call2.i = call noalias ptr @malloc(i64 noundef %conv1.i) #10
%cmp22.i = icmp sgt i32 %conv.i, 0
br i1 %cmp22.i, label %iter.check, label %InvertString.exit
iter.check: ; preds = %if.then19
%wide.trip.count.i = and i64 %call.i, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count.i, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%18 = add nsw i64 %wide.trip.count.i, -1
%19 = add i32 %conv.i, -1
%20 = trunc i64 %18 to i32
%21 = sub i32 %19, %20
%22 = icmp sgt i32 %21, %19
%23 = icmp ugt i64 %18, 4294967295
%24 = or i1 %22, %23
br i1 %24, label %for.body.i.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check26 = icmp ult i64 %wide.trip.count.i, 32
br i1 %min.iters.check26, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call.i, 31
%n.vec = sub nsw i64 %wide.trip.count.i, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%25 = xor i64 %index, -1
%26 = add i64 %call.i, %25
%27 = shl i64 %26, 32
%28 = ashr exact i64 %27, 32
%29 = getelementptr inbounds i8, ptr %add.ptr, i64 %28
%30 = getelementptr inbounds i8, ptr %29, i64 -15
%wide.load = load <16 x i8>, ptr %30, align 1, !tbaa !5
%reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%31 = getelementptr inbounds i8, ptr %29, i64 -31
%wide.load27 = load <16 x i8>, ptr %31, align 1, !tbaa !5
%reverse28 = shufflevector <16 x i8> %wide.load27, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%32 = getelementptr inbounds i8, ptr %call2.i, i64 %index
store <16 x i8> %reverse, ptr %32, align 1, !tbaa !5
%33 = getelementptr inbounds i8, ptr %32, i64 16
store <16 x i8> %reverse28, ptr %33, align 1, !tbaa !5
%index.next = add nuw i64 %index, 32
%34 = icmp eq i64 %index.next, %n.vec
br i1 %34, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %InvertString.exit, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body.i.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.mod.vf29 = and i64 %call.i, 7
%n.vec30 = sub nsw i64 %wide.trip.count.i, %n.mod.vf29
%invariant.gep = getelementptr i8, ptr %add.ptr, i64 -7
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index32 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next35, %vec.epilog.vector.body ]
%35 = xor i64 %index32, -1
%36 = add i64 %call.i, %35
%37 = shl i64 %36, 32
%38 = ashr exact i64 %37, 32
%gep = getelementptr i8, ptr %invariant.gep, i64 %38
%wide.load33 = load <8 x i8>, ptr %gep, align 1, !tbaa !5
%reverse34 = shufflevector <8 x i8> %wide.load33, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%39 = getelementptr inbounds i8, ptr %call2.i, i64 %index32
store <8 x i8> %reverse34, ptr %39, align 1, !tbaa !5
%index.next35 = add nuw i64 %index32, 8
%40 = icmp eq i64 %index.next35, %n.vec30
br i1 %40, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !24
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n31 = icmp eq i64 %n.mod.vf29, 0
br i1 %cmp.n31, label %InvertString.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.i.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec30, %vec.epilog.middle.block ]
%41 = sub i64 %call.i, %indvars.iv.i.ph
%.neg = add nsw i64 %indvars.iv.i.ph, 1
%xtraiter = and i64 %41, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader
%42 = xor i64 %indvars.iv.i.ph, -1
%sub4.i.prol = add i64 %call.i, %42
%sext25.i.prol = shl i64 %sub4.i.prol, 32
%idxprom.i.prol = ashr exact i64 %sext25.i.prol, 32
%arrayidx.i.prol = getelementptr inbounds i8, ptr %add.ptr, i64 %idxprom.i.prol
%43 = load i8, ptr %arrayidx.i.prol, align 1, !tbaa !5
%arrayidx6.i.prol = getelementptr inbounds i8, ptr %call2.i, i64 %indvars.iv.i.ph
store i8 %43, ptr %arrayidx6.i.prol, align 1, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.ph, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%44 = icmp eq i64 %wide.trip.count.i, %.neg
br i1 %44, label %InvertString.exit, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.prol.loopexit
%invariant.gep36 = getelementptr i8, ptr %call2.i, i64 1
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ %indvars.iv.i.unr, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %for.body.i ]
%45 = xor i64 %indvars.iv.i, -1
%sub4.i = add i64 %call.i, %45
%sext25.i = shl i64 %sub4.i, 32
%idxprom.i = ashr exact i64 %sext25.i, 32
%arrayidx.i = getelementptr inbounds i8, ptr %add.ptr, i64 %idxprom.i
%46 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%arrayidx6.i = getelementptr inbounds i8, ptr %call2.i, i64 %indvars.iv.i
store i8 %46, ptr %arrayidx6.i, align 1, !tbaa !5
%reass.sub = sub i64 %call.i, %indvars.iv.i
%sub4.i.1 = shl i64 %reass.sub, 32
%sext25.i.1 = add i64 %sub4.i.1, -8589934592
%idxprom.i.1 = ashr exact i64 %sext25.i.1, 32
%arrayidx.i.1 = getelementptr inbounds i8, ptr %add.ptr, i64 %idxprom.i.1
%47 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%gep37 = getelementptr i8, ptr %invariant.gep36, i64 %indvars.iv.i
store i8 %47, ptr %gep37, align 1, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, %wide.trip.count.i
br i1 %exitcond.not.i.1, label %InvertString.exit, label %for.body.i, !llvm.loop !25
InvertString.exit: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %vec.epilog.middle.block, %if.then19
%idxprom7.i = ashr exact i64 %add.i, 32
%arrayidx8.i = getelementptr inbounds i8, ptr %call2.i, i64 %idxprom7.i
store i8 0, ptr %arrayidx8.i, align 1, !tbaa !5
%call9.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr, ptr noundef nonnull dereferenceable(1) %call2.i) #11
call void @free(ptr noundef %call2.i) #11
br label %if.end20
if.end20: ; preds = %InvertString.exit, %for.cond.cleanup
%call21 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %add.ptr)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %C) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %F) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #11
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 @Init() local_unnamed_addr #7 {
entry:
%call = tail call noalias dereferenceable_or_null(500500) ptr @malloc(i64 noundef 500500) #10
store ptr %call, ptr @buffer, align 8, !tbaa !16
store i8 0, ptr @isReversed, align 1, !tbaa !18
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %call, ptr noundef nonnull @Q)
%0 = load ptr, ptr @buffer, align 8, !tbaa !16
%add.ptr = getelementptr inbounds i8, ptr %0, i64 200200
store ptr %add.ptr, ptr @prevPtr, align 8, !tbaa !16
%call2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #9
%add.ptr3 = getelementptr inbounds i8, ptr %add.ptr, i64 %call2
%add.ptr4 = getelementptr inbounds i8, ptr %add.ptr3, i64 1
store ptr %add.ptr4, ptr @postPtr, align 8, !tbaa !16
%add.ptr5 = getelementptr inbounds i8, ptr %0, i64 200201
%call6 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr5, ptr noundef nonnull dereferenceable(1) %0) #11
ret void
}
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local void @Clean() local_unnamed_addr #8 {
entry:
%0 = load ptr, ptr @buffer, align 8, !tbaa !16
tail call void @free(ptr noundef %0) #11
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call.i = tail call noalias dereferenceable_or_null(500500) ptr @malloc(i64 noundef 500500) #10
store ptr %call.i, ptr @buffer, align 8, !tbaa !16
store i8 0, ptr @isReversed, align 1, !tbaa !18
%call1.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %call.i, ptr noundef nonnull @Q)
%0 = load ptr, ptr @buffer, align 8, !tbaa !16
%add.ptr.i = getelementptr inbounds i8, ptr %0, i64 200200
store ptr %add.ptr.i, ptr @prevPtr, align 8, !tbaa !16
%call2.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #9
%add.ptr3.i = getelementptr inbounds i8, ptr %add.ptr.i, i64 %call2.i
%add.ptr4.i = getelementptr inbounds i8, ptr %add.ptr3.i, i64 1
store ptr %add.ptr4.i, ptr @postPtr, align 8, !tbaa !16
%add.ptr5.i = getelementptr inbounds i8, ptr %0, i64 200201
%call6.i = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr5.i, ptr noundef nonnull dereferenceable(1) %0) #11
tail call void @Solve()
%1 = load ptr, ptr @buffer, align 8, !tbaa !16
tail call void @free(ptr noundef %1) #11
ret i32 0
}
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !9, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !6, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !6, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"_Bool", !6, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !9}
!23 = distinct !{!23, !9, !10, !11}
!24 = distinct !{!24, !9, !10, !11}
!25 = distinct !{!25, !9, !10}
|
#include<stdio.h>
#define K 38
#define N 1407
int main(){
printf("%d %d\n",N,K);
int i,j,x,p=2,pp,mk[2048][64],pa[64]={0};
for(i=1;i<=K;i++){
mk[i][1]=1;
for(j=2;j<=K;j++){
mk[i][j]=p;p++;
}
}
pp=K;
for(i=2;i<=K;i++){
p=0;
for(j=2;j<=K;j++){
pa[j]=p;p+=(i-2);p%=(K-1);
}
for(x=2;x<=K;x++){
pp++;
for(j=1;j<=K;j++){
if(j==1){mk[pp][j]=i;}
else{mk[pp][j]=mk[j][pa[j]+2];pa[j]++;pa[j]%=(K-1);}
}
}
}
for(i=1;i<=N;i++){
for(j=1;j<=K;j++){
printf("%d",mk[i][j]);
if(j!=K){printf(" ");}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%mk = alloca [2048 x [64 x i32]], align 16
%pa = alloca [64 x i32], align 16
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 1407, i32 noundef 38)
call void @llvm.lifetime.start.p0(i64 524288, ptr nonnull %mk) #5
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %pa) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) %pa, i8 0, i64 256, i1 false)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]
%p.0123 = phi i32 [ 2, %entry ], [ %inc.36, %for.body ]
%arrayidx1 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 1
store i32 1, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 2
store i32 %p.0123, ptr %arrayidx8, align 8, !tbaa !5
%0 = insertelement <4 x i32> poison, i32 %p.0123, i64 0
%1 = shufflevector <4 x i32> %0, <4 x i32> poison, <4 x i32> zeroinitializer
%2 = add nuw nsw <4 x i32> %1, <i32 1, i32 2, i32 3, i32 4>
%arrayidx8.1 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 3
store <4 x i32> %2, ptr %arrayidx8.1, align 4, !tbaa !5
%3 = add nuw nsw <4 x i32> %1, <i32 5, i32 6, i32 7, i32 8>
%arrayidx8.5 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 7
store <4 x i32> %3, ptr %arrayidx8.5, align 4, !tbaa !5
%4 = add nuw nsw <4 x i32> %1, <i32 9, i32 10, i32 11, i32 12>
%arrayidx8.9 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 11
store <4 x i32> %4, ptr %arrayidx8.9, align 4, !tbaa !5
%5 = add nuw nsw <4 x i32> %1, <i32 13, i32 14, i32 15, i32 16>
%arrayidx8.13 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 15
store <4 x i32> %5, ptr %arrayidx8.13, align 4, !tbaa !5
%6 = add nuw nsw <4 x i32> %1, <i32 17, i32 18, i32 19, i32 20>
%arrayidx8.17 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 19
store <4 x i32> %6, ptr %arrayidx8.17, align 4, !tbaa !5
%7 = add nuw nsw <4 x i32> %1, <i32 21, i32 22, i32 23, i32 24>
%arrayidx8.21 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 23
store <4 x i32> %7, ptr %arrayidx8.21, align 4, !tbaa !5
%8 = add nuw nsw <4 x i32> %1, <i32 25, i32 26, i32 27, i32 28>
%arrayidx8.25 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 27
store <4 x i32> %8, ptr %arrayidx8.25, align 4, !tbaa !5
%9 = add nuw nsw <4 x i32> %1, <i32 29, i32 30, i32 31, i32 32>
%arrayidx8.29 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 31
store <4 x i32> %9, ptr %arrayidx8.29, align 4, !tbaa !5
%10 = add nuw nsw <4 x i32> %1, <i32 33, i32 34, i32 35, i32 36>
%arrayidx8.33 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv, i64 35
store <4 x i32> %10, ptr %arrayidx8.33, align 4, !tbaa !5
%inc.36 = add nuw nsw i32 %p.0123, 37
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 39
br i1 %exitcond.not, label %for.cond16.preheader.preheader, label %for.body, !llvm.loop !9
for.cond16.preheader.preheader: ; preds = %for.body
%arrayidx20 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 2
%arrayidx20.1 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 3
%arrayidx20.2 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 4
%arrayidx20.3 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 5
%arrayidx20.4 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 6
%arrayidx20.5 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 7
%arrayidx20.6 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 8
%arrayidx20.7 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 9
%arrayidx20.8 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 10
%arrayidx20.9 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 11
%arrayidx20.10 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 12
%arrayidx20.11 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 13
%arrayidx20.12 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 14
%arrayidx20.13 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 15
%arrayidx20.14 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 16
%arrayidx20.15 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 17
%arrayidx20.16 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 18
%arrayidx20.17 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 19
%arrayidx20.18 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 20
%arrayidx20.19 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 21
%arrayidx20.20 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 22
%arrayidx20.21 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 23
%arrayidx20.22 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 24
%arrayidx20.23 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 25
%arrayidx20.24 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 26
%arrayidx20.25 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 27
%arrayidx20.26 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 28
%arrayidx20.27 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 29
%arrayidx20.28 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 30
%arrayidx20.29 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 31
%arrayidx20.30 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 32
%arrayidx20.31 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 33
%arrayidx20.32 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 34
%arrayidx20.33 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 35
%arrayidx20.34 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 36
%arrayidx20.35 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 37
%arrayidx20.36 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 38
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.inc59
%pp.0130 = phi i32 [ %12, %for.inc59 ], [ 38, %for.cond16.preheader.preheader ]
%i.1129 = phi i32 [ %inc60, %for.inc59 ], [ 2, %for.cond16.preheader.preheader ]
%sub = add nsw i32 %i.1129, -2
store i32 0, ptr %arrayidx20, align 8, !tbaa !5
store i32 %sub, ptr %arrayidx20.1, align 4, !tbaa !5
%add.1 = shl nsw i32 %sub, 1
%rem.1 = srem i32 %add.1, 37
store i32 %rem.1, ptr %arrayidx20.2, align 16, !tbaa !5
%add.2 = add nsw i32 %sub, %rem.1
%rem.2 = srem i32 %add.2, 37
store i32 %rem.2, ptr %arrayidx20.3, align 4, !tbaa !5
%add.3 = add nsw i32 %sub, %rem.2
%rem.3 = srem i32 %add.3, 37
store i32 %rem.3, ptr %arrayidx20.4, align 8, !tbaa !5
%add.4 = add nsw i32 %sub, %rem.3
%rem.4 = srem i32 %add.4, 37
store i32 %rem.4, ptr %arrayidx20.5, align 4, !tbaa !5
%add.5 = add nsw i32 %sub, %rem.4
%rem.5 = srem i32 %add.5, 37
store i32 %rem.5, ptr %arrayidx20.6, align 16, !tbaa !5
%add.6 = add nsw i32 %sub, %rem.5
%rem.6 = srem i32 %add.6, 37
store i32 %rem.6, ptr %arrayidx20.7, align 4, !tbaa !5
%add.7 = add nsw i32 %sub, %rem.6
%rem.7 = srem i32 %add.7, 37
store i32 %rem.7, ptr %arrayidx20.8, align 8, !tbaa !5
%add.8 = add nsw i32 %sub, %rem.7
%rem.8 = srem i32 %add.8, 37
store i32 %rem.8, ptr %arrayidx20.9, align 4, !tbaa !5
%add.9 = add nsw i32 %sub, %rem.8
%rem.9 = srem i32 %add.9, 37
store i32 %rem.9, ptr %arrayidx20.10, align 16, !tbaa !5
%add.10 = add nsw i32 %sub, %rem.9
%rem.10 = srem i32 %add.10, 37
store i32 %rem.10, ptr %arrayidx20.11, align 4, !tbaa !5
%add.11 = add nsw i32 %sub, %rem.10
%rem.11 = srem i32 %add.11, 37
store i32 %rem.11, ptr %arrayidx20.12, align 8, !tbaa !5
%add.12 = add nsw i32 %sub, %rem.11
%rem.12 = srem i32 %add.12, 37
store i32 %rem.12, ptr %arrayidx20.13, align 4, !tbaa !5
%add.13 = add nsw i32 %sub, %rem.12
%rem.13 = srem i32 %add.13, 37
store i32 %rem.13, ptr %arrayidx20.14, align 16, !tbaa !5
%add.14 = add nsw i32 %sub, %rem.13
%rem.14 = srem i32 %add.14, 37
store i32 %rem.14, ptr %arrayidx20.15, align 4, !tbaa !5
%add.15 = add nsw i32 %sub, %rem.14
%rem.15 = srem i32 %add.15, 37
store i32 %rem.15, ptr %arrayidx20.16, align 8, !tbaa !5
%add.16 = add nsw i32 %sub, %rem.15
%rem.16 = srem i32 %add.16, 37
store i32 %rem.16, ptr %arrayidx20.17, align 4, !tbaa !5
%add.17 = add nsw i32 %sub, %rem.16
%rem.17 = srem i32 %add.17, 37
store i32 %rem.17, ptr %arrayidx20.18, align 16, !tbaa !5
%add.18 = add nsw i32 %sub, %rem.17
%rem.18 = srem i32 %add.18, 37
store i32 %rem.18, ptr %arrayidx20.19, align 4, !tbaa !5
%add.19 = add nsw i32 %sub, %rem.18
%rem.19 = srem i32 %add.19, 37
store i32 %rem.19, ptr %arrayidx20.20, align 8, !tbaa !5
%add.20 = add nsw i32 %sub, %rem.19
%rem.20 = srem i32 %add.20, 37
store i32 %rem.20, ptr %arrayidx20.21, align 4, !tbaa !5
%add.21 = add nsw i32 %sub, %rem.20
%rem.21 = srem i32 %add.21, 37
store i32 %rem.21, ptr %arrayidx20.22, align 16, !tbaa !5
%add.22 = add nsw i32 %sub, %rem.21
%rem.22 = srem i32 %add.22, 37
store i32 %rem.22, ptr %arrayidx20.23, align 4, !tbaa !5
%add.23 = add nsw i32 %sub, %rem.22
%rem.23 = srem i32 %add.23, 37
store i32 %rem.23, ptr %arrayidx20.24, align 8, !tbaa !5
%add.24 = add nsw i32 %sub, %rem.23
%rem.24 = srem i32 %add.24, 37
store i32 %rem.24, ptr %arrayidx20.25, align 4, !tbaa !5
%add.25 = add nsw i32 %sub, %rem.24
%rem.25 = srem i32 %add.25, 37
store i32 %rem.25, ptr %arrayidx20.26, align 16, !tbaa !5
%add.26 = add nsw i32 %sub, %rem.25
%rem.26 = srem i32 %add.26, 37
store i32 %rem.26, ptr %arrayidx20.27, align 4, !tbaa !5
%add.27 = add nsw i32 %sub, %rem.26
%rem.27 = srem i32 %add.27, 37
store i32 %rem.27, ptr %arrayidx20.28, align 8, !tbaa !5
%add.28 = add nsw i32 %sub, %rem.27
%rem.28 = srem i32 %add.28, 37
store i32 %rem.28, ptr %arrayidx20.29, align 4, !tbaa !5
%add.29 = add nsw i32 %sub, %rem.28
%rem.29 = srem i32 %add.29, 37
store i32 %rem.29, ptr %arrayidx20.30, align 16, !tbaa !5
%add.30 = add nsw i32 %sub, %rem.29
%rem.30 = srem i32 %add.30, 37
store i32 %rem.30, ptr %arrayidx20.31, align 4, !tbaa !5
%add.31 = add nsw i32 %sub, %rem.30
%rem.31 = srem i32 %add.31, 37
store i32 %rem.31, ptr %arrayidx20.32, align 8, !tbaa !5
%add.32 = add nsw i32 %sub, %rem.31
%rem.32 = srem i32 %add.32, 37
store i32 %rem.32, ptr %arrayidx20.33, align 4, !tbaa !5
%add.33 = add nsw i32 %sub, %rem.32
%rem.33 = srem i32 %add.33, 37
store i32 %rem.33, ptr %arrayidx20.34, align 16, !tbaa !5
%add.34 = add nsw i32 %sub, %rem.33
%rem.34 = srem i32 %add.34, 37
store i32 %rem.34, ptr %arrayidx20.35, align 4, !tbaa !5
%add.35 = add nsw i32 %sub, %rem.34
%rem.35 = srem i32 %add.35, 37
store i32 %rem.35, ptr %arrayidx20.36, align 8, !tbaa !5
%11 = sext i32 %pp.0130 to i64
%12 = add i32 %pp.0130, 37
br label %for.body30.peel.next
for.body30.peel.next: ; preds = %for.inc56, %for.cond16.preheader
%indvars.iv144 = phi i64 [ %11, %for.cond16.preheader ], [ %indvars.iv.next145, %for.inc56 ]
%indvars.iv.next145 = add nsw i64 %indvars.iv144, 1
%arrayidx35 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv.next145, i64 1
store i32 %i.1129, ptr %arrayidx35, align 4, !tbaa !5
br label %for.inc53
for.inc53: ; preds = %for.body30.peel.next, %for.inc53
%indvars.iv139 = phi i64 [ 2, %for.body30.peel.next ], [ %indvars.iv.next140, %for.inc53 ]
%arrayidx39 = getelementptr inbounds [64 x i32], ptr %pa, i64 0, i64 %indvars.iv139
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%add40 = add nsw i32 %13, 2
%idxprom41 = sext i32 %add40 to i64
%arrayidx42 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv139, i64 %idxprom41
%14 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%arrayidx46 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv.next145, i64 %indvars.iv139
store i32 %14, ptr %arrayidx46, align 4, !tbaa !5
%inc49 = add nsw i32 %13, 1
%rem52 = srem i32 %inc49, 37
store i32 %rem52, ptr %arrayidx39, align 4, !tbaa !5
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next140, 39
br i1 %exitcond142.not, label %for.inc56, label %for.inc53, !llvm.loop !11
for.inc56: ; preds = %for.inc53
%lftr.wideiv = trunc i64 %indvars.iv.next145 to i32
%exitcond147.not = icmp eq i32 %12, %lftr.wideiv
br i1 %exitcond147.not, label %for.inc59, label %for.body30.peel.next, !llvm.loop !13
for.inc59: ; preds = %for.inc56
%inc60 = add nuw nsw i32 %i.1129, 1
%exitcond148.not = icmp eq i32 %inc60, 39
br i1 %exitcond148.not, label %for.cond65.preheader, label %for.cond16.preheader, !llvm.loop !14
for.cond65.preheader: ; preds = %for.inc59, %for.cond65.preheader
%indvars.iv153 = phi i64 [ %indvars.iv.next154, %for.cond65.preheader ], [ 1, %for.inc59 ]
%arrayidx71159 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 1
%15 = load i32, ptr %arrayidx71159, align 4, !tbaa !5
%call72160 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%putchar119 = tail call i32 @putchar(i32 32)
%arrayidx71 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 2
%16 = load i32, ptr %arrayidx71, align 8, !tbaa !5
%call72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
%putchar119.1 = tail call i32 @putchar(i32 32)
%arrayidx71.1 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 3
%17 = load i32, ptr %arrayidx71.1, align 4, !tbaa !5
%call72.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
%putchar119.2 = tail call i32 @putchar(i32 32)
%arrayidx71.2 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 4
%18 = load i32, ptr %arrayidx71.2, align 16, !tbaa !5
%call72.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%putchar119.3 = tail call i32 @putchar(i32 32)
%arrayidx71.3 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 5
%19 = load i32, ptr %arrayidx71.3, align 4, !tbaa !5
%call72.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
%putchar119.4 = tail call i32 @putchar(i32 32)
%arrayidx71.4 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 6
%20 = load i32, ptr %arrayidx71.4, align 8, !tbaa !5
%call72.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20)
%putchar119.5 = tail call i32 @putchar(i32 32)
%arrayidx71.5 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 7
%21 = load i32, ptr %arrayidx71.5, align 4, !tbaa !5
%call72.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
%putchar119.6 = tail call i32 @putchar(i32 32)
%arrayidx71.6 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 8
%22 = load i32, ptr %arrayidx71.6, align 16, !tbaa !5
%call72.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
%putchar119.7 = tail call i32 @putchar(i32 32)
%arrayidx71.7 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 9
%23 = load i32, ptr %arrayidx71.7, align 4, !tbaa !5
%call72.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %23)
%putchar119.8 = tail call i32 @putchar(i32 32)
%arrayidx71.8 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 10
%24 = load i32, ptr %arrayidx71.8, align 8, !tbaa !5
%call72.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24)
%putchar119.9 = tail call i32 @putchar(i32 32)
%arrayidx71.9 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 11
%25 = load i32, ptr %arrayidx71.9, align 4, !tbaa !5
%call72.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %25)
%putchar119.10 = tail call i32 @putchar(i32 32)
%arrayidx71.10 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 12
%26 = load i32, ptr %arrayidx71.10, align 16, !tbaa !5
%call72.10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %26)
%putchar119.11 = tail call i32 @putchar(i32 32)
%arrayidx71.11 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 13
%27 = load i32, ptr %arrayidx71.11, align 4, !tbaa !5
%call72.11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %27)
%putchar119.12 = tail call i32 @putchar(i32 32)
%arrayidx71.12 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 14
%28 = load i32, ptr %arrayidx71.12, align 8, !tbaa !5
%call72.12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28)
%putchar119.13 = tail call i32 @putchar(i32 32)
%arrayidx71.13 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 15
%29 = load i32, ptr %arrayidx71.13, align 4, !tbaa !5
%call72.13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %29)
%putchar119.14 = tail call i32 @putchar(i32 32)
%arrayidx71.14 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 16
%30 = load i32, ptr %arrayidx71.14, align 16, !tbaa !5
%call72.14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %30)
%putchar119.15 = tail call i32 @putchar(i32 32)
%arrayidx71.15 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 17
%31 = load i32, ptr %arrayidx71.15, align 4, !tbaa !5
%call72.15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %31)
%putchar119.16 = tail call i32 @putchar(i32 32)
%arrayidx71.16 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 18
%32 = load i32, ptr %arrayidx71.16, align 8, !tbaa !5
%call72.16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %32)
%putchar119.17 = tail call i32 @putchar(i32 32)
%arrayidx71.17 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 19
%33 = load i32, ptr %arrayidx71.17, align 4, !tbaa !5
%call72.17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33)
%putchar119.18 = tail call i32 @putchar(i32 32)
%arrayidx71.18 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 20
%34 = load i32, ptr %arrayidx71.18, align 16, !tbaa !5
%call72.18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
%putchar119.19 = tail call i32 @putchar(i32 32)
%arrayidx71.19 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 21
%35 = load i32, ptr %arrayidx71.19, align 4, !tbaa !5
%call72.19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
%putchar119.20 = tail call i32 @putchar(i32 32)
%arrayidx71.20 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 22
%36 = load i32, ptr %arrayidx71.20, align 8, !tbaa !5
%call72.20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %36)
%putchar119.21 = tail call i32 @putchar(i32 32)
%arrayidx71.21 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 23
%37 = load i32, ptr %arrayidx71.21, align 4, !tbaa !5
%call72.21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %37)
%putchar119.22 = tail call i32 @putchar(i32 32)
%arrayidx71.22 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 24
%38 = load i32, ptr %arrayidx71.22, align 16, !tbaa !5
%call72.22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %38)
%putchar119.23 = tail call i32 @putchar(i32 32)
%arrayidx71.23 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 25
%39 = load i32, ptr %arrayidx71.23, align 4, !tbaa !5
%call72.23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %39)
%putchar119.24 = tail call i32 @putchar(i32 32)
%arrayidx71.24 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 26
%40 = load i32, ptr %arrayidx71.24, align 8, !tbaa !5
%call72.24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %40)
%putchar119.25 = tail call i32 @putchar(i32 32)
%arrayidx71.25 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 27
%41 = load i32, ptr %arrayidx71.25, align 4, !tbaa !5
%call72.25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %41)
%putchar119.26 = tail call i32 @putchar(i32 32)
%arrayidx71.26 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 28
%42 = load i32, ptr %arrayidx71.26, align 16, !tbaa !5
%call72.26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %42)
%putchar119.27 = tail call i32 @putchar(i32 32)
%arrayidx71.27 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 29
%43 = load i32, ptr %arrayidx71.27, align 4, !tbaa !5
%call72.27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %43)
%putchar119.28 = tail call i32 @putchar(i32 32)
%arrayidx71.28 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 30
%44 = load i32, ptr %arrayidx71.28, align 8, !tbaa !5
%call72.28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %44)
%putchar119.29 = tail call i32 @putchar(i32 32)
%arrayidx71.29 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 31
%45 = load i32, ptr %arrayidx71.29, align 4, !tbaa !5
%call72.29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %45)
%putchar119.30 = tail call i32 @putchar(i32 32)
%arrayidx71.30 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 32
%46 = load i32, ptr %arrayidx71.30, align 16, !tbaa !5
%call72.30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %46)
%putchar119.31 = tail call i32 @putchar(i32 32)
%arrayidx71.31 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 33
%47 = load i32, ptr %arrayidx71.31, align 4, !tbaa !5
%call72.31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %47)
%putchar119.32 = tail call i32 @putchar(i32 32)
%arrayidx71.32 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 34
%48 = load i32, ptr %arrayidx71.32, align 8, !tbaa !5
%call72.32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %48)
%putchar119.33 = tail call i32 @putchar(i32 32)
%arrayidx71.33 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 35
%49 = load i32, ptr %arrayidx71.33, align 4, !tbaa !5
%call72.33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %49)
%putchar119.34 = tail call i32 @putchar(i32 32)
%arrayidx71.34 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 36
%50 = load i32, ptr %arrayidx71.34, align 16, !tbaa !5
%call72.34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %50)
%putchar119.35 = tail call i32 @putchar(i32 32)
%arrayidx71.35 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 37
%51 = load i32, ptr %arrayidx71.35, align 4, !tbaa !5
%call72.35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %51)
%putchar119.36 = tail call i32 @putchar(i32 32)
%arrayidx71.36 = getelementptr inbounds [2048 x [64 x i32]], ptr %mk, i64 0, i64 %indvars.iv153, i64 38
%52 = load i32, ptr %arrayidx71.36, align 8, !tbaa !5
%call72.36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %52)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
%exitcond156.not = icmp eq i64 %indvars.iv.next154, 1408
br i1 %exitcond156.not, label %for.end83, label %for.cond65.preheader, !llvm.loop !15
for.end83: ; preds = %for.cond65.preheader
call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %pa) #5
call void @llvm.lifetime.end.p0(i64 524288, ptr nonnull %mk) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main()
{
int T;
int n;
int i;
int a, b, c;
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
for (i=0; i<n; i+=2) {
scanf("%d %d", &a, &b);
c = a*b;
if (i!=0) printf(" ");
printf("%d %d", -c / a, c / b);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10441/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10441/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !5
%dec15 = add nsw i32 %0, -1
store i32 %dec15, ptr %T, align 4, !tbaa !5
%tobool.not16 = icmp eq i32 %0, 0
br i1 %tobool.not16, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %1, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %while.body
%call2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %a, align 4, !tbaa !5
%div.peel = sub nsw i32 0, %2
%call6.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div.peel, i32 noundef %3)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %4, 2
br i1 %cmp.peel, label %if.end, label %for.end
if.end: ; preds = %if.end.peel, %if.end
%i.014 = phi i32 [ %add, %if.end ], [ 2, %if.end.peel ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%5 = load i32, ptr %a, align 4, !tbaa !5
%6 = load i32, ptr %b, align 4, !tbaa !5
%mul = mul nsw i32 %6, %5
%putchar11 = call i32 @putchar(i32 32)
%.pre18 = load i32, ptr %b, align 4, !tbaa !5
%.pre = load i32, ptr %a, align 4, !tbaa !5
%div12 = sdiv i32 %mul, %.pre
%div = sub nsw i32 0, %div12
%div5 = sdiv i32 %mul, %.pre18
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div5)
%add = add nuw nsw i32 %i.014, 2
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %7
br i1 %cmp, label %if.end, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %while.body
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %T, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %T, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int n,a[100000],i;
scanf("%d",&n);
for(i=0; i<n; i++)
scanf("%d",&a[i]);
for(i=0; i<n-1; i++)
if(a[i]<=a[i+1])
{
if(a[i]<a[i+1])
a[i+1]--;
}
else if(a[i]>a[i+1])
{
printf("No\n");
return 0;
}
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%a = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400000, 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
%cmp49 = icmp sgt i32 %0, 0
br i1 %cmp49, label %for.body, label %cleanup
for.cond2.preheader: ; preds = %for.body
%cmp351 = icmp sgt i32 %1, 1
br i1 %cmp351, label %for.body4.preheader, label %cleanup
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %1, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i32, ptr %a, align 16, !tbaa !5
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 %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc30
%3 = phi i32 [ %.pre, %for.body4.preheader ], [ %5, %for.inc30 ]
%indvars.iv55 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next56, %for.inc30 ]
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next56
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp sgt i32 %3, %4
br i1 %cmp9.not, label %cleanup, label %if.then
if.then: ; preds = %for.body4
%cmp15 = icmp slt i32 %3, %4
br i1 %cmp15, label %if.then16, label %for.inc30
if.then16: ; preds = %if.then
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %arrayidx8, align 4, !tbaa !5
br label %for.inc30
for.inc30: ; preds = %if.then16, %if.then
%5 = phi i32 [ %dec, %if.then16 ], [ %4, %if.then ]
%exitcond.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body4, !llvm.loop !11
cleanup: ; preds = %for.inc30, %for.body4, %for.cond2.preheader, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.cond2.preheader ], [ @str.3, %for.body4 ], [ @str, %for.inc30 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int i;
int N;
scanf("%d", &N);
int H[N];
for(i=0; i<N; i++)
scanf("%d", &H[i]);
for(i=N-2; i>=0; i--){
if(H[i] == H[i+1]+1)
H[i]--;
else if(H[i] > H[i+1]+1)
break;
}
if(i == -1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104497/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104497/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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
%cmp45 = icmp sgt i32 %3, 0
br i1 %cmp45, label %for.body, label %if.else28
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%sub = add i32 %4, -2
%cmp347 = icmp sgt i32 %4, 1
br i1 %cmp347, label %for.body4.preheader, label %for.end24
for.body4.preheader: ; preds = %for.end
%6 = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 1
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %for.inc22
%indvars.iv52 = phi i64 [ %6, %for.body4.preheader ], [ %indvars.iv.next53, %for.inc22 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv52
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv52
%8 = load i32, ptr %gep, align 4, !tbaa !5
%add9 = add nsw i32 %8, 1
%cmp10 = icmp eq i32 %7, %add9
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %for.body4
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %arrayidx6, align 4, !tbaa !5
br label %for.inc22
if.else: ; preds = %for.body4
%cmp19 = icmp sgt i32 %7, %add9
br i1 %cmp19, label %if.else28, label %for.inc22
for.inc22: ; preds = %if.then, %if.else
%indvars.iv.next53 = add nsw i64 %indvars.iv52, -1
%cmp3 = icmp sgt i64 %indvars.iv52, 0
br i1 %cmp3, label %for.body4, label %if.end30, !llvm.loop !11
for.end24: ; preds = %for.end
%cmp25 = icmp eq i32 %sub, -1
br i1 %cmp25, label %if.end30, label %if.else28
if.else28: ; preds = %if.else, %entry, %for.end24
br label %if.end30
if.end30: ; preds = %for.inc22, %for.end24, %if.else28
%str.sink = phi ptr [ @str, %if.else28 ], [ @str.3, %for.end24 ], [ @str.3, %for.inc22 ]
%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<stdlib.h>
int main()
{
int text,n,i;
int a[1000];
int b[1000];
scanf("%d",&text);
while(text--){
scanf("%d",&n);
for(i=0;i<n/2;++i)
scanf("%d",&a[i]);
for(i=0;i<n/2;++i){
scanf("%d",&b[i]);
b[i]=-b[i];
}
for(i=0;i<n/2;++i)
printf("%d ",b[i]);
for(i=0;i<n/2;++i)
printf("%d ",a[i]);
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10454/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10454/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%text = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [1000 x i32], align 16
%b = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %text) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %text)
%0 = load i32, ptr %text, align 4, !tbaa !5
%dec63 = add nsw i32 %0, -1
store i32 %dec63, ptr %text, align 4, !tbaa !5
%tobool.not64 = icmp eq i32 %0, 0
br i1 %tobool.not64, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end36
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %1, 1
br i1 %cmp52, label %for.body, label %for.end36
for.cond3.preheader: ; preds = %for.body
%cmp555 = icmp sgt i32 %2, 1
br i1 %cmp555, label %for.body6, label %for.end36
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %2, 2
%3 = sext i32 %div to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond17.preheader: ; preds = %for.body6
%cmp1958 = icmp sgt i32 %5, 1
br i1 %cmp1958, label %for.body20, label %for.end36
for.body6: ; preds = %for.cond3.preheader, %for.body6
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body6 ], [ 0, %for.cond3.preheader ]
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv66
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%sub = sub nsw i32 0, %4
store i32 %sub, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%div4 = sdiv i32 %5, 2
%6 = sext i32 %div4 to i64
%cmp5 = icmp slt i64 %indvars.iv.next67, %6
br i1 %cmp5, label %for.body6, label %for.cond17.preheader, !llvm.loop !11
for.cond27.preheader: ; preds = %for.body20
%cmp2961 = icmp sgt i32 %8, 1
br i1 %cmp2961, label %for.body30, label %for.end36
for.body20: ; preds = %for.cond17.preheader, %for.body20
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body20 ], [ 0, %for.cond17.preheader ]
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv69
%7 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%div18 = sdiv i32 %8, 2
%9 = sext i32 %div18 to i64
%cmp19 = icmp slt i64 %indvars.iv.next70, %9
br i1 %cmp19, label %for.body20, label %for.cond27.preheader, !llvm.loop !12
for.body30: ; preds = %for.cond27.preheader, %for.body30
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body30 ], [ 0, %for.cond27.preheader ]
%arrayidx32 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv72
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%div28 = sdiv i32 %11, 2
%12 = sext i32 %div28 to i64
%cmp29 = icmp slt i64 %indvars.iv.next73, %12
br i1 %cmp29, label %for.body30, label %for.end36, !llvm.loop !13
for.end36: ; preds = %for.body30, %while.body, %for.cond3.preheader, %for.cond17.preheader, %for.cond27.preheader
%putchar = call i32 @putchar(i32 10)
%13 = load i32, ptr %text, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %text, align 4, !tbaa !5
%tobool.not = icmp eq i32 %13, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %for.end36, %entry
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %text) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
char c;
scanf("%c", &c);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') printf("vowel\n");
else printf("consonant\n");
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104583/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104583/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@stdout = external local_unnamed_addr global ptr, align 8
@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)
%5 = load ptr, ptr @stdout, align 8, !tbaa !5
%call19 = call i32 @fflush(ptr noundef %5)
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: 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
; 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
char c;
scanf("%c",&c);
if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
printf("vowel");
}else{
printf("consonant");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104626/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104626/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%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
%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 ]
%call18 = 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)"}
|
#include <stdio.h>
int n, k, c;
long long int d=1;
int gcd(int a, int b) {
if(a==0 || b==0) return a+b;
if(a>b) return gcd(a%b, b);
else return gcd(a, b%a);
}
int lcm(long long int a, long long int b) {
return a*b/gcd(a, b);
}
int main() {
scanf("%d %d", &n, &k);
for(int i=0;i<n;i++) {
scanf("%d", &c);
d=lcm(d, gcd(c, k));
if(d>k) break;
}
if(d==k) puts("Yes");
else puts("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10467/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@d = dso_local local_unnamed_addr global i64 1, align 8
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@k = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@c = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cmp28 = icmp eq i32 %a, 0
%cmp11729 = icmp eq i32 %b, 0
%or.cond1830 = or i1 %cmp28, %cmp11729
br i1 %or.cond1830, label %if.then, label %if.end.preheader
if.end.preheader: ; preds = %entry, %if.then3
%b.tr.ph32 = phi i32 [ %b.tr19, %if.then3 ], [ %b, %entry ]
%a.tr.ph31 = phi i32 [ %rem, %if.then3 ], [ %a, %entry ]
br label %if.end
if.then: ; preds = %if.then3, %if.else, %entry
%a.tr.ph.lcssa = phi i32 [ %a, %entry ], [ %a.tr.ph31, %if.else ], [ %rem, %if.then3 ]
%b.tr.lcssa = phi i32 [ %b, %entry ], [ 0, %if.else ], [ %b.tr19, %if.then3 ]
%add = add nsw i32 %b.tr.lcssa, %a.tr.ph.lcssa
ret i32 %add
if.end: ; preds = %if.end.preheader, %if.else
%b.tr19 = phi i32 [ %rem4, %if.else ], [ %b.tr.ph32, %if.end.preheader ]
%cmp2 = icmp sgt i32 %a.tr.ph31, %b.tr19
br i1 %cmp2, label %if.then3, label %if.else
if.then3: ; preds = %if.end
%rem = srem i32 %a.tr.ph31, %b.tr19
%cmp = icmp eq i32 %rem, 0
%cmp117 = icmp eq i32 %b.tr19, 0
%or.cond18 = or i1 %cmp, %cmp117
br i1 %or.cond18, label %if.then, label %if.end.preheader
if.else: ; preds = %if.end
%rem4 = srem i32 %b.tr19, %a.tr.ph31
%cmp1 = icmp eq i32 %rem4, 0
br i1 %cmp1, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%conv = trunc i64 %a to i32
%conv1 = trunc i64 %b to i32
%cmp28.i = icmp eq i32 %conv, 0
%cmp11729.i = icmp eq i32 %conv1, 0
%or.cond1830.i = or i1 %cmp28.i, %cmp11729.i
br i1 %or.cond1830.i, label %gcd.exit, label %if.end.preheader.i
if.end.preheader.i: ; preds = %entry, %if.then3.i
%b.tr.ph32.i = phi i32 [ %b.tr19.i, %if.then3.i ], [ %conv1, %entry ]
%a.tr.ph31.i = phi i32 [ %rem.i, %if.then3.i ], [ %conv, %entry ]
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.end.preheader.i
%b.tr19.i = phi i32 [ %rem4.i, %if.else.i ], [ %b.tr.ph32.i, %if.end.preheader.i ]
%cmp2.i = icmp sgt i32 %a.tr.ph31.i, %b.tr19.i
br i1 %cmp2.i, label %if.then3.i, label %if.else.i
if.then3.i: ; preds = %if.end.i
%rem.i = srem i32 %a.tr.ph31.i, %b.tr19.i
%cmp.i = icmp eq i32 %rem.i, 0
%cmp117.i = icmp eq i32 %b.tr19.i, 0
%or.cond18.i = or i1 %cmp117.i, %cmp.i
br i1 %or.cond18.i, label %gcd.exit, label %if.end.preheader.i
if.else.i: ; preds = %if.end.i
%rem4.i = srem i32 %b.tr19.i, %a.tr.ph31.i
%cmp1.i = icmp eq i32 %rem4.i, 0
br i1 %cmp1.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.then3.i, %if.else.i, %entry
%a.tr.ph.lcssa.i = phi i32 [ %conv, %entry ], [ %a.tr.ph31.i, %if.else.i ], [ %rem.i, %if.then3.i ]
%b.tr.lcssa.i = phi i32 [ %conv1, %entry ], [ 0, %if.else.i ], [ %b.tr19.i, %if.then3.i ]
%mul = mul nsw i64 %b, %a
%add.i = add nsw i32 %b.tr.lcssa.i, %a.tr.ph.lcssa.i
%conv2 = sext i32 %add.i to i64
%div = sdiv i64 %mul, %conv2
%conv3 = trunc i64 %div to i32
ret i32 %conv3
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %entry.cleanup_crit_edge
entry.cleanup_crit_edge: ; preds = %entry
%.pre = load i64, ptr @d, align 8, !tbaa !9
%.pre30 = load i32, ptr @k, align 4, !tbaa !5
br label %cleanup
for.cond: ; preds = %lcm.exit
%inc = add nuw nsw i32 %i.023, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %1
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !11
for.body: ; preds = %entry, %for.cond
%i.023 = phi i32 [ %inc, %for.cond ], [ 0, %entry ]
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @c)
%2 = load i64, ptr @d, align 8, !tbaa !9
%3 = load i32, ptr @c, align 4, !tbaa !5
%4 = load i32, ptr @k, align 4, !tbaa !5
%cmp28.i = icmp eq i32 %3, 0
%cmp11729.i = icmp eq i32 %4, 0
%or.cond1830.i = or i1 %cmp28.i, %cmp11729.i
br i1 %or.cond1830.i, label %gcd.exit, label %if.end.preheader.i
if.end.preheader.i: ; preds = %for.body, %if.then3.i
%b.tr.ph32.i = phi i32 [ %b.tr19.i, %if.then3.i ], [ %4, %for.body ]
%a.tr.ph31.i = phi i32 [ %rem.i, %if.then3.i ], [ %3, %for.body ]
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.end.preheader.i
%b.tr19.i = phi i32 [ %rem4.i, %if.else.i ], [ %b.tr.ph32.i, %if.end.preheader.i ]
%cmp2.i = icmp sgt i32 %a.tr.ph31.i, %b.tr19.i
br i1 %cmp2.i, label %if.then3.i, label %if.else.i
if.then3.i: ; preds = %if.end.i
%rem.i = srem i32 %a.tr.ph31.i, %b.tr19.i
%cmp.i = icmp eq i32 %rem.i, 0
%cmp117.i = icmp eq i32 %b.tr19.i, 0
%or.cond18.i = or i1 %cmp117.i, %cmp.i
br i1 %or.cond18.i, label %gcd.exit, label %if.end.preheader.i
if.else.i: ; preds = %if.end.i
%rem4.i = srem i32 %b.tr19.i, %a.tr.ph31.i
%cmp1.i = icmp eq i32 %rem4.i, 0
br i1 %cmp1.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.then3.i, %if.else.i, %for.body
%a.tr.ph.lcssa.i = phi i32 [ %3, %for.body ], [ %a.tr.ph31.i, %if.else.i ], [ %rem.i, %if.then3.i ]
%b.tr.lcssa.i = phi i32 [ %4, %for.body ], [ 0, %if.else.i ], [ %b.tr19.i, %if.then3.i ]
%add.i = add nsw i32 %b.tr.lcssa.i, %a.tr.ph.lcssa.i
%conv = sext i32 %add.i to i64
%conv.i = trunc i64 %2 to i32
%cmp28.i.i = icmp eq i32 %conv.i, 0
%cmp11729.i.i = icmp eq i32 %add.i, 0
%or.cond1830.i.i = or i1 %cmp28.i.i, %cmp11729.i.i
br i1 %or.cond1830.i.i, label %lcm.exit, label %if.end.preheader.i.i
if.end.preheader.i.i: ; preds = %gcd.exit, %if.then3.i.i
%b.tr.ph32.i.i = phi i32 [ %b.tr19.i.i, %if.then3.i.i ], [ %add.i, %gcd.exit ]
%a.tr.ph31.i.i = phi i32 [ %rem.i.i, %if.then3.i.i ], [ %conv.i, %gcd.exit ]
br label %if.end.i.i
if.end.i.i: ; preds = %if.else.i.i, %if.end.preheader.i.i
%b.tr19.i.i = phi i32 [ %rem4.i.i, %if.else.i.i ], [ %b.tr.ph32.i.i, %if.end.preheader.i.i ]
%cmp2.i.i = icmp sgt i32 %a.tr.ph31.i.i, %b.tr19.i.i
br i1 %cmp2.i.i, label %if.then3.i.i, label %if.else.i.i
if.then3.i.i: ; preds = %if.end.i.i
%rem.i.i = srem i32 %a.tr.ph31.i.i, %b.tr19.i.i
%cmp.i.i = icmp eq i32 %rem.i.i, 0
%cmp117.i.i = icmp eq i32 %b.tr19.i.i, 0
%or.cond18.i.i = or i1 %cmp117.i.i, %cmp.i.i
br i1 %or.cond18.i.i, label %lcm.exit, label %if.end.preheader.i.i
if.else.i.i: ; preds = %if.end.i.i
%rem4.i.i = srem i32 %b.tr19.i.i, %a.tr.ph31.i.i
%cmp1.i.i = icmp eq i32 %rem4.i.i, 0
br i1 %cmp1.i.i, label %lcm.exit, label %if.end.i.i
lcm.exit: ; preds = %if.then3.i.i, %if.else.i.i, %gcd.exit
%a.tr.ph.lcssa.i.i = phi i32 [ %conv.i, %gcd.exit ], [ %a.tr.ph31.i.i, %if.else.i.i ], [ %rem.i.i, %if.then3.i.i ]
%b.tr.lcssa.i.i = phi i32 [ %add.i, %gcd.exit ], [ 0, %if.else.i.i ], [ %b.tr19.i.i, %if.then3.i.i ]
%mul.i = mul nsw i64 %2, %conv
%add.i.i = add nsw i32 %b.tr.lcssa.i.i, %a.tr.ph.lcssa.i.i
%conv2.i = sext i32 %add.i.i to i64
%div.i = sdiv i64 %mul.i, %conv2.i
%conv3.i = trunc i64 %div.i to i32
%sext = shl i64 %div.i, 32
%conv4 = ashr exact i64 %sext, 32
store i64 %conv4, ptr @d, align 8, !tbaa !9
%cmp6 = icmp slt i32 %4, %conv3.i
br i1 %cmp6, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %lcm.exit, %entry.cleanup_crit_edge
%5 = phi i32 [ %.pre30, %entry.cleanup_crit_edge ], [ %4, %lcm.exit ], [ %4, %for.cond ]
%6 = phi i64 [ %.pre, %entry.cleanup_crit_edge ], [ %conv4, %lcm.exit ], [ %conv4, %for.cond ]
%conv8 = sext i32 %5 to i64
%cmp9 = icmp eq i64 %6, %conv8
%.str.2..str.3 = select i1 %cmp9, ptr @.str.2, ptr @.str.3
%call13 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
char word;
scanf("%c", &word);
switch(word){
case 'a':
case 'i':
case 'u':
case 'e':
case 'o':printf("vowel");
break;
default:printf("consonant");
break;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104712/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104712/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%word = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %word) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %word)
%0 = load i8, ptr %word, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%1 = add nsw i32 %conv, -97
%2 = call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 31)
%3 = icmp ult i32 %2, 11
br i1 %3, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %entry
%4 = sext i32 %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 %sw.epilog
sw.epilog: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %word) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #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(void){
char c;
scanf("%c",&c);
if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
printf("vowel\n");
}else{
printf("consonant\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104756/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104756/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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()
{
char ch;
scanf("%c",&ch);
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u'){
printf("vowel\n");
}
else {
printf("consonant\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104813/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, 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 %ch) #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()
{
char c;
scanf("%c",&c);
switch(c)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u': printf("vowel");break;
default :
printf("consonant");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%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
%conv = sext i8 %0 to i32
%1 = add nsw i32 %conv, -97
%2 = call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 31)
%3 = icmp ult i32 %2, 11
br i1 %3, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %entry
%4 = sext i32 %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 %sw.epilog
sw.epilog: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call2 = 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 i32 @llvm.fshl.i32(i32, i32, i32) #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() {
char c[5];
scanf("%s",c);
if (c[0] == 'a' || c[0] == 'i' || c[0] == 'u' || c[0] == 'e' || c[0] == 'o') { printf("vowel\n"); }
else { printf("consonant\n"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104907/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [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 [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, 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 5, 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>
#include<math.h>
int main ()
{
int n,a;
scanf("%d",&n);
if(n%2==0)
a=n;
else
a=n*2;
printf("%d\n",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104950/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104950/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%a.0 = shl i32 %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0)
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 i, length=0;
char input[200000];
scanf("%s", &input);
for(i=0; input[i] != '\0'; i++)
length++;
printf("%s", input);
for(i=length-1; i>=0; i--)
printf("%c", input[i]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10500/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10500/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%input = alloca [200000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %input) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i8, ptr %input, align 16, !tbaa !5
%cmp.not19 = icmp eq i8 %0, 0
br i1 %cmp.not19, label %for.end.thread, label %for.body
for.end.thread: ; preds = %entry
%call332 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %input)
br label %for.end13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [200000 x i8], ptr %input, i64 0, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %1, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body
%indvars = trunc i64 %indvars.iv.next to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %input)
%cmp522 = icmp sgt i32 %indvars, 0
br i1 %cmp522, label %for.body7.preheader, label %for.end13
for.body7.preheader: ; preds = %for.end
%2 = and i64 %indvars.iv.next, 4294967295
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv27 = phi i64 [ %2, %for.body7.preheader ], [ %indvars.iv.next28, %for.body7 ]
%indvars.iv.next28 = add nsw i64 %indvars.iv27, -1
%arrayidx9 = getelementptr inbounds [200000 x i8], ptr %input, i64 0, i64 %indvars.iv.next28
%3 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%conv10 = sext i8 %3 to i32
%putchar = call i32 @putchar(i32 %conv10)
%cmp5 = icmp ugt i64 %indvars.iv27, 1
br i1 %cmp5, label %for.body7, label %for.end13, !llvm.loop !10
for.end13: ; preds = %for.body7, %for.end.thread, %for.end
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %input) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
long long int n;
scanf("%lld",&n);
if(n%2==0)
printf("%d",n);
else
printf("%d",2*n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [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 i64, align 8
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
%1 = and i64 %0, 1
%mul.sink = shl i64 %0, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long long", !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_105094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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",n);
}else{
printf("%d\n",n*2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105144/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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)
{
unsigned long ans=0;
unsigned long input=0;
scanf("%lu\n", &input);
if(input%2==0) ans=input;
else ans=2*input;
printf("%lu\n", ans);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105230/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105230/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %input) #3
store i64 0, ptr %input, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i64, ptr %input, align 8, !tbaa !5
%rem = and i64 %0, 1
%ans.0 = shl i64 %0, %rem
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %input) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#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_105274/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105274/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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() {
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_105331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105331/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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){
double w,h,x,y;
scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
printf("%lf %d",w*h/2,x+x==w&&y+y==h);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%lf %d\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 double, align 8
%y = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, 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
%2 = load double, ptr %x, align 8, !tbaa !5
%add = fadd double %2, %2
%cmp = fcmp oeq double %add, %0
%3 = load double, ptr %y, align 8
%add1 = fadd double %3, %3
%cmp2 = fcmp oeq double %add1, %1
%narrow = select i1 %cmp, i1 %cmp2, i1 false
%land.ext = zext i1 %narrow to i32
%mul = fmul double %0, %1
%div = fmul double %mul, 5.000000e-01
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div, i32 noundef %land.ext)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int W,H,x,y;
scanf("%d %d %d %d",&W,&H,&x,&y);
double w,h;
w = (double)W;
h = (double)H;
double ans = w*h/2.0;
int ans_2 = 0;
if(x*2 == W && y*2 == H)
{
ans_2 = 1;
}
printf("%f %d",ans,ans_2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%f %d\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
%1 = load i32, ptr %H, align 4, !tbaa !5
%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
%narrow = select i1 %cmp, i1 %cmp5, i1 false
%ans_2.0 = zext i1 %narrow to i32
%conv = sitofp i32 %0 to double
%conv1 = sitofp i32 %1 to double
%mul = fmul double %conv, %conv1
%div = fmul double %mul, 5.000000e-01
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div, i32 noundef %ans_2.0)
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(void){
long long H,W;
scanf("%lld%lld",&H,&W);
long long x,y;
scanf("%lld%lld",&x,&y);
int ans = 0;
if(x*2 == H && y*2 == W) ans = 1;
printf("%.9lf %d",(double)(H*W)/2,ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105469/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105469/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%.9lf %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i64, align 8
%W = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %W) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i64, ptr %x, align 8, !tbaa !5
%mul = shl nsw i64 %0, 1
%1 = load i64, ptr %H, align 8, !tbaa !5
%cmp = icmp eq i64 %mul, %1
%.pre = load i64, ptr %W, align 8, !tbaa !5
%2 = load i64, ptr %y, align 8
%mul2 = shl nsw i64 %2, 1
%cmp3 = icmp eq i64 %mul2, %.pre
%narrow = select i1 %cmp, i1 %cmp3, i1 false
%ans.0 = zext i1 %narrow to i32
%mul4 = mul nsw i64 %.pre, %1
%conv = sitofp i64 %mul4 to double
%div = fmul double %conv, 5.000000e-01
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #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"}
|
#include<stdio.h>
int main(){
int W, H;
int x, y;
int i, j, k;
double surfW, surfH;
double surfmin;
int sum=0;
scanf("%d %d %d %d", &W, &H, &x, &y);
printf("%lf ", (double)W*(double)H/2.0);
if(x+x==W && y+y==H){
printf("1");
}else{
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%lf \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) #4
call void @llvm.lifetime.start.p0(i64 4, 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, 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
%mul = fmul double %conv, %conv1
%div = fmul double %mul, 5.000000e-01
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
%2 = load i32, ptr %x, align 4, !tbaa !5
%add = shl nsw i32 %2, 1
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp = icmp eq i32 %add, %3
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%4 = load i32, ptr %y, align 4, !tbaa !5
%add4 = shl nsw i32 %4, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp5 = icmp eq i32 %add4, %5
br i1 %cmp5, 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
%.sink = phi i32 [ 48, %if.else ], [ 49, %land.lhs.true ]
%putchar = call i32 @putchar(i32 %.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 4, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
double W,H,x,y;
int ok=0;
scanf("%lf%lf%lf%lf",&W,&H,&x,&y);
if(x==W/2&&y==H/2)ok=1;
printf("%.9lf %d\n",(W*H)/2,ok);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%.9lf %d\0A\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 double, align 8
%y = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %W) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W, ptr noundef nonnull %H, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load double, ptr %x, align 8, !tbaa !5
%1 = load double, ptr %W, align 8, !tbaa !5
%div = fmul double %1, 5.000000e-01
%cmp = fcmp oeq double %0, %div
%.pre = load double, ptr %H, align 8, !tbaa !5
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %entry
%2 = load double, ptr %y, align 8, !tbaa !5
%div1 = fmul double %.pre, 5.000000e-01
%cmp2 = fcmp oeq double %2, %div1
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true, %entry
%ok.0 = phi i32 [ 1, %if.then ], [ 0, %land.lhs.true ], [ 0, %entry ]
%mul = fmul double %1, %.pre
%div3 = fmul double %mul, 5.000000e-01
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div3, i32 noundef %ok.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 1315: Gift from the Goddess of Programming
// 2017.10.4 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(a,b) ((a)>=(b)?(a):(b))
int tm[1002], s[1002];
char in[1002];
int main()
{
int n, i, hh, mm, t, p, max, ans;
char date[10], time[10], e[5];
while (scanf("%d", &n) && n > 0) {
max = 0; memset(in, 0, sizeof(in)), memset(s, 0, sizeof(s));
while (n-- > 0) {
scanf("%s%s%s%d", date, time, e, &p);
hh = atoi(time), mm = atoi(time+3);
t = hh*60 + mm;
if (*e == 'I') tm[p] = t, in[p] = 1;
else {
in[p] = 0;
if (p == 0) {
for (i = 1; i <= max; i++) {
if (in[i]) s[i] += t - MAX(tm[0], tm[i]);
}
} else if (in[0]) s[p] += t - MAX(tm[0], tm[p]);
}
if (p > max) max = p;
}
for (ans = 0, i = 1; i <= max; i++) if (s[i] > ans) ans = s[i];
printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105599/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@in = dso_local local_unnamed_addr global [1002 x i8] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [1002 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%s%s%s%d\00", align 1
@tm = dso_local local_unnamed_addr global [1002 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca i32, align 4
%date = alloca [10 x i8], align 1
%time = alloca [10 x i8], align 1
%e = alloca [5 x 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 %p) #6
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %date) #6
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %time) #6
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %e) #6
%call110 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool111 = icmp ne i32 %call110, 0
%0 = load i32, ptr %n, align 4
%cmp112 = icmp sgt i32 %0, 0
%1 = select i1 %tobool111, i1 %cmp112, i1 false
br i1 %1, label %while.body.lr.ph, label %while.end76
while.body.lr.ph: ; preds = %entry
%add.ptr = getelementptr inbounds i8, ptr %time, i64 3
br label %while.body3.preheader
while.body3.preheader: ; preds = %for.end74, %while.body.lr.ph
%2 = phi i32 [ %0, %while.body.lr.ph ], [ %25, %for.end74 ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1002) @in, i8 0, i64 1002, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4008) @s, i8 0, i64 4008, i1 false)
%dec103 = add nsw i32 %2, -1
store i32 %dec103, ptr %n, align 4, !tbaa !5
br label %while.body3
for.cond60.preheader: ; preds = %if.end55
%cmp61.not106 = icmp slt i32 %spec.select, 1
br i1 %cmp61.not106, label %for.end74, label %for.body63.preheader
for.body63.preheader: ; preds = %for.cond60.preheader
%3 = add nuw i32 %spec.select, 1
%wide.trip.count117 = zext i32 %3 to i64
%4 = add nsw i64 %wide.trip.count117, -1
%min.iters.check = icmp ult i32 %spec.select, 8
br i1 %min.iters.check, label %for.body63.preheader121, label %vector.ph
vector.ph: ; preds = %for.body63.preheader
%n.vec = and i64 %4, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi119 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%offset.idx = or i64 %index, 1
%5 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load120 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
%8 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load120, <4 x i32> %vec.phi119)
%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
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %7, <4 x i32> %8)
%10 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end74, label %for.body63.preheader121
for.body63.preheader121: ; preds = %for.body63.preheader, %middle.block
%indvars.iv114.ph = phi i64 [ 1, %for.body63.preheader ], [ %ind.end, %middle.block ]
%ans.0108.ph = phi i32 [ 0, %for.body63.preheader ], [ %10, %middle.block ]
br label %for.body63
while.body3: ; preds = %while.body3.preheader, %if.end55
%max.0105 = phi i32 [ %spec.select, %if.end55 ], [ 0, %while.body3.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %date, ptr noundef nonnull %time, ptr noundef nonnull %e, ptr noundef nonnull %p)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %time, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%call.i99 = call i64 @strtol(ptr nocapture noundef nonnull %add.ptr, ptr noundef null, i32 noundef 10) #6
%conv.i100 = trunc i64 %call.i99 to i32
%mul = mul nsw i32 %conv.i, 60
%add = add nsw i32 %mul, %conv.i100
%11 = load i8, ptr %e, align 1, !tbaa !13
%cmp12 = icmp eq i8 %11, 73
%12 = load i32, ptr %p, align 4, !tbaa !5
%idxprom = sext i32 %12 to i64
br i1 %cmp12, label %if.then, label %if.else
if.then: ; preds = %while.body3
%arrayidx = getelementptr inbounds [1002 x i32], ptr @tm, i64 0, i64 %idxprom
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%arrayidx15 = getelementptr inbounds [1002 x i8], ptr @in, i64 0, i64 %idxprom
store i8 1, ptr %arrayidx15, align 1, !tbaa !13
br label %if.end55
if.else: ; preds = %while.body3
%arrayidx17 = getelementptr inbounds [1002 x i8], ptr @in, i64 0, i64 %idxprom
store i8 0, ptr %arrayidx17, align 1, !tbaa !13
%cmp18 = icmp eq i32 %12, 0
br i1 %cmp18, label %for.cond.preheader, label %if.else36
for.cond.preheader: ; preds = %if.else
%cmp21.not101 = icmp slt i32 %max.0105, 1
br i1 %cmp21.not101, label %if.end55, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond.preheader
%13 = load i32, ptr @tm, align 16
%14 = add nuw i32 %max.0105, 1
%wide.trip.count = zext i32 %14 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%arrayidx24 = getelementptr inbounds [1002 x i8], ptr @in, i64 0, i64 %indvars.iv
%15 = load i8, ptr %arrayidx24, align 1, !tbaa !13
%tobool25.not = icmp eq i8 %15, 0
br i1 %tobool25.not, label %for.inc, label %if.then26
if.then26: ; preds = %for.body
%arrayidx28 = getelementptr inbounds [1002 x i32], ptr @tm, i64 0, i64 %indvars.iv
%16 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %13, i32 %16)
%sub = sub i32 %add, %.
%arrayidx34 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv
%17 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%add35 = add nsw i32 %sub, %17
store i32 %add35, ptr %arrayidx34, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then26
%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.end55, label %for.body, !llvm.loop !14
if.else36: ; preds = %if.else
%18 = load i8, ptr @in, align 16, !tbaa !13
%tobool37.not = icmp eq i8 %18, 0
br i1 %tobool37.not, label %if.end55, label %if.then38
if.then38: ; preds = %if.else36
%19 = load i32, ptr @tm, align 16, !tbaa !5
%arrayidx40 = getelementptr inbounds [1002 x i32], ptr @tm, i64 0, i64 %idxprom
%20 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%.97 = call i32 @llvm.smax.i32(i32 %19, i32 %20)
%sub49 = sub i32 %add, %.97
%arrayidx51 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %idxprom
%21 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%add52 = add nsw i32 %sub49, %21
store i32 %add52, ptr %arrayidx51, align 4, !tbaa !5
br label %if.end55
if.end55: ; preds = %for.inc, %for.cond.preheader, %if.then38, %if.else36, %if.then
%22 = phi i32 [ 0, %for.cond.preheader ], [ %12, %if.then38 ], [ %12, %if.else36 ], [ %12, %if.then ], [ 0, %for.inc ]
%spec.select = call i32 @llvm.smax.i32(i32 %22, i32 %max.0105)
%23 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %23, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %23, 0
br i1 %cmp2, label %while.body3, label %for.cond60.preheader, !llvm.loop !15
for.body63: ; preds = %for.body63.preheader121, %for.body63
%indvars.iv114 = phi i64 [ %indvars.iv.next115, %for.body63 ], [ %indvars.iv114.ph, %for.body63.preheader121 ]
%ans.0108 = phi i32 [ %spec.select98, %for.body63 ], [ %ans.0108.ph, %for.body63.preheader121 ]
%arrayidx65 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv114
%24 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%spec.select98 = call i32 @llvm.smax.i32(i32 %24, i32 %ans.0108)
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
br i1 %exitcond118.not, label %for.end74, label %for.body63, !llvm.loop !16
for.end74: ; preds = %for.body63, %middle.block, %for.cond60.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond60.preheader ], [ %10, %middle.block ], [ %spec.select98, %for.body63 ]
%call75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp ne i32 %call, 0
%25 = load i32, ptr %n, align 4
%cmp = icmp sgt i32 %25, 0
%26 = select i1 %tobool, i1 %cmp, i1 false
br i1 %26, label %while.body3.preheader, label %while.end76, !llvm.loop !17
while.end76: ; preds = %for.end74, %entry
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %e) #6
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %time) #6
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %date) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #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 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<assert.h>
typedef long long ll;
typedef unsigned long long ull;
int main()
{
int n, cnt, mcnt = 0;
scanf("%d", &n);
int* a = calloc(n, sizeof(int));
for (size_t i = 0; i < n; i++)
{
scanf("%d", a + i);
}
cnt = 0;
for (size_t i = 0; i < n; i++)
{
if (a[i] == cnt+1)
{
cnt++;
}
}
if (cnt)
{
printf("%d", n - cnt);
}
else
{
printf("-1");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105649/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #5
%cmp31.not = icmp eq i32 %0, 0
br i1 %cmp31.not, label %if.else, label %for.body
for.cond6.preheader: ; preds = %for.body
%cmp834.not = icmp eq i32 %2, 0
br i1 %cmp834.not, label %if.else, label %for.body11.preheader
for.body11.preheader: ; preds = %for.cond6.preheader
%xtraiter = and i64 %conv2, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.cond.cleanup10.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %conv2, -4
br label %for.body11
for.body: ; preds = %entry, %for.body
%i.032 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %i.032
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%inc = add nuw i64 %i.032, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%conv2 = sext i32 %2 to i64
%cmp = icmp ult i64 %inc, %conv2
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond.cleanup10.unr-lcssa: ; preds = %for.body11, %for.body11.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body11.preheader ], [ %spec.select.3, %for.body11 ]
%i5.036.unr = phi i64 [ 0, %for.body11.preheader ], [ %inc16.3, %for.body11 ]
%cnt.035.unr = phi i32 [ 0, %for.body11.preheader ], [ %spec.select.3, %for.body11 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %for.body11.epil
for.body11.epil: ; preds = %for.cond.cleanup10.unr-lcssa, %for.body11.epil
%i5.036.epil = phi i64 [ %inc16.epil, %for.body11.epil ], [ %i5.036.unr, %for.cond.cleanup10.unr-lcssa ]
%cnt.035.epil = phi i32 [ %spec.select.epil, %for.body11.epil ], [ %cnt.035.unr, %for.cond.cleanup10.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body11.epil ], [ 0, %for.cond.cleanup10.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds i32, ptr %call1, i64 %i5.036.epil
%3 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %cnt.035.epil, 1
%cmp12.epil = icmp eq i32 %3, %add.epil
%spec.select.epil = select i1 %cmp12.epil, i32 %add.epil, i32 %cnt.035.epil
%inc16.epil = add nuw i64 %i5.036.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup10, label %for.body11.epil, !llvm.loop !11
for.cond.cleanup10: ; preds = %for.body11.epil, %for.cond.cleanup10.unr-lcssa
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.cond.cleanup10.unr-lcssa ], [ %spec.select.epil, %for.body11.epil ]
%tobool.not = icmp eq i32 %spec.select.lcssa, 0
br i1 %tobool.not, label %if.else, label %if.then18
for.body11: ; preds = %for.body11, %for.body11.preheader.new
%i5.036 = phi i64 [ 0, %for.body11.preheader.new ], [ %inc16.3, %for.body11 ]
%cnt.035 = phi i32 [ 0, %for.body11.preheader.new ], [ %spec.select.3, %for.body11 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.3, %for.body11 ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %i5.036
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %cnt.035, 1
%cmp12 = icmp eq i32 %4, %add
%spec.select = select i1 %cmp12, i32 %add, i32 %cnt.035
%inc16 = or i64 %i5.036, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %call1, i64 %inc16
%5 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%add.1 = add nsw i32 %spec.select, 1
%cmp12.1 = icmp eq i32 %5, %add.1
%spec.select.1 = select i1 %cmp12.1, i32 %add.1, i32 %spec.select
%inc16.1 = or i64 %i5.036, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %call1, i64 %inc16.1
%6 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%add.2 = add nsw i32 %spec.select.1, 1
%cmp12.2 = icmp eq i32 %6, %add.2
%spec.select.2 = select i1 %cmp12.2, i32 %add.2, i32 %spec.select.1
%inc16.2 = or i64 %i5.036, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %call1, i64 %inc16.2
%7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%add.3 = add nsw i32 %spec.select.2, 1
%cmp12.3 = icmp eq i32 %7, %add.3
%spec.select.3 = select i1 %cmp12.3, i32 %add.3, i32 %spec.select.2
%inc16.3 = add nuw i64 %i5.036, 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.cond.cleanup10.unr-lcssa, label %for.body11, !llvm.loop !13
if.then18: ; preds = %for.cond.cleanup10
%sub = sub nsw i32 %2, %spec.select.lcssa
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
br label %if.end21
if.else: ; preds = %entry, %for.cond6.preheader, %for.cond.cleanup10
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end21
if.end21: ; preds = %if.else, %if.then18
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int N;
scanf("%d", &N);
int a[N];
int r;
for(r=0; r<N; r++){
scanf("%d", &a[r]);
}
int c = 0;
for(r=0; r<N; r++){
if(a[r] == c+1){
c++;
}
}
if(c==0) printf("-1");
else printf("%d",N-c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105692/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%cmp25 = icmp sgt i32 %3, 0
br i1 %cmp25, label %for.body, label %if.then13
for.cond2.preheader: ; preds = %for.body
%cmp327 = icmp sgt i32 %5, 0
br i1 %cmp327, 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.iv33 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next34.3, %for.body4 ]
%c.029 = phi i32 [ 0, %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.iv33
%7 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%add = add nsw i32 %c.029, 1
%cmp7 = icmp eq i32 %7, %add
%spec.select = select i1 %cmp7, i32 %add, i32 %c.029
%indvars.iv.next34 = or i64 %indvars.iv33, 1
%arrayidx6.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next34
%8 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%add.1 = add nsw i32 %spec.select, 1
%cmp7.1 = icmp eq i32 %8, %add.1
%spec.select.1 = select i1 %cmp7.1, i32 %add.1, i32 %spec.select
%indvars.iv.next34.1 = or i64 %indvars.iv33, 2
%arrayidx6.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next34.1
%9 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%add.2 = add nsw i32 %spec.select.1, 1
%cmp7.2 = icmp eq i32 %9, %add.2
%spec.select.2 = select i1 %cmp7.2, i32 %add.2, i32 %spec.select.1
%indvars.iv.next34.2 = or i64 %indvars.iv33, 3
%arrayidx6.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next34.2
%10 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%add.3 = add nsw i32 %spec.select.2, 1
%cmp7.3 = icmp eq i32 %10, %add.3
%spec.select.3 = select i1 %cmp7.3, i32 %add.3, i32 %spec.select.2
%indvars.iv.next34.3 = add nuw nsw i64 %indvars.iv33, 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.iv33.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next34.3, %for.body4 ]
%c.029.unr = phi i32 [ 0, %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.iv33.epil = phi i64 [ %indvars.iv.next34.epil, %for.body4.epil ], [ %indvars.iv33.unr, %for.end11.unr-lcssa ]
%c.029.epil = phi i32 [ %spec.select.epil, %for.body4.epil ], [ %c.029.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.iv33.epil
%11 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %c.029.epil, 1
%cmp7.epil = icmp eq i32 %11, %add.epil
%spec.select.epil = select i1 %cmp7.epil, i32 %add.epil, i32 %c.029.epil
%indvars.iv.next34.epil = add nuw nsw i64 %indvars.iv33.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 ]
%cmp12 = icmp eq i32 %spec.select.lcssa, 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.end16
if.else: ; preds = %for.end11
%sub = sub nsw i32 %5, %spec.select.lcssa
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
br label %if.end16
if.end16: ; 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>
int main()
{
unsigned int n;
scanf("%d",&n);
unsigned int a[n+2];
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
int cnt=0;
int i,j;
int ans[n+1];
for(int i=0;i<=n;i++){
ans[i] = i+1;
}
j = 0;
for(i=0;i<n;i++){
if(a[i] == ans[j]){
j++;
}
}
if(j){
j = n - j;
printf("%d",j);
}
else{
printf("-1");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105735/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105735/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%add = add i32 %0, 2
%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
%cmp44.not = icmp eq i32 %3, 0
br i1 %cmp44.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ 0, %entry ], [ %12, %for.body ]
%add3 = add i32 %.lcssa, 1
%4 = zext i32 %add3 to i64
%vla4 = alloca i32, i64 %4, align 16
%min.iters.check = icmp ult i32 %add3, 8
br i1 %min.iters.check, label %for.body9.preheader, label %vector.ph
vector.ph: ; preds = %for.cond.cleanup
%n.vec = and i64 %4, 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 i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla4, i64 %index
%6 = trunc <4 x i64> %vec.ind to <4 x i32>
%7 = add <4 x i32> %6, <i32 1, i32 1, i32 1, i32 1>
%8 = trunc <4 x i64> %vec.ind to <4 x i32>
%9 = add <4 x i32> %8, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %7, ptr %5, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> %9, ptr %10, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %4
br i1 %cmp.n, label %for.cond16.preheader, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond.cleanup, %middle.block
%indvars.iv53.ph = phi i64 [ 0, %for.cond.cleanup ], [ %n.vec, %middle.block ]
br label %for.body9
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
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = zext i32 %12 to i64
%cmp = icmp ult i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond16.preheader: ; preds = %for.body9, %middle.block
%cmp1747.not = icmp eq i32 %.lcssa, 0
br i1 %cmp1747.not, label %if.else, label %for.body18.preheader
for.body18.preheader: ; preds = %for.cond16.preheader
%wide.trip.count59 = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count59, 3
%14 = icmp ult i32 %.lcssa, 4
br i1 %14, label %for.end27.unr-lcssa, label %for.body18.preheader.new
for.body18.preheader.new: ; preds = %for.body18.preheader
%unroll_iter = and i64 %wide.trip.count59, 4294967292
br label %for.body18
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body9 ], [ %indvars.iv53.ph, %for.body9.preheader ]
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%arrayidx12 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv53
%15 = trunc i64 %indvars.iv.next54 to i32
store i32 %15, ptr %arrayidx12, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next54, %4
br i1 %exitcond.not, label %for.cond16.preheader, label %for.body9, !llvm.loop !14
for.body18: ; preds = %for.body18, %for.body18.preheader.new
%indvars.iv56 = phi i64 [ 0, %for.body18.preheader.new ], [ %indvars.iv.next57.3, %for.body18 ]
%j.049 = phi i32 [ 0, %for.body18.preheader.new ], [ %spec.select.3, %for.body18 ]
%niter = phi i64 [ 0, %for.body18.preheader.new ], [ %niter.next.3, %for.body18 ]
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv56
%16 = load i32, ptr %arrayidx20, align 16, !tbaa !5
%idxprom21 = zext i32 %j.049 to i64
%arrayidx22 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom21
%17 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %16, %17
%inc24 = zext i1 %cmp23 to i32
%spec.select = add nuw nsw i32 %j.049, %inc24
%indvars.iv.next57 = or i64 %indvars.iv56, 1
%arrayidx20.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next57
%18 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%idxprom21.1 = zext i32 %spec.select to i64
%arrayidx22.1 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom21.1
%19 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %18, %19
%inc24.1 = zext i1 %cmp23.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc24.1
%indvars.iv.next57.1 = or i64 %indvars.iv56, 2
%arrayidx20.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next57.1
%20 = load i32, ptr %arrayidx20.2, align 8, !tbaa !5
%idxprom21.2 = zext i32 %spec.select.1 to i64
%arrayidx22.2 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom21.2
%21 = load i32, ptr %arrayidx22.2, align 4, !tbaa !5
%cmp23.2 = icmp eq i32 %20, %21
%inc24.2 = zext i1 %cmp23.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc24.2
%indvars.iv.next57.2 = or i64 %indvars.iv56, 3
%arrayidx20.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next57.2
%22 = load i32, ptr %arrayidx20.3, align 4, !tbaa !5
%idxprom21.3 = zext i32 %spec.select.2 to i64
%arrayidx22.3 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom21.3
%23 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %22, %23
%inc24.3 = zext i1 %cmp23.3 to i32
%spec.select.3 = add nuw nsw i32 %spec.select.2, %inc24.3
%indvars.iv.next57.3 = add nuw nsw i64 %indvars.iv56, 4
%niter.next.3 = add nuw i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end27.unr-lcssa, label %for.body18, !llvm.loop !15
for.end27.unr-lcssa: ; preds = %for.body18, %for.body18.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body18.preheader ], [ %spec.select.3, %for.body18 ]
%indvars.iv56.unr = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next57.3, %for.body18 ]
%j.049.unr = phi i32 [ 0, %for.body18.preheader ], [ %spec.select.3, %for.body18 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end27, label %for.body18.epil
for.body18.epil: ; preds = %for.end27.unr-lcssa, %for.body18.epil
%indvars.iv56.epil = phi i64 [ %indvars.iv.next57.epil, %for.body18.epil ], [ %indvars.iv56.unr, %for.end27.unr-lcssa ]
%j.049.epil = phi i32 [ %spec.select.epil, %for.body18.epil ], [ %j.049.unr, %for.end27.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body18.epil ], [ 0, %for.end27.unr-lcssa ]
%arrayidx20.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv56.epil
%24 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%idxprom21.epil = zext i32 %j.049.epil to i64
%arrayidx22.epil = getelementptr inbounds i32, ptr %vla4, i64 %idxprom21.epil
%25 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5
%cmp23.epil = icmp eq i32 %24, %25
%inc24.epil = zext i1 %cmp23.epil to i32
%spec.select.epil = add nuw nsw i32 %j.049.epil, %inc24.epil
%indvars.iv.next57.epil = add nuw nsw i64 %indvars.iv56.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.end27, label %for.body18.epil, !llvm.loop !16
for.end27: ; preds = %for.body18.epil, %for.end27.unr-lcssa
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.end27.unr-lcssa ], [ %spec.select.epil, %for.body18.epil ]
%tobool.not = icmp eq i32 %spec.select.lcssa, 0
br i1 %tobool.not, label %if.else, label %if.then28
if.then28: ; preds = %for.end27
%sub = sub i32 %.lcssa, %spec.select.lcssa
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
br label %if.end31
if.else: ; preds = %for.cond16.preheader, %for.end27
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end31
if.end31: ; preds = %if.else, %if.then28
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(void){
// Your code here!
int n,i,k=1,cnt=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++){
if(k==a[i]) k++;
else cnt++;
}
if(n==cnt) printf("-1");
else printf("%d",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105786/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105786/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %for.end12
for.cond2.preheader: ; preds = %for.body
%cmp329 = icmp sgt i32 %5, 0
br i1 %cmp329, label %for.body4.preheader, label %for.end12
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %5, 1
br i1 %4, label %for.end12.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
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.iv36 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next37.1, %for.body4 ]
%cnt.031 = phi i32 [ 0, %for.body4.preheader.new ], [ %cnt.1.1, %for.body4 ]
%k.030 = phi i32 [ 1, %for.body4.preheader.new ], [ %k.1.1, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.body4 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv36
%7 = load i32, ptr %arrayidx6, align 8, !tbaa !5
%cmp7 = icmp eq i32 %k.030, %7
%inc8 = zext i1 %cmp7 to i32
%k.1 = add nuw nsw i32 %k.030, %inc8
%not.cmp7 = xor i1 %cmp7, true
%inc9 = zext i1 %not.cmp7 to i32
%cnt.1 = add nuw nsw i32 %cnt.031, %inc9
%indvars.iv.next37 = or i64 %indvars.iv36, 1
%arrayidx6.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next37
%8 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%cmp7.1 = icmp eq i32 %k.1, %8
%inc8.1 = zext i1 %cmp7.1 to i32
%k.1.1 = add nuw nsw i32 %k.1, %inc8.1
%not.cmp7.1 = xor i1 %cmp7.1, true
%inc9.1 = zext i1 %not.cmp7.1 to i32
%cnt.1.1 = add nuw nsw i32 %cnt.1, %inc9.1
%indvars.iv.next37.1 = add nuw nsw i64 %indvars.iv36, 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.end12.loopexit.unr-lcssa, label %for.body4, !llvm.loop !11
for.end12.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%cnt.1.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %cnt.1.1, %for.body4 ]
%indvars.iv36.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next37.1, %for.body4 ]
%cnt.031.unr = phi i32 [ 0, %for.body4.preheader ], [ %cnt.1.1, %for.body4 ]
%k.030.unr = phi i32 [ 1, %for.body4.preheader ], [ %k.1.1, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end12, label %for.body4.epil
for.body4.epil: ; preds = %for.end12.loopexit.unr-lcssa
%arrayidx6.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv36.unr
%9 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%cmp7.epil = icmp ne i32 %k.030.unr, %9
%inc9.epil = zext i1 %cmp7.epil to i32
%cnt.1.epil = add nuw nsw i32 %cnt.031.unr, %inc9.epil
br label %for.end12
for.end12: ; preds = %for.body4.epil, %for.end12.loopexit.unr-lcssa, %entry, %for.cond2.preheader
%.lcssa41 = phi i32 [ %5, %for.cond2.preheader ], [ %3, %entry ], [ %5, %for.end12.loopexit.unr-lcssa ], [ %5, %for.body4.epil ]
%cnt.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %cnt.1.lcssa.ph, %for.end12.loopexit.unr-lcssa ], [ %cnt.1.epil, %for.body4.epil ]
%cmp13 = icmp eq i32 %.lcssa41, %cnt.0.lcssa
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %for.end12
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end18
if.else16: ; preds = %for.end12
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.0.lcssa)
br label %if.end18
if.end18: ; preds = %if.else16, %if.then14
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>
#include <string.h>
#define MOD 100000
#define FMAX 10946
#define NMMAX 20
int main(void)
{
int i, j, k, m, n, fcheck, mask, ans = 1, res = 0, fcount = 0;
int k2b[FMAX], b2k[1<<19], dp[2][FMAX][2], (*src)[2], (*dst)[2];
char field[NMMAX][NMMAX+1];
scanf("%d %d%*c", &m, &n);
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
field[i][j] = getchar_unlocked();
if (field[i][j] == '?') ans = (ans * 3) % MOD;
}
getchar_unlocked();
}
for (i = 0; i < (1 << (n - 1)); i++) {
fcheck = 1;
for (j = 0; j < n - 2; j++) {
if (((i >> j) & 1) & ((i >> (j + 1)) & 1)) {
fcheck = 0;
break;
}
}
if (fcheck) {
k2b[fcount] = i;
b2k[i] = fcount++;
}
}
mask = (1 << (n - 1)) - 1;
fcheck = 1;
src = dp[0];
dst = dp[1];
src[0][0] = 1;
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
int (*ftemp)[2];
memset(dp[fcheck], 0, sizeof(dp[fcheck]));
for (k = 0; k < fcount; k++) {
int nk, jflag;
if (field[i][j] == 'J' || field[i][j] == '?') {
nk = b2k[(k2b[k] << 1) & mask];
jflag = (j < n - 1);
dst[nk][jflag] = (dst[nk][jflag] + src[k][0] + src[k][1]) % MOD;
}
if (field[i][j] == 'O' || field[i][j] == '?') {
nk = b2k[((k2b[k] << 1) & mask) | 0];
jflag = 0;
dst[nk][jflag] = (dst[nk][jflag] + src[k][0]) % MOD;
nk = b2k[((k2b[k] << 1) & mask) | 1];
dst[nk][jflag] = (dst[nk][jflag] + src[k][1]) % MOD;
}
if (field[i][j] == 'I' || field[i][j] == '?') {
if (((~k2b[k]) >> (n - 2)) & 1) {
nk = b2k[(k2b[k] << 1) & mask];
jflag = 0;
dst[nk][jflag] = (dst[nk][jflag] + src[k][0] + src[k][1]) % MOD;
}
}
}
ftemp = src;
src = dst;
dst = ftemp;
fcheck ^= 1;
}
}
for (i = 0; i < fcount; i++) res = (res + src[i][0] + src[i][1]) % MOD;
printf("%d\n", (ans - res + MOD) % MOD);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105836/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@.str = private unnamed_addr constant [9 x i8] c"%d %d%*c\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%k2b = alloca [10946 x i32], align 16
%b2k = alloca [524288 x i32], align 16
%dp = alloca [2 x [10946 x [2 x i32]]], align 16
%field = alloca [20 x [21 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 43784, ptr nonnull %k2b) #6
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b2k) #6
call void @llvm.lifetime.start.p0(i64 175136, ptr nonnull %dp) #6
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %field) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp348 = icmp sgt i32 %0, 0
br i1 %cmp348, label %for.cond1.preheader.preheader, label %for.cond18.preheader
for.cond1.preheader.preheader: ; preds = %entry
%.pre410.pre413 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %getchar_unlocked.exit344
%.pre410 = phi ptr [ %.pre410.pre413, %for.cond1.preheader.preheader ], [ %.pre410414, %getchar_unlocked.exit344 ]
%indvars.iv383 = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next384, %getchar_unlocked.exit344 ]
%ans.0349 = phi i32 [ 1, %for.cond1.preheader.preheader ], [ %ans.1.lcssa, %getchar_unlocked.exit344 ]
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp2345 = icmp sgt i32 %1, 0
br i1 %cmp2345, label %for.body3, label %for.end
for.cond18.preheader.loopexit: ; preds = %getchar_unlocked.exit344
%2 = add i32 %ans.1.lcssa, 100000
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %entry
%3 = phi i32 [ %0, %entry ], [ %16, %for.cond18.preheader.loopexit ]
%ans.0.lcssa = phi i32 [ 100001, %entry ], [ %2, %for.cond18.preheader.loopexit ]
%4 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %4, -1
%shl = shl nuw i32 1, %sub
%cmp19352.not = icmp eq i32 %sub, 31
br i1 %cmp19352.not, label %for.end45.thread, label %for.cond22.preheader.lr.ph
for.cond22.preheader.lr.ph: ; preds = %for.cond18.preheader
%5 = call i32 @llvm.smax.i32(i32 %4, i32 2)
%smax = add nsw i32 %5, -2
%smax389 = call i32 @llvm.smax.i32(i32 %shl, i32 1)
%wide.trip.count = zext i32 %smax389 to i64
br label %for.cond22.preheader
for.body3: ; preds = %for.cond1.preheader, %for.inc
%.pre410417 = phi ptr [ %.pre410416, %for.inc ], [ %.pre410, %for.cond1.preheader ]
%6 = phi ptr [ %10, %for.inc ], [ %.pre410, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.cond1.preheader ]
%ans.1347 = phi i32 [ %ans.2, %for.inc ], [ %ans.0349, %for.cond1.preheader ]
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !11
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2
%8 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !15
%cmp.not.i = icmp ult ptr %7, %8
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %for.body3
%call.i = call i32 @__uflow(ptr noundef nonnull %6) #6
%.pre = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getchar_unlocked.exit
cond.false.i: ; preds = %for.body3
%incdec.ptr.i = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !11
%9 = load i8, ptr %7, align 1, !tbaa !17
%conv3.i = zext i8 %9 to i32
br label %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%.pre410416 = phi ptr [ %.pre, %cond.true.i ], [ %.pre410417, %cond.false.i ]
%10 = phi ptr [ %.pre, %cond.true.i ], [ %6, %cond.false.i ]
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%conv = trunc i32 %cond.i to i8
%arrayidx6 = getelementptr inbounds [20 x [21 x i8]], ptr %field, i64 0, i64 %indvars.iv383, i64 %indvars.iv
store i8 %conv, ptr %arrayidx6, align 1, !tbaa !17
%sext.mask = and i32 %cond.i, 255
%cmp12 = icmp eq i32 %sext.mask, 63
br i1 %cmp12, label %if.then, label %for.inc
if.then: ; preds = %getchar_unlocked.exit
%mul = mul nsw i32 %ans.1347, 3
%rem = srem i32 %mul, 100000
br label %for.inc
for.inc: ; preds = %getchar_unlocked.exit, %if.then
%ans.2 = phi i32 [ %rem, %if.then ], [ %ans.1347, %getchar_unlocked.exit ]
%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
%cmp2 = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %for.cond1.preheader
%.pre410415 = phi ptr [ %.pre410, %for.cond1.preheader ], [ %.pre410416, %for.inc ]
%13 = phi ptr [ %.pre410, %for.cond1.preheader ], [ %10, %for.inc ]
%ans.1.lcssa = phi i32 [ %ans.0349, %for.cond1.preheader ], [ %ans.2, %for.inc ]
%_IO_read_ptr.i335 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i335, align 8, !tbaa !11
%_IO_read_end.i336 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i336, align 8, !tbaa !15
%cmp.not.i337 = icmp ult ptr %14, %15
br i1 %cmp.not.i337, label %cond.false.i341, label %cond.true.i338, !prof !16
cond.true.i338: ; preds = %for.end
%call.i339 = call i32 @__uflow(ptr noundef nonnull %13) #6
%.pre410.pre = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getchar_unlocked.exit344
cond.false.i341: ; preds = %for.end
%incdec.ptr.i342 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i342, ptr %_IO_read_ptr.i335, align 8, !tbaa !11
br label %getchar_unlocked.exit344
getchar_unlocked.exit344: ; preds = %cond.true.i338, %cond.false.i341
%.pre410414 = phi ptr [ %.pre410.pre, %cond.true.i338 ], [ %.pre410415, %cond.false.i341 ]
%indvars.iv.next384 = add nuw nsw i64 %indvars.iv383, 1
%16 = load i32, ptr %m, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp = icmp slt i64 %indvars.iv.next384, %17
br i1 %cmp, label %for.cond1.preheader, label %for.cond18.preheader.loopexit, !llvm.loop !20
for.cond22.preheader: ; preds = %for.cond22.preheader.lr.ph, %for.inc43
%indvars.iv386 = phi i64 [ 0, %for.cond22.preheader.lr.ph ], [ %indvars.iv.next387, %for.inc43 ]
%fcount.0353 = phi i32 [ 0, %for.cond22.preheader.lr.ph ], [ %fcount.1, %for.inc43 ]
%18 = trunc i64 %indvars.iv386 to i32
br label %for.cond22
for.cond22: ; preds = %for.cond22.preheader, %for.body26
%j.1 = phi i32 [ %add, %for.body26 ], [ 0, %for.cond22.preheader ]
%exitcond.not = icmp eq i32 %j.1, %smax
br i1 %exitcond.not, label %if.then36, label %for.body26
for.body26: ; preds = %for.cond22
%shr = lshr i32 %18, %j.1
%add = add nuw i32 %j.1, 1
%shr27 = lshr i32 %18, %add
%and28 = and i32 %shr, 1
%and29 = and i32 %and28, %shr27
%tobool.not = icmp eq i32 %and29, 0
br i1 %tobool.not, label %for.cond22, label %for.inc43, !llvm.loop !21
if.then36: ; preds = %for.cond22
%idxprom37 = sext i32 %fcount.0353 to i64
%arrayidx38 = getelementptr inbounds [10946 x i32], ptr %k2b, i64 0, i64 %idxprom37
%19 = trunc i64 %indvars.iv386 to i32
store i32 %19, ptr %arrayidx38, align 4, !tbaa !5
%inc39 = add nsw i32 %fcount.0353, 1
%arrayidx41 = getelementptr inbounds [524288 x i32], ptr %b2k, i64 0, i64 %indvars.iv386
store i32 %fcount.0353, ptr %arrayidx41, align 4, !tbaa !5
br label %for.inc43
for.inc43: ; preds = %for.body26, %if.then36
%fcount.1 = phi i32 [ %inc39, %if.then36 ], [ %fcount.0353, %for.body26 ]
%indvars.iv.next387 = add nuw nsw i64 %indvars.iv386, 1
%exitcond390.not = icmp eq i64 %indvars.iv.next387, %wide.trip.count
br i1 %exitcond390.not, label %for.end45, label %for.cond22.preheader, !llvm.loop !22
for.end45: ; preds = %for.inc43
store i32 1, ptr %dp, align 16, !tbaa !5
%cmp55369 = icmp sgt i32 %3, 0
%cmp66357 = icmp sgt i32 %fcount.1, 0
%20 = icmp sgt i32 %4, 0
%or.cond = and i1 %cmp55369, %20
br i1 %or.cond, label %for.cond58.preheader.preheader, label %for.cond224.preheader
for.end45.thread: ; preds = %for.cond18.preheader
store i32 1, ptr %dp, align 16, !tbaa !5
%cmp55369421 = icmp sgt i32 %3, 0
br i1 %cmp55369421, label %for.cond58.preheader.preheader, label %for.end239
for.cond58.preheader.preheader: ; preds = %for.end45, %for.end45.thread
%cmp66357430 = phi i1 [ false, %for.end45.thread ], [ %cmp66357, %for.end45 ]
%fcount.0.lcssa422429 = phi i32 [ 0, %for.end45.thread ], [ %fcount.1, %for.end45 ]
%sub48424428 = add nsw i32 %shl, -1
%arrayidx50 = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 1
%wide.trip.count396 = zext i32 %fcount.0.lcssa422429 to i64
br label %for.cond58.preheader
for.cond58.preheader: ; preds = %for.cond58.preheader.preheader, %for.inc221
%21 = phi i32 [ %3, %for.cond58.preheader.preheader ], [ %54, %for.inc221 ]
%22 = phi i32 [ %4, %for.cond58.preheader.preheader ], [ %55, %for.inc221 ]
%23 = phi i32 [ %4, %for.cond58.preheader.preheader ], [ %56, %for.inc221 ]
%indvars.iv401 = phi i64 [ 0, %for.cond58.preheader.preheader ], [ %indvars.iv.next402, %for.inc221 ]
%dst.0372 = phi ptr [ %arrayidx50, %for.cond58.preheader.preheader ], [ %dst.1.lcssa, %for.inc221 ]
%src.0371 = phi ptr [ %dp, %for.cond58.preheader.preheader ], [ %src.1.lcssa, %for.inc221 ]
%fcheck.1370 = phi i32 [ 1, %for.cond58.preheader.preheader ], [ %fcheck.2.lcssa, %for.inc221 ]
%cmp59359 = icmp sgt i32 %23, 0
br i1 %cmp59359, label %for.body61.lr.ph, label %for.inc221
for.body61.lr.ph: ; preds = %for.cond58.preheader
br i1 %cmp66357430, label %for.body61.us, label %for.body61.lr.ph.split
for.body61.us: ; preds = %for.body61.lr.ph, %for.cond65.for.end217_crit_edge.us
%indvars.iv398 = phi i64 [ %indvars.iv.next399, %for.cond65.for.end217_crit_edge.us ], [ 0, %for.body61.lr.ph ]
%dst.1363.us = phi ptr [ %src.1362.us, %for.cond65.for.end217_crit_edge.us ], [ %dst.0372, %for.body61.lr.ph ]
%src.1362.us = phi ptr [ %dst.1363.us, %for.cond65.for.end217_crit_edge.us ], [ %src.0371, %for.body61.lr.ph ]
%fcheck.2360.us = phi i32 [ %xor.us, %for.cond65.for.end217_crit_edge.us ], [ %fcheck.1370, %for.body61.lr.ph ]
%idxprom62.us = zext i32 %fcheck.2360.us to i64
%arrayidx63.us = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62.us
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63.us, i8 0, i64 87568, i1 false)
%arrayidx72.us = getelementptr inbounds [20 x [21 x i8]], ptr %field, i64 0, i64 %indvars.iv401, i64 %indvars.iv398
br label %for.body68.us
for.body68.us: ; preds = %for.body61.us, %if.end214.us
%indvars.iv393 = phi i64 [ 0, %for.body61.us ], [ %indvars.iv.next394, %if.end214.us ]
%24 = load i8, ptr %arrayidx72.us, align 1, !tbaa !17
switch i8 %24, label %if.end110.us [
i8 74, label %if.then83.us
i8 63, label %if.then83.us
]
if.then83.us: ; preds = %for.body68.us, %for.body68.us
%arrayidx85.us = getelementptr inbounds [10946 x i32], ptr %k2b, i64 0, i64 %indvars.iv393
%25 = load i32, ptr %arrayidx85.us, align 4, !tbaa !5
%shl86.us = shl i32 %25, 1
%and87.us = and i32 %shl86.us, %sub48424428
%idxprom88.us = sext i32 %and87.us to i64
%arrayidx89.us = getelementptr inbounds [524288 x i32], ptr %b2k, i64 0, i64 %idxprom88.us
%26 = load i32, ptr %arrayidx89.us, align 8, !tbaa !5
%27 = load i32, ptr %n, align 4, !tbaa !5
%sub90.us = add nsw i32 %27, -1
%28 = sext i32 %sub90.us to i64
%cmp91.us = icmp slt i64 %indvars.iv398, %28
%idxprom93.us = sext i32 %26 to i64
%idxprom95.us = zext i1 %cmp91.us to i64
%arrayidx96.us = getelementptr inbounds [2 x i32], ptr %dst.1363.us, i64 %idxprom93.us, i64 %idxprom95.us
%29 = load i32, ptr %arrayidx96.us, align 4, !tbaa !5
%arrayidx98.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393
%30 = load i32, ptr %arrayidx98.us, align 4, !tbaa !5
%add100.us = add nsw i32 %30, %29
%arrayidx103.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393, i64 1
%31 = load i32, ptr %arrayidx103.us, align 4, !tbaa !5
%add104.us = add nsw i32 %add100.us, %31
%rem105.us = srem i32 %add104.us, 100000
store i32 %rem105.us, ptr %arrayidx96.us, align 4, !tbaa !5
%.pr.us = load i8, ptr %arrayidx72.us, align 1, !tbaa !17
br label %if.end110.us
if.end110.us: ; preds = %if.then83.us, %for.body68.us
%32 = phi i8 [ %24, %for.body68.us ], [ %.pr.us, %if.then83.us ]
switch i8 %32, label %if.end166.us [
i8 79, label %if.then126.us
i8 63, label %if.then126.us
]
if.then126.us: ; preds = %if.end110.us, %if.end110.us
%arrayidx128.us = getelementptr inbounds [10946 x i32], ptr %k2b, i64 0, i64 %indvars.iv393
%33 = load i32, ptr %arrayidx128.us, align 4, !tbaa !5
%shl129.us = shl i32 %33, 1
%and130.us = and i32 %shl129.us, %sub48424428
%idxprom131.us = sext i32 %and130.us to i64
%arrayidx132.us = getelementptr inbounds [524288 x i32], ptr %b2k, i64 0, i64 %idxprom131.us
%34 = load i32, ptr %arrayidx132.us, align 8, !tbaa !5
%idxprom133.us = sext i32 %34 to i64
%arrayidx134.us = getelementptr inbounds [2 x i32], ptr %dst.1363.us, i64 %idxprom133.us
%35 = load i32, ptr %arrayidx134.us, align 4, !tbaa !5
%arrayidx138.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393
%36 = load i32, ptr %arrayidx138.us, align 4, !tbaa !5
%add140.us = add nsw i32 %36, %35
%rem141.us = srem i32 %add140.us, 100000
store i32 %rem141.us, ptr %arrayidx134.us, align 4, !tbaa !5
%37 = load i32, ptr %arrayidx128.us, align 4, !tbaa !5
%shl148.us = shl i32 %37, 1
%and149.us = and i32 %shl148.us, %sub48424428
%or150.us = or i32 %and149.us, 1
%idxprom151.us = sext i32 %or150.us to i64
%arrayidx152.us = getelementptr inbounds [524288 x i32], ptr %b2k, i64 0, i64 %idxprom151.us
%38 = load i32, ptr %arrayidx152.us, align 4, !tbaa !5
%idxprom153.us = sext i32 %38 to i64
%arrayidx154.us = getelementptr inbounds [2 x i32], ptr %dst.1363.us, i64 %idxprom153.us
%39 = load i32, ptr %arrayidx154.us, align 4, !tbaa !5
%arrayidx159.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393, i64 1
%40 = load i32, ptr %arrayidx159.us, align 4, !tbaa !5
%add160.us = add nsw i32 %40, %39
%rem161.us = srem i32 %add160.us, 100000
store i32 %rem161.us, ptr %arrayidx154.us, align 4, !tbaa !5
%.pre411 = load i8, ptr %arrayidx72.us, align 1, !tbaa !17
br label %if.end166.us
if.end166.us: ; preds = %if.then126.us, %if.end110.us
%41 = phi i8 [ %.pre411, %if.then126.us ], [ %32, %if.end110.us ]
switch i8 %41, label %if.end214.us [
i8 73, label %if.then182.us
i8 63, label %if.then182.us
]
if.then182.us: ; preds = %if.end166.us, %if.end166.us
%arrayidx184.us = getelementptr inbounds [10946 x i32], ptr %k2b, i64 0, i64 %indvars.iv393
%42 = load i32, ptr %arrayidx184.us, align 4, !tbaa !5
%43 = load i32, ptr %n, align 4, !tbaa !5
%sub185.us = add nsw i32 %43, -2
%44 = shl nuw i32 1, %sub185.us
%45 = and i32 %44, %42
%tobool188.not.not.us = icmp eq i32 %45, 0
br i1 %tobool188.not.not.us, label %if.then189.us, label %if.end214.us
if.then189.us: ; preds = %if.then182.us
%shl192.us = shl i32 %42, 1
%and193.us = and i32 %shl192.us, %sub48424428
%idxprom194.us = sext i32 %and193.us to i64
%arrayidx195.us = getelementptr inbounds [524288 x i32], ptr %b2k, i64 0, i64 %idxprom194.us
%46 = load i32, ptr %arrayidx195.us, align 8, !tbaa !5
%idxprom196.us = sext i32 %46 to i64
%arrayidx197.us = getelementptr inbounds [2 x i32], ptr %dst.1363.us, i64 %idxprom196.us
%47 = load i32, ptr %arrayidx197.us, align 4, !tbaa !5
%arrayidx201.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393
%48 = load i32, ptr %arrayidx201.us, align 4, !tbaa !5
%add203.us = add nsw i32 %48, %47
%arrayidx206.us = getelementptr inbounds [2 x i32], ptr %src.1362.us, i64 %indvars.iv393, i64 1
%49 = load i32, ptr %arrayidx206.us, align 4, !tbaa !5
%add207.us = add nsw i32 %add203.us, %49
%rem208.us = srem i32 %add207.us, 100000
store i32 %rem208.us, ptr %arrayidx197.us, align 4, !tbaa !5
br label %if.end214.us
if.end214.us: ; preds = %if.then189.us, %if.then182.us, %if.end166.us
%indvars.iv.next394 = add nuw nsw i64 %indvars.iv393, 1
%exitcond397.not = icmp eq i64 %indvars.iv.next394, %wide.trip.count396
br i1 %exitcond397.not, label %for.cond65.for.end217_crit_edge.us, label %for.body68.us, !llvm.loop !23
for.cond65.for.end217_crit_edge.us: ; preds = %if.end214.us
%xor.us = xor i32 %fcheck.2360.us, 1
%indvars.iv.next399 = add nuw nsw i64 %indvars.iv398, 1
%50 = load i32, ptr %n, align 4, !tbaa !5
%51 = sext i32 %50 to i64
%cmp59.us = icmp slt i64 %indvars.iv.next399, %51
br i1 %cmp59.us, label %for.body61.us, label %for.inc221.loopexit, !llvm.loop !24
for.body61.lr.ph.split: ; preds = %for.body61.lr.ph
%smax391 = call i32 @llvm.smax.i32(i32 %22, i32 1)
%xtraiter = and i32 %smax391, 3
%52 = icmp ult i32 %smax391, 4
br i1 %52, label %for.inc221.loopexit440.unr-lcssa, label %for.body61.lr.ph.split.new
for.body61.lr.ph.split.new: ; preds = %for.body61.lr.ph.split
%unroll_iter = and i32 %smax391, 2147483644
%idxprom62 = zext i32 %fcheck.1370 to i64
%arrayidx63 = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62
%xor = xor i32 %fcheck.1370, 1
%idxprom62.1 = zext i32 %xor to i64
%arrayidx63.1 = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62.1
%idxprom62.2 = zext i32 %fcheck.1370 to i64
%arrayidx63.2 = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62.2
%xor.2 = xor i32 %fcheck.1370, 1
%idxprom62.3 = zext i32 %xor.2 to i64
%arrayidx63.3 = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62.3
br label %for.body61
for.cond224.preheader: ; preds = %for.inc221, %for.end45
%fcount.0.lcssa423 = phi i32 [ %fcount.1, %for.end45 ], [ %fcount.0.lcssa422429, %for.inc221 ]
%src.0.lcssa = phi ptr [ %dp, %for.end45 ], [ %src.1.lcssa, %for.inc221 ]
%cmp225376 = icmp sgt i32 %fcount.0.lcssa423, 0
br i1 %cmp225376, label %for.body227.preheader, label %for.end239
for.body227.preheader: ; preds = %for.cond224.preheader
%wide.trip.count407 = zext i32 %fcount.0.lcssa423 to i64
%xtraiter446 = and i64 %wide.trip.count407, 1
%53 = icmp eq i32 %fcount.0.lcssa423, 1
br i1 %53, label %for.end239.loopexit.unr-lcssa, label %for.body227.preheader.new
for.body227.preheader.new: ; preds = %for.body227.preheader
%unroll_iter450 = and i64 %wide.trip.count407, 4294967294
br label %for.body227
for.body61: ; preds = %for.body61, %for.body61.lr.ph.split.new
%niter = phi i32 [ 0, %for.body61.lr.ph.split.new ], [ %niter.next.3, %for.body61 ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63, i8 0, i64 87568, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63.1, i8 0, i64 87568, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63.2, i8 0, i64 87568, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63.3, i8 0, i64 87568, i1 false)
%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.inc221.loopexit440.unr-lcssa, label %for.body61, !llvm.loop !24
for.inc221.loopexit: ; preds = %for.cond65.for.end217_crit_edge.us
%.pre412 = load i32, ptr %m, align 4, !tbaa !5
br label %for.inc221
for.inc221.loopexit440.unr-lcssa: ; preds = %for.body61, %for.body61.lr.ph.split
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc221, label %for.body61.epil
for.body61.epil: ; preds = %for.inc221.loopexit440.unr-lcssa, %for.body61.epil
%dst.1363.epil = phi ptr [ %src.1362.epil, %for.body61.epil ], [ %dst.0372, %for.inc221.loopexit440.unr-lcssa ]
%src.1362.epil = phi ptr [ %dst.1363.epil, %for.body61.epil ], [ %src.0371, %for.inc221.loopexit440.unr-lcssa ]
%fcheck.2360.epil = phi i32 [ %xor.epil, %for.body61.epil ], [ %fcheck.1370, %for.inc221.loopexit440.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body61.epil ], [ 0, %for.inc221.loopexit440.unr-lcssa ]
%idxprom62.epil = zext i32 %fcheck.2360.epil to i64
%arrayidx63.epil = getelementptr inbounds [2 x [10946 x [2 x i32]]], ptr %dp, i64 0, i64 %idxprom62.epil
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(87568) %arrayidx63.epil, i8 0, i64 87568, i1 false)
%xor.epil = xor i32 %fcheck.2360.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 %for.inc221, label %for.body61.epil, !llvm.loop !25
for.inc221: ; preds = %for.inc221.loopexit440.unr-lcssa, %for.body61.epil, %for.inc221.loopexit, %for.cond58.preheader
%54 = phi i32 [ %21, %for.cond58.preheader ], [ %.pre412, %for.inc221.loopexit ], [ %21, %for.body61.epil ], [ %21, %for.inc221.loopexit440.unr-lcssa ]
%55 = phi i32 [ %22, %for.cond58.preheader ], [ %50, %for.inc221.loopexit ], [ %22, %for.body61.epil ], [ %22, %for.inc221.loopexit440.unr-lcssa ]
%56 = phi i32 [ %23, %for.cond58.preheader ], [ %50, %for.inc221.loopexit ], [ %22, %for.body61.epil ], [ %22, %for.inc221.loopexit440.unr-lcssa ]
%fcheck.2.lcssa = phi i32 [ %fcheck.1370, %for.cond58.preheader ], [ %xor.us, %for.inc221.loopexit ], [ %fcheck.1370, %for.inc221.loopexit440.unr-lcssa ], [ %xor.epil, %for.body61.epil ]
%src.1.lcssa = phi ptr [ %src.0371, %for.cond58.preheader ], [ %dst.1363.us, %for.inc221.loopexit ], [ %src.0371, %for.inc221.loopexit440.unr-lcssa ], [ %dst.1363.epil, %for.body61.epil ]
%dst.1.lcssa = phi ptr [ %dst.0372, %for.cond58.preheader ], [ %src.1362.us, %for.inc221.loopexit ], [ %dst.0372, %for.inc221.loopexit440.unr-lcssa ], [ %src.1362.epil, %for.body61.epil ]
%indvars.iv.next402 = add nuw nsw i64 %indvars.iv401, 1
%57 = sext i32 %54 to i64
%cmp55 = icmp slt i64 %indvars.iv.next402, %57
br i1 %cmp55, label %for.cond58.preheader, label %for.cond224.preheader, !llvm.loop !27
for.body227: ; preds = %for.body227, %for.body227.preheader.new
%indvars.iv404 = phi i64 [ 0, %for.body227.preheader.new ], [ %indvars.iv.next405.1, %for.body227 ]
%res.0377 = phi i32 [ 0, %for.body227.preheader.new ], [ %rem236.1, %for.body227 ]
%niter451 = phi i64 [ 0, %for.body227.preheader.new ], [ %niter451.next.1, %for.body227 ]
%arrayidx229 = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv404
%58 = load i32, ptr %arrayidx229, align 4, !tbaa !5
%add231 = add nsw i32 %58, %res.0377
%arrayidx234 = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv404, i64 1
%59 = load i32, ptr %arrayidx234, align 4, !tbaa !5
%add235 = add nsw i32 %add231, %59
%rem236 = srem i32 %add235, 100000
%indvars.iv.next405 = or i64 %indvars.iv404, 1
%arrayidx229.1 = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv.next405
%60 = load i32, ptr %arrayidx229.1, align 4, !tbaa !5
%add231.1 = add nsw i32 %60, %rem236
%arrayidx234.1 = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv.next405, i64 1
%61 = load i32, ptr %arrayidx234.1, align 4, !tbaa !5
%add235.1 = add nsw i32 %add231.1, %61
%rem236.1 = srem i32 %add235.1, 100000
%indvars.iv.next405.1 = add nuw nsw i64 %indvars.iv404, 2
%niter451.next.1 = add i64 %niter451, 2
%niter451.ncmp.1 = icmp eq i64 %niter451.next.1, %unroll_iter450
br i1 %niter451.ncmp.1, label %for.end239.loopexit.unr-lcssa, label %for.body227, !llvm.loop !29
for.end239.loopexit.unr-lcssa: ; preds = %for.body227, %for.body227.preheader
%rem236.lcssa.ph = phi i32 [ undef, %for.body227.preheader ], [ %rem236.1, %for.body227 ]
%indvars.iv404.unr = phi i64 [ 0, %for.body227.preheader ], [ %indvars.iv.next405.1, %for.body227 ]
%res.0377.unr = phi i32 [ 0, %for.body227.preheader ], [ %rem236.1, %for.body227 ]
%lcmp.mod448.not = icmp eq i64 %xtraiter446, 0
br i1 %lcmp.mod448.not, label %for.end239, label %for.body227.epil
for.body227.epil: ; preds = %for.end239.loopexit.unr-lcssa
%arrayidx229.epil = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv404.unr
%62 = load i32, ptr %arrayidx229.epil, align 4, !tbaa !5
%add231.epil = add nsw i32 %62, %res.0377.unr
%arrayidx234.epil = getelementptr inbounds [2 x i32], ptr %src.0.lcssa, i64 %indvars.iv404.unr, i64 1
%63 = load i32, ptr %arrayidx234.epil, align 4, !tbaa !5
%add235.epil = add nsw i32 %add231.epil, %63
%rem236.epil = srem i32 %add235.epil, 100000
br label %for.end239
for.end239: ; preds = %for.body227.epil, %for.end239.loopexit.unr-lcssa, %for.end45.thread, %for.cond224.preheader
%res.0.lcssa = phi i32 [ 0, %for.cond224.preheader ], [ 0, %for.end45.thread ], [ %rem236.lcssa.ph, %for.end239.loopexit.unr-lcssa ], [ %rem236.epil, %for.body227.epil ]
%add241 = sub i32 %ans.0.lcssa, %res.0.lcssa
%rem242 = srem i32 %add241, 100000
%call243 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %rem242)
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %field) #6
call void @llvm.lifetime.end.p0(i64 175136, ptr nonnull %dp) #6
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b2k) #6
call void @llvm.lifetime.end.p0(i64 43784, ptr nonnull %k2b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_IO_FILE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !6, i64 112, !6, i64 116, !13, i64 120, !14, i64 128, !7, i64 130, !7, i64 131, !10, i64 136, !13, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !13, i64 184, !6, i64 192, !7, i64 196}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !10, i64 16}
!16 = !{!"branch_weights", i32 2000, i32 1}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.unroll.disable"}
!27 = distinct !{!27, !19, !28}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = distinct !{!29, !19}
|
#include <stdio.h>
char a[105][105];
int main()
{
int n,d,i,j;
scanf("%d %d\n",&n,&d);
for (i=1; i<=d; i++)
{
for (j=1; j<=n; j++)
scanf("%c",&a[i][j]);
if (i!=d && j!=n)
scanf("\n");
}
int ans=0, k=0;
int t;
for (i=1; i<=d; i++)
{
t=0;
for (j=1; j<=n; j++)
if (a[i][j]=='0')
{
k++;
t=1;
break;
}
if (t==0)
{
if (k>ans)
ans=k;
k=0;
}
}
if (k>ans)
ans=k;
printf("%d\n",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@a = dso_local global [105 x [105 x i8]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = 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 %d) #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
%cmp.not70 = icmp slt i32 %0, 1
br i1 %cmp.not70, label %for.end41, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc10
%1 = phi i32 [ %11, %for.inc10 ], [ %0, %entry ]
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.inc10 ], [ 1, %entry ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp2.not68 = icmp slt i32 %2, 1
br i1 %cmp2.not68, label %for.end, label %for.body3
for.cond13.preheader: ; preds = %for.inc10
%cmp14.not76 = icmp slt i32 %11, 1
br i1 %cmp14.not76, label %for.end41, label %for.cond16.preheader.lr.ph
for.cond16.preheader.lr.ph: ; preds = %for.cond13.preheader
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp17.not72 = icmp slt i32 %3, 1
br i1 %cmp17.not72, label %for.end41, label %for.cond16.preheader.preheader
for.cond16.preheader.preheader: ; preds = %for.cond16.preheader.lr.ph
%4 = zext i32 %3 to i64
%5 = add nuw i32 %3, 1
%6 = add nuw i32 %11, 1
%wide.trip.count96 = zext i32 %6 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.cond16.preheader
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 1, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [105 x [105 x i8]], ptr @a, i64 0, i64 %indvars.iv88, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%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
%cmp2.not.not = icmp slt i64 %indvars.iv, %8
br i1 %cmp2.not.not, label %for.body3, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body3
%.pre = load i32, ptr %d, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond1.preheader
%9 = phi i32 [ %.pre, %for.end.loopexit ], [ %1, %for.cond1.preheader ]
%10 = zext i32 %9 to i64
%cmp7.not = icmp eq i64 %indvars.iv88, %10
br i1 %cmp7.not, label %for.inc10, label %if.then
if.then: ; preds = %for.end
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2)
%.pre98 = load i32, ptr %d, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.end, %if.then
%11 = phi i32 [ %9, %for.end ], [ %.pre98, %if.then ]
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%12 = sext i32 %11 to i64
%cmp.not.not = icmp slt i64 %indvars.iv88, %12
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond13.preheader, !llvm.loop !11
for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.end30
%indvars.iv93 = phi i64 [ 1, %for.cond16.preheader.preheader ], [ %indvars.iv.next94, %for.end30 ]
%k.080 = phi i32 [ 0, %for.cond16.preheader.preheader ], [ %k.2, %for.end30 ]
%ans.079 = phi i32 [ 0, %for.cond16.preheader.preheader ], [ %ans.2, %for.end30 ]
%arrayidx22103 = getelementptr inbounds [105 x [105 x i8]], ptr @a, i64 0, i64 %indvars.iv93, i64 1
%13 = load i8, ptr %arrayidx22103, align 1, !tbaa !12
%cmp23104 = icmp eq i8 %13, 48
br i1 %cmp23104, label %if.then25, label %for.cond16
for.cond16: ; preds = %for.cond16.preheader, %for.body18
%indvars.iv91105 = phi i64 [ %indvars.iv.next92, %for.body18 ], [ 1, %for.cond16.preheader ]
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91105, 1
%exitcond = icmp eq i64 %indvars.iv.next92, %wide.trip.count
br i1 %exitcond, label %for.end30.loopexit, label %for.body18, !llvm.loop !13
for.body18: ; preds = %for.cond16
%arrayidx22 = getelementptr inbounds [105 x [105 x i8]], ptr @a, i64 0, i64 %indvars.iv93, i64 %indvars.iv.next92
%14 = load i8, ptr %arrayidx22, align 1, !tbaa !12
%cmp23 = icmp eq i8 %14, 48
br i1 %cmp23, label %if.then25.loopexit, label %for.cond16, !llvm.loop !13
if.then25.loopexit: ; preds = %for.body18
%cmp17.not.le = icmp uge i64 %indvars.iv91105, %4
br label %if.then25
if.then25: ; preds = %if.then25.loopexit, %for.cond16.preheader
%cmp17.not74.lcssa = phi i1 [ false, %for.cond16.preheader ], [ %cmp17.not.le, %if.then25.loopexit ]
%inc26 = add nsw i32 %k.080, 1
br label %for.end30
for.end30.loopexit: ; preds = %for.cond16
%cmp17.not.le109 = icmp uge i64 %indvars.iv91105, %4
br label %for.end30
for.end30: ; preds = %for.end30.loopexit, %if.then25
%cmp17.not67 = phi i1 [ %cmp17.not74.lcssa, %if.then25 ], [ %cmp17.not.le109, %for.end30.loopexit ]
%k.2 = phi i32 [ %inc26, %if.then25 ], [ 0, %for.end30.loopexit ]
%k.1 = phi i32 [ %inc26, %if.then25 ], [ %k.080, %for.end30.loopexit ]
%spec.select = call i32 @llvm.smax.i32(i32 %k.1, i32 %ans.079)
%ans.2 = select i1 %cmp17.not67, i32 %spec.select, i32 %ans.079
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96
br i1 %exitcond97.not, label %for.end41, label %for.cond16.preheader, !llvm.loop !14
for.end41: ; preds = %for.end30, %entry, %for.cond16.preheader.lr.ph, %for.cond13.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.cond16.preheader.lr.ph ], [ 0, %entry ], [ %ans.2, %for.end30 ]
%k.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.cond16.preheader.lr.ph ], [ 0, %entry ], [ %k.2, %for.end30 ]
%spec.select65 = call i32 @llvm.smax.i32(i32 %k.0.lcssa, i32 %ans.0.lcssa)
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %spec.select65)
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: 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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, d, prev = 0,count = 0;
scanf("%d",&n);
scanf("%d",&d);
int i, j;
char ** arr = (char **)malloc(d*sizeof(char *));
for(i = 0; i < d; i++)
{
arr[i] = (char *)malloc((n+1)*sizeof(char));
scanf("%s",arr[i]);
}
for(i = 0; i < d; i++)
{
for(j = 0; j < n; j++)
if(arr[i][j] == '0')
{
count++;
break;
}
if(j == n)
{
if(count > prev)
prev = count;
count = 0;
}
}
if(prev > count)
printf("%d\n",prev);
else
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10593/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10593/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%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
%d = 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 %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call2 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %if.else
for.cond10.preheader: ; preds = %for.body
%cmp1173 = icmp sgt i32 %6, 0
br i1 %cmp1173, label %for.cond14.preheader.lr.ph, label %if.else
for.cond14.preheader.lr.ph: ; preds = %for.cond10.preheader
%1 = load i32, ptr %n, align 4, !tbaa !5
%.fr = freeze i32 %1
%cmp1569 = icmp sgt i32 %.fr, 0
br i1 %cmp1569, label %for.cond14.preheader.us.preheader, label %if.else
for.cond14.preheader.us.preheader: ; preds = %for.cond14.preheader.lr.ph
%wide.trip.count103 = zext i32 %6 to i64
%wide.trip.count = zext i32 %.fr to i64
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.preheader.us.preheader, %for.end28.us
%indvars.iv100 = phi i64 [ 0, %for.cond14.preheader.us.preheader ], [ %indvars.iv.next101, %for.end28.us ]
%prev.077.us = phi i32 [ 0, %for.cond14.preheader.us.preheader ], [ %prev.2.us, %for.end28.us ]
%count.074.us = phi i32 [ 0, %for.cond14.preheader.us.preheader ], [ %count.2.us, %for.end28.us ]
%arrayidx19.us = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv100
%2 = load ptr, ptr %arrayidx19.us, align 8, !tbaa !9
br label %for.body17.us
for.body17.us: ; preds = %for.cond14.preheader.us, %for.inc26.us
%indvars.iv97 = phi i64 [ 0, %for.cond14.preheader.us ], [ %indvars.iv.next98, %for.inc26.us ]
%arrayidx21.us = getelementptr inbounds i8, ptr %2, i64 %indvars.iv97
%3 = load i8, ptr %arrayidx21.us, align 1, !tbaa !11
%cmp23.us = icmp eq i8 %3, 48
br i1 %cmp23.us, label %if.then.us, label %for.inc26.us
for.inc26.us: ; preds = %for.body17.us
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%exitcond.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count
br i1 %exitcond.not, label %for.end28.us, label %for.body17.us, !llvm.loop !12
if.then.us: ; preds = %for.body17.us
%4 = trunc i64 %indvars.iv97 to i32
%inc25.us = add nsw i32 %count.074.us, 1
br label %for.end28.us
for.end28.us: ; preds = %for.inc26.us, %if.then.us
%j.065.us = phi i32 [ %4, %if.then.us ], [ %.fr, %for.inc26.us ]
%count.1.us = phi i32 [ %inc25.us, %if.then.us ], [ %count.074.us, %for.inc26.us ]
%cmp29.us = icmp eq i32 %j.065.us, %.fr
%spec.select.us = call i32 @llvm.smax.i32(i32 %count.1.us, i32 %prev.077.us)
%count.2.us = select i1 %cmp29.us, i32 0, i32 %count.1.us
%prev.2.us = select i1 %cmp29.us, i32 %spec.select.us, i32 %prev.077.us
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond104.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count103
br i1 %exitcond104.not, label %for.end39, label %for.cond14.preheader.us, !llvm.loop !14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%5 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %5, 1
%conv4 = sext i32 %add to i64
%call6 = call noalias ptr @malloc(i64 noundef %conv4) #6
%arrayidx = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv
store ptr %call6, ptr %arrayidx, align 8, !tbaa !9
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %d, 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.cond10.preheader, !llvm.loop !15
for.end39: ; preds = %for.end28.us
%cmp40 = icmp sgt i32 %prev.2.us, %count.2.us
br i1 %cmp40, label %if.end45, label %if.else
if.else: ; preds = %for.cond14.preheader.lr.ph, %entry, %for.cond10.preheader, %for.end39
%count.0.lcssa110 = phi i32 [ %count.2.us, %for.end39 ], [ 0, %for.cond10.preheader ], [ 0, %entry ], [ 0, %for.cond14.preheader.lr.ph ]
br label %if.end45
if.end45: ; preds = %for.end39, %if.else
%count.0.lcssa110.sink = phi i32 [ %count.0.lcssa110, %if.else ], [ %prev.2.us, %for.end39 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa110.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
|
#include <stdio.h>
int main(void)
{
int x;
scanf("%d",&x);
printf("%d\n", x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_105973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_105973/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(){
int x;
scanf("%d\n",&x);
x=x*x*x;
printf("%d\n",x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
store i32 %mul1, ptr %x, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, 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;
scanf("%d", &x);
printf("%d\n", x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106073/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106073/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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()
{
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106130/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106130/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(){
int x;
scanf("%d", &x);
printf("%d\n", x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106181/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106181/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(){
int x;
scanf("%d\n",&x);
printf("%d\n",x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106224/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106224/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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, 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_106275/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106275/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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,sum;
scanf("%d",&x);
sum=x*x*x;
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106318/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106318/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(){
int x;
int output;
scanf("%d",&x);
output = x*x*x;
printf("%d\n",output);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 sanjou(int);
int main()
{
int nyuuryoku;
scanf("%d",&nyuuryoku);
printf("%d\n",sanjou(nyuuryoku));
return 0;
}
int sanjou(int a)
{
return a*a*a;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106404/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%nyuuryoku = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nyuuryoku) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nyuuryoku)
%0 = load i32, ptr %nyuuryoku, align 4, !tbaa !5
%mul.i = mul nsw i32 %0, %0
%mul1.i = mul nsw i32 %mul.i, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nyuuryoku) #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 nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sanjou(i32 noundef %a) local_unnamed_addr #3 {
entry:
%mul = mul nsw i32 %a, %a
%mul1 = mul nsw i32 %mul, %a
ret i32 %mul1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{int x;
scanf("%d" , &x);
printf("%d\n" , x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106448/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106448/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(){
int x;
scanf("%d",&x);
printf("%d\n",x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106491/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106491/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 x, a;
scanf("%d", &x);
a = pow(x,3);
printf("%d\n", a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%call1 = call double @pow(double noundef %conv, double noundef 3.000000e+00) #4
%conv2 = fptosi double %call1 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv2)
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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a;
scanf("%d",&a);
printf("%d\n",a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, 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 %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a;
while(scanf("%d",&a)!=EOF)
{
printf("%d\n",a*a*a);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106620/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main ()
{
int x;
scanf("%d",&x);
printf("%d\n",x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106664/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106664/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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_106707/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106707/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 , kotae;
scanf("%d", &x);
kotae = x*x*x ;
printf("%d\n",kotae);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_106750/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_106750/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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.