Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> #include <stdlib.h> typedef struct _node{ int key; struct _node *left; struct _node *right; }NODE; NODE* makeNode(int x){ NODE *n=(NODE*)malloc(sizeof(NODE)); n->key=x; n->left=NULL; n->right=NULL; return n; } NODE* insert(NODE *t,int x){ if(t==NULL)return makeNode(x); if(t->key<x)t->right=insert(t->right,x); else t->left=insert(t->left,x); return t; } void inorder(NODE *t){ if(t==NULL)return; if(t->left!=NULL)inorder(t->left); printf(" %d",t->key); if(t->right!=NULL)inorder(t->right); return; } void preorder(NODE *t){ if(t==NULL)return; printf(" %d",t->key); if(t->left!=NULL)preorder(t->left); if(t->right!=NULL)preorder(t->right); return; } void find(NODE *t,int x){ if(t==NULL){ printf("no\n"); return; } if(t->key==x){ printf("yes\n"); return; } else if(t->key<x)find(t->right,x); else find(t->left,x); } int main(void){ NODE *root; root=NULL; int n; scanf("%d\n",&n); char com[6+1]; int x; while(n--){ scanf("%s",com); switch(com[0]){ case 'i': //insert scanf("%d\n",&x); root=insert(root,x); break; case 'p': //print inorder(root); printf("\n"); preorder(root); printf("\n"); break; case 'f': scanf("%d\n",&x); find(root,x); break; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220423/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220423/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr } @.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @str = private unnamed_addr constant [4 x i8] c"yes\00", align 1 @str.6 = private unnamed_addr constant [3 x i8] c"no\00", align 1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable define dso_local noalias ptr @makeNode(i32 noundef %x) local_unnamed_addr #0 { entry: %call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #7 store i32 %x, ptr %call, align 8, !tbaa !5 %left = getelementptr inbounds %struct._node, ptr %call, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false) ret ptr %call } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress 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 ptr @insert(ptr noundef %t, i32 noundef %x) local_unnamed_addr #3 { entry: %cmp = icmp eq ptr %t, null br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %call.i = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #7 store i32 %x, ptr %call.i, align 8, !tbaa !5 %left.i = getelementptr inbounds %struct._node, ptr %call.i, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false) br label %common.ret17 if.end: ; preds = %entry %0 = load i32, ptr %t, align 8, !tbaa !5 %cmp1 = icmp slt i32 %0, %x br i1 %cmp1, label %if.then2, label %if.else common.ret17: ; preds = %if.else, %if.then2, %if.then %common.ret17.op = phi ptr [ %call.i, %if.then ], [ %t, %if.then2 ], [ %t, %if.else ] ret ptr %common.ret17.op if.then2: ; preds = %if.end %right = getelementptr inbounds %struct._node, ptr %t, i64 0, i32 2 %1 = load ptr, ptr %right, align 8, !tbaa !11 %call3 = tail call ptr @insert(ptr noundef %1, i32 noundef %x) store ptr %call3, ptr %right, align 8, !tbaa !11 br label %common.ret17 if.else: ; preds = %if.end %left = getelementptr inbounds %struct._node, ptr %t, i64 0, i32 1 %2 = load ptr, ptr %left, align 8, !tbaa !12 %call5 = tail call ptr @insert(ptr noundef %2, i32 noundef %x) store ptr %call5, ptr %left, align 8, !tbaa !12 br label %common.ret17 } ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %t) local_unnamed_addr #3 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end4, %entry %t.tr = phi ptr [ %t, %entry ], [ %2, %if.end4 ] %cmp = icmp eq ptr %t.tr, null br i1 %cmp, label %return, label %if.end if.end: ; preds = %tailrecurse %left = getelementptr inbounds %struct._node, ptr %t.tr, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !12 %cmp1.not = icmp eq ptr %0, null br i1 %cmp1.not, label %if.end4, label %if.then2 if.then2: ; preds = %if.end tail call void @inorder(ptr noundef nonnull %0) br label %if.end4 if.end4: ; preds = %if.then2, %if.end %1 = load i32, ptr %t.tr, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %right = getelementptr inbounds %struct._node, ptr %t.tr, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !11 %cmp5.not = icmp eq ptr %2, null br i1 %cmp5.not, label %return, label %tailrecurse return: ; preds = %if.end4, %tailrecurse ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %t) local_unnamed_addr #3 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end4, %entry %t.tr = phi ptr [ %t, %entry ], [ %2, %if.end4 ] %cmp = icmp eq ptr %t.tr, null br i1 %cmp, label %return, label %if.end if.end: ; preds = %tailrecurse %0 = load i32, ptr %t.tr, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct._node, ptr %t.tr, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !12 %cmp1.not = icmp eq ptr %1, null br i1 %cmp1.not, label %if.end4, label %if.then2 if.then2: ; preds = %if.end tail call void @preorder(ptr noundef nonnull %1) br label %if.end4 if.end4: ; preds = %if.then2, %if.end %right = getelementptr inbounds %struct._node, ptr %t.tr, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !11 %cmp5.not = icmp eq ptr %2, null br i1 %cmp5.not, label %return, label %tailrecurse return: ; preds = %if.end4, %tailrecurse ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @find(ptr noundef readonly %t, i32 noundef %x) local_unnamed_addr #3 { entry: %cmp18 = icmp eq ptr %t, null br i1 %cmp18, label %if.end9, label %if.end if.end: ; preds = %entry, %if.else %t.tr19 = phi ptr [ %t.tr.be, %if.else ], [ %t, %entry ] %0 = load i32, ptr %t.tr19, align 8, !tbaa !5 %cmp1 = icmp eq i32 %0, %x br i1 %cmp1, label %if.end9, label %if.else if.else: ; preds = %if.end %cmp5 = icmp slt i32 %0, %x %right = getelementptr inbounds %struct._node, ptr %t.tr19, i64 0, i32 2 %left = getelementptr inbounds %struct._node, ptr %t.tr19, i64 0, i32 1 %t.tr.be.in = select i1 %cmp5, ptr %right, ptr %left %t.tr.be = load ptr, ptr %t.tr.be.in, align 8, !tbaa !13 %cmp = icmp eq ptr %t.tr.be, null br i1 %cmp, label %if.end9, label %if.end if.end9: ; preds = %if.end, %if.else, %entry %str.6.sink = phi ptr [ @str.6, %entry ], [ @str.6, %if.else ], [ @str, %if.end ] %puts17 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 %com = alloca [7 x i8], align 1 %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %com) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 %0 = load i32, ptr %n, align 4, !tbaa !14 %dec13 = add nsw i32 %0, -1 store i32 %dec13, ptr %n, align 4, !tbaa !14 %tobool.not14 = icmp eq i32 %0, 0 br i1 %tobool.not14, label %while.end, label %while.body while.body: ; preds = %entry, %sw.epilog %root.015 = phi ptr [ %root.1, %sw.epilog ], [ null, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 1, !tbaa !15 %conv = sext i8 %1 to i32 switch i32 %conv, label %sw.epilog [ i32 105, label %sw.bb i32 112, label %sw.bb4 i32 102, label %sw.bb7 ] sw.bb: ; preds = %while.body %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %x) %2 = load i32, ptr %x, align 4, !tbaa !14 %call3 = call ptr @insert(ptr noundef %root.015, i32 noundef %2) br label %sw.epilog sw.bb4: ; preds = %while.body call void @inorder(ptr noundef %root.015) %putchar = call i32 @putchar(i32 10) call void @preorder(ptr noundef %root.015) %putchar12 = call i32 @putchar(i32 10) br label %sw.epilog sw.bb7: ; preds = %while.body %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %x) %3 = load i32, ptr %x, align 4, !tbaa !14 %cmp18.i = icmp eq ptr %root.015, null br i1 %cmp18.i, label %find.exit, label %if.end.i if.end.i: ; preds = %sw.bb7, %if.else.i %t.tr19.i = phi ptr [ %t.tr.be.i, %if.else.i ], [ %root.015, %sw.bb7 ] %4 = load i32, ptr %t.tr19.i, align 8, !tbaa !5 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %find.exit, label %if.else.i if.else.i: ; preds = %if.end.i %cmp5.i = icmp slt i32 %4, %3 %right.i = getelementptr inbounds %struct._node, ptr %t.tr19.i, i64 0, i32 2 %left.i = getelementptr inbounds %struct._node, ptr %t.tr19.i, i64 0, i32 1 %t.tr.be.in.i = select i1 %cmp5.i, ptr %right.i, ptr %left.i %t.tr.be.i = load ptr, ptr %t.tr.be.in.i, align 8, !tbaa !13 %cmp.i = icmp eq ptr %t.tr.be.i, null br i1 %cmp.i, label %find.exit, label %if.end.i find.exit: ; preds = %if.end.i, %if.else.i, %sw.bb7 %str.6.sink.i = phi ptr [ @str.6, %sw.bb7 ], [ @str, %if.end.i ], [ @str.6, %if.else.i ] %puts17.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink.i) br label %sw.epilog sw.epilog: ; preds = %while.body, %find.exit, %sw.bb4, %sw.bb %root.1 = phi ptr [ %root.015, %while.body ], [ %root.015, %find.exit ], [ %root.015, %sw.bb4 ], [ %call3, %sw.bb ] %5 = load i32, ptr %n, align 4, !tbaa !14 %dec = add nsw i32 %5, -1 store i32 %dec, ptr %n, align 4, !tbaa !14 %tobool.not = icmp eq i32 %5, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !16 while.end: ; preds = %sw.epilog, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %com) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind allocsize(0) } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !6 = !{!"_node", !7, i64 0, !10, i64 8, !10, i64 16} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"any pointer", !8, i64 0} !11 = !{!6, !10, i64 16} !12 = !{!6, !10, i64 8} !13 = !{!10, !10, i64 0} !14 = !{!7, !7, i64 0} !15 = !{!8, !8, i64 0} !16 = distinct !{!16, !17} !17 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; #define NIL NULL Node root; //Node treeMinimum(Node x){ //} Node treeSearch(Node u, int k){ while(u != NULL){ if(k == u->key) return u; else if(k <= u->key){ u = u->left; } else { u = u->right; } } return NULL; } //Node treeSuccessor(Node x){ //} void treeDelete(Node z){ Node y; // node to be deleted Node x; // child of y } void insert(int k){ Node y = NIL; Node x = root; Node z; z = malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(x!=NIL){ y = x; if( z->key < x->key ) x = x->left; else x = x->right; } z->parent = y; if(y==NIL) root = z; else if(z->key<y->key) y->left = z; else y->right = z; } void inorder(Node u){ if(u != NIL){ inorder(u->left); printf(" %d",u->key); inorder(u->right); } } void preorder(Node u){ if(u != NIL){ printf(" %d",u->key); preorder(u->left); preorder(u->right); } } int main(){ int n, i, x; char com[20]; scanf("%d", &n); for ( i = 0; i < n; i++ ){ scanf("%s", com); if ( com[0] == 'f' ){ scanf("%d", &x); Node t = treeSearch(root, x); if ( t != NIL ) printf("yes\n"); else printf("no\n"); } else if ( com[0] == 'i' ){ scanf("%d", &x); insert(x); } else if ( com[0] == 'p' ){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if ( com[0] == 'd' ){ scanf("%d", &x); treeDelete(treeSearch(root, x)); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220467/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220467/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 { entry: %cmp.not13 = icmp eq ptr %u, null br i1 %cmp.not13, label %return, label %while.body while.body: ; preds = %entry, %if.else %u.addr.014 = phi ptr [ %u.addr.1, %if.else ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.addr.014, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %return, label %if.else if.else: ; preds = %while.body %cmp3.not = icmp slt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %u.addr.014, i64 0, i32 1 %u.addr.1.in = select i1 %cmp3.not, ptr %u.addr.014, ptr %left %u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %u.addr.1, null br i1 %cmp.not, label %return, label %while.body, !llvm.loop !12 return: ; preds = %while.body, %if.else, %entry %u.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %if.else ], [ %u.addr.014, %while.body ] ret ptr %u.addr.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #1 { entry: ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #3 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !11 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !5 %cmp.not34 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false) br i1 %cmp.not34, label %if.then7, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %1 = load i32, ptr %key2, align 8, !tbaa !5 %cmp3 = icmp sgt i32 %1, %k %left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !14 if.then7: ; preds = %entry %parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr null, ptr %parent37, align 8, !tbaa !15 br label %if.end17 if.else8: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.035, ptr %parent, align 8, !tbaa !15 %key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %2 = load i32, ptr %key10, align 8, !tbaa !5 %cmp11 = icmp sgt i32 %2, %k %left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %spec.select = select i1 %cmp11, ptr %left13, ptr %x.035 br label %if.end17 if.end17: ; preds = %if.else8, %if.then7 %left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ] store ptr %call, ptr %left13.sink, align 8, !tbaa !11 ret void } ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #3 { entry: %cmp.not4 = icmp eq ptr %u, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ] %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !16 tail call void @inorder(ptr noundef %0) %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !17 %cmp.not = icmp eq ptr %2, null 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 #5 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #3 { entry: %cmp.not4 = icmp eq ptr %u, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !16 tail call void @preorder(ptr noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !17 %cmp.not = icmp eq ptr %2, null 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 i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !18 %cmp59 = icmp sgt i32 %0, 0 br i1 %cmp59, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.060 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !19 switch i8 %1, label %for.inc [ i8 102, label %if.then i8 105, label %if.then16 i8 112, label %if.then23 i8 100, label %if.then31 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load ptr, ptr @root, align 8, !tbaa !11 %3 = load i32, ptr %x, align 4, !tbaa !18 %cmp.not13.i = icmp eq ptr %2, null br i1 %cmp.not13.i, label %if.else, label %while.body.i while.body.i: ; preds = %if.then, %if.else.i %u.addr.014.i = phi ptr [ %u.addr.1.i, %if.else.i ], [ %2, %if.then ] %key.i = getelementptr inbounds %struct.node, ptr %u.addr.014.i, i64 0, i32 3 %4 = load i32, ptr %key.i, align 8, !tbaa !5 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %if.then8, label %if.else.i if.else.i: ; preds = %while.body.i %cmp3.not.i = icmp slt i32 %4, %3 %left.i = getelementptr inbounds %struct.node, ptr %u.addr.014.i, i64 0, i32 1 %u.addr.1.in.i = select i1 %cmp3.not.i, ptr %u.addr.014.i, ptr %left.i %u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !11 %cmp.not.i = icmp eq ptr %u.addr.1.i, null br i1 %cmp.not.i, label %if.else, label %while.body.i, !llvm.loop !12 if.then8: ; preds = %while.body.i %puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else: ; preds = %if.else.i, %if.then %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc if.then16: ; preds = %for.body %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %5 = load i32, ptr %x, align 4, !tbaa !18 %6 = load ptr, ptr @root, align 8, !tbaa !11 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 %key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %5, ptr %key.i41, align 8, !tbaa !5 %cmp.not34.i = icmp eq ptr %6, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false) br i1 %cmp.not34.i, label %insert.exit, label %while.body.i42 while.body.i42: ; preds = %if.then16, %while.body.i42 %x.035.i = phi ptr [ %x.1.i, %while.body.i42 ], [ %6, %if.then16 ] %key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3 %7 = load i32, ptr %key2.i, align 8, !tbaa !5 %cmp3.i = icmp sgt i32 %7, %5 %left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11 %cmp.not.i43 = icmp eq ptr %x.1.i, null br i1 %cmp.not.i43, label %insert.exit, label %while.body.i42, !llvm.loop !14 insert.exit: ; preds = %while.body.i42, %if.then16 %.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i42 ] %left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i42 ] %parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %.sink, ptr %parent37.i, align 8, !tbaa !15 store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !11 br label %for.inc if.then23: ; preds = %for.body %8 = load ptr, ptr @root, align 8, !tbaa !11 call void @inorder(ptr noundef %8) %putchar = call i32 @putchar(i32 10) %9 = load ptr, ptr @root, align 8, !tbaa !11 call void @preorder(ptr noundef %9) %putchar39 = call i32 @putchar(i32 10) br label %for.inc if.then31: ; preds = %for.body %call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) br label %for.inc for.inc: ; preds = %if.then31, %for.body, %if.then8, %if.else, %if.then23, %insert.exit %inc = add nuw nsw i32 %i.060, 1 %10 = load i32, ptr %n, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %10 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7 attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nounwind allocsize(0) } 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, !10, i64 24} !6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24} !7 = !{!"any pointer", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"int", !8, i64 0} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13} !15 = !{!6, !7, i64 16} !16 = !{!6, !7, i64 8} !17 = !{!6, !7, i64 0} !18 = !{!10, !10, i64 0} !19 = !{!8, !8, i64 0} !20 = distinct !{!20, !13}
#include<stdio.h> #include<math.h> int main() { long long int n,x1,l,ans; scanf("%lld",&n); x1=(-1+sqrt(1+8*n))/2; l=n-(x1*(x1+1))/2; if(l>0) ans=l; else ans=x1; printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22051/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22051/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %mul = shl nsw i64 %0, 3 %add = or i64 %mul, 1 %conv = sitofp i64 %add to double %call1 = call double @sqrt(double noundef %conv) #4 %add2 = fadd double %call1, -1.000000e+00 %div = fmul double %add2, 5.000000e-01 %conv3 = fptosi double %div to i64 %1 = load i64, ptr %n, align 8, !tbaa !5 %add4 = add nsw i64 %conv3, 1 %mul5 = mul nsw i64 %add4, %conv3 %div6.neg = sdiv i64 %mul5, -2 %sub = add i64 %div6.neg, %1 %cmp = icmp sgt i64 %sub, 0 %sub.conv3 = select i1 %cmp, i64 %sub, i64 %conv3 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.conv3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #define NIL NULL struct node{ int key; struct node *r; struct node *l; struct node *p; }; typedef struct node * Node; Node root; void insert(int v){ Node y=NIL; Node x=root; Node z; z=malloc(sizeof(struct node)); z->key=v; z->l=NIL; z->r=NIL; while(x!=NIL){ y=x; if(z->key < x->key) x=x->l; else x=x->r; } z->p=y; if(y==NIL) root=z; else if(z->key < y->key) y->l=z; else y->r=z; } void inorder(Node u){ if(u!=NIL){ inorder(u->l); printf(" %d",u->key); inorder(u->r); } } void preorder(Node u){ if(u!=NIL){ printf(" %d",u->key); preorder(u->l); preorder(u->r); } } Node find(Node a,int k){ if (a==NIL || k==a->key) return a; if(k < a->key) return find(a->l,k); else return find(a->r,k); } int main(){ int n,i,x; char com[20]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",com); if(com[0]=='i'){ scanf("%d",&x); insert(x); } else if(com[0]=='p'){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if(com[0]=='f'){ scanf("%d",&x); Node s=find(root,x); if(s!=NIL) printf("yes\n"); else printf("no\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220553/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220553/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 void @insert(i32 noundef %v) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !5 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 store i32 %v, ptr %call, align 8, !tbaa !9 %r = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 %cmp.not34 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %r, i8 0, i64 16, i1 false) br i1 %cmp.not34, label %if.then7, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %1 = load i32, ptr %x.035, align 8, !tbaa !9 %cmp3 = icmp sgt i32 %1, %v %l4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2 %r5 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %l4, ptr %r5 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12 if.then7: ; preds = %entry %p37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store ptr null, ptr %p37, align 8, !tbaa !14 br label %if.end17 if.else8: ; preds = %while.body %p = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store ptr %x.035, ptr %p, align 8, !tbaa !14 %2 = load i32, ptr %x.035, align 8, !tbaa !9 %cmp11 = icmp sgt i32 %2, %v br i1 %cmp11, label %if.then12, label %if.else14 if.then12: ; preds = %if.else8 %l13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2 br label %if.end17 if.else14: ; preds = %if.else8 %r15 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 br label %if.end17 if.end17: ; preds = %if.then12, %if.else14, %if.then7 %l13.sink = phi ptr [ %l13, %if.then12 ], [ %r15, %if.else14 ], [ @root, %if.then7 ] store ptr %call, ptr %l13.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress 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 @inorder(ptr noundef readonly %u) local_unnamed_addr #0 { entry: %cmp.not4 = icmp eq ptr %u, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ] %l = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 2 %0 = load ptr, ptr %l, align 8, !tbaa !15 tail call void @inorder(ptr noundef %0) %1 = load i32, ptr %u.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %r = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %2 = load ptr, ptr %r, align 8, !tbaa !16 %cmp.not = icmp eq ptr %2, null 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 #3 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 { entry: %cmp.not4 = icmp eq ptr %u, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ] %0 = load i32, ptr %u.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %l = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 2 %1 = load ptr, ptr %l, align 8, !tbaa !15 tail call void @preorder(ptr noundef %1) %r = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %2 = load ptr, ptr %r, align 8, !tbaa !16 %cmp.not = icmp eq ptr %2, null br i1 %cmp.not, label %if.end, label %if.then if.end: ; preds = %if.then, %entry ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %a, i32 noundef %k) local_unnamed_addr #4 { entry: %cmp14 = icmp eq ptr %a, null br i1 %cmp14, label %return, label %lor.lhs.false lor.lhs.false: ; preds = %entry, %if.end %a.tr15 = phi ptr [ %a.tr.be, %if.end ], [ %a, %entry ] %0 = load i32, ptr %a.tr15, align 8, !tbaa !9 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %return, label %if.end if.end: ; preds = %lor.lhs.false %cmp3 = icmp sgt i32 %0, %k %l = getelementptr inbounds %struct.node, ptr %a.tr15, i64 0, i32 2 %r = getelementptr inbounds %struct.node, ptr %a.tr15, i64 0, i32 1 %a.tr.be.in = select i1 %cmp3, ptr %l, ptr %r %a.tr.be = load ptr, ptr %a.tr.be.in, align 8, !tbaa !5 %cmp = icmp eq ptr %a.tr.be, null br i1 %cmp, label %return, label %lor.lhs.false return: ; preds = %lor.lhs.false, %if.end, %entry %retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %a.tr15, %lor.lhs.false ] ret ptr %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !17 %cmp36 = icmp sgt i32 %0, 0 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.037 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !18 switch i8 %1, label %for.inc [ i8 105, label %if.then i8 112, label %if.then9 i8 102, label %if.then17 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load i32, ptr %x, align 4, !tbaa !17 %3 = load ptr, ptr @root, align 8, !tbaa !5 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 store i32 %2, ptr %call.i, align 8, !tbaa !9 %r.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1 %cmp.not34.i = icmp eq ptr %3, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %r.i, i8 0, i64 16, i1 false) br i1 %cmp.not34.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ] %4 = load i32, ptr %x.035.i, align 8, !tbaa !9 %cmp3.i = icmp sgt i32 %4, %2 %l4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 2 %r5.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i, ptr %l4.i, ptr %r5.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12 insert.exit: ; preds = %while.body.i, %if.then %x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ] %l13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ] %p.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store ptr %x.035.i.lcssa.sink, ptr %p.i, align 8, !tbaa !14 store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !5 br label %for.inc if.then9: ; preds = %for.body %5 = load ptr, ptr @root, align 8, !tbaa !5 call void @inorder(ptr noundef %5) %putchar = call i32 @putchar(i32 10) %6 = load ptr, ptr @root, align 8, !tbaa !5 call void @preorder(ptr noundef %6) %putchar31 = call i32 @putchar(i32 10) br label %for.inc if.then17: ; preds = %for.body %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %7 = load ptr, ptr @root, align 8, !tbaa !5 %8 = load i32, ptr %x, align 4, !tbaa !17 %cmp14.i = icmp eq ptr %7, null br i1 %cmp14.i, label %if.else24, label %lor.lhs.false.i lor.lhs.false.i: ; preds = %if.then17, %if.end.i %a.tr15.i = phi ptr [ %a.tr.be.i, %if.end.i ], [ %7, %if.then17 ] %9 = load i32, ptr %a.tr15.i, align 8, !tbaa !9 %cmp1.i = icmp eq i32 %9, %8 br i1 %cmp1.i, label %if.then22, label %if.end.i if.end.i: ; preds = %lor.lhs.false.i %cmp3.i32 = icmp sgt i32 %9, %8 %l.i = getelementptr inbounds %struct.node, ptr %a.tr15.i, i64 0, i32 2 %r.i33 = getelementptr inbounds %struct.node, ptr %a.tr15.i, i64 0, i32 1 %a.tr.be.in.i = select i1 %cmp3.i32, ptr %l.i, ptr %r.i33 %a.tr.be.i = load ptr, ptr %a.tr.be.in.i, align 8, !tbaa !5 %cmp.i = icmp eq ptr %a.tr.be.i, null br i1 %cmp.i, label %if.else24, label %lor.lhs.false.i if.then22: ; preds = %lor.lhs.false.i %puts30 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else24: ; preds = %if.end.i, %if.then17 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %if.then22, %if.else24, %for.body, %insert.exit, %if.then9 %inc = add nuw nsw i32 %i.037, 1 %10 = load i32, ptr %n, align 4, !tbaa !17 %cmp = icmp slt i32 %inc, %10 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree 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 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind allocsize(0) } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 0} !10 = !{!"node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!10, !6, i64 24} !15 = !{!10, !6, i64 16} !16 = !{!10, !6, i64 8} !17 = !{!11, !11, i64 0} !18 = !{!7, !7, i64 0} !19 = distinct !{!19, !13}
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { struct node *parent; struct node *child[2]; int key; }; void Insert(struct node **root, struct node *p){ struct node *y = NULL; struct node *x = *root; while(x!=NULL){ y = x; if(p->key<x->key){ x = x->child[0]; }else{ x = x->child[1]; } } p->parent = y; if(y==NULL){ *root = p; }else if(p->key<y->key){ y->child[0] = p; }else{ y->child[1] = p; } } int find(struct node *root, int p){ if(root==NULL){ return 0; }else if(root->key==p){ return 1; }else if(root->key>p){ return find(root->child[0],p); }else if(root->key<p){ return find(root->child[1],p); } return -1; } /* void calcDepth(int num){ int i; for(i=0;i<2;i++){ if(tree[num].child[i] == -1){ continue; } tree[tree[num].child[i]].depth = tree[num].depth + 1; calcDepth(tree[num].child[i]); } return; } */ /* int calcHeight(int num){ int i; int temp; int h = -1; if(num==-1){ return -1; } for(i=0;i<2;i++){ temp = calcHeight(tree[num].child[i]); h = (h>temp?h:temp); } tree[num].height = h + 1; return tree[num].height; } */ void Preorder(struct node *p){ printf(" %d",p->key); if(p->child[0]==NULL){ if(p->child[1]==NULL){ return; }else{ Preorder(p->child[1]); } return; } Preorder(p->child[0]); if(p->child[1]==NULL){ return; } Preorder(p->child[1]); return; } void Inorder(struct node *p){ if(p->child[0]==NULL&&p->child[1]==NULL){ printf(" %d",p->key); return; }else if(p->child[0]==NULL&&p->child[1]!=NULL){ printf(" %d",p->key); Inorder(p->child[1]); }else if(p->child[0]!=NULL&&p->child[1]==NULL){ Inorder(p->child[0]); printf(" %d",p->key); }else{ Inorder(p->child[0]); printf(" %d",p->key); Inorder(p->child[1]); } return; } /* void Postorder(struct node *p){ if(p->child[0]==NULL&&p->child[1]==NULL){ printf(" %d",p->key); return; }else if(p->child[0]==NULL&&p->child[1]!=NULL){ Postorder(p->child[1]); }else if(p->child[0]!=NULL&&p->child[1]==NULL){ Postorder(p->child[0]); }else{ Postorder(p->child[0]); Postorder(p->child[1]); printf(" %d",p->key); } } */ int main(){ int n; struct node *root = NULL; struct node *temp; int temp1; int i,j; char order[32]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",order); if(strcmp(order,"insert")==0){ temp = (struct node *)malloc(sizeof(struct node)); scanf("%d",&temp->key); temp->parent = NULL; temp->child[0] = NULL; temp->child[1] = NULL; Insert(&root,temp); }else if(strcmp(order,"print")==0){ Inorder(root); printf("\n"); Preorder(root); printf("\n"); }else if(strcmp(order,"find")==0){ scanf("%d",&temp1); j = find(root,temp1); if(j==1){ printf("yes\n"); }else if(j==0){ printf("no\n"); } } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220618/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220618/source.c" target datalayout = "e-m:e-p270: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 { ptr, [2 x ptr], i32 } @.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 [3 x i8] c"%s\00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"insert\00", align 1 @.str.4 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.6 = private unnamed_addr constant [5 x i8] c"find\00", align 1 @str = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.9 = private unnamed_addr constant [4 x i8] c"yes\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @Insert(ptr nocapture noundef %root, ptr noundef %p) local_unnamed_addr #0 { entry: %x.033 = load ptr, ptr %root, align 8, !tbaa !5 %cmp.not34 = icmp eq ptr %x.033, null br i1 %cmp.not34, label %if.then6, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %key = getelementptr inbounds %struct.node, ptr %p, i64 0, i32 2 %0 = load i32, ptr %key, align 8, !tbaa !9 br label %while.body while.body: ; preds = %while.body.lr.ph, %while.body %x.035 = phi ptr [ %x.033, %while.body.lr.ph ], [ %x.0, %while.body ] %key1 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2 %1 = load i32, ptr %key1, align 8, !tbaa !9 %cmp2 = icmp slt i32 %0, %1 %child = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %arrayidx4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1, i64 1 %x.1.in = select i1 %cmp2, ptr %child, ptr %arrayidx4 %x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.0, null br i1 %cmp.not, label %if.else7, label %while.body, !llvm.loop !12 if.then6: ; preds = %entry store ptr null, ptr %p, align 8, !tbaa !14 br label %if.end18 if.else7: ; preds = %while.body store ptr %x.035, ptr %p, align 8, !tbaa !14 %key8 = getelementptr inbounds %struct.node, ptr %p, i64 0, i32 2 %2 = load i32, ptr %key8, align 8, !tbaa !9 %key9 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2 %3 = load i32, ptr %key9, align 8, !tbaa !9 %cmp10 = icmp slt i32 %2, %3 br i1 %cmp10, label %if.then11, label %if.else14 if.then11: ; preds = %if.else7 %child12 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 br label %if.end18 if.else14: ; preds = %if.else7 %arrayidx16 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1, i64 1 br label %if.end18 if.end18: ; preds = %if.then11, %if.else14, %if.then6 %child12.sink = phi ptr [ %child12, %if.then11 ], [ %arrayidx16, %if.else14 ], [ %root, %if.then6 ] store ptr %p, ptr %child12.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @find(ptr noundef readonly %root, i32 noundef %p) local_unnamed_addr #2 { entry: %cmp26 = icmp eq ptr %root, null br i1 %cmp26, label %return, label %if.else if.else: ; preds = %entry, %tailrecurse.backedge %root.tr27 = phi ptr [ %root.tr.be, %tailrecurse.backedge ], [ %root, %entry ] %key = getelementptr inbounds %struct.node, ptr %root.tr27, i64 0, i32 2 %0 = load i32, ptr %key, align 8, !tbaa !9 %cmp1 = icmp eq i32 %0, %p br i1 %cmp1, label %return, label %if.else3 if.else3: ; preds = %if.else %cmp5 = icmp sgt i32 %0, %p br i1 %cmp5, label %if.then6, label %if.else7 if.then6: ; preds = %if.else3 %child = getelementptr inbounds %struct.node, ptr %root.tr27, i64 0, i32 1 br label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.then6, %if.then10 %root.tr.be.in = phi ptr [ %child, %if.then6 ], [ %arrayidx12, %if.then10 ] %root.tr.be = load ptr, ptr %root.tr.be.in, align 8, !tbaa !5 %cmp = icmp eq ptr %root.tr.be, null br i1 %cmp, label %return, label %if.else if.else7: ; preds = %if.else3 %cmp9 = icmp slt i32 %0, %p br i1 %cmp9, label %if.then10, label %return if.then10: ; preds = %if.else7 %arrayidx12 = getelementptr inbounds %struct.node, ptr %root.tr27, i64 0, i32 1, i64 1 br label %tailrecurse.backedge return: ; preds = %tailrecurse.backedge, %if.else, %if.else7, %entry %retval.0 = phi i32 [ 0, %entry ], [ -1, %if.else7 ], [ 1, %if.else ], [ 0, %tailrecurse.backedge ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @Preorder(ptr nocapture noundef readonly %p) local_unnamed_addr #3 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %p.tr = phi ptr [ %p, %entry ], [ %p.tr.be, %tailrecurse.backedge ] %key = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2 %0 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %child = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1 %1 = load ptr, ptr %child, align 8, !tbaa !5 %cmp = icmp eq ptr %1, null br i1 %cmp, label %if.then, label %if.end7 if.then: ; preds = %tailrecurse %arrayidx2 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1, i64 1 %2 = load ptr, ptr %arrayidx2, align 8, !tbaa !5 %cmp3 = icmp eq ptr %2, null br i1 %cmp3, label %return, label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.then, %if.end7 %p.tr.be = phi ptr [ %2, %if.then ], [ %3, %if.end7 ] br label %tailrecurse if.end7: ; preds = %tailrecurse tail call void @Preorder(ptr noundef nonnull %1) %arrayidx11 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1, i64 1 %3 = load ptr, ptr %arrayidx11, align 8, !tbaa !5 %cmp12 = icmp eq ptr %3, null br i1 %cmp12, label %return, label %tailrecurse.backedge return: ; preds = %if.end7, %if.then ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @Inorder(ptr nocapture noundef readonly %p) local_unnamed_addr #3 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %p.tr = phi ptr [ %p, %entry ], [ %p.tr.be, %tailrecurse.backedge ] %child = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1 %0 = load ptr, ptr %child, align 8, !tbaa !5 %cmp = icmp eq ptr %0, null %arrayidx2 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1, i64 1 %1 = load ptr, ptr %arrayidx2, align 8, !tbaa !5 %cmp3 = icmp eq ptr %1, null br i1 %cmp, label %land.lhs.true, label %land.lhs.true20 land.lhs.true: ; preds = %tailrecurse br i1 %cmp3, label %common.ret, label %if.then11 if.then11: ; preds = %land.lhs.true %key12 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2 %2 = load i32, ptr %key12, align 8, !tbaa !9 %call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2) br label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.then11, %if.else29 %p.tr.be.in = phi ptr [ %arrayidx2, %if.then11 ], [ %arrayidx35, %if.else29 ] %p.tr.be = load ptr, ptr %p.tr.be.in, align 8, !tbaa !5 br label %tailrecurse land.lhs.true20: ; preds = %tailrecurse tail call void @Inorder(ptr noundef nonnull %0) br i1 %cmp3, label %common.ret, label %if.else29 common.ret: ; preds = %land.lhs.true20, %land.lhs.true %key = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2 %3 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3) ret void if.else29: ; preds = %land.lhs.true20 %key32 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2 %4 = load i32, ptr %key32, align 8, !tbaa !9 %call33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4) %arrayidx35 = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1, i64 1 br label %tailrecurse.backedge } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 %root = alloca ptr, align 8 %temp1 = alloca i32, align 4 %order = alloca [32 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %root) store ptr null, ptr %root, align 8, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp1) #9 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %order) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !15 %cmp52 = icmp sgt i32 %0, 0 br i1 %cmp52, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.053 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %order) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %order, ptr noundef nonnull dereferenceable(7) @.str.3, i64 7) %cmp4 = icmp eq i32 %bcmp, 0 br i1 %cmp4, label %if.then, label %if.else if.then: ; preds = %for.body %call5 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10 %key = getelementptr inbounds %struct.node, ptr %call5, i64 0, i32 2 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %key) call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %call5, i8 0, i64 24, i1 false) %root.0.root.0.root.0.x.033.i = load ptr, ptr %root, align 8, !tbaa !5 %cmp.not34.i = icmp eq ptr %root.0.root.0.root.0.x.033.i, null br i1 %cmp.not34.i, label %Insert.exit, label %while.body.lr.ph.i while.body.lr.ph.i: ; preds = %if.then %1 = load i32, ptr %key, align 8, !tbaa !9 br label %while.body.i while.body.i: ; preds = %while.body.i, %while.body.lr.ph.i %x.035.i = phi ptr [ %root.0.root.0.root.0.x.033.i, %while.body.lr.ph.i ], [ %x.0.i, %while.body.i ] %key1.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 2 %2 = load i32, ptr %key1.i, align 8, !tbaa !9 %cmp2.i = icmp slt i32 %1, %2 %child.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %arrayidx4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1, i64 1 %x.1.in.i = select i1 %cmp2.i, ptr %child.i, ptr %arrayidx4.i %x.0.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %x.0.i, null br i1 %cmp.not.i, label %Insert.exit, label %while.body.i, !llvm.loop !12 Insert.exit: ; preds = %while.body.i, %if.then %storemerge = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ] %child12.sink.i = phi ptr [ %root, %if.then ], [ %x.1.in.i, %while.body.i ] store ptr %storemerge, ptr %call5, align 8, !tbaa !14 store ptr %call5, ptr %child12.sink.i, align 8, !tbaa !5 br label %for.inc if.else: ; preds = %for.body %bcmp39 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %order, ptr noundef nonnull dereferenceable(6) @.str.4, i64 6) %cmp11 = icmp eq i32 %bcmp39, 0 br i1 %cmp11, label %if.then12, label %if.else15 if.then12: ; preds = %if.else %root.0.root.0.root.0. = load ptr, ptr %root, align 8, !tbaa !5 call void @Inorder(ptr noundef %root.0.root.0.root.0.) %putchar = call i32 @putchar(i32 10) call void @Preorder(ptr noundef %root.0.root.0.root.0.) %putchar42 = call i32 @putchar(i32 10) br label %for.inc if.else15: ; preds = %if.else %bcmp40 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %order, ptr noundef nonnull dereferenceable(5) @.str.6, i64 5) %cmp18 = icmp eq i32 %bcmp40, 0 br i1 %cmp18, label %if.then19, label %for.inc if.then19: ; preds = %if.else15 %call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %temp1) %root.0.root.0.root.0.48 = load ptr, ptr %root, align 8, !tbaa !5 %3 = load i32, ptr %temp1, align 4, !tbaa !15 %cmp26.i = icmp eq ptr %root.0.root.0.root.0.48, null br i1 %cmp26.i, label %if.then27, label %if.else.i if.else.i: ; preds = %if.then19, %tailrecurse.backedge.i %root.tr27.i = phi ptr [ %root.tr.be.i, %tailrecurse.backedge.i ], [ %root.0.root.0.root.0.48, %if.then19 ] %key.i43 = getelementptr inbounds %struct.node, ptr %root.tr27.i, i64 0, i32 2 %4 = load i32, ptr %key.i43, align 8, !tbaa !9 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %if.then23, label %if.else3.i if.else3.i: ; preds = %if.else.i %cmp5.i = icmp sgt i32 %4, %3 br i1 %cmp5.i, label %if.then6.i45, label %if.else7.i44 if.then6.i45: ; preds = %if.else3.i %child.i46 = getelementptr inbounds %struct.node, ptr %root.tr27.i, i64 0, i32 1 br label %tailrecurse.backedge.i tailrecurse.backedge.i: ; preds = %if.then10.i, %if.then6.i45 %root.tr.be.in.i = phi ptr [ %child.i46, %if.then6.i45 ], [ %arrayidx12.i, %if.then10.i ] %root.tr.be.i = load ptr, ptr %root.tr.be.in.i, align 8, !tbaa !5 %cmp.i = icmp eq ptr %root.tr.be.i, null br i1 %cmp.i, label %if.then27, label %if.else.i if.else7.i44: ; preds = %if.else3.i %cmp9.i = icmp slt i32 %4, %3 br i1 %cmp9.i, label %if.then10.i, label %for.inc if.then10.i: ; preds = %if.else7.i44 %arrayidx12.i = getelementptr inbounds %struct.node, ptr %root.tr27.i, i64 0, i32 1, i64 1 br label %tailrecurse.backedge.i if.then23: ; preds = %if.else.i %puts41 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9) br label %for.inc if.then27: ; preds = %tailrecurse.backedge.i, %if.then19 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %if.else7.i44, %Insert.exit, %if.else15, %if.then27, %if.then23, %if.then12 %inc = add nuw nsw i32 %i.053, 1 %5 = load i32, ptr %n, align 4, !tbaa !15 %cmp = icmp slt i32 %inc, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %order) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp1) #9 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %root) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6 ; 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 nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind willreturn memory(argmem: read) } attributes #7 = { nofree nounwind } attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 24} !10 = !{!"node", !6, i64 0, !7, i64 8, !11, i64 24} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!10, !6, i64 0} !15 = !{!11, !11, i64 0} !16 = distinct !{!16, !13}
#include<stdio.h> #include<stdlib.h> #define NIL NULL struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; Node root; Node find(Node u,int k){ if(u==NIL||u->key==k) return u; if(u->key > k) return find(u->left,k); else return find(u->right,k); } void insert(int k){ Node y = NIL; Node x = root; Node z; z =malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(x!=NIL){ y=x; if(z->key < x->key)x=x->left; else x=x->right; } z->parent=y; if(y==NIL)root=z; else if(z->key <y->key) y->left=z; else y->right=z; } void inorder(Node u){ if(u->left!=NIL) inorder(u->left); printf(" %d",u->key); if(u->right!=NIL) inorder(u->right); } void preorder(Node u){ if(u!=NIL) printf(" %d",u->key); if(u->left!=NIL) preorder(u->left); if(u->right!=NIL) preorder(u->right); } int main(){ int n, i, x; char com[20]; scanf("%d", &n); for ( i = 0; i < n; i++ ){ scanf("%s", com); if ( com[0] == 'f' ){ scanf("%d", &x); Node t = find(root, x); if ( t != NIL ) printf("yes\n"); else printf("no\n"); } if ( com[0] == 'i' ){ scanf("%d", &x); insert(x); } else if ( com[0] == 'p' ){ inorder(root); printf("\n"); preorder(root); printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220669/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220669/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 { entry: %cmp14 = icmp eq ptr %u, null br i1 %cmp14, label %return, label %lor.lhs.false lor.lhs.false: ; preds = %entry, %if.end %u.tr15 = phi ptr [ %u.tr.be, %if.end ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %return, label %if.end if.end: ; preds = %lor.lhs.false %cmp3 = icmp sgt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 1 %spec.select = select i1 %cmp3, ptr %left, ptr %u.tr15 %u.tr.be = load ptr, ptr %spec.select, align 8, !tbaa !11 %cmp = icmp eq ptr %u.tr.be, null br i1 %cmp, label %return, label %lor.lhs.false return: ; preds = %lor.lhs.false, %if.end, %entry %retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %u.tr15, %lor.lhs.false ] ret ptr %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !11 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !5 %cmp.not34 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false) br i1 %cmp.not34, label %if.then7, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %1 = load i32, ptr %key2, align 8, !tbaa !5 %cmp3 = icmp sgt i32 %1, %k %left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12 if.then7: ; preds = %entry %parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr null, ptr %parent37, align 8, !tbaa !14 br label %if.end17 if.else8: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.035, ptr %parent, align 8, !tbaa !14 %key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %2 = load i32, ptr %key10, align 8, !tbaa !5 %cmp11 = icmp sgt i32 %2, %k %left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %spec.select = select i1 %cmp11, ptr %left13, ptr %x.035 br label %if.end17 if.end17: ; preds = %if.else8, %if.then7 %left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ] store ptr %call, ptr %left13.sink, align 8, !tbaa !11 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr nocapture noundef readonly %u) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %u.tr = phi ptr [ %u, %entry ], [ %2, %if.end ] %left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !15 %cmp.not = icmp eq ptr %0, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @inorder(ptr noundef nonnull %0) br label %if.end if.end: ; preds = %if.then, %tailrecurse %key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %2 = load ptr, ptr %u.tr, align 8, !tbaa !16 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end4, %entry %u.tr = phi ptr [ %u, %entry ], [ %2, %if.end4 ] %cmp.not = icmp eq ptr %u.tr, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse %key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) br label %if.end if.end: ; preds = %if.then, %tailrecurse %left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !15 %cmp1.not = icmp eq ptr %1, null br i1 %cmp1.not, label %if.end4, label %if.then2 if.then2: ; preds = %if.end tail call void @preorder(ptr noundef nonnull %1) br label %if.end4 if.end4: ; preds = %if.then2, %if.end %2 = load ptr, ptr %u.tr, align 8, !tbaa !16 %cmp5.not = icmp eq ptr %2, null br i1 %cmp5.not, label %if.end8, label %tailrecurse if.end8: ; preds = %if.end4 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !17 %cmp36 = icmp sgt i32 %0, 0 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.037 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !18 %cmp2 = icmp eq i8 %1, 102 br i1 %cmp2, label %if.then, label %if.end11 if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load ptr, ptr @root, align 8, !tbaa !11 %3 = load i32, ptr %x, align 4, !tbaa !17 %cmp14.i = icmp eq ptr %2, null br i1 %cmp14.i, label %if.end11thread-pre-split, label %lor.lhs.false.i lor.lhs.false.i: ; preds = %if.then, %if.end.i %u.tr15.i = phi ptr [ %u.tr.be.i, %if.end.i ], [ %2, %if.then ] %key.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 3 %4 = load i32, ptr %key.i, align 8, !tbaa !5 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %if.end11thread-pre-split, label %if.end.i if.end.i: ; preds = %lor.lhs.false.i %cmp3.i = icmp sgt i32 %4, %3 %left.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 1 %spec.select.i = select i1 %cmp3.i, ptr %left.i, ptr %u.tr15.i %u.tr.be.i = load ptr, ptr %spec.select.i, align 8, !tbaa !11 %cmp.i = icmp eq ptr %u.tr.be.i, null br i1 %cmp.i, label %if.end11thread-pre-split, label %lor.lhs.false.i if.end11thread-pre-split: ; preds = %if.end.i, %lor.lhs.false.i, %if.then %str.sink = phi ptr [ @str, %if.then ], [ @str.6, %lor.lhs.false.i ], [ @str, %if.end.i ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %.pr = load i8, ptr %com, align 16, !tbaa !18 br label %if.end11 if.end11: ; preds = %if.end11thread-pre-split, %for.body %5 = phi i8 [ %.pr, %if.end11thread-pre-split ], [ %1, %for.body ] switch i8 %5, label %for.inc [ i8 105, label %if.then16 i8 112, label %if.then23 ] if.then16: ; preds = %if.end11 %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %6 = load i32, ptr %x, align 4, !tbaa !17 %7 = load ptr, ptr @root, align 8, !tbaa !11 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key.i31 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %6, ptr %key.i31, align 8, !tbaa !5 %cmp.not34.i = icmp eq ptr %7, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false) br i1 %cmp.not34.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then16, %while.body.i %x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %7, %if.then16 ] %key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3 %8 = load i32, ptr %key2.i, align 8, !tbaa !5 %cmp3.i32 = icmp sgt i32 %8, %6 %left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i32, ptr %left4.i, ptr %x.035.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12 insert.exit: ; preds = %while.body.i, %if.then16 %.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ] %left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ] %parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14 store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !11 br label %for.inc if.then23: ; preds = %if.end11 %9 = load ptr, ptr @root, align 8, !tbaa !11 call void @inorder(ptr noundef %9) %putchar = call i32 @putchar(i32 10) %10 = load ptr, ptr @root, align 8, !tbaa !11 call void @preorder(ptr noundef %10) %putchar30 = call i32 @putchar(i32 10) br label %for.inc for.inc: ; preds = %if.end11, %insert.exit, %if.then23 %inc = add nuw nsw i32 %i.037, 1 %11 = load i32, ptr %n, align 4, !tbaa !17 %cmp = icmp slt i32 %inc, %11 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind allocsize(0) } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !10, i64 24} !6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24} !7 = !{!"any pointer", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"int", !8, i64 0} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!6, !7, i64 16} !15 = !{!6, !7, i64 8} !16 = !{!6, !7, i64 0} !17 = !{!10, !10, i64 0} !18 = !{!8, !8, i64 0} !19 = distinct !{!19, !13}
#include <stdio.h> #include<stdlib.h> struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; #define NIL NULL Node root; void insert(int k){ Node y = NIL; Node x = root; Node z; z = malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(x!=NIL){ y=x; if(z->key < x->key){ x=x->left; } else x=x->right; } z->parent=y; if(y==NIL) root=z; else if(z->key<y->key) y->left=z; else y->right=z; } void inorder(Node u){ if(u->left!=NIL){ inorder(u->left); } printf(" %d",u->key); if(u->right!=NIL){ inorder(u->right); } } void preorder(Node u){ printf(" %d",u->key); if(u->left!=NIL){ preorder(u->left); } if(u->right!=NIL){ preorder(u->right); } } Node find(Node x, int k){ if(x == NIL || k == x->key) return x; if(k < x->key) return find(x->left, k); else return find(x->right, k); } int main(){ int n, i, x, k; char com[20]; scanf("%d", &n); root=NIL; for ( i = 0; i < n; i++ ){ scanf("%s", com); if ( com[0] == 'i' ){ scanf("%d", &x); insert(x); } else if ( com[0] == 'p' ){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if( com[0] == 'f'){ scanf("%d",&x); Node t=find(root,x); if ( t != NIL ) printf("yes\n"); else printf("no\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220711/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220711/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 void @insert(i32 noundef %k) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !5 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !9 %cmp.not34 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false) br i1 %cmp.not34, label %if.then7, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %1 = load i32, ptr %key2, align 8, !tbaa !9 %cmp3 = icmp sgt i32 %1, %k %left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12 if.then7: ; preds = %entry %parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr null, ptr %parent37, align 8, !tbaa !14 br label %if.end17 if.else8: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.035, ptr %parent, align 8, !tbaa !14 %key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %2 = load i32, ptr %key10, align 8, !tbaa !9 %cmp11 = icmp sgt i32 %2, %k %left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %spec.select = select i1 %cmp11, ptr %left13, ptr %x.035 br label %if.end17 if.end17: ; preds = %if.else8, %if.then7 %left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ] store ptr %call, ptr %left13.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress 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 @inorder(ptr nocapture noundef readonly %u) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %u.tr = phi ptr [ %u, %entry ], [ %2, %if.end ] %left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !15 %cmp.not = icmp eq ptr %0, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @inorder(ptr noundef nonnull %0) br label %if.end if.end: ; preds = %if.then, %tailrecurse %key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %2 = load ptr, ptr %u.tr, align 8, !tbaa !16 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr nocapture noundef readonly %u) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %u.tr = phi ptr [ %u, %entry ], [ %2, %if.end ] %key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !15 %cmp.not = icmp eq ptr %1, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @preorder(ptr noundef nonnull %1) br label %if.end if.end: ; preds = %if.then, %tailrecurse %2 = load ptr, ptr %u.tr, align 8, !tbaa !16 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %x, i32 noundef %k) local_unnamed_addr #4 { entry: %cmp14 = icmp eq ptr %x, null br i1 %cmp14, label %return, label %lor.lhs.false lor.lhs.false: ; preds = %entry, %if.end %x.tr15 = phi ptr [ %x.tr.be, %if.end ], [ %x, %entry ] %key = getelementptr inbounds %struct.node, ptr %x.tr15, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !9 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %return, label %if.end if.end: ; preds = %lor.lhs.false %cmp3 = icmp sgt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %x.tr15, i64 0, i32 1 %spec.select = select i1 %cmp3, ptr %left, ptr %x.tr15 %x.tr.be = load ptr, ptr %spec.select, align 8, !tbaa !5 %cmp = icmp eq ptr %x.tr.be, null br i1 %cmp, label %return, label %lor.lhs.false return: ; preds = %lor.lhs.false, %if.end, %entry %retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %x.tr15, %lor.lhs.false ] ret ptr %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) store ptr null, ptr @root, align 8, !tbaa !5 %0 = load i32, ptr %n, align 4, !tbaa !17 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.038 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !18 switch i8 %1, label %for.inc [ i8 105, label %if.then i8 112, label %if.then9 i8 102, label %if.then17 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load i32, ptr %x, align 4, !tbaa !17 %3 = load ptr, ptr @root, align 8, !tbaa !5 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %2, ptr %key.i, align 8, !tbaa !9 %cmp.not34.i = icmp eq ptr %3, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false) br i1 %cmp.not34.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ] %key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3 %4 = load i32, ptr %key2.i, align 8, !tbaa !9 %cmp3.i = icmp sgt i32 %4, %2 %left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12 insert.exit: ; preds = %while.body.i, %if.then %.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ] %left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ] %parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14 store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5 br label %for.inc if.then9: ; preds = %for.body %5 = load ptr, ptr @root, align 8, !tbaa !5 call void @inorder(ptr noundef %5) %putchar = call i32 @putchar(i32 10) %6 = load ptr, ptr @root, align 8, !tbaa !5 call void @preorder(ptr noundef %6) %putchar31 = call i32 @putchar(i32 10) br label %for.inc if.then17: ; preds = %for.body %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %7 = load ptr, ptr @root, align 8, !tbaa !5 %8 = load i32, ptr %x, align 4, !tbaa !17 %cmp14.i = icmp eq ptr %7, null br i1 %cmp14.i, label %if.else24, label %lor.lhs.false.i lor.lhs.false.i: ; preds = %if.then17, %if.end.i %x.tr15.i = phi ptr [ %x.tr.be.i, %if.end.i ], [ %7, %if.then17 ] %key.i32 = getelementptr inbounds %struct.node, ptr %x.tr15.i, i64 0, i32 3 %9 = load i32, ptr %key.i32, align 8, !tbaa !9 %cmp1.i = icmp eq i32 %9, %8 br i1 %cmp1.i, label %if.then22, label %if.end.i if.end.i: ; preds = %lor.lhs.false.i %cmp3.i33 = icmp sgt i32 %9, %8 %left.i = getelementptr inbounds %struct.node, ptr %x.tr15.i, i64 0, i32 1 %spec.select.i34 = select i1 %cmp3.i33, ptr %left.i, ptr %x.tr15.i %x.tr.be.i = load ptr, ptr %spec.select.i34, align 8, !tbaa !5 %cmp.i = icmp eq ptr %x.tr.be.i, null br i1 %cmp.i, label %if.else24, label %lor.lhs.false.i if.then22: ; preds = %lor.lhs.false.i %puts30 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else24: ; preds = %if.end.i, %if.then17 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %if.then22, %if.else24, %for.body, %insert.exit, %if.then9 %inc = add nuw nsw i32 %i.038, 1 %10 = load i32, ptr %n, align 4, !tbaa !17 %cmp = icmp slt i32 %inc, %10 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree 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 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind allocsize(0) } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 24} !10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!10, !6, i64 16} !15 = !{!10, !6, i64 8} !16 = !{!10, !6, i64 0} !17 = !{!11, !11, i64 0} !18 = !{!7, !7, i64 0} !19 = distinct !{!19, !13}
#include <stdio.h> #include <stdlib.h> int get_int() { int n = 0; int sign = 1; int c = getchar_unlocked(); if(c == 45) sign = -1, c = getchar_unlocked(); else if(c < 48 || 57 < c) return c; while(47 < c && c < 58) { n = 10 * n + (c & 0xf); c = getchar_unlocked(); } return n * sign; } int get_str(char *str) { int c; while((c = getchar_unlocked()) > 32) *str++ = (char)c; *str = 0; return c; } void put_int(int n) { if(!n) { putchar_unlocked('0'); return; } if(n < 0) n *= -1, putchar_unlocked('-'); char buf[11]; int i = 0; while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10; while(i--)putchar_unlocked(buf[i]); } void put_str(char *str) { while(*str) putchar_unlocked(*str++); } typedef struct Node { int key; struct Node *left, *right; } Node; typedef struct BST { Node *root; size_t size; } BST; void bst_init(BST *BST) { BST->root = NULL; BST->size = 0; } void bst_insert(BST *BST, int key) { Node *new_node = malloc(sizeof(Node)); new_node->key = key; new_node->left = NULL; new_node->right = NULL; Node *tmp; Node *root = BST->root; while(root != NULL) { tmp = root; if(key < root->key) root = root->left; else root = root->right; } if(BST->size == 0) BST->root = new_node; else if(key < tmp->key) tmp->left = new_node; else tmp->right = new_node; BST->size++; } int bst_find(Node *root, int key) { if(root == NULL) return 0; else if(root->key == key) return 1; else if(root->key > key) return bst_find(root->left, key); else return bst_find(root->right, key); } void bst_inorder(Node *root) { if(root == NULL) return; bst_inorder(root->left); putchar_unlocked(' '); put_int(root->key); bst_inorder(root->right); } void bst_preorder(Node *root) { if(root == NULL) return; putchar_unlocked(' '); put_int(root->key); bst_preorder(root->left); bst_preorder(root->right); } int main(int argc, char **argv) { BST BST; bst_init(&BST); int m = get_int(); int key; char c[8]; for(int i = 0; i < m; ++i) { get_str(c); switch(*c){ case 'i': key = get_int(); bst_insert(&BST, key); break; case 'f': key = get_int(); put_str(bst_find(BST.root, key) ? "yes\n" : "no\n"); break; default: bst_inorder(BST.root); putchar_unlocked('\n'); bst_preorder(BST.root); putchar_unlocked('\n'); break; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220762/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220762/source.c" target datalayout = "e-m:e-p270: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] } %struct.Node = type { i32, ptr, ptr } %struct.BST = type { ptr, i64 } @.str = private unnamed_addr constant [5 x i8] c"yes\0A\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"no\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nounwind uwtable define dso_local i32 @get_int() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8 br label %getchar_unlocked.exit cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %getchar_unlocked.exit getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ] %cmp = icmp eq i32 %cond.i, 45 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %getchar_unlocked.exit %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i19 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i19, align 8, !tbaa !9 %_IO_read_end.i20 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i20, align 8, !tbaa !14 %cmp.not.i21 = icmp ult ptr %5, %6 br i1 %cmp.not.i21, label %cond.false.i25, label %cond.true.i22, !prof !15 cond.true.i22: ; preds = %if.then %call.i23 = tail call i32 @__uflow(ptr noundef nonnull %4) #8 br label %if.end5 cond.false.i25: ; preds = %if.then %incdec.ptr.i26 = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i26, ptr %_IO_read_ptr.i19, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i27 = zext i8 %7 to i32 br label %if.end5 if.else: ; preds = %getchar_unlocked.exit %8 = add i32 %cond.i, -58 %or.cond = icmp ult i32 %8, -10 br i1 %or.cond, label %cleanup, label %if.end5 if.end5: ; preds = %cond.false.i25, %cond.true.i22, %if.else %sign.0 = phi i32 [ 1, %if.else ], [ -1, %cond.true.i22 ], [ -1, %cond.false.i25 ] %c.0 = phi i32 [ %cond.i, %if.else ], [ %call.i23, %cond.true.i22 ], [ %conv3.i27, %cond.false.i25 ] %9 = add i32 %c.0, -48 %10 = icmp ult i32 %9, 10 br i1 %10, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %if.end5 %.pre41 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit38 %11 = phi ptr [ %15, %getchar_unlocked.exit38 ], [ %.pre41, %while.body.preheader ] %c.140 = phi i32 [ %cond.i34, %getchar_unlocked.exit38 ], [ %c.0, %while.body.preheader ] %n.039 = phi i32 [ %add, %getchar_unlocked.exit38 ], [ 0, %while.body.preheader ] %mul = mul nsw i32 %n.039, 10 %and = and i32 %c.140, 15 %add = add nsw i32 %and, %mul %_IO_read_ptr.i29 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 1 %12 = load ptr, ptr %_IO_read_ptr.i29, align 8, !tbaa !9 %_IO_read_end.i30 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 2 %13 = load ptr, ptr %_IO_read_end.i30, align 8, !tbaa !14 %cmp.not.i31 = icmp ult ptr %12, %13 br i1 %cmp.not.i31, label %cond.false.i35, label %cond.true.i32, !prof !15 cond.true.i32: ; preds = %while.body %call.i33 = tail call i32 @__uflow(ptr noundef nonnull %11) #8 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit38 cond.false.i35: ; preds = %while.body %incdec.ptr.i36 = getelementptr inbounds i8, ptr %12, i64 1 store ptr %incdec.ptr.i36, ptr %_IO_read_ptr.i29, align 8, !tbaa !9 %14 = load i8, ptr %12, align 1, !tbaa !16 %conv3.i37 = zext i8 %14 to i32 br label %getchar_unlocked.exit38 getchar_unlocked.exit38: ; preds = %cond.true.i32, %cond.false.i35 %15 = phi ptr [ %.pre, %cond.true.i32 ], [ %11, %cond.false.i35 ] %cond.i34 = phi i32 [ %call.i33, %cond.true.i32 ], [ %conv3.i37, %cond.false.i35 ] %16 = add i32 %cond.i34, -48 %17 = icmp ult i32 %16, 10 br i1 %17, label %while.body, label %while.end, !llvm.loop !17 while.end: ; preds = %getchar_unlocked.exit38, %if.end5 %n.0.lcssa = phi i32 [ 0, %if.end5 ], [ %add, %getchar_unlocked.exit38 ] %mul9 = mul nsw i32 %n.0.lcssa, %sign.0 br label %cleanup cleanup: ; preds = %if.else, %while.end %retval.0 = phi i32 [ %mul9, %while.end ], [ %cond.i, %if.else ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nounwind uwtable define dso_local i32 @get_str(ptr nocapture noundef writeonly %str) local_unnamed_addr #0 { entry: br label %while.cond while.cond: ; preds = %while.body, %entry %str.addr.0 = phi ptr [ %str, %entry ], [ %incdec.ptr, %while.body ] %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %while.cond %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8 br label %getchar_unlocked.exit cond.false.i: ; preds = %while.cond %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %getchar_unlocked.exit getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ] %cmp = icmp sgt i32 %cond.i, 32 br i1 %cmp, label %while.body, label %while.end while.body: ; preds = %getchar_unlocked.exit %conv = trunc i32 %cond.i to i8 %incdec.ptr = getelementptr inbounds i8, ptr %str.addr.0, i64 1 store i8 %conv, ptr %str.addr.0, align 1, !tbaa !16 br label %while.cond, !llvm.loop !19 while.end: ; preds = %getchar_unlocked.exit store i8 0, ptr %str.addr.0, align 1, !tbaa !16 ret i32 %cond.i } ; Function Attrs: nounwind uwtable define dso_local void @put_int(i32 noundef %n) local_unnamed_addr #0 { entry: %buf = alloca [11 x i8], align 1 %tobool.not = icmp eq i32 %n, 0 br i1 %tobool.not, label %if.then, label %if.end if.then: ; preds = %entry %0 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5 %1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !20 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6 %2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !21 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %if.then %call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 48) #8 br label %return cond.false.i: ; preds = %if.then %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !20 store i8 48, ptr %1, align 1, !tbaa !16 br label %return if.end: ; preds = %entry %cmp = icmp slt i32 %n, 0 br i1 %cmp, label %if.then1, label %if.end3 if.then1: ; preds = %if.end %mul = sub nsw i32 0, %n %3 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i20 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 5 %4 = load ptr, ptr %_IO_write_ptr.i20, align 8, !tbaa !20 %_IO_write_end.i21 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 6 %5 = load ptr, ptr %_IO_write_end.i21, align 8, !tbaa !21 %cmp.not.i22 = icmp ult ptr %4, %5 br i1 %cmp.not.i22, label %cond.false.i26, label %cond.true.i23, !prof !15 cond.true.i23: ; preds = %if.then1 %call.i24 = tail call i32 @__overflow(ptr noundef nonnull %3, i32 noundef 45) #8 br label %if.end3 cond.false.i26: ; preds = %if.then1 %incdec.ptr.i27 = getelementptr inbounds i8, ptr %4, i64 1 store ptr %incdec.ptr.i27, ptr %_IO_write_ptr.i20, align 8, !tbaa !20 store i8 45, ptr %4, align 1, !tbaa !16 br label %if.end3 if.end3: ; preds = %cond.false.i26, %cond.true.i23, %if.end %n.addr.0 = phi i32 [ %n, %if.end ], [ %mul, %cond.true.i23 ], [ %mul, %cond.false.i26 ] call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf) #8 br label %while.body while.body: ; preds = %if.end3, %while.body %indvars.iv42 = phi i32 [ 1, %if.end3 ], [ %indvars.iv.next43, %while.body ] %indvars.iv = phi i64 [ 0, %if.end3 ], [ %indvars.iv.next, %while.body ] %n.addr.138 = phi i32 [ %n.addr.0, %if.end3 ], [ %div, %while.body ] %rem = srem i32 %n.addr.138, 10 %6 = trunc i32 %rem to i8 %conv = add nsw i8 %6, 48 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv store i8 %conv, ptr %arrayidx, align 1, !tbaa !16 %div = sdiv i32 %n.addr.138, 10 %n.addr.138.off = add i32 %n.addr.138, 9 %tobool4.not = icmp ult i32 %n.addr.138.off, 19 %indvars.iv.next43 = add nuw i32 %indvars.iv42, 1 br i1 %tobool4.not, label %while.body7.preheader, label %while.body, !llvm.loop !22 while.body7.preheader: ; preds = %while.body %7 = sext i32 %indvars.iv42 to i64 br label %while.body7 while.body7: ; preds = %while.body7.preheader, %putchar_unlocked.exit37 %indvars.iv44 = phi i64 [ %7, %while.body7.preheader ], [ %indvars.iv.next45, %putchar_unlocked.exit37 ] %indvars.iv.next45 = add nsw i64 %indvars.iv44, -1 %arrayidx9 = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv.next45 %8 = load i8, ptr %arrayidx9, align 1, !tbaa !16 %9 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i29 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 5 %10 = load ptr, ptr %_IO_write_ptr.i29, align 8, !tbaa !20 %_IO_write_end.i30 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 6 %11 = load ptr, ptr %_IO_write_end.i30, align 8, !tbaa !21 %cmp.not.i31 = icmp ult ptr %10, %11 br i1 %cmp.not.i31, label %cond.false.i35, label %cond.true.i32, !prof !15 cond.true.i32: ; preds = %while.body7 %conv10 = zext i8 %8 to i32 %call.i33 = tail call i32 @__overflow(ptr noundef nonnull %9, i32 noundef %conv10) #8 br label %putchar_unlocked.exit37 cond.false.i35: ; preds = %while.body7 %incdec.ptr.i36 = getelementptr inbounds i8, ptr %10, i64 1 store ptr %incdec.ptr.i36, ptr %_IO_write_ptr.i29, align 8, !tbaa !20 store i8 %8, ptr %10, align 1, !tbaa !16 br label %putchar_unlocked.exit37 putchar_unlocked.exit37: ; preds = %cond.true.i32, %cond.false.i35 %12 = and i64 %indvars.iv.next45, 4294967295 %tobool6.not = icmp eq i64 %12, 0 br i1 %tobool6.not, label %while.end12, label %while.body7, !llvm.loop !23 while.end12: ; preds = %putchar_unlocked.exit37 call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf) #8 br label %return return: ; preds = %cond.false.i, %cond.true.i, %while.end12 ret void } ; Function Attrs: nounwind uwtable define dso_local void @put_str(ptr nocapture noundef readonly %str) local_unnamed_addr #0 { entry: %0 = load i8, ptr %str, align 1, !tbaa !16 %tobool.not2 = icmp eq i8 %0, 0 br i1 %tobool.not2, label %while.end, label %while.body while.body: ; preds = %entry, %putchar_unlocked.exit %1 = phi i8 [ %5, %putchar_unlocked.exit ], [ %0, %entry ] %str.addr.03 = phi ptr [ %incdec.ptr, %putchar_unlocked.exit ], [ %str, %entry ] %incdec.ptr = getelementptr inbounds i8, ptr %str.addr.03, i64 1 %2 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %2, i64 0, i32 5 %3 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !20 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %2, i64 0, i32 6 %4 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !21 %cmp.not.i = icmp ult ptr %3, %4 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %while.body %conv = zext i8 %1 to i32 %call.i = tail call i32 @__overflow(ptr noundef nonnull %2, i32 noundef %conv) #8 br label %putchar_unlocked.exit cond.false.i: ; preds = %while.body %incdec.ptr.i = getelementptr inbounds i8, ptr %3, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !20 store i8 %1, ptr %3, align 1, !tbaa !16 br label %putchar_unlocked.exit putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %5 = load i8, ptr %incdec.ptr, align 1, !tbaa !16 %tobool.not = icmp eq i8 %5, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24 while.end: ; preds = %putchar_unlocked.exit, %entry ret void } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable define dso_local void @bst_init(ptr nocapture noundef writeonly %BST) local_unnamed_addr #2 { entry: tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %BST, i8 0, i64 16, i1 false) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @bst_insert(ptr nocapture noundef %BST, i32 noundef %key) local_unnamed_addr #3 { entry: %call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #9 store i32 %key, ptr %call, align 8, !tbaa !25 %left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false) %root.036 = load ptr, ptr %BST, align 8, !tbaa !5 %cmp.not37 = icmp eq ptr %root.036, null br i1 %cmp.not37, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %root.038 = phi ptr [ %root.0, %while.body ], [ %root.036, %entry ] %0 = load i32, ptr %root.038, align 8, !tbaa !25 %cmp4 = icmp sgt i32 %0, %key %left5 = getelementptr inbounds %struct.Node, ptr %root.038, i64 0, i32 1 %right6 = getelementptr inbounds %struct.Node, ptr %root.038, i64 0, i32 2 %root.1.in = select i1 %cmp4, ptr %left5, ptr %right6 %root.0 = load ptr, ptr %root.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %root.0, null br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !27 while.end: ; preds = %while.body, %entry %tmp.0.lcssa = phi ptr [ undef, %entry ], [ %root.038, %while.body ] %size = getelementptr inbounds %struct.BST, ptr %BST, i64 0, i32 1 %1 = load i64, ptr %size, align 8, !tbaa !28 %cmp7 = icmp eq i64 %1, 0 br i1 %cmp7, label %if.end18, label %if.else10 if.else10: ; preds = %while.end %2 = load i32, ptr %tmp.0.lcssa, align 8, !tbaa !25 %cmp12 = icmp sgt i32 %2, %key br i1 %cmp12, label %if.then13, label %if.else15 if.then13: ; preds = %if.else10 %left14 = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa, i64 0, i32 1 br label %if.end18 if.else15: ; preds = %if.else10 %right16 = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa, i64 0, i32 2 br label %if.end18 if.end18: ; preds = %while.end, %if.then13, %if.else15 %left14.sink = phi ptr [ %left14, %if.then13 ], [ %right16, %if.else15 ], [ %BST, %while.end ] store ptr %call, ptr %left14.sink, align 8, !tbaa !5 %inc = add i64 %1, 1 store i64 %inc, ptr %size, align 8, !tbaa !28 ret void } ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @bst_find(ptr noundef readonly %root, i32 noundef %key) local_unnamed_addr #5 { entry: %cmp17 = icmp eq ptr %root, null br i1 %cmp17, label %return, label %if.else if.else: ; preds = %entry, %if.else4 %root.tr18 = phi ptr [ %root.tr.be, %if.else4 ], [ %root, %entry ] %0 = load i32, ptr %root.tr18, align 8, !tbaa !25 %cmp2 = icmp eq i32 %0, %key br i1 %cmp2, label %return, label %if.else4 if.else4: ; preds = %if.else %cmp6 = icmp sgt i32 %0, %key %left = getelementptr inbounds %struct.Node, ptr %root.tr18, i64 0, i32 1 %right = getelementptr inbounds %struct.Node, ptr %root.tr18, i64 0, i32 2 %root.tr.be.in = select i1 %cmp6, ptr %left, ptr %right %root.tr.be = load ptr, ptr %root.tr.be.in, align 8, !tbaa !5 %cmp = icmp eq ptr %root.tr.be, null br i1 %cmp, label %return, label %if.else return: ; preds = %if.else4, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.else4 ] ret i32 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local void @bst_inorder(ptr noundef readonly %root) local_unnamed_addr #0 { entry: %cmp4 = icmp eq ptr %root, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %putchar_unlocked.exit %root.tr5 = phi ptr [ %5, %putchar_unlocked.exit ], [ %root, %entry ] %left = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !30 tail call void @bst_inorder(ptr noundef %0) %1 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %1, i64 0, i32 5 %2 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !20 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %1, i64 0, i32 6 %3 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !21 %cmp.not.i = icmp ult ptr %2, %3 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %if.end %call.i = tail call i32 @__overflow(ptr noundef nonnull %1, i32 noundef 32) #8 br label %putchar_unlocked.exit cond.false.i: ; preds = %if.end %incdec.ptr.i = getelementptr inbounds i8, ptr %2, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !20 store i8 32, ptr %2, align 1, !tbaa !16 br label %putchar_unlocked.exit putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %4 = load i32, ptr %root.tr5, align 8, !tbaa !25 tail call void @put_int(i32 noundef %4) %right = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 2 %5 = load ptr, ptr %right, align 8, !tbaa !31 %cmp = icmp eq ptr %5, null br i1 %cmp, label %return, label %if.end return: ; preds = %putchar_unlocked.exit, %entry ret void } ; Function Attrs: nounwind uwtable define dso_local void @bst_preorder(ptr noundef readonly %root) local_unnamed_addr #0 { entry: %cmp4 = icmp eq ptr %root, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %putchar_unlocked.exit %root.tr5 = phi ptr [ %5, %putchar_unlocked.exit ], [ %root, %entry ] %0 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5 %1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !20 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6 %2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !21 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %if.end %call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 32) #8 br label %putchar_unlocked.exit cond.false.i: ; preds = %if.end %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !20 store i8 32, ptr %1, align 1, !tbaa !16 br label %putchar_unlocked.exit putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %3 = load i32, ptr %root.tr5, align 8, !tbaa !25 tail call void @put_int(i32 noundef %3) %left = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 1 %4 = load ptr, ptr %left, align 8, !tbaa !30 tail call void @bst_preorder(ptr noundef %4) %right = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 2 %5 = load ptr, ptr %right, align 8, !tbaa !31 %cmp = icmp eq ptr %5, null br i1 %cmp, label %return, label %if.end return: ; preds = %putchar_unlocked.exit, %entry ret void } ; Function Attrs: nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %BST.sroa.0 = alloca ptr, align 8 %c = alloca [8 x i8], align 1 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %BST.sroa.0) store ptr null, ptr %BST.sroa.0, align 8 %call = tail call i32 @get_int() call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #8 %cmp41 = icmp sgt i32 %call, 0 br i1 %cmp41, label %while.cond.i.preheader, label %for.cond.cleanup while.cond.i.preheader: ; preds = %entry, %for.inc %i.043 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %BST.sroa.8.042 = phi i64 [ %BST.sroa.8.1, %for.inc ], [ 0, %entry ] %.pre44 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.cond.i for.cond.cleanup: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #8 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %BST.sroa.0) ret i32 0 while.cond.i: ; preds = %while.cond.i.preheader, %while.body.i %0 = phi ptr [ %4, %while.body.i ], [ %.pre44, %while.cond.i.preheader ] %str.addr.0.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %c, %while.cond.i.preheader ] %_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14 %cmp.not.i.i = icmp ult ptr %1, %2 br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15 cond.true.i.i: ; preds = %while.cond.i %call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit.i cond.false.i.i: ; preds = %while.cond.i %incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i.i = zext i8 %3 to i32 br label %getchar_unlocked.exit.i getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i %4 = phi ptr [ %.pre, %cond.true.i.i ], [ %0, %cond.false.i.i ] %cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ] %cmp.i = icmp sgt i32 %cond.i.i, 32 br i1 %cmp.i, label %while.body.i, label %get_str.exit while.body.i: ; preds = %getchar_unlocked.exit.i %conv.i = trunc i32 %cond.i.i to i8 %incdec.ptr.i = getelementptr inbounds i8, ptr %str.addr.0.i, i64 1 store i8 %conv.i, ptr %str.addr.0.i, align 1, !tbaa !16 br label %while.cond.i, !llvm.loop !19 get_str.exit: ; preds = %getchar_unlocked.exit.i store i8 0, ptr %str.addr.0.i, align 1, !tbaa !16 %5 = load i8, ptr %c, align 1, !tbaa !16 %conv = sext i8 %5 to i32 switch i32 %conv, label %sw.default [ i32 105, label %sw.bb i32 102, label %sw.bb4 ] sw.bb: ; preds = %get_str.exit %call3 = tail call i32 @get_int() %call.i = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #9 store i32 %call3, ptr %call.i, align 8, !tbaa !25 %left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false) %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i = load ptr, ptr %BST.sroa.0, align 8, !tbaa !5 %cmp.not37.i = icmp eq ptr %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i, null br i1 %cmp.not37.i, label %while.end.i, label %while.body.i13 while.body.i13: ; preds = %sw.bb, %while.body.i13 %root.038.i = phi ptr [ %root.0.i, %while.body.i13 ], [ %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i, %sw.bb ] %6 = load i32, ptr %root.038.i, align 8, !tbaa !25 %cmp4.i = icmp sgt i32 %6, %call3 %left5.i = getelementptr inbounds %struct.Node, ptr %root.038.i, i64 0, i32 1 %right6.i = getelementptr inbounds %struct.Node, ptr %root.038.i, i64 0, i32 2 %root.1.in.i = select i1 %cmp4.i, ptr %left5.i, ptr %right6.i %root.0.i = load ptr, ptr %root.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %root.0.i, null br i1 %cmp.not.i, label %while.end.i, label %while.body.i13, !llvm.loop !27 while.end.i: ; preds = %while.body.i13, %sw.bb %tmp.0.lcssa.i = phi ptr [ undef, %sw.bb ], [ %root.038.i, %while.body.i13 ] %cmp7.i = icmp eq i64 %BST.sroa.8.042, 0 br i1 %cmp7.i, label %bst_insert.exit, label %if.else10.i if.else10.i: ; preds = %while.end.i %7 = load i32, ptr %tmp.0.lcssa.i, align 8, !tbaa !25 %cmp12.i = icmp sgt i32 %7, %call3 br i1 %cmp12.i, label %if.then13.i, label %if.else15.i if.then13.i: ; preds = %if.else10.i %left14.i = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa.i, i64 0, i32 1 br label %bst_insert.exit if.else15.i: ; preds = %if.else10.i %right16.i = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa.i, i64 0, i32 2 br label %bst_insert.exit bst_insert.exit: ; preds = %while.end.i, %if.then13.i, %if.else15.i %left14.sink.i = phi ptr [ %left14.i, %if.then13.i ], [ %right16.i, %if.else15.i ], [ %BST.sroa.0, %while.end.i ] store ptr %call.i, ptr %left14.sink.i, align 8, !tbaa !5 %inc.i = add i64 %BST.sroa.8.042, 1 br label %for.inc sw.bb4: ; preds = %get_str.exit %call5 = tail call i32 @get_int() %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.38 = load ptr, ptr %BST.sroa.0, align 8, !tbaa !32 %cmp17.i = icmp eq ptr %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.38, null br i1 %cmp17.i, label %bst_find.exit, label %if.else.i if.else.i: ; preds = %sw.bb4, %if.else4.i %root.tr18.i = phi ptr [ %root.tr.be.i, %if.else4.i ], [ %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.38, %sw.bb4 ] %8 = load i32, ptr %root.tr18.i, align 8, !tbaa !25 %cmp2.i = icmp eq i32 %8, %call5 br i1 %cmp2.i, label %bst_find.exit, label %if.else4.i if.else4.i: ; preds = %if.else.i %cmp6.i = icmp sgt i32 %8, %call5 %left.i14 = getelementptr inbounds %struct.Node, ptr %root.tr18.i, i64 0, i32 1 %right.i = getelementptr inbounds %struct.Node, ptr %root.tr18.i, i64 0, i32 2 %root.tr.be.in.i = select i1 %cmp6.i, ptr %left.i14, ptr %right.i %root.tr.be.i = load ptr, ptr %root.tr.be.in.i, align 8, !tbaa !5 %cmp.i15 = icmp eq ptr %root.tr.be.i, null br i1 %cmp.i15, label %bst_find.exit, label %if.else.i bst_find.exit: ; preds = %if.else4.i, %if.else.i, %sw.bb4 %9 = phi ptr [ @.str.1, %sw.bb4 ], [ @.str.1, %if.else4.i ], [ @.str, %if.else.i ] %10 = load i8, ptr %9, align 1, !tbaa !16 %tobool.not2.i = icmp eq i8 %10, 0 br i1 %tobool.not2.i, label %for.inc, label %while.body.i16 while.body.i16: ; preds = %bst_find.exit, %putchar_unlocked.exit.i %11 = phi i8 [ %15, %putchar_unlocked.exit.i ], [ %10, %bst_find.exit ] %str.addr.03.i = phi ptr [ %incdec.ptr.i17, %putchar_unlocked.exit.i ], [ %9, %bst_find.exit ] %incdec.ptr.i17 = getelementptr inbounds i8, ptr %str.addr.03.i, i64 1 %12 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 5 %13 = load ptr, ptr %_IO_write_ptr.i.i, align 8, !tbaa !20 %_IO_write_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 6 %14 = load ptr, ptr %_IO_write_end.i.i, align 8, !tbaa !21 %cmp.not.i.i18 = icmp ult ptr %13, %14 br i1 %cmp.not.i.i18, label %cond.false.i.i23, label %cond.true.i.i19, !prof !15 cond.true.i.i19: ; preds = %while.body.i16 %conv.i20 = zext i8 %11 to i32 %call.i.i21 = tail call i32 @__overflow(ptr noundef nonnull %12, i32 noundef %conv.i20) #8 br label %putchar_unlocked.exit.i cond.false.i.i23: ; preds = %while.body.i16 %incdec.ptr.i.i24 = getelementptr inbounds i8, ptr %13, i64 1 store ptr %incdec.ptr.i.i24, ptr %_IO_write_ptr.i.i, align 8, !tbaa !20 store i8 %11, ptr %13, align 1, !tbaa !16 br label %putchar_unlocked.exit.i putchar_unlocked.exit.i: ; preds = %cond.false.i.i23, %cond.true.i.i19 %15 = load i8, ptr %incdec.ptr.i17, align 1, !tbaa !16 %tobool.not.i = icmp eq i8 %15, 0 br i1 %tobool.not.i, label %for.inc, label %while.body.i16, !llvm.loop !24 sw.default: ; preds = %get_str.exit %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0. = load ptr, ptr %BST.sroa.0, align 8, !tbaa !32 tail call void @bst_inorder(ptr noundef %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.) %16 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 5 %17 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !20 %_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 6 %18 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !21 %cmp.not.i25 = icmp ult ptr %17, %18 br i1 %cmp.not.i25, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %sw.default %call.i26 = tail call i32 @__overflow(ptr noundef nonnull %16, i32 noundef 10) #8 br label %putchar_unlocked.exit cond.false.i: ; preds = %sw.default %incdec.ptr.i27 = getelementptr inbounds i8, ptr %17, i64 1 store ptr %incdec.ptr.i27, ptr %_IO_write_ptr.i, align 8, !tbaa !20 store i8 10, ptr %17, align 1, !tbaa !16 br label %putchar_unlocked.exit putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i tail call void @bst_preorder(ptr noundef %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.) %19 = load ptr, ptr @stdout, align 8, !tbaa !5 %_IO_write_ptr.i28 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 5 %20 = load ptr, ptr %_IO_write_ptr.i28, align 8, !tbaa !20 %_IO_write_end.i29 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 6 %21 = load ptr, ptr %_IO_write_end.i29, align 8, !tbaa !21 %cmp.not.i30 = icmp ult ptr %20, %21 br i1 %cmp.not.i30, label %cond.false.i34, label %cond.true.i31, !prof !15 cond.true.i31: ; preds = %putchar_unlocked.exit %call.i32 = tail call i32 @__overflow(ptr noundef nonnull %19, i32 noundef 10) #8 br label %for.inc cond.false.i34: ; preds = %putchar_unlocked.exit %incdec.ptr.i35 = getelementptr inbounds i8, ptr %20, i64 1 store ptr %incdec.ptr.i35, ptr %_IO_write_ptr.i28, align 8, !tbaa !20 store i8 10, ptr %20, align 1, !tbaa !16 br label %for.inc for.inc: ; preds = %putchar_unlocked.exit.i, %cond.false.i34, %cond.true.i31, %bst_find.exit, %bst_insert.exit %BST.sroa.8.1 = phi i64 [ %inc.i, %bst_insert.exit ], [ %BST.sroa.8.042, %bst_find.exit ], [ %BST.sroa.8.042, %cond.true.i31 ], [ %BST.sroa.8.042, %cond.false.i34 ], [ %BST.sroa.8.042, %putchar_unlocked.exit.i ] %inc = add nuw nsw i32 %i.043, 1 %exitcond.not = icmp eq i32 %inc, %call br i1 %exitcond.not, label %for.cond.cleanup, label %while.cond.i.preheader, !llvm.loop !33 } declare i32 @__uflow(ptr noundef) local_unnamed_addr #6 declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #6 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { 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 #6 = { "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nounwind } attributes #9 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !6, i64 8} !10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196} !11 = !{!"int", !7, i64 0} !12 = !{!"long", !7, i64 0} !13 = !{!"short", !7, i64 0} !14 = !{!10, !6, i64 16} !15 = !{!"branch_weights", i32 2000, i32 1} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"} !19 = distinct !{!19, !18} !20 = !{!10, !6, i64 40} !21 = !{!10, !6, i64 48} !22 = distinct !{!22, !18} !23 = distinct !{!23, !18} !24 = distinct !{!24, !18} !25 = !{!26, !11, i64 0} !26 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16} !27 = distinct !{!27, !18} !28 = !{!29, !12, i64 8} !29 = !{!"BST", !6, i64 0, !12, i64 8} !30 = !{!26, !6, i64 8} !31 = !{!26, !6, i64 16} !32 = !{!29, !6, i64 0} !33 = distinct !{!33, !18}
#include<stdio.h> #include<stdlib.h> struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; #define NIL NULL Node root = NIL; Node treeMinimum(Node x){ } Node treeSearch(Node u, int k){ Node i=u; while(i!=NIL){ if(i->key==k)return i; else if(i->key<k)i=i->right; else i=i->left; } return NIL; } Node treeSuccessor(Node x){ } void treeDelete(Node z){ Node y; // node to be deleted Node x; // child of y } void insert(int k){ Node y = NIL; Node x = root; Node z; z = malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(x!=NIL){ y=x; if(z->key<x->key)x=x->left; else x=x->right; } z->parent=y; if(y==NIL)root=z; else if(z->key<y->key)y->left=z; else y->right=z; } void inorder(Node u){ if(u==NIL)return; inorder(u->left); printf(" %d",u->key); inorder(u->right); } void preorder(Node u){ if(u==NIL)return; printf(" %d",u->key); preorder(u->left); preorder(u->right); } int main(){ int n, i, x; char com[20]; scanf("%d", &n); for ( i = 0; i < n; i++ ){ scanf("%s", com); if ( com[0] == 'f' ){ scanf("%d", &x); Node t = treeSearch(root, x); if ( t != NIL ) printf("yes\n"); else printf("no\n"); } else if ( com[0] == 'i' ){ scanf("%d", &x); insert(x); } else if ( com[0] == 'p' ){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if ( com[0] == 'd' ){ scanf("%d", &x); treeDelete(treeSearch(root, x)); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220805/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220805/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 { entry: ret ptr undef } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #1 { entry: %cmp.not13 = icmp eq ptr %u, null br i1 %cmp.not13, label %cleanup, label %while.body while.body: ; preds = %entry, %if.else %i.014 = phi ptr [ %i.1, %if.else ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %i.014, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp3 = icmp slt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %i.014, i64 0, i32 1 %i.1.in = select i1 %cmp3, ptr %i.014, ptr %left %i.1 = load ptr, ptr %i.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %i.1, null br i1 %cmp.not, label %cleanup, label %while.body, !llvm.loop !12 cleanup: ; preds = %while.body, %if.else, %entry %i.0.lcssa = phi ptr [ null, %entry ], [ null, %if.else ], [ %i.014, %while.body ] ret ptr %i.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 { entry: ret ptr undef } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 { entry: ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #3 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !11 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !5 %cmp.not34 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false) br i1 %cmp.not34, label %if.then7, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %1 = load i32, ptr %key2, align 8, !tbaa !5 %cmp3 = icmp sgt i32 %1, %k %left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !14 if.then7: ; preds = %entry %parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr null, ptr %parent37, align 8, !tbaa !15 br label %if.end17 if.else8: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.035, ptr %parent, align 8, !tbaa !15 %key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %2 = load i32, ptr %key10, align 8, !tbaa !5 %cmp11 = icmp sgt i32 %2, %k %left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %spec.select = select i1 %cmp11, ptr %left13, ptr %x.035 br label %if.end17 if.end17: ; preds = %if.else8, %if.then7 %left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ] store ptr %call, ptr %left13.sink, align 8, !tbaa !11 ret void } ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #3 { entry: %cmp4 = icmp eq ptr %u, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ] %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !16 tail call void @inorder(ptr noundef %0) %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !17 %cmp = icmp eq ptr %2, null 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 #5 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #3 { entry: %cmp4 = icmp eq ptr %u, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !16 tail call void @preorder(ptr noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !17 %cmp = icmp eq ptr %2, null br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !18 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.061 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !19 switch i8 %1, label %for.inc [ i8 102, label %if.then i8 105, label %if.then16 i8 112, label %if.then23 i8 100, label %if.then31 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load ptr, ptr @root, align 8, !tbaa !11 %3 = load i32, ptr %x, align 4, !tbaa !18 %cmp.not13.i = icmp eq ptr %2, null br i1 %cmp.not13.i, label %if.else, label %while.body.i while.body.i: ; preds = %if.then, %if.else.i %i.014.i = phi ptr [ %i.1.i, %if.else.i ], [ %2, %if.then ] %key.i = getelementptr inbounds %struct.node, ptr %i.014.i, i64 0, i32 3 %4 = load i32, ptr %key.i, align 8, !tbaa !5 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %if.then8, label %if.else.i if.else.i: ; preds = %while.body.i %cmp3.i = icmp slt i32 %4, %3 %left.i = getelementptr inbounds %struct.node, ptr %i.014.i, i64 0, i32 1 %i.1.in.i = select i1 %cmp3.i, ptr %i.014.i, ptr %left.i %i.1.i = load ptr, ptr %i.1.in.i, align 8, !tbaa !11 %cmp.not.i = icmp eq ptr %i.1.i, null br i1 %cmp.not.i, label %if.else, label %while.body.i, !llvm.loop !12 if.then8: ; preds = %while.body.i %puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else: ; preds = %if.else.i, %if.then %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc if.then16: ; preds = %for.body %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %5 = load i32, ptr %x, align 4, !tbaa !18 %6 = load ptr, ptr @root, align 8, !tbaa !11 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 %key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %5, ptr %key.i41, align 8, !tbaa !5 %cmp.not34.i = icmp eq ptr %6, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false) br i1 %cmp.not34.i, label %insert.exit, label %while.body.i42 while.body.i42: ; preds = %if.then16, %while.body.i42 %x.035.i = phi ptr [ %x.1.i, %while.body.i42 ], [ %6, %if.then16 ] %key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3 %7 = load i32, ptr %key2.i, align 8, !tbaa !5 %cmp3.i43 = icmp sgt i32 %7, %5 %left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i43, ptr %left4.i, ptr %x.035.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11 %cmp.not.i44 = icmp eq ptr %x.1.i, null br i1 %cmp.not.i44, label %insert.exit, label %while.body.i42, !llvm.loop !14 insert.exit: ; preds = %while.body.i42, %if.then16 %.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i42 ] %left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i42 ] %parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %.sink, ptr %parent37.i, align 8, !tbaa !15 store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !11 br label %for.inc if.then23: ; preds = %for.body %8 = load ptr, ptr @root, align 8, !tbaa !11 call void @inorder(ptr noundef %8) %putchar = call i32 @putchar(i32 10) %9 = load ptr, ptr @root, align 8, !tbaa !11 call void @preorder(ptr noundef %9) %putchar39 = call i32 @putchar(i32 10) br label %for.inc if.then31: ; preds = %for.body %call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) br label %for.inc for.inc: ; preds = %if.then31, %for.body, %if.then8, %if.else, %if.then23, %insert.exit %inc = add nuw nsw i32 %i.061, 1 %10 = load i32, ptr %n, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %10 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7 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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nounwind allocsize(0) } 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, !10, i64 24} !6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24} !7 = !{!"any pointer", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"int", !8, i64 0} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13} !15 = !{!6, !7, i64 16} !16 = !{!6, !7, i64 8} !17 = !{!6, !7, i64 0} !18 = !{!10, !10, i64 0} !19 = !{!8, !8, i64 0} !20 = distinct !{!20, !13}
#include<stdio.h> #include<stdlib.h> #include<string.h> struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; struct node *root, *NIL; struct node *find(struct node *u, int k){ while(u != NIL && k != u->key){ if(k < u->key) u = u->left; else u = u->right; } return u; } void insert(int k){ struct node *y = NIL; struct node *x = root; struct node *z; z = malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(x != NIL){ y = x; if(z->key < x->key){ x = x->left; }else{ x = x->right; } } z->parent = y; if(y == NIL){ root = z; }else{ if(z->key < y->key){ y->left = z; }else{ y->right = z; } } } void inorder(struct node *u){ if(u == NIL) return ; inorder(u->left); printf(" %d", u->key); inorder(u->right); } void preorder(struct node *u){ if( u == NIL) return; printf(" %d", u->key); preorder(u->left); preorder(u->right); } int main(){ int n, i, x; char com[5000]; scanf("%d", &n); for(i=0;i<n;i++){ scanf("%s", com); if(strcmp(com,"find")==0){ scanf("%d", &x); struct node *t = find(root, x); if(t != NIL) printf("yes\n"); else printf("no\n"); }else if(strcmp(com,"insert")==0){ scanf("%d", &x); insert(x); }else if(com[0] == 'p'){ inorder(root); printf("\n"); preorder(root); printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220856/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220856/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @NIL = dso_local local_unnamed_addr global ptr null, align 8 @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"find\00", align 1 @.str.6 = private unnamed_addr constant [7 x i8] c"insert\00", align 1 @str = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.8 = private unnamed_addr constant [4 x i8] c"yes\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp.not10 = icmp eq ptr %0, %u br i1 %cmp.not10, label %while.end, label %land.rhs land.rhs: ; preds = %entry, %while.body %u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !9 %cmp1.not = icmp eq i32 %1, %k br i1 %cmp1.not, label %while.end, label %while.body while.body: ; preds = %land.rhs %cmp3 = icmp sgt i32 %1, %k %left = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 1 %u.addr.1.in = select i1 %cmp3, ptr %left, ptr %u.addr.011 %u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %u.addr.1, %0 br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !12 while.end: ; preds = %land.rhs, %while.body, %entry %u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ] ret ptr %u.addr.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %1 = load ptr, ptr @root, align 8, !tbaa !5 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !9 %left = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 store ptr %0, ptr %left, align 8, !tbaa !14 store ptr %0, ptr %call, align 8, !tbaa !15 %cmp.not34 = icmp eq ptr %1, %0 br i1 %cmp.not34, label %while.end.thread, label %while.body while.end.thread: ; preds = %entry %parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %0, ptr %parent37, align 8, !tbaa !16 br label %if.end17 while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %2 = load i32, ptr %key2, align 8, !tbaa !9 %cmp3 = icmp sgt i32 %2, %k %left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.1, %0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17 while.end: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.035, ptr %parent, align 8, !tbaa !16 %cmp6 = icmp eq ptr %x.035, %0 br i1 %cmp6, label %if.end17, label %if.else8 if.else8: ; preds = %while.end %key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3 %3 = load i32, ptr %key10, align 8, !tbaa !9 %cmp11 = icmp sgt i32 %3, %k %left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1 %spec.select = select i1 %cmp11, ptr %left13, ptr %x.035 br label %if.end17 if.end17: ; preds = %if.else8, %while.end, %while.end.thread %left13.sink = phi ptr [ @root, %while.end.thread ], [ @root, %while.end ], [ %spec.select, %if.else8 ] store ptr %call, ptr %left13.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %u br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ] %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !14 tail call void @inorder(ptr noundef %1) %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %2 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2) %3 = load ptr, ptr %u.tr5, align 8, !tbaa !15 %4 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 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 #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %u br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %2 = load ptr, ptr %left, align 8, !tbaa !14 tail call void @preorder(ptr noundef %2) %3 = load ptr, ptr %u.tr5, align 8, !tbaa !15 %4 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [5000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %com) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !18 %cmp38 = icmp sgt i32 %0, 0 br i1 %cmp38, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.039 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %com, ptr noundef nonnull dereferenceable(5) @.str.3, i64 5) %cmp4 = icmp eq i32 %bcmp, 0 br i1 %cmp4, label %if.then, label %if.else11 if.then: ; preds = %for.body %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %1 = load ptr, ptr @root, align 8, !tbaa !5 %2 = load i32, ptr %x, align 4, !tbaa !18 %3 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp.not10.i = icmp eq ptr %3, %1 br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i land.rhs.i: ; preds = %if.then, %while.body.i %u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %1, %if.then ] %key.i = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 3 %4 = load i32, ptr %key.i, align 8, !tbaa !9 %cmp1.not.i = icmp eq i32 %4, %2 br i1 %cmp1.not.i, label %find.exit, label %while.body.i while.body.i: ; preds = %land.rhs.i %cmp3.i = icmp sgt i32 %4, %2 %left.i = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 1 %u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %u.addr.011.i %u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %u.addr.1.i, %3 br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !12 find.exit: ; preds = %land.rhs.i, %if.then %u.addr.0.lcssa.i = phi ptr [ %1, %if.then ], [ %u.addr.011.i, %land.rhs.i ] %cmp7.not = icmp eq ptr %u.addr.0.lcssa.i, %3 br i1 %cmp7.not, label %if.else, label %if.then8 if.then8: ; preds = %find.exit %puts29 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) br label %for.inc if.else: ; preds = %while.body.i, %find.exit %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc if.else11: ; preds = %for.body %bcmp27 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @.str.6, i64 7) %cmp14 = icmp eq i32 %bcmp27, 0 br i1 %cmp14, label %if.then15, label %if.else17 if.then15: ; preds = %if.else11 %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %5 = load i32, ptr %x, align 4, !tbaa !18 %6 = load ptr, ptr @NIL, align 8, !tbaa !5 %7 = load ptr, ptr @root, align 8, !tbaa !5 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7 %key.i30 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %5, ptr %key.i30, align 8, !tbaa !9 %left.i31 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1 store ptr %6, ptr %left.i31, align 8, !tbaa !14 store ptr %6, ptr %call.i, align 8, !tbaa !15 %cmp.not34.i = icmp eq ptr %7, %6 br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i32 while.end.thread.i: ; preds = %if.then15 %parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %6, ptr %parent37.i, align 8, !tbaa !16 br label %insert.exit while.body.i32: ; preds = %if.then15, %while.body.i32 %x.035.i = phi ptr [ %x.1.i, %while.body.i32 ], [ %7, %if.then15 ] %key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3 %8 = load i32, ptr %key2.i, align 8, !tbaa !9 %cmp3.i33 = icmp sgt i32 %8, %5 %left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i33, ptr %left4.i, ptr %x.035.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i34 = icmp eq ptr %x.1.i, %6 br i1 %cmp.not.i34, label %while.end.i, label %while.body.i32, !llvm.loop !17 while.end.i: ; preds = %while.body.i32 %parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16 %cmp6.i = icmp eq ptr %x.035.i, %6 %spec.select = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i br label %insert.exit insert.exit: ; preds = %while.end.i, %while.end.thread.i %left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select, %while.end.i ] store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5 br label %for.inc if.else17: ; preds = %if.else11 %9 = load i8, ptr %com, align 16, !tbaa !19 %cmp18 = icmp eq i8 %9, 112 br i1 %cmp18, label %if.then20, label %for.inc if.then20: ; preds = %if.else17 %10 = load ptr, ptr @root, align 8, !tbaa !5 call void @inorder(ptr noundef %10) %putchar = call i32 @putchar(i32 10) %11 = load ptr, ptr @root, align 8, !tbaa !5 call void @preorder(ptr noundef %11) %putchar28 = call i32 @putchar(i32 10) br label %for.inc for.inc: ; preds = %if.then8, %if.else, %if.else17, %if.then20, %insert.exit %inc = add nuw nsw i32 %i.039, 1 %12 = load i32, ptr %n, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %12 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %com) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6 attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind "no-trapping-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 willreturn memory(argmem: read) } attributes #6 = { nofree nounwind } attributes #7 = { nounwind allocsize(0) } attributes #8 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 24} !10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!10, !6, i64 8} !15 = !{!10, !6, i64 0} !16 = !{!10, !6, i64 16} !17 = distinct !{!17, !13} !18 = !{!11, !11, i64 0} !19 = !{!7, !7, i64 0} !20 = distinct !{!20, !13}
#include<stdio.h> #include<math.h> int main() { int t; scanf("%d",&t); int n,a,b,d; while(t>0) { scanf("%d",&n); a=pow(2,n/2)+pow(2,n)-2; b=pow(2,n+1)-2-a; d=a-b; printf("%d\n",d); t--; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2209/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2209/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %.pr = load i32, ptr %t, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %.pr, 0 br i1 %cmp18, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %div = sdiv i32 %0, 2 %ldexp = call double @ldexp(double 1.000000e+00, i32 %div) #4 %1 = load i32, ptr %n, align 4, !tbaa !5 %ldexp16 = call double @ldexp(double 1.000000e+00, i32 %1) #4 %add = fadd double %ldexp, %ldexp16 %sub = fadd double %add, -2.000000e+00 %conv5 = fptosi double %sub to i32 %2 = load i32, ptr %n, align 4, !tbaa !5 %add6 = add nsw i32 %2, 1 %ldexp17 = call double @ldexp(double 1.000000e+00, i32 %add6) #4 %sub9 = fadd double %ldexp17, -2.000000e+00 %conv10 = sitofp i32 %conv5 to double %sub11 = fsub double %sub9, %conv10 %conv12 = fptosi double %sub11 to i32 %sub13 = sub nsw i32 %conv5, %conv12 %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub13) %3 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %cmp = icmp sgt i32 %3, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body, %entry 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 willreturn declare double @ldexp(double, i32) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> struct node{ int key; struct node *parent; struct node *right; struct node *left; }; typedef struct node *Node; Node T; #define NIL NULL; void Insert(int); int Find(int); void Preorder(Node); void Inorder(Node); int main() { int n,i,key; char S[7]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",S); if(S[0]=='i'){ scanf("%d",&key); Insert(key); } else if(S[0]=='f'){ scanf("%d",&key); if(Find(key))printf("yes\n"); else printf("no\n"); } else{ Inorder(T); printf("\n"); Preorder(T); printf("\n"); } } return 0; } void Insert(int key) { Node y,x,z; y=NIL; x=T; z=malloc(sizeof(struct node)); z->key=key; z->left=NIL; z->right=NIL; while(x!=NULL){ y=x; if( z->key < x->key )x=x->left; else x=x->right; } z->parent=y; if(y==NULL){ T=z; } else if(z->key<y->key){ y->left=z; } else{ y->right=z; } } int Find(int key) { Node TT; TT=T; while(TT!=NULL && TT->key!=key){ if(key<TT->key)TT=TT->left; else TT=TT->right; } if(TT==NULL)return 0; else return 1; } void Preorder(Node T) { printf(" %d",T->key); if(T->left!=NULL){ Preorder(T->left); } if(T->right!=NULL){ Preorder(T->right); } } void Inorder(Node T) { if(T->left!=NULL && T->right!=NULL){ Inorder(T->left); printf(" %d",T->key); Inorder(T->right); } if(T->left!=NULL && T->right==NULL){ Inorder(T->left); printf(" %d",T->key); } if(T->right!=NULL && T->left==NULL){ printf(" %d",T->key); Inorder(T->right); } if(T->left==NULL && T->right==NULL)printf(" %d",T->key); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220942/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220942/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @.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 @T = dso_local local_unnamed_addr global ptr null, align 8 @.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %key = alloca i32, align 4 %S = alloca [7 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #7 call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %S) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp29 = icmp sgt i32 %0, 0 br i1 %cmp29, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.030 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S) %1 = load i8, ptr %S, align 1, !tbaa !9 switch i8 %1, label %if.else16 [ i8 105, label %if.then i8 102, label %if.then9 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %2 = load i32, ptr %key, align 4, !tbaa !5 %3 = load ptr, ptr @T, align 8, !tbaa !10 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 store i32 %2, ptr %call.i, align 8, !tbaa !12 %right.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 %cmp.not35.i = icmp eq ptr %3, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right.i, i8 0, i64 16, i1 false) br i1 %cmp.not35.i, label %Insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.036.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ] %4 = load i32, ptr %x.036.i, align 8, !tbaa !12 %cmp4.i = icmp sgt i32 %4, %2 %left5.i = getelementptr inbounds %struct.node, ptr %x.036.i, i64 0, i32 3 %right6.i = getelementptr inbounds %struct.node, ptr %x.036.i, i64 0, i32 2 %x.1.in.i = select i1 %cmp4.i, ptr %left5.i, ptr %right6.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !10 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %Insert.exit, label %while.body.i, !llvm.loop !14 Insert.exit: ; preds = %while.body.i, %if.then %x.036.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.036.i, %while.body.i ] %left14.sink.i = phi ptr [ @T, %if.then ], [ %x.1.in.i, %while.body.i ] %parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1 store ptr %x.036.i.lcssa.sink, ptr %parent.i, align 8, !tbaa !16 store ptr %call.i, ptr %left14.sink.i, align 8, !tbaa !10 br label %for.inc if.then9: ; preds = %for.body %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %5 = load i32, ptr %key, align 4, !tbaa !5 %TT.014.i = load ptr, ptr @T, align 8, !tbaa !10 %cond15.i = icmp eq ptr %TT.014.i, null br i1 %cond15.i, label %if.else14, label %land.rhs.i land.rhs.i: ; preds = %if.then9, %while.body.i24 %TT.016.i = phi ptr [ %TT.0.i, %while.body.i24 ], [ %TT.014.i, %if.then9 ] %6 = load i32, ptr %TT.016.i, align 8, !tbaa !12 %cmp2.not.i = icmp eq i32 %6, %5 br i1 %cmp2.not.i, label %if.then12, label %while.body.i24 while.body.i24: ; preds = %land.rhs.i %cmp4.i25 = icmp sgt i32 %6, %5 %left.i = getelementptr inbounds %struct.node, ptr %TT.016.i, i64 0, i32 3 %right.i26 = getelementptr inbounds %struct.node, ptr %TT.016.i, i64 0, i32 2 %TT.1.in.i = select i1 %cmp4.i25, ptr %left.i, ptr %right.i26 %TT.0.i = load ptr, ptr %TT.1.in.i, align 8, !tbaa !10 %cond.i = icmp eq ptr %TT.0.i, null br i1 %cond.i, label %if.else14, label %land.rhs.i, !llvm.loop !17 if.then12: ; preds = %land.rhs.i %puts23 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else14: ; preds = %while.body.i24, %if.then9 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc if.else16: ; preds = %for.body %7 = load ptr, ptr @T, align 8, !tbaa !10 call void @Inorder(ptr noundef %7) %putchar = call i32 @putchar(i32 10) %8 = load ptr, ptr @T, align 8, !tbaa !10 call void @Preorder(ptr noundef %8) %putchar22 = call i32 @putchar(i32 10) br label %for.inc for.inc: ; preds = %Insert.exit, %if.then12, %if.else14, %if.else16 %inc = add nuw nsw i32 %i.030, 1 %9 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %9 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %S) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @Insert(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @T, align 8, !tbaa !10 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8 store i32 %key, ptr %call, align 8, !tbaa !12 %right = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 %cmp.not35 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right, i8 0, i64 16, i1 false) br i1 %cmp.not35, label %if.then8, label %while.body while.body: ; preds = %entry, %while.body %x.036 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %1 = load i32, ptr %x.036, align 8, !tbaa !12 %cmp4 = icmp sgt i32 %1, %key %left5 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 3 %right6 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 2 %x.1.in = select i1 %cmp4, ptr %left5, ptr %right6 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !10 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else9, label %while.body, !llvm.loop !14 if.then8: ; preds = %entry %parent38 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 store ptr null, ptr %parent38, align 8, !tbaa !16 br label %if.end18 if.else9: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 store ptr %x.036, ptr %parent, align 8, !tbaa !16 %2 = load i32, ptr %x.036, align 8, !tbaa !12 %cmp12 = icmp sgt i32 %2, %key br i1 %cmp12, label %if.then13, label %if.else15 if.then13: ; preds = %if.else9 %left14 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 3 br label %if.end18 if.else15: ; preds = %if.else9 %right16 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 2 br label %if.end18 if.end18: ; preds = %if.then13, %if.else15, %if.then8 %left14.sink = phi ptr [ %left14, %if.then13 ], [ %right16, %if.else15 ], [ @T, %if.then8 ] store ptr %call, ptr %left14.sink, align 8, !tbaa !10 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @Find(i32 noundef %key) local_unnamed_addr #3 { entry: %TT.014 = load ptr, ptr @T, align 8, !tbaa !10 %cond15 = icmp eq ptr %TT.014, null br i1 %cond15, label %cleanup, label %land.rhs land.rhs: ; preds = %entry, %while.body %TT.016 = phi ptr [ %TT.0, %while.body ], [ %TT.014, %entry ] %0 = load i32, ptr %TT.016, align 8, !tbaa !12 %cmp2.not = icmp eq i32 %0, %key br i1 %cmp2.not, label %cleanup, label %while.body while.body: ; preds = %land.rhs %cmp4 = icmp sgt i32 %0, %key %left = getelementptr inbounds %struct.node, ptr %TT.016, i64 0, i32 3 %right = getelementptr inbounds %struct.node, ptr %TT.016, i64 0, i32 2 %TT.1.in = select i1 %cmp4, ptr %left, ptr %right %TT.0 = load ptr, ptr %TT.1.in, align 8, !tbaa !10 %cond = icmp eq ptr %TT.0, null br i1 %cond, label %cleanup, label %land.rhs, !llvm.loop !17 cleanup: ; preds = %while.body, %land.rhs, %entry %retval.0 = phi i32 [ 0, %entry ], [ 1, %land.rhs ], [ 0, %while.body ] ret i32 %retval.0 } ; 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 @Inorder(ptr nocapture noundef readonly %T) local_unnamed_addr #0 { entry: %left = getelementptr inbounds %struct.node, ptr %T, i64 0, i32 3 %0 = load ptr, ptr %left, align 8, !tbaa !19 %cmp.not = icmp eq ptr %0, null br i1 %cmp.not, label %if.end13, label %land.lhs.true land.lhs.true: ; preds = %entry %right = getelementptr inbounds %struct.node, ptr %T, i64 0, i32 2 %1 = load ptr, ptr %right, align 8, !tbaa !20 %cmp1.not = icmp eq ptr %1, null br i1 %cmp1.not, label %if.then9, label %if.end if.end: ; preds = %land.lhs.true tail call void @Inorder(ptr noundef nonnull %0) %2 = load i32, ptr %T, align 8, !tbaa !12 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %2) %3 = load ptr, ptr %right, align 8, !tbaa !20 tail call void @Inorder(ptr noundef %3) %.pr.pre = load ptr, ptr %left, align 8, !tbaa !19 %cmp5.not = icmp eq ptr %.pr.pre, null br i1 %cmp5.not, label %if.end13, label %land.lhs.true6 land.lhs.true6: ; preds = %if.end %.pr = load ptr, ptr %right, align 8, !tbaa !20 %cmp8 = icmp eq ptr %.pr, null br i1 %cmp8, label %if.then9, label %if.end13 if.then9: ; preds = %land.lhs.true, %land.lhs.true6 %.pr5861 = phi ptr [ %.pr.pre, %land.lhs.true6 ], [ %0, %land.lhs.true ] tail call void @Inorder(ptr noundef nonnull %.pr5861) %4 = load i32, ptr %T, align 8, !tbaa !12 %call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %4) %.pr50.pre53.pre = load ptr, ptr %left, align 8, !tbaa !19 br label %if.end13 if.end13: ; preds = %entry, %if.then9, %land.lhs.true6, %if.end %.pr50.pre53 = phi ptr [ null, %entry ], [ %.pr50.pre53.pre, %if.then9 ], [ %.pr.pre, %land.lhs.true6 ], [ null, %if.end ] %right14 = getelementptr inbounds %struct.node, ptr %T, i64 0, i32 2 %5 = load ptr, ptr %right14, align 8, !tbaa !20 %cmp15.not = icmp eq ptr %5, null br i1 %cmp15.not, label %if.end23, label %land.lhs.true16 land.lhs.true16: ; preds = %if.end13 %cmp18 = icmp eq ptr %.pr50.pre53, null br i1 %cmp18, label %if.then19, label %if.end32 if.then19: ; preds = %land.lhs.true16 %6 = load i32, ptr %T, align 8, !tbaa !12 %call21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %6) %7 = load ptr, ptr %right14, align 8, !tbaa !20 tail call void @Inorder(ptr noundef %7) %.pr50.pre = load ptr, ptr %left, align 8, !tbaa !19 br label %if.end23 if.end23: ; preds = %if.then19, %if.end13 %.pr50 = phi ptr [ %.pr50.pre, %if.then19 ], [ %.pr50.pre53, %if.end13 ] %cmp25 = icmp eq ptr %.pr50, null br i1 %cmp25, label %land.lhs.true26, label %if.end32 land.lhs.true26: ; preds = %if.end23 %8 = load ptr, ptr %right14, align 8, !tbaa !20 %cmp28 = icmp eq ptr %8, null br i1 %cmp28, label %if.then29, label %if.end32 if.then29: ; preds = %land.lhs.true26 %9 = load i32, ptr %T, align 8, !tbaa !12 %call31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %9) br label %if.end32 if.end32: ; preds = %land.lhs.true16, %if.then29, %land.lhs.true26, %if.end23 ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @Preorder(ptr nocapture noundef readonly %T) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %T.tr = phi ptr [ %T, %entry ], [ %2, %if.end ] %0 = load i32, ptr %T.tr, align 8, !tbaa !12 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %T.tr, i64 0, i32 3 %1 = load ptr, ptr %left, align 8, !tbaa !19 %cmp.not = icmp eq ptr %1, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @Preorder(ptr noundef nonnull %1) br label %if.end if.end: ; preds = %if.then, %tailrecurse %right = getelementptr inbounds %struct.node, ptr %T.tr, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !20 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; 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 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="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(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind } attributes #8 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = !{!11, !11, i64 0} !11 = !{!"any pointer", !7, i64 0} !12 = !{!13, !6, i64 0} !13 = !{!"node", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = !{!13, !11, i64 8} !17 = distinct !{!17, !15} !18 = distinct !{!18, !15} !19 = !{!13, !11, i64 24} !20 = !{!13, !11, i64 16}
#include<stdio.h> #include<stdlib.h> struct Node{ int key; struct Node *right, *left ,*parent; }; struct Node *root, *NIL; struct Node * find(struct Node *u, int k){ while(u != NIL && k != u->key){ if(k < u->key) u = u->left; else u = u->right; } return u; } void insert(int k){ struct Node *y = NIL; struct Node *x = root; struct Node *z; z= (struct Node *)malloc(sizeof(struct Node)); z->key = k; z->left = NIL; z->right = NIL; while(x != NIL){ y = x; if(z->key < x->key)x = x->left; else x = x->right; } z->parent = y; if(y == NIL)root = z; else{ if(z->key < y->key){ y->left = z; } else y->right = z; } } void inorder(struct Node *u){ if(u == NIL)return; inorder(u->left); printf(" %d", u->key); inorder(u->right); } void preorder(struct Node *u){ if (u == NIL)return; printf(" %d" ,u->key); preorder(u->left); preorder(u->right); } int main(){ int n ,i ,x; char com[20]; scanf("%d",&n); for (i=0;i<n;i++){ scanf("%s",com); if(com[0]=='f'){ scanf("%d",&x); struct Node *t = find(root,x); if(t != NIL)printf("yes\n"); else printf("no\n"); } if(com[0]=='i'){ scanf("%d",&x); insert(x); }else if (com[0]=='p'){ inorder(root); printf("\n"); preorder(root); printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220986/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220986/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @NIL = dso_local local_unnamed_addr global ptr null, align 8 @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp.not10 = icmp eq ptr %0, %u br i1 %cmp.not10, label %while.end, label %land.rhs land.rhs: ; preds = %entry, %while.body %u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ] %1 = load i32, ptr %u.addr.011, align 8, !tbaa !9 %cmp1.not = icmp eq i32 %1, %k br i1 %cmp1.not, label %while.end, label %while.body while.body: ; preds = %land.rhs %cmp3 = icmp sgt i32 %1, %k %left = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 2 %right = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 1 %u.addr.1.in = select i1 %cmp3, ptr %left, ptr %right %u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %u.addr.1, %0 br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !12 while.end: ; preds = %land.rhs, %while.body, %entry %u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ] ret ptr %u.addr.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %1 = load ptr, ptr @root, align 8, !tbaa !5 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6 store i32 %k, ptr %call, align 8, !tbaa !9 %left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2 store ptr %0, ptr %left, align 8, !tbaa !14 %right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1 store ptr %0, ptr %right, align 8, !tbaa !15 %cmp.not34 = icmp eq ptr %1, %0 br i1 %cmp.not34, label %while.end.thread, label %while.body while.end.thread: ; preds = %entry %parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3 store ptr %0, ptr %parent37, align 8, !tbaa !16 br label %if.end17 while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ] %2 = load i32, ptr %x.035, align 8, !tbaa !9 %cmp3 = icmp sgt i32 %2, %k %left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2 %right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left4, ptr %right5 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.1, %0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17 while.end: ; preds = %while.body %parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3 store ptr %x.035, ptr %parent, align 8, !tbaa !16 %cmp6 = icmp eq ptr %x.035, %0 br i1 %cmp6, label %if.end17, label %if.else8 if.else8: ; preds = %while.end %3 = load i32, ptr %x.035, align 8, !tbaa !9 %cmp11 = icmp sgt i32 %3, %k br i1 %cmp11, label %if.then12, label %if.else14 if.then12: ; preds = %if.else8 %left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2 br label %if.end17 if.else14: ; preds = %if.else8 %right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1 br label %if.end17 if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14 %left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ] store ptr %call, ptr %left13.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %u br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ] %left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2 %1 = load ptr, ptr %left, align 8, !tbaa !14 tail call void @inorder(ptr noundef %1) %2 = load i32, ptr %u.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2) %right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1 %3 = load ptr, ptr %right, align 8, !tbaa !15 %4 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 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 #4 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 { entry: %0 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %u br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ] %1 = load i32, ptr %u.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2 %2 = load ptr, ptr %left, align 8, !tbaa !14 tail call void @preorder(ptr noundef %2) %right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1 %3 = load ptr, ptr %right, align 8, !tbaa !15 %4 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !18 %cmp40 = icmp sgt i32 %0, 0 br i1 %cmp40, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.041 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !19 %cmp2 = icmp eq i8 %1, 102 br i1 %cmp2, label %if.then, label %if.end11 if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load ptr, ptr @root, align 8, !tbaa !5 %3 = load i32, ptr %x, align 4, !tbaa !18 %4 = load ptr, ptr @NIL, align 8, !tbaa !5 %cmp.not10.i = icmp eq ptr %4, %2 br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i land.rhs.i: ; preds = %if.then, %while.body.i %u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %2, %if.then ] %5 = load i32, ptr %u.addr.011.i, align 8, !tbaa !9 %cmp1.not.i = icmp eq i32 %5, %3 br i1 %cmp1.not.i, label %find.exit, label %while.body.i while.body.i: ; preds = %land.rhs.i %cmp3.i = icmp sgt i32 %5, %3 %left.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 2 %right.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 1 %u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %right.i %u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %u.addr.1.i, %4 br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !12 find.exit: ; preds = %land.rhs.i, %if.then %u.addr.0.lcssa.i = phi ptr [ %2, %if.then ], [ %u.addr.011.i, %land.rhs.i ] %cmp6.not = icmp eq ptr %u.addr.0.lcssa.i, %4 br i1 %cmp6.not, label %if.else, label %if.end11thread-pre-split if.else: ; preds = %while.body.i, %find.exit br label %if.end11thread-pre-split if.end11thread-pre-split: ; preds = %find.exit, %if.else %str.sink = phi ptr [ @str, %if.else ], [ @str.6, %find.exit ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %.pr = load i8, ptr %com, align 16, !tbaa !19 br label %if.end11 if.end11: ; preds = %if.end11thread-pre-split, %for.body %6 = phi i8 [ %.pr, %if.end11thread-pre-split ], [ %1, %for.body ] switch i8 %6, label %for.inc [ i8 105, label %if.then16 i8 112, label %if.then23 ] if.then16: ; preds = %if.end11 %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %7 = load i32, ptr %x, align 4, !tbaa !18 %8 = load ptr, ptr @NIL, align 8, !tbaa !5 %9 = load ptr, ptr @root, align 8, !tbaa !5 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6 store i32 %7, ptr %call.i, align 8, !tbaa !9 %left.i31 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2 store ptr %8, ptr %left.i31, align 8, !tbaa !14 %right.i32 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1 store ptr %8, ptr %right.i32, align 8, !tbaa !15 %cmp.not34.i = icmp eq ptr %9, %8 br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i33 while.end.thread.i: ; preds = %if.then16 %parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3 store ptr %8, ptr %parent37.i, align 8, !tbaa !16 br label %insert.exit while.body.i33: ; preds = %if.then16, %while.body.i33 %x.035.i = phi ptr [ %x.1.i, %while.body.i33 ], [ %9, %if.then16 ] %10 = load i32, ptr %x.035.i, align 8, !tbaa !9 %cmp3.i34 = icmp sgt i32 %10, %7 %left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2 %right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i34, ptr %left4.i, ptr %right5.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i35 = icmp eq ptr %x.1.i, %8 br i1 %cmp.not.i35, label %while.end.i, label %while.body.i33, !llvm.loop !17 while.end.i: ; preds = %while.body.i33 %parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3 store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16 %cmp6.i = icmp eq ptr %x.035.i, %8 %spec.select38 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i br label %insert.exit insert.exit: ; preds = %while.end.i, %while.end.thread.i %left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select38, %while.end.i ] store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5 br label %for.inc if.then23: ; preds = %if.end11 %11 = load ptr, ptr @root, align 8, !tbaa !5 call void @inorder(ptr noundef %11) %putchar = call i32 @putchar(i32 10) %12 = load ptr, ptr @root, align 8, !tbaa !5 call void @preorder(ptr noundef %12) %putchar30 = call i32 @putchar(i32 10) br label %for.inc for.inc: ; preds = %if.end11, %insert.exit, %if.then23 %inc = add nuw nsw i32 %i.041, 1 %13 = load i32, ptr %n, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %13 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind "no-trapping-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 allocsize(0) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 0} !10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!10, !6, i64 16} !15 = !{!10, !6, i64 8} !16 = !{!10, !6, i64 24} !17 = distinct !{!17, !13} !18 = !{!11, !11, i64 0} !19 = !{!7, !7, i64 0} !20 = distinct !{!20, !13}
#include<stdio.h> #include<stdlib.h> struct Node{ int key; struct Node *p; struct Node *l; struct Node *r; }; typedef struct Node * Nodepointer; Nodepointer root,nil; void insert(int i){ Nodepointer x = root; Nodepointer y = nil; /*parent*/ Nodepointer z; z = (struct Node *)malloc(sizeof(struct Node)); z->key = i; z->l = nil; z->r = nil; while(x != nil){ y = x; if(x->key > z->key) x = x->l; else x = x->r; } z->p = y; if(y == nil) root = z; else{ if(y->key > z->key) y->l = z; else y->r = z; } } void inorder(Nodepointer x){ if(x == nil) return; inorder(x->l); printf(" %d",x->key); inorder(x->r); } void preorder(Nodepointer x){ if(x == nil) return; printf(" %d",x->key); preorder(x->l); preorder(x->r); } Nodepointer find(Nodepointer x,int i){ while(x != nil && i != x->key){ if(x->key > i) x = x->l; else x = x->r; } return x; } int main(){ int n,i,num; char c[20]; scanf("%d",&n); for(i = 0;i < n;i++){ scanf("%s",&c); if(c[0] == 'i'){ scanf("%d",&num); insert(num); } else if(c[0] == 'p'){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if(c[0] == 'f'){ scanf("%d",&num); if(find(root,num) != nil) printf("yes\n"); else printf("no\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221035/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221035/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @root = dso_local local_unnamed_addr global ptr null, align 8 @nil = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 void @insert(i32 noundef %i) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !5 %1 = load ptr, ptr @nil, align 8, !tbaa !5 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6 store i32 %i, ptr %call, align 8, !tbaa !9 %l = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2 store ptr %1, ptr %l, align 8, !tbaa !12 %r = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3 store ptr %1, ptr %r, align 8, !tbaa !13 %cmp.not34 = icmp eq ptr %0, %1 br i1 %cmp.not34, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %2 = load i32, ptr %x.035, align 8, !tbaa !9 %cmp3 = icmp sgt i32 %2, %i %l4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2 %r5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 3 %x.1.in = select i1 %cmp3, ptr %l4, ptr %r5 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.1, %1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %entry %y.0.lcssa = phi ptr [ %0, %entry ], [ %x.035, %while.body ] %p = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1 store ptr %y.0.lcssa, ptr %p, align 8, !tbaa !16 %cmp6 = icmp eq ptr %y.0.lcssa, %1 br i1 %cmp6, label %if.end17, label %if.else8 if.else8: ; preds = %while.end %3 = load i32, ptr %y.0.lcssa, align 8, !tbaa !9 %cmp11 = icmp sgt i32 %3, %i br i1 %cmp11, label %if.then12, label %if.else14 if.then12: ; preds = %if.else8 %l13 = getelementptr inbounds %struct.Node, ptr %y.0.lcssa, i64 0, i32 2 br label %if.end17 if.else14: ; preds = %if.else8 %r15 = getelementptr inbounds %struct.Node, ptr %y.0.lcssa, i64 0, i32 3 br label %if.end17 if.end17: ; preds = %while.end, %if.then12, %if.else14 %l13.sink = phi ptr [ %l13, %if.then12 ], [ %r15, %if.else14 ], [ @root, %while.end ] store ptr %call, ptr %l13.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress 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 @inorder(ptr noundef readonly %x) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %x br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ] %l = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2 %1 = load ptr, ptr %l, align 8, !tbaa !12 tail call void @inorder(ptr noundef %1) %2 = load i32, ptr %x.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2) %r = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 3 %3 = load ptr, ptr %r, align 8, !tbaa !13 %4 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 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 #3 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %x) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp4 = icmp eq ptr %0, %x br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ] %1 = load i32, ptr %x.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %l = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2 %2 = load ptr, ptr %l, align 8, !tbaa !12 tail call void @preorder(ptr noundef %2) %r = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 3 %3 = load ptr, ptr %r, align 8, !tbaa !13 %4 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp = icmp eq ptr %4, %3 br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @find(ptr noundef readonly %x, i32 noundef %i) local_unnamed_addr #4 { entry: %0 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp.not10 = icmp eq ptr %0, %x br i1 %cmp.not10, label %while.end, label %land.rhs land.rhs: ; preds = %entry, %while.body %x.addr.011 = phi ptr [ %x.addr.1, %while.body ], [ %x, %entry ] %1 = load i32, ptr %x.addr.011, align 8, !tbaa !9 %cmp1.not = icmp eq i32 %1, %i br i1 %cmp1.not, label %while.end, label %while.body while.body: ; preds = %land.rhs %cmp3 = icmp sgt i32 %1, %i %l = getelementptr inbounds %struct.Node, ptr %x.addr.011, i64 0, i32 2 %r = getelementptr inbounds %struct.Node, ptr %x.addr.011, i64 0, i32 3 %x.addr.1.in = select i1 %cmp3, ptr %l, ptr %r %x.addr.1 = load ptr, ptr %x.addr.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %x.addr.1, %0 br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !17 while.end: ; preds = %land.rhs, %while.body, %entry %x.addr.0.lcssa = phi ptr [ %x, %entry ], [ %0, %while.body ], [ %x.addr.011, %land.rhs ] ret ptr %x.addr.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %num = alloca i32, align 4 %c = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #7 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %c) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !18 %cmp41 = icmp sgt i32 %0, 0 br i1 %cmp41, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.042 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c) %1 = load i8, ptr %c, align 16, !tbaa !19 switch i8 %1, label %for.inc [ i8 105, label %if.then i8 112, label %if.then9 i8 102, label %if.then17 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num) %2 = load i32, ptr %num, align 4, !tbaa !18 %3 = load ptr, ptr @root, align 8, !tbaa !5 %4 = load ptr, ptr @nil, align 8, !tbaa !5 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6 store i32 %2, ptr %call.i, align 8, !tbaa !9 %l.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2 store ptr %4, ptr %l.i, align 8, !tbaa !12 %r.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3 store ptr %4, ptr %r.i, align 8, !tbaa !13 %cmp.not34.i = icmp eq ptr %3, %4 br i1 %cmp.not34.i, label %while.end.i, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ] %5 = load i32, ptr %x.035.i, align 8, !tbaa !9 %cmp3.i = icmp sgt i32 %5, %2 %l4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2 %r5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 3 %x.1.in.i = select i1 %cmp3.i, ptr %l4.i, ptr %r5.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 %cmp.not.i = icmp eq ptr %x.1.i, %4 br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !14 while.end.i: ; preds = %while.body.i, %if.then %y.0.lcssa.i = phi ptr [ %3, %if.then ], [ %x.035.i, %while.body.i ] %p.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1 store ptr %y.0.lcssa.i, ptr %p.i, align 8, !tbaa !16 %cmp6.i = icmp eq ptr %y.0.lcssa.i, %4 br i1 %cmp6.i, label %insert.exit, label %if.else8.i if.else8.i: ; preds = %while.end.i %6 = load i32, ptr %y.0.lcssa.i, align 8, !tbaa !9 %cmp11.i = icmp sgt i32 %6, %2 br i1 %cmp11.i, label %if.then12.i, label %if.else14.i if.then12.i: ; preds = %if.else8.i %l13.i = getelementptr inbounds %struct.Node, ptr %y.0.lcssa.i, i64 0, i32 2 br label %insert.exit if.else14.i: ; preds = %if.else8.i %r15.i = getelementptr inbounds %struct.Node, ptr %y.0.lcssa.i, i64 0, i32 3 br label %insert.exit insert.exit: ; preds = %while.end.i, %if.then12.i, %if.else14.i %l13.sink.i = phi ptr [ %l13.i, %if.then12.i ], [ %r15.i, %if.else14.i ], [ @root, %while.end.i ] store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !5 br label %for.inc if.then9: ; preds = %for.body %7 = load ptr, ptr @root, align 8, !tbaa !5 call void @inorder(ptr noundef %7) %putchar = call i32 @putchar(i32 10) %8 = load ptr, ptr @root, align 8, !tbaa !5 call void @preorder(ptr noundef %8) %putchar31 = call i32 @putchar(i32 10) br label %for.inc if.then17: ; preds = %for.body %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num) %9 = load ptr, ptr @root, align 8, !tbaa !5 %10 = load i32, ptr %num, align 4, !tbaa !18 %11 = load ptr, ptr @nil, align 8, !tbaa !5 %cmp.not10.i = icmp eq ptr %11, %9 br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i land.rhs.i: ; preds = %if.then17, %while.body.i32 %x.addr.011.i = phi ptr [ %x.addr.1.i, %while.body.i32 ], [ %9, %if.then17 ] %12 = load i32, ptr %x.addr.011.i, align 8, !tbaa !9 %cmp1.not.i = icmp eq i32 %12, %10 br i1 %cmp1.not.i, label %find.exit, label %while.body.i32 while.body.i32: ; preds = %land.rhs.i %cmp3.i33 = icmp sgt i32 %12, %10 %l.i34 = getelementptr inbounds %struct.Node, ptr %x.addr.011.i, i64 0, i32 2 %r.i35 = getelementptr inbounds %struct.Node, ptr %x.addr.011.i, i64 0, i32 3 %x.addr.1.in.i = select i1 %cmp3.i33, ptr %l.i34, ptr %r.i35 %x.addr.1.i = load ptr, ptr %x.addr.1.in.i, align 8, !tbaa !5 %cmp.not.i36 = icmp eq ptr %x.addr.1.i, %11 br i1 %cmp.not.i36, label %if.else24, label %land.rhs.i, !llvm.loop !17 find.exit: ; preds = %land.rhs.i, %if.then17 %x.addr.0.lcssa.i = phi ptr [ %9, %if.then17 ], [ %x.addr.011.i, %land.rhs.i ] %cmp20.not = icmp eq ptr %x.addr.0.lcssa.i, %11 br i1 %cmp20.not, label %if.else24, label %if.then22 if.then22: ; preds = %find.exit %puts30 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else24: ; preds = %while.body.i32, %find.exit %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %for.body, %insert.exit, %if.else24, %if.then22, %if.then9 %inc = add nuw nsw i32 %i.042, 1 %13 = load i32, ptr %n, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %13 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %c) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree 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 = { nofree nounwind } attributes #6 = { nounwind allocsize(0) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 0} !10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24} !11 = !{!"int", !7, i64 0} !12 = !{!10, !6, i64 16} !13 = !{!10, !6, i64 24} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = !{!10, !6, i64 8} !17 = distinct !{!17, !15} !18 = !{!11, !11, i64 0} !19 = !{!7, !7, i64 0} !20 = distinct !{!20, !15}
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct node { int key; struct node *left; struct node *right; } Tree; Tree *root = NULL; Tree *make1node(int key) { Tree *tree = malloc(sizeof(struct node)); tree->key = key; tree->left = NULL; tree->right = NULL; return tree; } void insert(Tree *tree) { Tree *x, *y; y = NULL; x = root; while (x != NULL) { y = x; if (tree->key < x->key) x = x->left; else x = x->right; } if (y == NULL) root = tree; else if (tree->key < y->key) y->left = tree; else y->right = tree; } int find(Tree *tree, int key) { if (tree == NULL) return 0; if (tree->key == key) return 1; if(key < tree->key) return find(tree->left, key); else return find(tree->right, key); } void printleft(Tree *tree) { if (tree->left != NULL) printleft(tree->left); printf(" %d", tree->key); if (tree->right != NULL) printleft(tree->right); } void printmid(Tree *tree) { printf(" %d", tree->key); if (tree->left != NULL) printmid(tree->left); if (tree->right != NULL) printmid(tree->right); } void printtree(Tree *tree) { printleft(tree); printf("\n"); printmid(tree); printf("\n"); } int main(void){ int n, key, i, j, find_key[500000], find_key_num = 0, before = 0; char command[7]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%s", command); if (!strcmp(command, "insert")) { scanf("%d", &key); insert(make1node(key)); } else if (!strcmp(command, "find")) { scanf("%d", &key); find_key[find_key_num] = key; find_key_num++; } else { for (j = before; j < find_key_num; j++) { if (find(root, find_key[j])) { printf("yes\n"); } else { printf("no\n"); } } before = find_key_num; printtree(root); } } for (j = before; j < find_key_num; j++) { if (find(root, find_key[j])) { printf("yes\n"); } else { printf("no\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221079/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221079/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr } @root = dso_local local_unnamed_addr global ptr null, align 8 @.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.4 = private unnamed_addr constant [7 x i8] c"insert\00", align 1 @.str.5 = private unnamed_addr constant [5 x i8] c"find\00", align 1 @str.9 = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.10 = private unnamed_addr constant [4 x i8] c"yes\00", align 1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable define dso_local noalias ptr @make1node(i32 noundef %key) local_unnamed_addr #0 { entry: %call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #10 store i32 %key, ptr %call, align 8, !tbaa !5 %left = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false) ret ptr %call } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress 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(readwrite, inaccessiblemem: none) uwtable define dso_local void @insert(ptr noundef %tree) local_unnamed_addr #3 { entry: %x.026 = load ptr, ptr @root, align 8, !tbaa !11 %cmp.not27 = icmp eq ptr %x.026, null br i1 %cmp.not27, label %if.end14, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %0 = load i32, ptr %tree, align 8, !tbaa !5 br label %while.body while.body: ; preds = %while.body.lr.ph, %while.body %x.028 = phi ptr [ %x.026, %while.body.lr.ph ], [ %x.0, %while.body ] %1 = load i32, ptr %x.028, align 8, !tbaa !5 %cmp2 = icmp slt i32 %0, %1 %left = getelementptr inbounds %struct.node, ptr %x.028, i64 0, i32 1 %right = getelementptr inbounds %struct.node, ptr %x.028, i64 0, i32 2 %x.1.in = select i1 %cmp2, ptr %left, ptr %right %x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !11 %cmp.not = icmp eq ptr %x.0, null br i1 %cmp.not, label %if.else5, label %while.body, !llvm.loop !12 if.else5: ; preds = %while.body %2 = load i32, ptr %tree, align 8, !tbaa !5 %3 = load i32, ptr %x.028, align 8, !tbaa !5 %cmp8 = icmp slt i32 %2, %3 br i1 %cmp8, label %if.then9, label %if.else11 if.then9: ; preds = %if.else5 %left10 = getelementptr inbounds %struct.node, ptr %x.028, i64 0, i32 1 br label %if.end14 if.else11: ; preds = %if.else5 %right12 = getelementptr inbounds %struct.node, ptr %x.028, i64 0, i32 2 br label %if.end14 if.end14: ; preds = %entry, %if.then9, %if.else11 %left10.sink = phi ptr [ %left10, %if.then9 ], [ %right12, %if.else11 ], [ @root, %entry ] store ptr %tree, ptr %left10.sink, align 8, !tbaa !11 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @find(ptr noundef readonly %tree, i32 noundef %key) local_unnamed_addr #4 { entry: %cmp16 = icmp eq ptr %tree, null br i1 %cmp16, label %return, label %if.end if.end: ; preds = %entry, %if.end4 %tree.tr17 = phi ptr [ %tree.tr.be, %if.end4 ], [ %tree, %entry ] %0 = load i32, ptr %tree.tr17, align 8, !tbaa !5 %cmp2 = icmp eq i32 %0, %key br i1 %cmp2, label %return, label %if.end4 if.end4: ; preds = %if.end %cmp6 = icmp sgt i32 %0, %key %left = getelementptr inbounds %struct.node, ptr %tree.tr17, i64 0, i32 1 %right = getelementptr inbounds %struct.node, ptr %tree.tr17, i64 0, i32 2 %tree.tr.be.in = select i1 %cmp6, ptr %left, ptr %right %tree.tr.be = load ptr, ptr %tree.tr.be.in, align 8, !tbaa !11 %cmp = icmp eq ptr %tree.tr.be, null br i1 %cmp, label %return, label %if.end return: ; preds = %if.end4, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %if.end4 ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local void @printleft(ptr nocapture noundef readonly %tree) local_unnamed_addr #5 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %tree.tr = phi ptr [ %tree, %entry ], [ %2, %if.end ] %left = getelementptr inbounds %struct.node, ptr %tree.tr, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !14 %cmp.not = icmp eq ptr %0, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @printleft(ptr noundef nonnull %0) br label %if.end if.end: ; preds = %if.then, %tailrecurse %1 = load i32, ptr %tree.tr, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %right = getelementptr inbounds %struct.node, ptr %tree.tr, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !15 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: nofree nounwind uwtable define dso_local void @printmid(ptr nocapture noundef readonly %tree) local_unnamed_addr #5 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %tree.tr = phi ptr [ %tree, %entry ], [ %2, %if.end ] %0 = load i32, ptr %tree.tr, align 8, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %tree.tr, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !14 %cmp.not = icmp eq ptr %1, null br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @printmid(ptr noundef nonnull %1) br label %if.end if.end: ; preds = %if.then, %tailrecurse %right = getelementptr inbounds %struct.node, ptr %tree.tr, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !15 %cmp2.not = icmp eq ptr %2, null br i1 %cmp2.not, label %if.end5, label %tailrecurse if.end5: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @printtree(ptr nocapture noundef readonly %tree) local_unnamed_addr #5 { entry: tail call void @printleft(ptr noundef %tree) %putchar = tail call i32 @putchar(i32 10) tail call void @printmid(ptr noundef %tree) %putchar3 = tail call i32 @putchar(i32 10) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #5 { entry: %n = alloca i32, align 4 %key = alloca i32, align 4 %find_key = alloca [500000 x i32], align 16 %command = alloca [7 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #11 call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %find_key) #11 call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %command) #11 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !16 %cmp82 = icmp sgt i32 %0, 0 br i1 %cmp82, label %for.body, label %for.end43 for.cond29.preheader: ; preds = %for.inc26 %cmp3087 = icmp slt i32 %before.1, %find_key_num.1 br i1 %cmp3087, label %for.body31.preheader, label %for.end43 for.body31.preheader: ; preds = %for.cond29.preheader %1 = sext i32 %before.1 to i64 br label %for.body31 for.body: ; preds = %entry, %for.inc26 %before.085 = phi i32 [ %before.1, %for.inc26 ], [ 0, %entry ] %find_key_num.084 = phi i32 [ %find_key_num.1, %for.inc26 ], [ 0, %entry ] %i.083 = phi i32 [ %inc27, %for.inc26 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %command) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %command, ptr noundef nonnull dereferenceable(7) @.str.4, i64 7) %tobool.not = icmp eq i32 %bcmp, 0 br i1 %tobool.not, label %if.then, label %if.else if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %key) %2 = load i32, ptr %key, align 4, !tbaa !16 %call.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #10 store i32 %2, ptr %call.i, align 8, !tbaa !5 %left.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1 call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false) %x.026.i = load ptr, ptr @root, align 8, !tbaa !11 %cmp.not27.i = icmp eq ptr %x.026.i, null br i1 %cmp.not27.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.028.i = phi ptr [ %x.0.i, %while.body.i ], [ %x.026.i, %if.then ] %3 = load i32, ptr %x.028.i, align 8, !tbaa !5 %cmp2.i = icmp slt i32 %2, %3 %left.i59 = getelementptr inbounds %struct.node, ptr %x.028.i, i64 0, i32 1 %right.i = getelementptr inbounds %struct.node, ptr %x.028.i, i64 0, i32 2 %x.1.in.i = select i1 %cmp2.i, ptr %left.i59, ptr %right.i %x.0.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11 %cmp.not.i = icmp eq ptr %x.0.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12 insert.exit: ; preds = %while.body.i, %if.then %left10.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ] store ptr %call.i, ptr %left10.sink.i, align 8, !tbaa !11 br label %for.inc26 if.else: ; preds = %for.body %bcmp56 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %command, ptr noundef nonnull dereferenceable(5) @.str.5, i64 5) %tobool8.not = icmp eq i32 %bcmp56, 0 br i1 %tobool8.not, label %if.then9, label %for.cond12.preheader for.cond12.preheader: ; preds = %if.else %cmp1380 = icmp slt i32 %before.085, %find_key_num.084 br i1 %cmp1380, label %for.body14.preheader, label %for.end for.body14.preheader: ; preds = %for.cond12.preheader %4 = sext i32 %before.085 to i64 br label %for.body14 if.then9: ; preds = %if.else %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %key) %5 = load i32, ptr %key, align 4, !tbaa !16 %idxprom = sext i32 %find_key_num.084 to i64 %arrayidx = getelementptr inbounds [500000 x i32], ptr %find_key, i64 0, i64 %idxprom store i32 %5, ptr %arrayidx, align 4, !tbaa !16 %inc = add nsw i32 %find_key_num.084, 1 br label %for.inc26 for.body14: ; preds = %for.body14.preheader, %for.inc %indvars.iv = phi i64 [ %4, %for.body14.preheader ], [ %indvars.iv.next, %for.inc ] %6 = load ptr, ptr @root, align 8, !tbaa !11 %arrayidx16 = getelementptr inbounds [500000 x i32], ptr %find_key, i64 0, i64 %indvars.iv %7 = load i32, ptr %arrayidx16, align 4, !tbaa !16 %cmp16.i = icmp eq ptr %6, null br i1 %cmp16.i, label %for.inc, label %if.end.i if.end.i: ; preds = %for.body14, %if.end4.i %tree.tr17.i = phi ptr [ %tree.tr.be.i, %if.end4.i ], [ %6, %for.body14 ] %8 = load i32, ptr %tree.tr17.i, align 8, !tbaa !5 %cmp2.i60 = icmp eq i32 %8, %7 br i1 %cmp2.i60, label %for.inc, label %if.end4.i if.end4.i: ; preds = %if.end.i %cmp6.i = icmp sgt i32 %8, %7 %left.i61 = getelementptr inbounds %struct.node, ptr %tree.tr17.i, i64 0, i32 1 %right.i62 = getelementptr inbounds %struct.node, ptr %tree.tr17.i, i64 0, i32 2 %tree.tr.be.in.i = select i1 %cmp6.i, ptr %left.i61, ptr %right.i62 %tree.tr.be.i = load ptr, ptr %tree.tr.be.in.i, align 8, !tbaa !11 %cmp.i = icmp eq ptr %tree.tr.be.i, null br i1 %cmp.i, label %for.inc, label %if.end.i for.inc: ; preds = %if.end4.i, %if.end.i, %for.body14 %str.10.sink = phi ptr [ @str.9, %for.body14 ], [ @str.10, %if.end.i ], [ @str.9, %if.end4.i ] %puts58 = call i32 @puts(ptr nonnull dereferenceable(1) %str.10.sink) %indvars.iv.next = add nsw i64 %indvars.iv, 1 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 %exitcond.not = icmp eq i32 %find_key_num.084, %lftr.wideiv br i1 %exitcond.not, label %for.end, label %for.body14, !llvm.loop !17 for.end: ; preds = %for.inc, %for.cond12.preheader %9 = load ptr, ptr @root, align 8, !tbaa !11 call void @printleft(ptr noundef %9) %putchar.i = call i32 @putchar(i32 10) call void @printmid(ptr noundef %9) %putchar3.i = call i32 @putchar(i32 10) br label %for.inc26 for.inc26: ; preds = %insert.exit, %for.end, %if.then9 %find_key_num.1 = phi i32 [ %find_key_num.084, %for.end ], [ %inc, %if.then9 ], [ %find_key_num.084, %insert.exit ] %before.1 = phi i32 [ %find_key_num.084, %for.end ], [ %before.085, %if.then9 ], [ %before.085, %insert.exit ] %inc27 = add nuw nsw i32 %i.083, 1 %10 = load i32, ptr %n, align 4, !tbaa !16 %cmp = icmp slt i32 %inc27, %10 br i1 %cmp, label %for.body, label %for.cond29.preheader, !llvm.loop !18 for.body31: ; preds = %for.body31.preheader, %for.inc41 %indvars.iv90 = phi i64 [ %1, %for.body31.preheader ], [ %indvars.iv.next91, %for.inc41 ] %11 = load ptr, ptr @root, align 8, !tbaa !11 %arrayidx33 = getelementptr inbounds [500000 x i32], ptr %find_key, i64 0, i64 %indvars.iv90 %12 = load i32, ptr %arrayidx33, align 4, !tbaa !16 %cmp16.i63 = icmp eq ptr %11, null br i1 %cmp16.i63, label %for.inc41, label %if.end.i64 if.end.i64: ; preds = %for.body31, %if.end4.i67 %tree.tr17.i65 = phi ptr [ %tree.tr.be.i72, %if.end4.i67 ], [ %11, %for.body31 ] %13 = load i32, ptr %tree.tr17.i65, align 8, !tbaa !5 %cmp2.i66 = icmp eq i32 %13, %12 br i1 %cmp2.i66, label %for.inc41, label %if.end4.i67 if.end4.i67: ; preds = %if.end.i64 %cmp6.i68 = icmp sgt i32 %13, %12 %left.i69 = getelementptr inbounds %struct.node, ptr %tree.tr17.i65, i64 0, i32 1 %right.i70 = getelementptr inbounds %struct.node, ptr %tree.tr17.i65, i64 0, i32 2 %tree.tr.be.in.i71 = select i1 %cmp6.i68, ptr %left.i69, ptr %right.i70 %tree.tr.be.i72 = load ptr, ptr %tree.tr.be.in.i71, align 8, !tbaa !11 %cmp.i73 = icmp eq ptr %tree.tr.be.i72, null br i1 %cmp.i73, label %for.inc41, label %if.end.i64 for.inc41: ; preds = %if.end4.i67, %if.end.i64, %for.body31 %str.8.sink = phi ptr [ @str.9, %for.body31 ], [ @str.10, %if.end.i64 ], [ @str.9, %if.end4.i67 ] %puts55 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink) %indvars.iv.next91 = add nsw i64 %indvars.iv90, 1 %lftr.wideiv93 = trunc i64 %indvars.iv.next91 to i32 %exitcond94.not = icmp eq i32 %find_key_num.1, %lftr.wideiv93 br i1 %exitcond94.not, label %for.end43, label %for.body31, !llvm.loop !19 for.end43: ; preds = %for.inc41, %entry, %for.cond29.preheader call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %command) #11 call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %find_key) #11 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #11 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #8 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9 attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 } attributes #8 = { nofree nounwind willreturn memory(argmem: read) } attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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, !7, i64 0} !6 = !{!"node", !7, i64 0, !10, i64 8, !10, i64 16} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"any pointer", !8, i64 0} !11 = !{!10, !10, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = !{!6, !10, i64 8} !15 = !{!6, !10, i64 16} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !13} !18 = distinct !{!18, !13} !19 = distinct !{!19, !13}
#include<stdio.h> #include<stdlib.h> struct node{ struct node *right; struct node *left; struct node *parent; int key; }; typedef struct node * Node; #define NIL NULL Node root; Node treeMinimum(Node x){ while(1){ if(x->left == NIL)break; x = x->left; } return x; } Node treeMaximum(Node x){ while(1){ if(x->right == NIL)break; x = x->right; } return x; } Node treeSearch(Node u, int k){ while(1){ if(u == NIL || k == u->key)break; if(k < u->key){ u = u->left; } else { u = u->right; } } return u; } Node treeSuccessor(Node x){ Node y; if(x->right != NIL){ return treeMinimum(x->right); } y = x->parent; while(1){ if(y == NIL || x != y->right)break; x=y; y=y->parent; } return y; } void treeDelete(Node z){ Node y; // node to be deleted Node x; // child of y if(z->left == NIL || z->right == NIL){ y = z; } else { y = treeSuccessor(z); } if(y->left != NIL){ x = y->left; } else { x = y->right; } if(x != NIL){ x->parent = y->parent; } if(y->parent == NIL){ root = x; } else { if(y == y->parent->left){ y->parent->left = x; } else { y->parent->right = x; } } if(y != z){ z->key = y->key; } free(y); } void insert(int k){ Node y = NIL; Node x = root; Node z; z = malloc(sizeof(struct node)); z->key = k; z->left = NIL; z->right = NIL; while(1){ if(x == NIL)break; y=x; if(z->key < x->key){ x = x->left; } else { x = x->right; } } z->parent = y; if(y == NIL){ root = z; } else { if(z->key < y->key){ y->left = z; } else { y->right = z; } } } void inorder(Node u){ if(u==NIL)return; inorder(u->left); printf(" %d",u->key); inorder(u->right); } void preorder(Node u){ if(u==NIL)return; printf(" %d",u->key); preorder(u->left); preorder(u->right); } int main(){ int n, i, x; char com[20]; scanf("%d", &n); for ( i = 0; i < n; i++ ){ scanf("%s", com); if ( com[0] == 'f' ){ scanf("%d", &x); Node t = treeSearch(root, x); if ( t != NIL ) printf("yes\n"); else printf("no\n"); } else if ( com[0] == 'i' ){ scanf("%d", &x); insert(x); } else if ( com[0] == 'p' ){ inorder(root); printf("\n"); preorder(root); printf("\n"); } else if ( com[0] == 'd' ){ scanf("%d", &x); treeDelete(treeSearch(root, x)); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221136/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221136/source.c" target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 } @root = dso_local local_unnamed_addr global ptr null, align 8 @.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 [3 x i8] c"%s\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 norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeMinimum(ptr noundef readonly %x) local_unnamed_addr #0 { entry: br label %while.body while.body: ; preds = %while.body, %entry %x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.body ] %left = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !5 %cmp = icmp eq ptr %0, null br i1 %cmp, label %while.end, label %while.body while.end: ; preds = %while.body ret ptr %x.addr.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeMaximum(ptr noundef readonly %x) local_unnamed_addr #0 { entry: br label %while.body while.body: ; preds = %while.body, %entry %x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.body ] %0 = load ptr, ptr %x.addr.0, align 8, !tbaa !11 %cmp = icmp eq ptr %0, null br i1 %cmp, label %while.end, label %while.body while.end: ; preds = %while.body ret ptr %x.addr.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 { entry: %cmp12 = icmp eq ptr %u, null br i1 %cmp12, label %while.end, label %lor.lhs.false lor.lhs.false: ; preds = %entry, %if.end %u.addr.013 = phi ptr [ %u.addr.1, %if.end ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.addr.013, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !12 %cmp1 = icmp eq i32 %0, %k br i1 %cmp1, label %while.end, label %if.end if.end: ; preds = %lor.lhs.false %cmp3 = icmp sgt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %u.addr.013, i64 0, i32 1 %u.addr.1.in = select i1 %cmp3, ptr %left, ptr %u.addr.013 %u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !13 %cmp = icmp eq ptr %u.addr.1, null br i1 %cmp, label %while.end, label %lor.lhs.false while.end: ; preds = %lor.lhs.false, %if.end, %entry %u.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %if.end ], [ %u.addr.013, %lor.lhs.false ] ret ptr %u.addr.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local ptr @treeSuccessor(ptr noundef readonly %x) local_unnamed_addr #0 { entry: %0 = load ptr, ptr %x, align 8, !tbaa !11 %cmp.not = icmp eq ptr %0, null br i1 %cmp.not, label %while.cond, label %while.body.i while.body.i: ; preds = %entry, %while.body.i %x.addr.0.i = phi ptr [ %1, %while.body.i ], [ %0, %entry ] %left.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i, i64 0, i32 1 %1 = load ptr, ptr %left.i, align 8, !tbaa !5 %cmp.i = icmp eq ptr %1, null br i1 %cmp.i, label %cleanup, label %while.body.i while.cond: ; preds = %entry, %lor.lhs.false %x.addr.0 = phi ptr [ %y.0, %lor.lhs.false ], [ %x, %entry ] %y.0.in = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 2 %y.0 = load ptr, ptr %y.0.in, align 8, !tbaa !14 %cmp2 = icmp eq ptr %y.0, null br i1 %cmp2, label %cleanup, label %lor.lhs.false lor.lhs.false: ; preds = %while.cond %2 = load ptr, ptr %y.0, align 8, !tbaa !11 %cmp4.not = icmp eq ptr %x.addr.0, %2 br i1 %cmp4.not, label %while.cond, label %cleanup cleanup: ; preds = %while.body.i, %lor.lhs.false, %while.cond %retval.0 = phi ptr [ %y.0, %lor.lhs.false ], [ null, %while.cond ], [ %x.addr.0.i, %while.body.i ] ret ptr %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nounwind uwtable define dso_local void @treeDelete(ptr noundef %z) local_unnamed_addr #2 { entry: %left = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !5 %cmp = icmp eq ptr %0, null br i1 %cmp, label %if.end8, label %lor.lhs.false lor.lhs.false: ; preds = %entry %1 = load ptr, ptr %z, align 8, !tbaa !11 %cmp1 = icmp eq ptr %1, null br i1 %cmp1, label %if.then10, label %while.body.i.i while.body.i.i: ; preds = %lor.lhs.false, %while.body.i.i %x.addr.0.i.i = phi ptr [ %2, %while.body.i.i ], [ %1, %lor.lhs.false ] %left.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i, i64 0, i32 1 %2 = load ptr, ptr %left.i.i, align 8, !tbaa !5 %cmp.i.i = icmp eq ptr %2, null br i1 %cmp.i.i, label %if.end8, label %while.body.i.i if.end8: ; preds = %while.body.i.i, %entry %y.0.ph = phi ptr [ %z, %entry ], [ %x.addr.0.i.i, %while.body.i.i ] %3 = load ptr, ptr %y.0.ph, align 8, !tbaa !11 %cmp9.not = icmp eq ptr %3, null br i1 %cmp9.not, label %if.end12, label %if.then10 if.then10: ; preds = %lor.lhs.false, %if.end8 %y.059 = phi ptr [ %y.0.ph, %if.end8 ], [ %z, %lor.lhs.false ] %x.055 = phi ptr [ %3, %if.end8 ], [ %0, %lor.lhs.false ] %parent = getelementptr inbounds %struct.node, ptr %y.059, i64 0, i32 2 %4 = load ptr, ptr %parent, align 8, !tbaa !14 %parent11 = getelementptr inbounds %struct.node, ptr %x.055, i64 0, i32 2 store ptr %4, ptr %parent11, align 8, !tbaa !14 br label %if.end12 if.end12: ; preds = %if.then10, %if.end8 %y.061 = phi ptr [ %y.059, %if.then10 ], [ %y.0.ph, %if.end8 ] %x.056 = phi ptr [ %x.055, %if.then10 ], [ null, %if.end8 ] %parent13 = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 2 %5 = load ptr, ptr %parent13, align 8, !tbaa !14 %cmp14 = icmp eq ptr %5, null br i1 %cmp14, label %if.end27, label %if.else16 if.else16: ; preds = %if.end12 %left18 = getelementptr inbounds %struct.node, ptr %5, i64 0, i32 1 %6 = load ptr, ptr %left18, align 8, !tbaa !5 %cmp19 = icmp eq ptr %y.061, %6 %left18. = select i1 %cmp19, ptr %left18, ptr %5 br label %if.end27 if.end27: ; preds = %if.else16, %if.end12 %left18.sink = phi ptr [ @root, %if.end12 ], [ %left18., %if.else16 ] store ptr %x.056, ptr %left18.sink, align 8, !tbaa !13 %cmp28.not = icmp eq ptr %y.061, %z br i1 %cmp28.not, label %if.end31, label %if.then29 if.then29: ; preds = %if.end27 %key = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 3 %7 = load i32, ptr %key, align 8, !tbaa !12 %key30 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 3 store i32 %7, ptr %key30, align 8, !tbaa !12 br label %if.end31 if.end31: ; preds = %if.then29, %if.end27 tail call void @free(ptr noundef nonnull %y.061) #9 ret void } ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %k) local_unnamed_addr #4 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !13 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10 %key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store i32 %k, ptr %key, align 8, !tbaa !12 %cmp36 = icmp eq ptr %0, null tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false) br i1 %cmp36, label %if.then9, label %if.end if.end: ; preds = %entry, %if.end %x.037 = phi ptr [ %x.1, %if.end ], [ %0, %entry ] %key2 = getelementptr inbounds %struct.node, ptr %x.037, i64 0, i32 3 %1 = load i32, ptr %key2, align 8, !tbaa !12 %cmp3 = icmp sgt i32 %1, %k %left5 = getelementptr inbounds %struct.node, ptr %x.037, i64 0, i32 1 %x.1.in = select i1 %cmp3, ptr %left5, ptr %x.037 %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !13 %cmp = icmp eq ptr %x.1, null br i1 %cmp, label %if.else10, label %if.end if.then9: ; preds = %entry %parent39 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr null, ptr %parent39, align 8, !tbaa !14 br label %if.end19 if.else10: ; preds = %if.end %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2 store ptr %x.037, ptr %parent, align 8, !tbaa !14 %key12 = getelementptr inbounds %struct.node, ptr %x.037, i64 0, i32 3 %2 = load i32, ptr %key12, align 8, !tbaa !12 %cmp13 = icmp sgt i32 %2, %k %left15 = getelementptr inbounds %struct.node, ptr %x.037, i64 0, i32 1 %spec.select = select i1 %cmp13, ptr %left15, ptr %x.037 br label %if.end19 if.end19: ; preds = %if.else10, %if.then9 %left15.sink = phi ptr [ @root, %if.then9 ], [ %spec.select, %if.else10 ] store ptr %call, ptr %left15.sink, align 8, !tbaa !13 ret void } ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #4 { entry: %cmp4 = icmp eq ptr %u, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ] %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !5 tail call void @inorder(ptr noundef %0) %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %1 = load i32, ptr %key, align 8, !tbaa !12 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !11 %cmp = icmp eq ptr %2, null 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 #6 ; Function Attrs: nofree nounwind uwtable define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #4 { entry: %cmp4 = icmp eq ptr %u, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ] %key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3 %0 = load i32, ptr %key, align 8, !tbaa !12 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !5 tail call void @preorder(ptr noundef %1) %2 = load ptr, ptr %u.tr5, align 8, !tbaa !11 %cmp = icmp eq ptr %2, null br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %com = alloca [20 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !15 %cmp66 = icmp sgt i32 %0, 0 br i1 %cmp66, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.067 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com) %1 = load i8, ptr %com, align 16, !tbaa !16 switch i8 %1, label %for.inc [ i8 102, label %if.then i8 105, label %if.then16 i8 112, label %if.then23 i8 100, label %if.then31 ] if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %2 = load ptr, ptr @root, align 8, !tbaa !13 %3 = load i32, ptr %x, align 4, !tbaa !15 %cmp12.i = icmp eq ptr %2, null br i1 %cmp12.i, label %if.else, label %lor.lhs.false.i lor.lhs.false.i: ; preds = %if.then, %if.end.i %u.addr.013.i = phi ptr [ %u.addr.1.i, %if.end.i ], [ %2, %if.then ] %key.i = getelementptr inbounds %struct.node, ptr %u.addr.013.i, i64 0, i32 3 %4 = load i32, ptr %key.i, align 8, !tbaa !12 %cmp1.i = icmp eq i32 %4, %3 br i1 %cmp1.i, label %if.then8, label %if.end.i if.end.i: ; preds = %lor.lhs.false.i %cmp3.i = icmp sgt i32 %4, %3 %left.i = getelementptr inbounds %struct.node, ptr %u.addr.013.i, i64 0, i32 1 %u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %u.addr.013.i %u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !13 %cmp.i = icmp eq ptr %u.addr.1.i, null br i1 %cmp.i, label %if.else, label %lor.lhs.false.i if.then8: ; preds = %lor.lhs.false.i %puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc if.else: ; preds = %if.end.i, %if.then %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc if.then16: ; preds = %for.body %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %5 = load i32, ptr %x, align 4, !tbaa !15 %6 = load ptr, ptr @root, align 8, !tbaa !13 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10 %key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store i32 %5, ptr %key.i41, align 8, !tbaa !12 %cmp36.i = icmp eq ptr %6, null call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false) br i1 %cmp36.i, label %insert.exit, label %if.end.i42 if.end.i42: ; preds = %if.then16, %if.end.i42 %x.037.i = phi ptr [ %x.1.i, %if.end.i42 ], [ %6, %if.then16 ] %key2.i = getelementptr inbounds %struct.node, ptr %x.037.i, i64 0, i32 3 %7 = load i32, ptr %key2.i, align 8, !tbaa !12 %cmp3.i43 = icmp sgt i32 %7, %5 %left5.i = getelementptr inbounds %struct.node, ptr %x.037.i, i64 0, i32 1 %x.1.in.i = select i1 %cmp3.i43, ptr %left5.i, ptr %x.037.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !13 %cmp.i44 = icmp eq ptr %x.1.i, null br i1 %cmp.i44, label %insert.exit, label %if.end.i42 insert.exit: ; preds = %if.end.i42, %if.then16 %.sink = phi ptr [ null, %if.then16 ], [ %x.037.i, %if.end.i42 ] %left15.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %if.end.i42 ] %parent39.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2 store ptr %.sink, ptr %parent39.i, align 8, !tbaa !14 store ptr %call.i, ptr %left15.sink.i, align 8, !tbaa !13 br label %for.inc if.then23: ; preds = %for.body %8 = load ptr, ptr @root, align 8, !tbaa !13 call void @inorder(ptr noundef %8) %putchar = call i32 @putchar(i32 10) %9 = load ptr, ptr @root, align 8, !tbaa !13 call void @preorder(ptr noundef %9) %putchar39 = call i32 @putchar(i32 10) br label %for.inc if.then31: ; preds = %for.body %call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %10 = load ptr, ptr @root, align 8, !tbaa !13 %11 = load i32, ptr %x, align 4, !tbaa !15 %cmp12.i45 = icmp eq ptr %10, null br i1 %cmp12.i45, label %treeSearch.exit57, label %lor.lhs.false.i46 lor.lhs.false.i46: ; preds = %if.then31, %if.end.i50 %u.addr.013.i47 = phi ptr [ %u.addr.1.i54, %if.end.i50 ], [ %10, %if.then31 ] %key.i48 = getelementptr inbounds %struct.node, ptr %u.addr.013.i47, i64 0, i32 3 %12 = load i32, ptr %key.i48, align 8, !tbaa !12 %cmp1.i49 = icmp eq i32 %12, %11 br i1 %cmp1.i49, label %treeSearch.exit57, label %if.end.i50 if.end.i50: ; preds = %lor.lhs.false.i46 %cmp3.i51 = icmp sgt i32 %12, %11 %left.i52 = getelementptr inbounds %struct.node, ptr %u.addr.013.i47, i64 0, i32 1 %u.addr.1.in.i53 = select i1 %cmp3.i51, ptr %left.i52, ptr %u.addr.013.i47 %u.addr.1.i54 = load ptr, ptr %u.addr.1.in.i53, align 8, !tbaa !13 %cmp.i55 = icmp eq ptr %u.addr.1.i54, null br i1 %cmp.i55, label %treeSearch.exit57, label %lor.lhs.false.i46 treeSearch.exit57: ; preds = %lor.lhs.false.i46, %if.end.i50, %if.then31 %u.addr.0.lcssa.i56 = phi ptr [ null, %if.then31 ], [ %u.addr.013.i47, %lor.lhs.false.i46 ], [ null, %if.end.i50 ] %left.i58 = getelementptr inbounds %struct.node, ptr %u.addr.0.lcssa.i56, i64 0, i32 1 %13 = load ptr, ptr %left.i58, align 8, !tbaa !5 %cmp.i59 = icmp eq ptr %13, null br i1 %cmp.i59, label %if.end8.i, label %lor.lhs.false.i60 lor.lhs.false.i60: ; preds = %treeSearch.exit57 %14 = load ptr, ptr %u.addr.0.lcssa.i56, align 8, !tbaa !11 %cmp1.i61 = icmp eq ptr %14, null br i1 %cmp1.i61, label %if.then10.i, label %while.body.i.i.i while.body.i.i.i: ; preds = %lor.lhs.false.i60, %while.body.i.i.i %x.addr.0.i.i.i = phi ptr [ %15, %while.body.i.i.i ], [ %14, %lor.lhs.false.i60 ] %left.i.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i.i, i64 0, i32 1 %15 = load ptr, ptr %left.i.i.i, align 8, !tbaa !5 %cmp.i.i.i = icmp eq ptr %15, null br i1 %cmp.i.i.i, label %if.end8.i, label %while.body.i.i.i if.end8.i: ; preds = %while.body.i.i.i, %treeSearch.exit57 %y.0.ph.i = phi ptr [ %u.addr.0.lcssa.i56, %treeSearch.exit57 ], [ %x.addr.0.i.i.i, %while.body.i.i.i ] %16 = load ptr, ptr %y.0.ph.i, align 8, !tbaa !11 %cmp9.not.i = icmp eq ptr %16, null br i1 %cmp9.not.i, label %if.end12.i, label %if.then10.i if.then10.i: ; preds = %if.end8.i, %lor.lhs.false.i60 %y.059.i = phi ptr [ %y.0.ph.i, %if.end8.i ], [ %u.addr.0.lcssa.i56, %lor.lhs.false.i60 ] %x.055.i = phi ptr [ %16, %if.end8.i ], [ %13, %lor.lhs.false.i60 ] %parent.i62 = getelementptr inbounds %struct.node, ptr %y.059.i, i64 0, i32 2 %17 = load ptr, ptr %parent.i62, align 8, !tbaa !14 %parent11.i = getelementptr inbounds %struct.node, ptr %x.055.i, i64 0, i32 2 store ptr %17, ptr %parent11.i, align 8, !tbaa !14 br label %if.end12.i if.end12.i: ; preds = %if.then10.i, %if.end8.i %y.061.i = phi ptr [ %y.059.i, %if.then10.i ], [ %y.0.ph.i, %if.end8.i ] %x.056.i = phi ptr [ %x.055.i, %if.then10.i ], [ null, %if.end8.i ] %parent13.i = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 2 %18 = load ptr, ptr %parent13.i, align 8, !tbaa !14 %cmp14.i = icmp eq ptr %18, null br i1 %cmp14.i, label %if.end27.i, label %if.else16.i if.else16.i: ; preds = %if.end12.i %left18.i = getelementptr inbounds %struct.node, ptr %18, i64 0, i32 1 %19 = load ptr, ptr %left18.i, align 8, !tbaa !5 %cmp19.i = icmp eq ptr %y.061.i, %19 %left18..i = select i1 %cmp19.i, ptr %left18.i, ptr %18 br label %if.end27.i if.end27.i: ; preds = %if.else16.i, %if.end12.i %left18.sink.i = phi ptr [ @root, %if.end12.i ], [ %left18..i, %if.else16.i ] store ptr %x.056.i, ptr %left18.sink.i, align 8, !tbaa !13 %cmp28.not.i = icmp eq ptr %y.061.i, %u.addr.0.lcssa.i56 br i1 %cmp28.not.i, label %treeDelete.exit, label %if.then29.i if.then29.i: ; preds = %if.end27.i %key.i63 = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 3 %20 = load i32, ptr %key.i63, align 8, !tbaa !12 %key30.i = getelementptr inbounds %struct.node, ptr %u.addr.0.lcssa.i56, i64 0, i32 3 store i32 %20, ptr %key30.i, align 8, !tbaa !12 br label %treeDelete.exit treeDelete.exit: ; preds = %if.end27.i, %if.then29.i call void @free(ptr noundef nonnull %y.061.i) #9 br label %for.inc for.inc: ; preds = %for.body, %if.then8, %if.else, %if.then23, %treeDelete.exit, %insert.exit %inc = add nuw nsw i32 %i.067, 1 %21 = load i32, ptr %n, align 4, !tbaa !15 %cmp = icmp slt i32 %inc, %21 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8 attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 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 #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind "no-trapping-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 nounwind willreturn memory(argmem: write) } 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, !7, i64 8} !6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24} !7 = !{!"any pointer", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"int", !8, i64 0} !11 = !{!6, !7, i64 0} !12 = !{!6, !10, i64 24} !13 = !{!7, !7, i64 0} !14 = !{!6, !7, i64 16} !15 = !{!10, !10, i64 0} !16 = !{!8, !8, i64 0} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int t,j,i; long long int n,s; scanf("%d",&t); for(j=0;j<t;j++){ scanf("%lld",&n); s=1; n=n*2; for(i=3;i<=n;i++){ s=(s*i)%1000000007; } printf("%lld\n",s); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22118/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22118/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp20 = icmp sgt i32 %0, 0 br i1 %cmp20, label %for.body, label %for.end11 for.body: ; preds = %entry, %for.end %j.021 = phi i32 [ %inc10, %for.end ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i64, ptr %n, align 8, !tbaa !9 %mul = shl i64 %1, 1 store i64 %mul, ptr %n, align 8, !tbaa !9 %cmp3.not16 = icmp slt i64 %1, 2 br i1 %cmp3.not16, label %for.end, label %for.body5.preheader for.body5.preheader: ; preds = %for.body %2 = or i64 %mul, 1 %smax = call i64 @llvm.smax.i64(i64 %2, i64 4) %3 = add nsw i64 %smax, -3 %4 = add nsw i64 %smax, -4 %xtraiter = and i64 %3, 3 %5 = icmp ult i64 %4, 3 br i1 %5, label %for.end.loopexit.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %3, -4 br label %for.body5 for.body5: ; preds = %for.body5, %for.body5.preheader.new %indvars.iv = phi i64 [ 3, %for.body5.preheader.new ], [ %indvars.iv.next.3, %for.body5 ] %s.018 = phi i64 [ 1, %for.body5.preheader.new ], [ %rem.3, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ] %mul7 = mul nsw i64 %s.018, %indvars.iv %rem = srem i64 %mul7, 1000000007 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %mul7.1 = mul nsw i64 %rem, %indvars.iv.next %rem.1 = srem i64 %mul7.1, 1000000007 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul7.2 = mul nsw i64 %rem.1, %indvars.iv.next.1 %rem.2 = srem i64 %mul7.2, 1000000007 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %mul7.3 = mul nsw i64 %rem.2, %indvars.iv.next.2 %rem.3 = srem i64 %mul7.3, 1000000007 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11 for.end.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body5.preheader ], [ %rem.3, %for.body5 ] %indvars.iv.unr = phi i64 [ 3, %for.body5.preheader ], [ %indvars.iv.next.3, %for.body5 ] %s.018.unr = phi i64 [ 1, %for.body5.preheader ], [ %rem.3, %for.body5 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body5.epil for.body5.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body5.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body5.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %s.018.epil = phi i64 [ %rem.epil, %for.body5.epil ], [ %s.018.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul7.epil = mul nsw i64 %s.018.epil, %indvars.iv.epil %rem.epil = srem i64 %mul7.epil, 1000000007 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body5.epil, !llvm.loop !13 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body5.epil, %for.body %s.0.lcssa = phi i64 [ 1, %for.body ], [ %rem.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body5.epil ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.0.lcssa) %inc10 = add nuw nsw i32 %j.021, 1 %6 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc10, %6 br i1 %cmp, label %for.body, label %for.end11, !llvm.loop !15 for.end11: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 8, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"long long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.unroll.disable"} !15 = distinct !{!15, !12}
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node{ int key; struct node *left; struct node *right; struct node *parent; }; typedef struct node *NodePointer; void insert(int); int Search(NodePointer, int); void Preorder(NodePointer); void Inorder(NodePointer); NodePointer root = NULL; int main () { int n = 0, i, x = 0; char str[7]; scanf("%d",&n); for(i = 0 ; i < n ; i++) { scanf("%s",str); if(strcmp(str,"insert") == 0) { scanf("%d",&x); insert(x); } else if(strcmp(str,"print") == 0) { Inorder(root); printf("\n"); Preorder(root); printf("\n"); } else { scanf("%d",&x); if(Search(root, x) == 1) printf("yes\n"); else printf("no\n"); } } return 0; } int Search(NodePointer p, int x) { if(p == NULL) return 0; else if(p->key == x) return 1; else if(p->key > x) return Search(p->left, x); else return Search(p->right, x); } void insert(int z) { NodePointer p, x = root, y = NULL; p = (NodePointer)malloc(sizeof(struct node)); p->key = z; while(x != NULL) { y = x; if(z < x->key) x = x->left; else x = x->right; } p->parent = y; if(y == NULL) root = p; else if(p->key < y->key) y->left = p; else y->right = p; p->left = NULL; p->right = NULL; } void Preorder(NodePointer cur) { if(cur != NULL) { printf(" %d",cur->key); Preorder(cur->left); Preorder(cur->right); } } void Inorder(NodePointer cur) { if(cur != NULL) { Inorder(cur->left); printf(" %d",cur->key); Inorder(cur->right); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221222/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221222/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @root = dso_local local_unnamed_addr global ptr null, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"insert\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.7 = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.8 = 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 %x = alloca i32, align 4 %str = alloca [7 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 store i32 0, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8 store i32 0, ptr %x, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %str) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp30 = icmp sgt i32 %0, 0 br i1 %cmp30, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.031 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %str, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7) %cmp4 = icmp eq i32 %bcmp, 0 br i1 %cmp4, label %if.then, label %if.else if.then: ; preds = %for.body %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %1 = load i32, ptr %x, align 4, !tbaa !5 %2 = load ptr, ptr @root, align 8, !tbaa !9 %call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9 store i32 %1, ptr %call.i, align 8, !tbaa !11 %cmp.not33.i = icmp eq ptr %2, null br i1 %cmp.not33.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.034.i = phi ptr [ %x.1.i, %while.body.i ], [ %2, %if.then ] %3 = load i32, ptr %x.034.i, align 8, !tbaa !11 %cmp2.i = icmp sgt i32 %3, %1 %left.i = getelementptr inbounds %struct.node, ptr %x.034.i, i64 0, i32 1 %right.i = getelementptr inbounds %struct.node, ptr %x.034.i, i64 0, i32 2 %x.1.in.i = select i1 %cmp2.i, ptr %left.i, ptr %right.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !9 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !13 insert.exit: ; preds = %while.body.i, %if.then %x.034.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.034.i, %while.body.i ] %left10.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ] %parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3 store ptr %x.034.i.lcssa.sink, ptr %parent.i, align 8, !tbaa !15 store ptr %call.i, ptr %left10.sink.i, align 8, !tbaa !9 %left15.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1 call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left15.i, i8 0, i64 16, i1 false) br label %for.inc if.else: ; preds = %for.body %bcmp23 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %str, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6) %cmp8 = icmp eq i32 %bcmp23, 0 br i1 %cmp8, label %if.then9, label %if.else12 if.then9: ; preds = %if.else %4 = load ptr, ptr @root, align 8, !tbaa !9 call void @Inorder(ptr noundef %4) %putchar = call i32 @putchar(i32 10) %5 = load ptr, ptr @root, align 8, !tbaa !9 call void @Preorder(ptr noundef %5) %putchar25 = call i32 @putchar(i32 10) br label %for.inc if.else12: ; preds = %if.else %call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %6 = load ptr, ptr @root, align 8, !tbaa !9 %7 = load i32, ptr %x, align 4, !tbaa !5 %cmp16.i = icmp eq ptr %6, null br i1 %cmp16.i, label %if.else18, label %if.else.i if.else.i: ; preds = %if.else12, %if.else3.i %p.tr17.i = phi ptr [ %p.tr.be.i, %if.else3.i ], [ %6, %if.else12 ] %8 = load i32, ptr %p.tr17.i, align 8, !tbaa !11 %cmp1.i = icmp eq i32 %8, %7 br i1 %cmp1.i, label %if.then16, label %if.else3.i if.else3.i: ; preds = %if.else.i %cmp5.i = icmp sgt i32 %8, %7 %left.i26 = getelementptr inbounds %struct.node, ptr %p.tr17.i, i64 0, i32 1 %right.i27 = getelementptr inbounds %struct.node, ptr %p.tr17.i, i64 0, i32 2 %p.tr.be.in.i = select i1 %cmp5.i, ptr %left.i26, ptr %right.i27 %p.tr.be.i = load ptr, ptr %p.tr.be.in.i, align 8, !tbaa !9 %cmp.i = icmp eq ptr %p.tr.be.i, null br i1 %cmp.i, label %if.else18, label %if.else.i if.then16: ; preds = %if.else.i %puts24 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) br label %for.inc if.else18: ; preds = %if.else3.i, %if.else12 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %insert.exit, %if.then16, %if.else18, %if.then9 %inc = add nuw nsw i32 %i.031, 1 %9 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %9 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %str) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @insert(i32 noundef %z) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !9 %call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9 store i32 %z, ptr %call, align 8, !tbaa !11 %cmp.not33 = icmp eq ptr %0, null br i1 %cmp.not33, label %if.then4, label %while.body while.body: ; preds = %entry, %while.body %x.034 = phi ptr [ %x.1, %while.body ], [ %0, %entry ] %1 = load i32, ptr %x.034, align 8, !tbaa !11 %cmp2 = icmp sgt i32 %1, %z %left = getelementptr inbounds %struct.node, ptr %x.034, i64 0, i32 1 %right = getelementptr inbounds %struct.node, ptr %x.034, i64 0, i32 2 %x.1.in = select i1 %cmp2, ptr %left, ptr %right %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !9 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else5, label %while.body, !llvm.loop !13 if.then4: ; preds = %entry %parent36 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store ptr null, ptr %parent36, align 8, !tbaa !15 br label %if.end14 if.else5: ; preds = %while.body %parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3 store ptr %x.034, ptr %parent, align 8, !tbaa !15 %2 = load i32, ptr %x.034, align 8, !tbaa !11 %cmp8 = icmp sgt i32 %2, %z br i1 %cmp8, label %if.then9, label %if.else11 if.then9: ; preds = %if.else5 %left10 = getelementptr inbounds %struct.node, ptr %x.034, i64 0, i32 1 br label %if.end14 if.else11: ; preds = %if.else5 %right12 = getelementptr inbounds %struct.node, ptr %x.034, i64 0, i32 2 br label %if.end14 if.end14: ; preds = %if.then9, %if.else11, %if.then4 %left10.sink = phi ptr [ %left10, %if.then9 ], [ %right12, %if.else11 ], [ @root, %if.then4 ] store ptr %call, ptr %left10.sink, align 8, !tbaa !9 %left15 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left15, i8 0, i64 16, i1 false) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @Inorder(ptr noundef readonly %cur) local_unnamed_addr #0 { entry: %cmp.not4 = icmp eq ptr %cur, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %cur.tr5 = phi ptr [ %2, %if.then ], [ %cur, %entry ] %left = getelementptr inbounds %struct.node, ptr %cur.tr5, i64 0, i32 1 %0 = load ptr, ptr %left, align 8, !tbaa !17 tail call void @Inorder(ptr noundef %0) %1 = load i32, ptr %cur.tr5, align 8, !tbaa !11 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %1) %right = getelementptr inbounds %struct.node, ptr %cur.tr5, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !18 %cmp.not = icmp eq ptr %2, null 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 #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @Preorder(ptr noundef readonly %cur) local_unnamed_addr #0 { entry: %cmp.not4 = icmp eq ptr %cur, null br i1 %cmp.not4, label %if.end, label %if.then if.then: ; preds = %entry, %if.then %cur.tr5 = phi ptr [ %2, %if.then ], [ %cur, %entry ] %0 = load i32, ptr %cur.tr5, align 8, !tbaa !11 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %cur.tr5, i64 0, i32 1 %1 = load ptr, ptr %left, align 8, !tbaa !17 tail call void @Preorder(ptr noundef %1) %right = getelementptr inbounds %struct.node, ptr %cur.tr5, i64 0, i32 2 %2 = load ptr, ptr %right, align 8, !tbaa !18 %cmp.not = icmp eq ptr %2, null br i1 %cmp.not, label %if.end, label %if.then if.end: ; preds = %if.then, %entry ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @Search(ptr noundef readonly %p, i32 noundef %x) local_unnamed_addr #3 { entry: %cmp16 = icmp eq ptr %p, null br i1 %cmp16, label %return, label %if.else if.else: ; preds = %entry, %if.else3 %p.tr17 = phi ptr [ %p.tr.be, %if.else3 ], [ %p, %entry ] %0 = load i32, ptr %p.tr17, align 8, !tbaa !11 %cmp1 = icmp eq i32 %0, %x br i1 %cmp1, label %return, label %if.else3 if.else3: ; preds = %if.else %cmp5 = icmp sgt i32 %0, %x %left = getelementptr inbounds %struct.node, ptr %p.tr17, i64 0, i32 1 %right = getelementptr inbounds %struct.node, ptr %p.tr17, i64 0, i32 2 %p.tr.be.in = select i1 %cmp5, ptr %left, ptr %right %p.tr.be = load ptr, ptr %p.tr.be.in, align 8, !tbaa !9 %cmp = icmp eq ptr %p.tr.be, null br i1 %cmp, label %return, label %if.else return: ; preds = %if.else3, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.else3 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind willreturn memory(argmem: read) } attributes #6 = { nofree nounwind } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nounwind } attributes #9 = { 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 0} !12 = !{!"node", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = !{!12, !10, i64 24} !16 = distinct !{!16, !14} !17 = !{!12, !10, i64 8} !18 = !{!12, !10, i64 16}
#include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct node *link; struct node { int key; link parent,left,right; }; link root; link in; void insert(link z) { link p=NULL; link x=root; while(x!=NULL) { p=x; if(z->key<x->key) { x=x->left; } else { x=x->right; } z->parent=p; } if(p==NULL) { root=z; } else if(z->key<p->key) { p->left=z; } else { p->right=z; } } void traverse1(link a) { if(a==NULL) return; printf(" %d",a->key); traverse1(a->left); traverse1(a->right); } void traverse2(link a) { if(a==NULL) return; traverse2(a->left); printf(" %d",a->key); traverse2(a->right); } void find(link a,int k) { while(a!=NULL&&k!=a->key) { if(k<a->key) { a=a->left; } else { a=a->right; } } if(a!=NULL) { printf("yes\n"); } else { printf("no\n"); } } int main(void) { root=NULL; int i,num,N; char get[10]; scanf("%d",&N); for(i=0;i<N;i++) { scanf("%s",get); if(strcmp(get,"insert")==0) { scanf("%d",&num); in=malloc(sizeof(*in)); in->key=num; in->left=NULL; in->right=NULL; in->parent=NULL; insert(in); } else if(strcmp(get,"print")==0) { traverse2(root); printf("\n"); traverse1(root); printf("\n"); } else if(strcmp(get,"find")==0) { scanf("%d",&num); find(root,num); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221266/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221266/source.c" target datalayout = "e-m:e-p270: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, ptr, ptr, ptr } @root = dso_local local_unnamed_addr global ptr null, align 8 @.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.5 = private unnamed_addr constant [7 x i8] c"insert\00", align 1 @in = dso_local local_unnamed_addr global ptr null, align 8 @.str.6 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.8 = private unnamed_addr constant [5 x i8] c"find\00", align 1 @str = private unnamed_addr constant [3 x i8] c"no\00", align 1 @str.9 = private unnamed_addr constant [4 x i8] c"yes\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @insert(ptr noundef %z) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @root, align 8, !tbaa !5 %cmp.not28 = icmp eq ptr %0, null br i1 %cmp.not28, label %if.end14, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %1 = load i32, ptr %z, align 8, !tbaa !9 %parent = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1 br label %while.body while.body: ; preds = %while.body.lr.ph, %while.body %x.029 = phi ptr [ %0, %while.body.lr.ph ], [ %x.1, %while.body ] %2 = load i32, ptr %x.029, align 8, !tbaa !9 %cmp2 = icmp slt i32 %1, %2 %left = getelementptr inbounds %struct.node, ptr %x.029, i64 0, i32 2 %right = getelementptr inbounds %struct.node, ptr %x.029, i64 0, i32 3 %x.1.in = select i1 %cmp2, ptr %left, ptr %right %x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5 store ptr %x.029, ptr %parent, align 8, !tbaa !12 %cmp.not = icmp eq ptr %x.1, null br i1 %cmp.not, label %if.else5, label %while.body, !llvm.loop !13 if.else5: ; preds = %while.body %3 = load i32, ptr %z, align 8, !tbaa !9 %4 = load i32, ptr %x.029, align 8, !tbaa !9 %cmp8 = icmp slt i32 %3, %4 br i1 %cmp8, label %if.then9, label %if.else11 if.then9: ; preds = %if.else5 %left10 = getelementptr inbounds %struct.node, ptr %x.029, i64 0, i32 2 br label %if.end14 if.else11: ; preds = %if.else5 %right12 = getelementptr inbounds %struct.node, ptr %x.029, i64 0, i32 3 br label %if.end14 if.end14: ; preds = %entry, %if.then9, %if.else11 %left10.sink = phi ptr [ %left10, %if.then9 ], [ %right12, %if.else11 ], [ @root, %entry ] store ptr %z, ptr %left10.sink, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local void @traverse1(ptr noundef readonly %a) local_unnamed_addr #2 { entry: %cmp4 = icmp eq ptr %a, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %a.tr5 = phi ptr [ %2, %if.end ], [ %a, %entry ] %0 = load i32, ptr %a.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %left = getelementptr inbounds %struct.node, ptr %a.tr5, i64 0, i32 2 %1 = load ptr, ptr %left, align 8, !tbaa !15 tail call void @traverse1(ptr noundef %1) %right = getelementptr inbounds %struct.node, ptr %a.tr5, i64 0, i32 3 %2 = load ptr, ptr %right, align 8, !tbaa !16 %cmp = icmp eq ptr %2, null 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 #3 ; Function Attrs: nofree nounwind uwtable define dso_local void @traverse2(ptr noundef readonly %a) local_unnamed_addr #2 { entry: %cmp4 = icmp eq ptr %a, null br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %a.tr5 = phi ptr [ %2, %if.end ], [ %a, %entry ] %left = getelementptr inbounds %struct.node, ptr %a.tr5, i64 0, i32 2 %0 = load ptr, ptr %left, align 8, !tbaa !15 tail call void @traverse2(ptr noundef %0) %1 = load i32, ptr %a.tr5, align 8, !tbaa !9 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1) %right = getelementptr inbounds %struct.node, ptr %a.tr5, i64 0, i32 3 %2 = load ptr, ptr %right, align 8, !tbaa !16 %cmp = icmp eq ptr %2, null br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @find(ptr noundef readonly %a, i32 noundef %k) local_unnamed_addr #2 { entry: %cmp.not16 = icmp eq ptr %a, null br i1 %cmp.not16, label %if.end8, label %land.rhs land.rhs: ; preds = %entry, %while.body %a.addr.017 = phi ptr [ %a.addr.1, %while.body ], [ %a, %entry ] %0 = load i32, ptr %a.addr.017, align 8, !tbaa !9 %cmp1.not = icmp eq i32 %0, %k br i1 %cmp1.not, label %if.end8, label %while.body while.body: ; preds = %land.rhs %cmp3 = icmp sgt i32 %0, %k %left = getelementptr inbounds %struct.node, ptr %a.addr.017, i64 0, i32 2 %right = getelementptr inbounds %struct.node, ptr %a.addr.017, i64 0, i32 3 %a.addr.1.in = select i1 %cmp3, ptr %left, ptr %right %a.addr.1 = load ptr, ptr %a.addr.1.in, align 8, !tbaa !5 %cmp.not = icmp eq ptr %a.addr.1, null br i1 %cmp.not, label %if.end8, label %land.rhs, !llvm.loop !17 if.end8: ; preds = %while.body, %land.rhs, %entry %str.sink = phi ptr [ @str, %entry ], [ @str.9, %land.rhs ], [ @str, %while.body ] %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %num = alloca i32, align 4 %N = alloca i32, align 4 %get = alloca [10 x i8], align 1 store ptr null, ptr @root, align 8, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %get) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !18 %cmp29 = icmp sgt i32 %0, 0 br i1 %cmp29, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.030 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %get) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %get, ptr noundef nonnull dereferenceable(7) @.str.5, i64 7) %cmp4 = icmp eq i32 %bcmp, 0 br i1 %cmp4, label %if.then, label %if.else if.then: ; preds = %for.body %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %num) %call6 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9 store ptr %call6, ptr @in, align 8, !tbaa !5 %1 = load i32, ptr %num, align 4, !tbaa !18 store i32 %1, ptr %call6, align 8, !tbaa !9 %parent = getelementptr inbounds %struct.node, ptr %call6, i64 0, i32 1 call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %parent, i8 0, i64 24, i1 false) %2 = load ptr, ptr @root, align 8, !tbaa !5 %cmp.not28.i = icmp eq ptr %2, null br i1 %cmp.not28.i, label %insert.exit, label %while.body.i while.body.i: ; preds = %if.then, %while.body.i %x.029.i = phi ptr [ %x.1.i, %while.body.i ], [ %2, %if.then ] %3 = load i32, ptr %x.029.i, align 8, !tbaa !9 %cmp2.i = icmp slt i32 %1, %3 %left.i = getelementptr inbounds %struct.node, ptr %x.029.i, i64 0, i32 2 %right.i = getelementptr inbounds %struct.node, ptr %x.029.i, i64 0, i32 3 %x.1.in.i = select i1 %cmp2.i, ptr %left.i, ptr %right.i %x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5 store ptr %x.029.i, ptr %parent, align 8, !tbaa !12 %cmp.not.i = icmp eq ptr %x.1.i, null br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !13 insert.exit: ; preds = %while.body.i, %if.then %left10.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ] store ptr %call6, ptr %left10.sink.i, align 8, !tbaa !5 br label %for.inc if.else: ; preds = %for.body %bcmp22 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %get, ptr noundef nonnull dereferenceable(6) @.str.6, i64 6) %cmp9 = icmp eq i32 %bcmp22, 0 br i1 %cmp9, label %if.then10, label %if.else13 if.then10: ; preds = %if.else %4 = load ptr, ptr @root, align 8, !tbaa !5 call void @traverse2(ptr noundef %4) %putchar = call i32 @putchar(i32 10) %5 = load ptr, ptr @root, align 8, !tbaa !5 call void @traverse1(ptr noundef %5) %putchar24 = call i32 @putchar(i32 10) br label %for.inc if.else13: ; preds = %if.else %bcmp23 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %get, ptr noundef nonnull dereferenceable(5) @.str.8, i64 5) %cmp16 = icmp eq i32 %bcmp23, 0 br i1 %cmp16, label %if.then17, label %for.inc if.then17: ; preds = %if.else13 %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %num) %6 = load ptr, ptr @root, align 8, !tbaa !5 %7 = load i32, ptr %num, align 4, !tbaa !18 %cmp.not16.i = icmp eq ptr %6, null br i1 %cmp.not16.i, label %find.exit, label %land.rhs.i land.rhs.i: ; preds = %if.then17, %while.body.i25 %a.addr.017.i = phi ptr [ %a.addr.1.i, %while.body.i25 ], [ %6, %if.then17 ] %8 = load i32, ptr %a.addr.017.i, align 8, !tbaa !9 %cmp1.not.i = icmp eq i32 %8, %7 br i1 %cmp1.not.i, label %find.exit, label %while.body.i25 while.body.i25: ; preds = %land.rhs.i %cmp3.i = icmp sgt i32 %8, %7 %left.i26 = getelementptr inbounds %struct.node, ptr %a.addr.017.i, i64 0, i32 2 %right.i27 = getelementptr inbounds %struct.node, ptr %a.addr.017.i, i64 0, i32 3 %a.addr.1.in.i = select i1 %cmp3.i, ptr %left.i26, ptr %right.i27 %a.addr.1.i = load ptr, ptr %a.addr.1.in.i, align 8, !tbaa !5 %cmp.not.i28 = icmp eq ptr %a.addr.1.i, null br i1 %cmp.not.i28, label %find.exit, label %land.rhs.i, !llvm.loop !17 find.exit: ; preds = %land.rhs.i, %while.body.i25, %if.then17 %str.sink.i = phi ptr [ @str, %if.then17 ], [ @str, %while.body.i25 ], [ @str.9, %land.rhs.i ] %puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i) br label %for.inc for.inc: ; preds = %insert.exit, %if.else13, %find.exit, %if.then10 %inc = add nuw nsw i32 %i.030, 1 %9 = load i32, ptr %N, align 4, !tbaa !18 %cmp = icmp slt i32 %inc, %9 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %get) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #8 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7 attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nofree nounwind willreturn memory(argmem: read) } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nounwind } attributes #9 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 0} !10 = !{!"node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24} !11 = !{!"int", !7, i64 0} !12 = !{!10, !6, i64 8} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = !{!10, !6, i64 16} !16 = !{!10, !6, i64 24} !17 = distinct !{!17, !14} !18 = !{!11, !11, i64 0} !19 = distinct !{!19, !14}
#include<stdio.h> int main() { int n, k; scanf("%d %d", &n, &k); n=n-k; if(k==1) { n=0; printf("%d", n); } else printf("%d", n); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221316/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221316/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = load i32, ptr %k, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 %cmp = icmp eq i32 %1, 1 %spec.store.select = select i1 %cmp, i32 0, i32 %sub store i32 %spec.store.select, ptr %n, align 4 %spec.select = select i1 %cmp, i32 0, i32 %sub %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int test; scanf("%d",&test); while(test--){ int num; scanf("%d",&num); long long int fact=1; for(int i=3;i<=2*num;i++){ fact=(fact*i)%1000000007; } printf("%lld\n",fact); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22136/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22136/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %test = alloca i32, align 4 %num = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %test) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %test) %0 = load i32, ptr %test, align 4, !tbaa !5 %dec10 = add nsw i32 %0, -1 store i32 %dec10, ptr %test, align 4, !tbaa !5 %tobool.not11 = icmp eq i32 %0, 0 br i1 %tobool.not11, label %while.end, label %while.body while.body: ; preds = %entry, %for.cond.cleanup call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %1 = load i32, ptr %num, align 4, !tbaa !5 %cmp.not7 = icmp slt i32 %1, 2 br i1 %cmp.not7, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %while.body %mul = shl nuw i32 %1, 1 %smax = call i32 @llvm.smax.i32(i32 %mul, i32 3) %2 = zext i32 %smax to i64 %3 = add nsw i64 %2, -2 %4 = add nsw i64 %2, -3 %xtraiter = and i64 %3, 3 %5 = icmp ult i64 %4, 3 br i1 %5, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %3, -4 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %indvars.iv.unr = phi i64 [ 3, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %fact.08.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %fact.08.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %fact.08.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ] %mul2.epil = mul nsw i64 %fact.08.epil, %indvars.iv.epil %rem.epil = srem i64 %mul2.epil, 1000000007 %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.cond.cleanup, label %for.body.epil, !llvm.loop !9 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %while.body %fact.0.lcssa = phi i64 [ 1, %while.body ], [ %rem.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %fact.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4 %6 = load i32, ptr %test, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %test, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 3, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %fact.08 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %mul2 = mul nsw i64 %fact.08, %indvars.iv %rem = srem i64 %mul2, 1000000007 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %mul2.1 = mul nsw i64 %rem, %indvars.iv.next %rem.1 = srem i64 %mul2.1, 1000000007 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul2.2 = mul nsw i64 %rem.1, %indvars.iv.next.1 %rem.2 = srem i64 %mul2.2, 1000000007 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %mul2.3 = mul nsw i64 %rem.2, %indvars.iv.next.2 %rem.3 = srem i64 %mul2.3, 1000000007 %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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !13 while.end: ; preds = %for.cond.cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %test) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.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.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include <stdio.h> int main() { int N,K; scanf("%d%d", &N,&K); if(K!=1)printf("%d",N - K); if (K == 1)printf("0"); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221402/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221402/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K) %0 = load i32, ptr %K, align 4, !tbaa !5 %cmp.not = icmp eq i32 %0, 1 br i1 %cmp.not, label %if.then3, label %if.end if.end: ; preds = %entry %1 = load i32, ptr %N, align 4, !tbaa !5 %sub = sub nsw i32 %1, %0 %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub) %.pr = load i32, ptr %K, align 4, !tbaa !5 %cmp2 = icmp eq i32 %.pr, 1 br i1 %cmp2, label %if.then3, label %if.end5 if.then3: ; preds = %entry, %if.end %putchar = call i32 @putchar(i32 48) br label %if.end5 if.end5: ; preds = %if.then3, %if.end call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int n,k; scanf("%d%d",&n,&k); n-=k; if(k==1)puts("0"); else printf("%d\n",n); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221446/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221446/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"0\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 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = load i32, ptr %n, align 4, !tbaa !5 %sub = sub nsw i32 %1, %0 store i32 %sub, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1) br label %if.end if.else: ; preds = %entry %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub) br label %if.end if.end: ; preds = %if.else, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #include <limits.h> struct vertex { int k; int dis; int definite; int **vlist; }; int main(int argc, char *argv[]) { int n, i, j, id; struct vertex *adj; int minv, op, cost, mind; scanf("%d", &n); adj = (struct vertex *)malloc(sizeof(struct vertex) * n); for (i = 0; i < n; i++) { scanf("%d", &id); scanf("%d", &(adj[id].k)); adj[id].vlist = (int **)malloc(sizeof(int *) * adj[id].k); for (j = 0; j < adj[id].k; j++) { adj[id].vlist[j] = (int *)malloc(sizeof(int) * 2); scanf("%d", &(adj[id].vlist[j][0])); scanf("%d", &(adj[id].vlist[j][1])); } adj[id].dis = INT_MAX; adj[id].definite = 0; } adj[0].dis = 0; adj[0].definite = 1; minv = 0; while (minv != -1) { for (i = 0; i < n; i++) { if (adj[i].definite == 1) { for (j = 0; j < adj[i].k; j++) { op = adj[i].vlist[j][0]; cost = adj[i].vlist[j][1]; if (adj[op].definite == 0 && adj[op].dis > adj[i].dis + cost) { adj[op].dis = adj[i].dis + cost; } } } } minv = -1; mind = INT_MAX; for (i = 0; i < n; i++) { if (adj[i].definite == 0 && mind > adj[i].dis) { mind = adj[i].dis; minv = i; } } if (minv != -1) adj[minv].definite = 1; } for (i = 0; i < n; i++) printf("%d %d\n", i, adj[i].dis); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221503/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221503/source.c" target datalayout = "e-m:e-p270: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.vertex = type { i32, i32, i32, ptr } @.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\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %id = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = mul nsw i64 %conv, 24 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 %cmp212 = icmp sgt i32 %0, 0 br i1 %cmp212, label %for.body, label %for.end46.thread for.end46.thread: ; preds = %entry %dis48275 = getelementptr inbounds %struct.vertex, ptr %call1, i64 0, i32 1 store i32 0, ptr %dis48275, align 4, !tbaa !9 %definite50276 = getelementptr inbounds %struct.vertex, ptr %call1, i64 0, i32 2 store i32 1, ptr %definite50276, align 8, !tbaa !12 br label %for.end149 for.body: ; preds = %entry, %for.end %i.0213 = phi i32 [ %inc45, %for.end ], [ 0, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id) %1 = load i32, ptr %id, align 4, !tbaa !5 %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %2 = load i32, ptr %id, align 4, !tbaa !5 %idxprom5 = sext i32 %2 to i64 %arrayidx6 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom5 %3 = load i32, ptr %arrayidx6, align 8, !tbaa !13 %conv8 = sext i32 %3 to i64 %mul9 = shl nsw i64 %conv8, 3 %call10 = call noalias ptr @malloc(i64 noundef %mul9) #6 %vlist = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom5, i32 3 store ptr %call10, ptr %vlist, align 8, !tbaa !14 %cmp17209 = icmp sgt i32 %3, 0 br i1 %cmp17209, label %for.body19, label %for.end for.body19: ; preds = %for.body, %for.body19 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body19 ], [ 0, %for.body ] %idxprom14211 = phi i64 [ %idxprom14, %for.body19 ], [ %idxprom5, %for.body ] %call20 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6 %vlist23 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom14211, i32 3 %4 = load ptr, ptr %vlist23, align 8, !tbaa !14 %arrayidx25 = getelementptr inbounds ptr, ptr %4, i64 %indvars.iv store ptr %call20, ptr %arrayidx25, align 8, !tbaa !15 %5 = load ptr, ptr %vlist23, align 8, !tbaa !14 %arrayidx30 = getelementptr inbounds ptr, ptr %5, i64 %indvars.iv %6 = load ptr, ptr %arrayidx30, align 8, !tbaa !15 %call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %6) %7 = load i32, ptr %id, align 4, !tbaa !5 %idxprom33 = sext i32 %7 to i64 %vlist35 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom33, i32 3 %8 = load ptr, ptr %vlist35, align 8, !tbaa !14 %arrayidx37 = getelementptr inbounds ptr, ptr %8, i64 %indvars.iv %9 = load ptr, ptr %arrayidx37, align 8, !tbaa !15 %arrayidx38 = getelementptr inbounds i32, ptr %9, i64 1 %call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx38) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %10 = load i32, ptr %id, align 4, !tbaa !5 %idxprom14 = sext i32 %10 to i64 %arrayidx15 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom14 %11 = load i32, ptr %arrayidx15, align 8, !tbaa !13 %12 = sext i32 %11 to i64 %cmp17 = icmp slt i64 %indvars.iv.next, %12 br i1 %cmp17, label %for.body19, label %for.end, !llvm.loop !16 for.end: ; preds = %for.body19, %for.body %idxprom14.lcssa = phi i64 [ %idxprom5, %for.body ], [ %idxprom14, %for.body19 ] %dis = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom14.lcssa, i32 1 store i32 2147483647, ptr %dis, align 4, !tbaa !9 %definite = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom14.lcssa, i32 2 store i32 0, ptr %definite, align 8, !tbaa !12 %inc45 = add nuw nsw i32 %i.0213, 1 %13 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc45, %13 br i1 %cmp, label %for.body, label %for.end46, !llvm.loop !18 for.end46: ; preds = %for.end %dis48 = getelementptr inbounds %struct.vertex, ptr %call1, i64 0, i32 1 store i32 0, ptr %dis48, align 4, !tbaa !9 %definite50 = getelementptr inbounds %struct.vertex, ptr %call1, i64 0, i32 2 store i32 1, ptr %definite50, align 8, !tbaa !12 %cmp54217 = icmp sgt i32 %13, 0 br i1 %cmp54217, label %for.cond53.preheader.us.preheader, label %for.end149 for.cond53.preheader.us.preheader: ; preds = %for.end46 %wide.trip.count265 = zext i32 %13 to i64 %xtraiter = and i64 %wide.trip.count265, 1 %14 = icmp eq i32 %13, 1 %unroll_iter = and i64 %wide.trip.count265, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.body56.us for.end131.us.unr-lcssa: ; preds = %for.inc129.us.1, %for.body112.us.preheader %minv.2.us.lcssa.ph = phi i32 [ undef, %for.body112.us.preheader ], [ %minv.2.us.1, %for.inc129.us.1 ] %indvars.iv267.unr = phi i64 [ 0, %for.body112.us.preheader ], [ %indvars.iv.next268.1, %for.inc129.us.1 ] %mind.0222.us.unr = phi i32 [ 2147483647, %for.body112.us.preheader ], [ %mind.1.us.1, %for.inc129.us.1 ] %minv.1220.us.unr = phi i32 [ -1, %for.body112.us.preheader ], [ %minv.2.us.1, %for.inc129.us.1 ] br i1 %lcmp.mod.not, label %for.end131.us, label %for.body112.us.epil for.body112.us.epil: ; preds = %for.end131.us.unr-lcssa %definite115.us.epil = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv267.unr, i32 2 %15 = load i32, ptr %definite115.us.epil, align 8, !tbaa !12 %cmp116.us.epil = icmp eq i32 %15, 0 br i1 %cmp116.us.epil, label %land.lhs.true118.us.epil, label %for.end131.us land.lhs.true118.us.epil: ; preds = %for.body112.us.epil %dis121.us.epil = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv267.unr, i32 1 %16 = load i32, ptr %dis121.us.epil, align 4, !tbaa !9 %cmp122.us.epil = icmp sgt i32 %mind.0222.us.unr, %16 %17 = trunc i64 %indvars.iv267.unr to i32 %spec.select.us.epil = select i1 %cmp122.us.epil, i32 %17, i32 %minv.1220.us.unr br label %for.end131.us for.end131.us: ; preds = %for.body112.us.epil, %land.lhs.true118.us.epil, %for.end131.us.unr-lcssa %minv.2.us.lcssa = phi i32 [ %minv.2.us.lcssa.ph, %for.end131.us.unr-lcssa ], [ %minv.1220.us.unr, %for.body112.us.epil ], [ %spec.select.us.epil, %land.lhs.true118.us.epil ] %cond255 = icmp eq i32 %minv.2.us.lcssa, -1 br i1 %cond255, label %for.cond139.preheader, label %if.then134.us if.then134.us: ; preds = %for.end131.us %idxprom135.us = sext i32 %minv.2.us.lcssa to i64 %definite137.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom135.us, i32 2 store i32 1, ptr %definite137.us, align 8, !tbaa !12 br label %for.body56.us.backedge for.body112.us: ; preds = %for.body112.us.preheader, %for.inc129.us.1 %indvars.iv267 = phi i64 [ %indvars.iv.next268.1, %for.inc129.us.1 ], [ 0, %for.body112.us.preheader ] %mind.0222.us = phi i32 [ %mind.1.us.1, %for.inc129.us.1 ], [ 2147483647, %for.body112.us.preheader ] %minv.1220.us = phi i32 [ %minv.2.us.1, %for.inc129.us.1 ], [ -1, %for.body112.us.preheader ] %niter = phi i64 [ %niter.next.1, %for.inc129.us.1 ], [ 0, %for.body112.us.preheader ] %definite115.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv267, i32 2 %18 = load i32, ptr %definite115.us, align 8, !tbaa !12 %cmp116.us = icmp eq i32 %18, 0 br i1 %cmp116.us, label %land.lhs.true118.us, label %for.inc129.us land.lhs.true118.us: ; preds = %for.body112.us %dis121.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv267, i32 1 %19 = load i32, ptr %dis121.us, align 4, !tbaa !9 %cmp122.us = icmp sgt i32 %mind.0222.us, %19 %20 = trunc i64 %indvars.iv267 to i32 %spec.select.us = select i1 %cmp122.us, i32 %20, i32 %minv.1220.us %spec.select206.us = call i32 @llvm.smin.i32(i32 %mind.0222.us, i32 %19) br label %for.inc129.us for.inc129.us: ; preds = %land.lhs.true118.us, %for.body112.us %minv.2.us = phi i32 [ %minv.1220.us, %for.body112.us ], [ %spec.select.us, %land.lhs.true118.us ] %mind.1.us = phi i32 [ %mind.0222.us, %for.body112.us ], [ %spec.select206.us, %land.lhs.true118.us ] %indvars.iv.next268 = or i64 %indvars.iv267, 1 %definite115.us.1 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv.next268, i32 2 %21 = load i32, ptr %definite115.us.1, align 8, !tbaa !12 %cmp116.us.1 = icmp eq i32 %21, 0 br i1 %cmp116.us.1, label %land.lhs.true118.us.1, label %for.inc129.us.1 land.lhs.true118.us.1: ; preds = %for.inc129.us %dis121.us.1 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv.next268, i32 1 %22 = load i32, ptr %dis121.us.1, align 4, !tbaa !9 %cmp122.us.1 = icmp sgt i32 %mind.1.us, %22 %23 = trunc i64 %indvars.iv.next268 to i32 %spec.select.us.1 = select i1 %cmp122.us.1, i32 %23, i32 %minv.2.us %spec.select206.us.1 = call i32 @llvm.smin.i32(i32 %mind.1.us, i32 %22) br label %for.inc129.us.1 for.inc129.us.1: ; preds = %land.lhs.true118.us.1, %for.inc129.us %minv.2.us.1 = phi i32 [ %minv.2.us, %for.inc129.us ], [ %spec.select.us.1, %land.lhs.true118.us.1 ] %mind.1.us.1 = phi i32 [ %mind.1.us, %for.inc129.us ], [ %spec.select206.us.1, %land.lhs.true118.us.1 ] %indvars.iv.next268.1 = add nuw nsw i64 %indvars.iv267, 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.end131.us.unr-lcssa, label %for.body112.us, !llvm.loop !19 for.body56.us: ; preds = %for.body56.us.backedge, %for.cond53.preheader.us.preheader %indvars.iv262 = phi i64 [ 0, %for.cond53.preheader.us.preheader ], [ %indvars.iv262.be, %for.body56.us.backedge ] %definite59.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv262, i32 2 %24 = load i32, ptr %definite59.us, align 8, !tbaa !12 %cmp60.us = icmp eq i32 %24, 1 br i1 %cmp60.us, label %for.cond62.preheader.us, label %for.inc106.us for.inc106.us: ; preds = %for.inc102.us, %for.cond62.preheader.us, %for.body56.us %indvars.iv.next263 = add nuw nsw i64 %indvars.iv262, 1 %exitcond266.not = icmp eq i64 %indvars.iv.next263, %wide.trip.count265 br i1 %exitcond266.not, label %for.body112.us.preheader, label %for.body56.us.backedge for.body56.us.backedge: ; preds = %for.inc106.us, %if.then134.us %indvars.iv262.be = phi i64 [ %indvars.iv.next263, %for.inc106.us ], [ 0, %if.then134.us ] br label %for.body56.us, !llvm.loop !20 for.body112.us.preheader: ; preds = %for.inc106.us br i1 %14, label %for.end131.us.unr-lcssa, label %for.body112.us for.body68.us: ; preds = %for.body68.lr.ph.us, %for.inc102.us %indvars.iv259 = phi i64 [ 0, %for.body68.lr.ph.us ], [ %indvars.iv.next260, %for.inc102.us ] %arrayidx73.us = getelementptr inbounds ptr, ptr %32, i64 %indvars.iv259 %25 = load ptr, ptr %arrayidx73.us, align 8, !tbaa !15 %26 = load i32, ptr %25, align 4, !tbaa !5 %idxprom81.us = sext i32 %26 to i64 %definite83.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom81.us, i32 2 %27 = load i32, ptr %definite83.us, align 8, !tbaa !12 %cmp84.us = icmp eq i32 %27, 0 br i1 %cmp84.us, label %land.lhs.true.us, label %for.inc102.us land.lhs.true.us: ; preds = %for.body68.us %arrayidx80.us = getelementptr inbounds i32, ptr %25, i64 1 %28 = load i32, ptr %arrayidx80.us, align 4, !tbaa !5 %dis88.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %idxprom81.us, i32 1 %29 = load i32, ptr %dis88.us, align 4, !tbaa !9 %30 = load i32, ptr %dis91.us, align 4, !tbaa !9 %add.us = add nsw i32 %30, %28 %cmp92.us = icmp sgt i32 %29, %add.us br i1 %cmp92.us, label %if.then94.us, label %for.inc102.us if.then94.us: ; preds = %land.lhs.true.us store i32 %add.us, ptr %dis88.us, align 4, !tbaa !9 br label %for.inc102.us for.inc102.us: ; preds = %if.then94.us, %land.lhs.true.us, %for.body68.us %indvars.iv.next260 = add nuw nsw i64 %indvars.iv259, 1 %exitcond.not = icmp eq i64 %indvars.iv.next260, %wide.trip.count br i1 %exitcond.not, label %for.inc106.us, label %for.body68.us, !llvm.loop !21 for.cond62.preheader.us: ; preds = %for.body56.us %arrayidx58.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv262 %31 = load i32, ptr %arrayidx58.us, align 8, !tbaa !13 %cmp66215.us = icmp sgt i32 %31, 0 br i1 %cmp66215.us, label %for.body68.lr.ph.us, label %for.inc106.us for.body68.lr.ph.us: ; preds = %for.cond62.preheader.us %vlist71.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv262, i32 3 %32 = load ptr, ptr %vlist71.us, align 8, !tbaa !14 %dis91.us = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv262, i32 1 %wide.trip.count = zext i32 %31 to i64 br label %for.body68.us for.cond139.preheader: ; preds = %for.end131.us br i1 %cmp54217, label %for.body142, label %for.end149 for.body142: ; preds = %for.cond139.preheader, %for.body142 %indvars.iv272 = phi i64 [ %indvars.iv.next273, %for.body142 ], [ 0, %for.cond139.preheader ] %dis145 = getelementptr inbounds %struct.vertex, ptr %call1, i64 %indvars.iv272, i32 1 %33 = load i32, ptr %dis145, align 4, !tbaa !9 %34 = trunc i64 %indvars.iv272 to i32 %call146 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34, i32 noundef %33) %indvars.iv.next273 = add nuw nsw i64 %indvars.iv272, 1 %35 = load i32, ptr %n, align 4, !tbaa !5 %36 = sext i32 %35 to i64 %cmp140 = icmp slt i64 %indvars.iv.next273, %36 br i1 %cmp140, label %for.body142, label %for.end149, !llvm.loop !22 for.end149: ; preds = %for.body142, %for.end46, %for.end46.thread, %for.cond139.preheader 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree 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, !6, i64 4} !10 = !{!"vertex", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16} !11 = !{!"any pointer", !7, i64 0} !12 = !{!10, !6, i64 8} !13 = !{!10, !6, i64 0} !14 = !{!10, !11, i64 16} !15 = !{!11, !11, i64 0} !16 = distinct !{!16, !17} !17 = !{!"llvm.loop.mustprogress"} !18 = distinct !{!18, !17} !19 = distinct !{!19, !17} !20 = distinct !{!20, !17} !21 = distinct !{!21, !17} !22 = distinct !{!22, !17}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define NODE_NUM 100 int wght[NODE_NUM]; int visited[NODE_NUM]; typedef struct VERTEX{ int idx; int w; }VERTEX; void search(int node_idx, int w, VERTEX ** A, int* num, int n){ int i, weight, next; if (visited[node_idx] == 1) { return; } for (i=0; i < num[node_idx]; i++) { next = A[node_idx][i].idx; if ( visited[next]) { continue; } weight = A[node_idx][i].w; if( wght[next] > w + weight ) { wght[next] = w + weight; visited[node_idx] = 1; search(next, w + weight, A, num, n); visited[node_idx] = 0; } } return; } int main( ){ int i, j, k, v, c, u, n , *num; VERTEX ** A; scanf("%d", &n); A = malloc(sizeof(VERTEX) * n); num = malloc(sizeof(int) * n); for (i=0; i <n; i++) { wght[i] = 300000000; } wght[0] = 0; for (i=0; i<n; i++){ scanf("%d", &u); scanf("%d", &k); A[u] = malloc(sizeof(VERTEX) * k); num[u] = k; for (j = 0; j < k; j++) { scanf("%d %d", &v, &c); A[u][j].idx = v; A[u][j].w = c; } } search(0, 0, A, num, n); for (i=0; i<n; i++) { printf("%d %d\n", i, wght[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221554/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221554/source.c" target datalayout = "e-m:e-p270: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.VERTEX = type { i32, i32 } @visited = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @wght = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local void @search(i32 noundef %node_idx, i32 noundef %w, ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %num, i32 noundef %n) local_unnamed_addr #0 { entry: %idxprom = sext i32 %node_idx to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @visited, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 1 br i1 %cmp, label %cleanup, label %for.cond.preheader for.cond.preheader: ; preds = %entry %arrayidx2 = getelementptr inbounds i32, ptr %num, i64 %idxprom %1 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp350 = icmp sgt i32 %1, 0 br i1 %cmp350, label %for.body.lr.ph, label %cleanup for.body.lr.ph: ; preds = %for.cond.preheader %arrayidx5 = getelementptr inbounds ptr, ptr %A, i64 %idxprom br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %2 = phi i32 [ %1, %for.body.lr.ph ], [ %8, %for.inc ] %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ] %3 = load ptr, ptr %arrayidx5, align 8, !tbaa !9 %arrayidx7 = getelementptr inbounds %struct.VERTEX, ptr %3, i64 %indvars.iv %4 = load i32, ptr %arrayidx7, align 4, !tbaa !11 %idxprom8 = sext i32 %4 to i64 %arrayidx9 = getelementptr inbounds [100 x i32], ptr @visited, i64 0, i64 %idxprom8 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %tobool.not = icmp eq i32 %5, 0 br i1 %tobool.not, label %if.end11, label %for.inc if.end11: ; preds = %for.body %w16 = getelementptr inbounds %struct.VERTEX, ptr %3, i64 %indvars.iv, i32 1 %6 = load i32, ptr %w16, align 4, !tbaa !13 %arrayidx18 = getelementptr inbounds [100 x i32], ptr @wght, i64 0, i64 %idxprom8 %7 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %add = add nsw i32 %6, %w %cmp19 = icmp sgt i32 %7, %add br i1 %cmp19, label %if.then20, label %for.inc if.then20: ; preds = %if.end11 store i32 %add, ptr %arrayidx18, align 4, !tbaa !5 store i32 1, ptr %arrayidx, align 4, !tbaa !5 tail call void @search(i32 noundef %4, i32 noundef %add, ptr noundef nonnull %A, ptr noundef nonnull %num, i32 noundef %n) store i32 0, ptr %arrayidx, align 4, !tbaa !5 %.pre = load i32, ptr %arrayidx2, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %if.end11, %if.then20, %for.body %8 = phi i32 [ %2, %if.end11 ], [ %.pre, %if.then20 ], [ %2, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %9 = sext i32 %8 to i64 %cmp3 = icmp slt i64 %indvars.iv.next, %9 br i1 %cmp3, label %for.body, label %cleanup, !llvm.loop !14 cleanup: ; preds = %for.inc, %for.cond.preheader, %entry ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %k = alloca i32, align 4 %v = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 %mul3 = shl nsw i64 %conv, 2 %call4 = call noalias ptr @malloc(i64 noundef %mul3) #6 %cmp63 = icmp sgt i32 %0, 0 br i1 %cmp63, label %for.body.preheader, label %for.end.thread for.end.thread: ; preds = %entry store i32 0, ptr @wght, align 16, !tbaa !5 br label %for.end37 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader82, 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 ] %1 = getelementptr inbounds [100 x i32], ptr @wght, i64 0, i64 %index store <4 x i32> <i32 300000000, i32 300000000, i32 300000000, i32 300000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 300000000, i32 300000000, i32 300000000, i32 300000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %for.body.preheader82 for.body.preheader82: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader82, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader82 ] %arrayidx = getelementptr inbounds [100 x i32], ptr @wght, i64 0, i64 %indvars.iv store i32 300000000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !19 for.end: ; preds = %for.body, %middle.block store i32 0, ptr @wght, align 16, !tbaa !5 br i1 %cmp63, label %for.body9, label %for.end37 for.body9: ; preds = %for.end, %for.inc35 %i.168 = phi i32 [ %inc36, %for.inc35 ], [ 0, %for.end ] %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u) %call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %conv12 = sext i32 %4 to i64 %mul13 = shl nsw i64 %conv12, 3 %call14 = call noalias ptr @malloc(i64 noundef %mul13) #6 %5 = load i32, ptr %u, align 4, !tbaa !5 %idxprom15 = sext i32 %5 to i64 %arrayidx16 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom15 store ptr %call14, ptr %arrayidx16, align 8, !tbaa !9 %arrayidx18 = getelementptr inbounds i32, ptr %call4, i64 %idxprom15 store i32 %4, ptr %arrayidx18, align 4, !tbaa !5 %cmp2065 = icmp sgt i32 %4, 0 br i1 %cmp2065, label %for.body22, label %for.inc35 for.body22: ; preds = %for.body9, %for.body22 %indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body22 ], [ 0, %for.body9 ] %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %6 = load i32, ptr %v, align 4, !tbaa !5 %7 = load i32, ptr %u, align 4, !tbaa !5 %idxprom24 = sext i32 %7 to i64 %arrayidx25 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom24 %8 = load ptr, ptr %arrayidx25, align 8, !tbaa !9 %arrayidx27 = getelementptr inbounds %struct.VERTEX, ptr %8, i64 %indvars.iv73 store i32 %6, ptr %arrayidx27, align 4, !tbaa !11 %9 = load i32, ptr %c, align 4, !tbaa !5 %10 = load i32, ptr %u, align 4, !tbaa !5 %idxprom28 = sext i32 %10 to i64 %arrayidx29 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom28 %11 = load ptr, ptr %arrayidx29, align 8, !tbaa !9 %w = getelementptr inbounds %struct.VERTEX, ptr %11, i64 %indvars.iv73, i32 1 store i32 %9, ptr %w, align 4, !tbaa !13 %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %12 = load i32, ptr %k, align 4, !tbaa !5 %13 = sext i32 %12 to i64 %cmp20 = icmp slt i64 %indvars.iv.next74, %13 br i1 %cmp20, label %for.body22, label %for.inc35, !llvm.loop !20 for.inc35: ; preds = %for.body22, %for.body9 %inc36 = add nuw nsw i32 %i.168, 1 %14 = load i32, ptr %n, align 4, !tbaa !5 %cmp7 = icmp slt i32 %inc36, %14 br i1 %cmp7, label %for.body9, label %for.end37, !llvm.loop !21 for.end37: ; preds = %for.inc35, %for.end.thread, %for.end %.lcssa = phi i32 [ %0, %for.end ], [ %0, %for.end.thread ], [ %14, %for.inc35 ] call void @search(i32 noundef 0, i32 noundef 0, ptr noundef %call1, ptr noundef %call4, i32 noundef %.lcssa) %15 = load i32, ptr %n, align 4, !tbaa !5 %cmp3969 = icmp sgt i32 %15, 0 br i1 %cmp3969, label %for.body41, label %for.end47 for.body41: ; preds = %for.end37, %for.body41 %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body41 ], [ 0, %for.end37 ] %arrayidx43 = getelementptr inbounds [100 x i32], ptr @wght, i64 0, i64 %indvars.iv76 %16 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %17 = trunc i64 %indvars.iv76 to i32 %call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17, i32 noundef %16) %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %18 = load i32, ptr %n, align 4, !tbaa !5 %19 = sext i32 %18 to i64 %cmp39 = icmp slt i64 %indvars.iv.next77, %19 br i1 %cmp39, label %for.body41, label %for.end47, !llvm.loop !22 for.end47: ; preds = %for.body41, %for.end37 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { 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 0} !12 = !{!"VERTEX", !6, i64 0, !6, i64 4} !13 = !{!12, !6, i64 4} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = distinct !{!16, !15, !17, !18} !17 = !{!"llvm.loop.isvectorized", i32 1} !18 = !{!"llvm.loop.unroll.runtime.disable"} !19 = distinct !{!19, !15, !18, !17} !20 = distinct !{!20, !15} !21 = distinct !{!21, !15} !22 = distinct !{!22, !15}
#include<stdio.h> #define NUM 10000000 #define N 100 void def(int,int); int n; int arraysi[N],arrayc[N][N]; int arrayd[N],arrayt[N][N]; int main(int argc,char *argv[]){ int i,j,m; scanf("%d",&n); for(i = 0;i < n;i++){ scanf("%d",&m); scanf("%d",&arraysi[m]); for(j = 0;j < arraysi[m];j++){ scanf("%d",&arrayt[m][j]); scanf("%d",&arrayc[m][j]); } } for(i = 0;i < n;i++) arrayd[i] = NUM; def(0,0); for(i = 0;i < n;i++){ printf("%d %d\n",i,arrayd[i]); } return 0; } void def(int p,int x){ int i; arrayd[p] = x; for(i = 0;i < arraysi[p];i++){ if(arrayd[arrayt[p][i]] > x + arrayc[p][i]) def(arrayt[p][i],x + arrayc[p][i]); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221604/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221604/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @arraysi = dso_local global [100 x i32] zeroinitializer, align 16 @arrayt = dso_local global [100 x [100 x i32]] zeroinitializer, align 16 @arrayc = dso_local global [100 x [100 x i32]] zeroinitializer, align 16 @arrayd = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #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 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.end28 for.cond21.preheader: ; preds = %for.inc18 %cmp2256 = icmp sgt i32 %11, 0 br i1 %cmp2256, label %for.body23.preheader, label %for.end28 for.body23.preheader: ; preds = %for.cond21.preheader %wide.trip.count = zext i32 %11 to i64 %min.iters.check = icmp ult i32 %11, 8 br i1 %min.iters.check, label %for.body23.preheader70, label %vector.ph vector.ph: ; preds = %for.body23.preheader %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %1 = getelementptr inbounds [100 x i32], ptr @arrayd, i64 0, i64 %index store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end28, label %for.body23.preheader70 for.body23.preheader70: ; preds = %for.body23.preheader, %middle.block %indvars.iv62.ph = phi i64 [ 0, %for.body23.preheader ], [ %n.vec, %middle.block ] br label %for.body23 for.body: ; preds = %entry, %for.inc18 %i.055 = phi i32 [ %inc19, %for.inc18 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %4 = load i32, ptr %m, align 4, !tbaa !5 %idxprom = sext i32 %4 to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @arraysi, i64 0, i64 %idxprom %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %5 = load i32, ptr %m, align 4, !tbaa !5 %idxprom449 = sext i32 %5 to i64 %arrayidx550 = getelementptr inbounds [100 x i32], ptr @arraysi, i64 0, i64 %idxprom449 %6 = load i32, ptr %arrayidx550, align 4, !tbaa !5 %cmp651 = icmp sgt i32 %6, 0 br i1 %cmp651, label %for.body7, label %for.inc18 for.body7: ; preds = %for.body, %for.body7 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 0, %for.body ] %idxprom453 = phi i64 [ %idxprom4, %for.body7 ], [ %idxprom449, %for.body ] %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], ptr @arrayt, i64 0, i64 %idxprom453, i64 %indvars.iv %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx11) %7 = load i32, ptr %m, align 4, !tbaa !5 %idxprom13 = sext i32 %7 to i64 %arrayidx16 = getelementptr inbounds [100 x [100 x i32]], ptr @arrayc, i64 0, i64 %idxprom13, i64 %indvars.iv %call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx16) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %8 = load i32, ptr %m, align 4, !tbaa !5 %idxprom4 = sext i32 %8 to i64 %arrayidx5 = getelementptr inbounds [100 x i32], ptr @arraysi, i64 0, i64 %idxprom4 %9 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp6 = icmp slt i64 %indvars.iv.next, %10 br i1 %cmp6, label %for.body7, label %for.inc18, !llvm.loop !13 for.inc18: ; preds = %for.body7, %for.body %inc19 = add nuw nsw i32 %i.055, 1 %11 = load i32, ptr @n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc19, %11 br i1 %cmp, label %for.body, label %for.cond21.preheader, !llvm.loop !14 for.body23: ; preds = %for.body23.preheader70, %for.body23 %indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body23 ], [ %indvars.iv62.ph, %for.body23.preheader70 ] %arrayidx25 = getelementptr inbounds [100 x i32], ptr @arrayd, i64 0, i64 %indvars.iv62 store i32 10000000, ptr %arrayidx25, align 4, !tbaa !5 %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.end28, label %for.body23, !llvm.loop !15 for.end28: ; preds = %for.body23, %middle.block, %entry, %for.cond21.preheader call void @def(i32 noundef 0, i32 noundef 0) %12 = load i32, ptr @n, align 4, !tbaa !5 %cmp3058 = icmp sgt i32 %12, 0 br i1 %cmp3058, label %for.body31, label %for.end37 for.body31: ; preds = %for.end28, %for.body31 %indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body31 ], [ 0, %for.end28 ] %arrayidx33 = getelementptr inbounds [100 x i32], ptr @arrayd, i64 0, i64 %indvars.iv65 %13 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %14 = trunc i64 %indvars.iv65 to i32 %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14, i32 noundef %13) %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp30 = icmp slt i64 %indvars.iv.next66, %16 br i1 %cmp30, label %for.body31, label %for.end37, !llvm.loop !16 for.end37: ; preds = %for.body31, %for.end28 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @def(i32 noundef %p, i32 noundef %x) local_unnamed_addr #3 { entry: %idxprom = sext i32 %p to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @arrayd, i64 0, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !5 %arrayidx2 = getelementptr inbounds [100 x i32], ptr @arraysi, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp35 = icmp sgt i32 %0, 0 br i1 %cmp35, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %1 = phi i32 [ %5, %for.inc ], [ %0, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] %arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @arrayt, i64 0, i64 %idxprom, i64 %indvars.iv %2 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %idxprom7 = sext i32 %2 to i64 %arrayidx8 = getelementptr inbounds [100 x i32], ptr @arrayd, i64 0, i64 %idxprom7 %3 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %arrayidx12 = getelementptr inbounds [100 x [100 x i32]], ptr @arrayc, i64 0, i64 %idxprom, i64 %indvars.iv %4 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %add = add nsw i32 %4, %x %cmp13 = icmp sgt i32 %3, %add br i1 %cmp13, label %if.then, label %for.inc if.then: ; preds = %for.body tail call void @def(i32 noundef %2, i32 noundef %add) %.pre = load i32, ptr %arrayidx2, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body, %if.then %5 = phi i32 [ %1, %for.body ], [ %.pre, %if.then ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = sext i32 %5 to i64 %cmp = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17 for.end: ; preds = %for.inc, %entry ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !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} !15 = distinct !{!15, !10, !12, !11} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10}
#include<stdio.h> #define N 100 #define MAX 100000000 void dijks(); int n,G[N][N]; int main(){ int i,j,u,k,c,v; scanf("%d",&n); for(i = 0; i< n; i++){ for(j = 0; j < n; j++){ G[i][j] = MAX; } } for(i = 0; i< n; i++){ scanf("%d %d",&u,&k); for(j = 0; j < k; j++){ scanf("%d %d",&v,&c); G[u][v] = c; } } dijks(); return 0; } void dijks(){ int minv,i,u,v; int d[N],color[N]; for(i = 0; i < n; i++){ d[i] = MAX; color[i] = 0; } d[0] = 0; color[0] = 1; while(1){ minv =MAX; u = -1; for(i = 0; i < n; i++){ if(minv > d[i] && color[i] != 2){ u = i; minv = d[i]; } } if(u == -1)break; color[u] = 2; for(v = 0; v < n; v++){ if(color[v] != 2 && G[u][v] != MAX){ if(d[v] > d[u] + G[u][v]){ d[v] = d[u] + G[u][v]; color[v] = 1; } } } } for(i = 0; i < n; i++){ printf("%d ",i); if(d[i] == MAX)printf("-1"); else printf("%d\n",d[i]); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221648/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221648/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 @.str.4 = 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: %u = alloca i32, align 4 %k = alloca i32, align 4 %c = alloca i32, align 4 %v = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #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 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count47 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count47, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count47 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us %indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ] br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %index store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body3.us for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ] %arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %indvars.iv store i32 100000000, ptr %arrayidx5.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47 br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47 br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14 for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us br i1 %cmp37, label %for.body11, label %for.end26 for.body11: ; preds = %for.cond9.preheader, %for.inc24 %i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1439 = icmp sgt i32 %4, 0 br i1 %cmp1439, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4, !tbaa !5 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %7 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom17, i64 %idxprom19 store i32 %5, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.140, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %8 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15 for.inc24: ; preds = %for.body15, %for.body11 %inc25 = add nuw nsw i32 %i.142, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc25, %9 br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16 for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader call void @dijks() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 uwtable define dso_local void @dijks() local_unnamed_addr #0 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #4 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp109 = icmp sgt i32 %.fr, 0 br i1 %cmp109, label %for.body.preheader, label %for.end77 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader168 for.body.preheader168: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader168, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 100000000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18 for.end: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp109, label %while.cond.us.preheader, label %for.end77 while.cond.us.preheader: ; preds = %for.end %wide.trip.count157 = zext i32 %.fr to i64 %wide.trip.count162 = zext i32 %.fr to i64 br label %for.body7.us for.end18.us: ; preds = %for.inc16.us %cmp19.us = icmp eq i32 %u.1.us, -1 br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us if.end21.us: ; preds = %for.end18.us %idxprom22.us = sext i32 %u.1.us to i64 %arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5 %arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us br label %for.body26.us for.body26.us: ; preds = %if.end21.us, %for.inc60.us %indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ] %arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159 %6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5 %cmp29.not.us = icmp eq i32 %6, 2 br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us land.lhs.true30.us: ; preds = %for.body26.us %arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom22.us, i64 %indvars.iv159 %7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5 %cmp35.not.us = icmp eq i32 %7, 100000000 br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us if.then36.us: ; preds = %land.lhs.true30.us %arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159 %8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp45.us = icmp sgt i32 %8, %add.us br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us if.then46.us: ; preds = %if.then36.us store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5 br label %for.inc60.us for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162 br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !19 for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader %indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ] %u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ] %minv.0112.us = phi i32 [ 100000000, %while.cond.us.preheader ], [ %minv.0112.us.be, %for.body7.us.backedge ] %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154 %10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp sgt i32 %minv.0112.us, %10 br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us land.lhs.true.us: ; preds = %for.body7.us %arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154 %11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5 %cmp13.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp13.not.us, i32 %minv.0112.us, i32 %10 %12 = trunc i64 %indvars.iv154 to i32 %spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12 br label %for.inc16.us for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us %minv.1.us = phi i32 [ %minv.0112.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ] %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157 br i1 %exitcond158.not, label %for.end18.us, label %for.body7.us.backedge for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us %indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ] %u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ] %minv.0112.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 100000000, %for.inc60.us ] br label %for.body7.us, !llvm.loop !19 for.cond63.preheader: ; preds = %for.end18.us %cmp64145 = icmp sgt i32 %.fr, 0 br i1 %cmp64145, label %for.body65, label %for.end77 for.body65: ; preds = %for.cond63.preheader, %for.inc75 %indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ] %13 = trunc i64 %indvars.iv164 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13) %arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164 %14 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %cmp68 = icmp eq i32 %14, 100000000 br i1 %cmp68, label %if.then69, label %if.else if.then69: ; preds = %for.body65 %call70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) br label %for.inc75 if.else: ; preds = %for.body65 %call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %14) br label %for.inc75 for.inc75: ; preds = %if.then69, %if.else %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp64 = icmp slt i64 %indvars.iv.next165, %16 br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !20 for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !11, !12} !18 = distinct !{!18, !10, !12, !11} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include<stdio.h> #define N 100 #define WHITE 0 #define BLACK 2 #define GRAY 1 #define INFTY 100000000 void dijkstra(void); int n,G[N][N]; int main(){ int i,j,u,v,k,c; scanf("%d",&n); for(i=0;i<n;i++){ for(j=0;j<n;j++){ G[i][j]=INFTY; } } for(i = 0;i < n;i++){ scanf("%d%d",&u,&k); for(j = 0;j < k;j++){ scanf("%d%d",&v,&c); G[u][v] = c; } } dijkstra(); return 0; } void dijkstra(){ int i,u,v,d[N],p[N],color[N],min; for(i = 0;i < n;i++){ p[i]=-1; color[i]=WHITE; d[i]=INFTY; } d[0]=0; color[0]=GRAY; while(1){ min = INFTY; for(i = 0;i < n;i++){ if(color[i] != BLACK && d[i] < min){ min = d[i]; u = i; } } if(min == INFTY)break; color[u]= BLACK; for(v = 0;v < n;v++){ if(color[v] != BLACK && G[u][v] != INFTY && G[u][v]+d[u] < d[v]){ d[v] = G[u][v] + d[u]; p[v] = u; //printf("%d \n",d[v]); color[v] = GRAY; } } } for(v = 0;v < n;v++){ printf("%d %d\n",v,d[v]); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221699/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221699/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %u = alloca i32, align 4 %v = alloca i32, align 4 %k = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #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 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count47 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count47, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count47 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us %indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ] br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %index store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body3.us for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ] %arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %indvars.iv store i32 100000000, ptr %arrayidx5.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47 br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47 br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14 for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us br i1 %cmp37, label %for.body11, label %for.end26 for.body11: ; preds = %for.cond9.preheader, %for.inc24 %i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1439 = icmp sgt i32 %4, 0 br i1 %cmp1439, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4, !tbaa !5 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %7 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom17, i64 %idxprom19 store i32 %5, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.140, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %8 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15 for.inc24: ; preds = %for.body15, %for.body11 %inc25 = add nuw nsw i32 %i.142, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc25, %9 br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16 for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader call void @dijkstra() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @dijkstra() local_unnamed_addr #0 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp106 = icmp sgt i32 %.fr, 0 br i1 %cmp106, label %for.body.preheader, label %for.end73 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader170, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader170 for.body.preheader170: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader170, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader170 ] %arrayidx4 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 100000000, ptr %arrayidx4, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18 for.end: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp106, label %while.cond.us.preheader, label %for.end73 while.cond.us.preheader: ; preds = %for.end %wide.trip.count159 = zext i32 %.fr to i64 %wide.trip.count164 = zext i32 %.fr to i64 br label %for.body9.us for.end20.us: ; preds = %for.inc18.us %cmp21.us = icmp eq i32 %min.1.us, 100000000 br i1 %cmp21.us, label %for.cond66.preheader, label %if.end23.us if.end23.us: ; preds = %for.end20.us %idxprom24.us = sext i32 %u.2.us to i64 %arrayidx25.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom24.us store i32 2, ptr %arrayidx25.us, align 4, !tbaa !5 %arrayidx44.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom24.us br label %for.body28.us for.body28.us: ; preds = %if.end23.us, %for.inc63.us %indvars.iv161 = phi i64 [ 0, %if.end23.us ], [ %indvars.iv.next162, %for.inc63.us ] %arrayidx30.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv161 %6 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5 %cmp31.not.us = icmp eq i32 %6, 2 br i1 %cmp31.not.us, label %for.inc63.us, label %land.lhs.true32.us land.lhs.true32.us: ; preds = %for.body28.us %arrayidx36.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom24.us, i64 %indvars.iv161 %7 = load i32, ptr %arrayidx36.us, align 4, !tbaa !5 %cmp37.not.us = icmp eq i32 %7, 100000000 br i1 %cmp37.not.us, label %for.inc63.us, label %land.lhs.true38.us land.lhs.true38.us: ; preds = %land.lhs.true32.us %8 = load i32, ptr %arrayidx44.us, align 4, !tbaa !5 %add.us = add nsw i32 %8, %7 %arrayidx46.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv161 %9 = load i32, ptr %arrayidx46.us, align 4, !tbaa !5 %cmp47.us = icmp slt i32 %add.us, %9 br i1 %cmp47.us, label %if.then48.us, label %for.inc63.us if.then48.us: ; preds = %land.lhs.true38.us store i32 %add.us, ptr %arrayidx46.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx30.us, align 4, !tbaa !5 br label %for.inc63.us for.inc63.us: ; preds = %if.then48.us, %land.lhs.true38.us, %land.lhs.true32.us, %for.body28.us %indvars.iv.next162 = add nuw nsw i64 %indvars.iv161, 1 %exitcond165.not = icmp eq i64 %indvars.iv.next162, %wide.trip.count164 br i1 %exitcond165.not, label %for.body9.us.backedge, label %for.body28.us, !llvm.loop !19 for.body9.us: ; preds = %for.body9.us.backedge, %while.cond.us.preheader %indvars.iv156 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv156.be, %for.body9.us.backedge ] %min.0111.us = phi i32 [ 100000000, %while.cond.us.preheader ], [ %min.0111.us.be, %for.body9.us.backedge ] %u.1110.us = phi i32 [ undef, %while.cond.us.preheader ], [ %u.2.us, %for.body9.us.backedge ] %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv156 %10 = load i32, ptr %arrayidx11.us, align 4, !tbaa !5 %cmp12.not.us = icmp eq i32 %10, 2 br i1 %cmp12.not.us, label %for.inc18.us, label %land.lhs.true.us land.lhs.true.us: ; preds = %for.body9.us %arrayidx14.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv156 %11 = load i32, ptr %arrayidx14.us, align 4, !tbaa !5 %cmp15.us = icmp slt i32 %11, %min.0111.us %12 = trunc i64 %indvars.iv156 to i32 %spec.select.us = select i1 %cmp15.us, i32 %12, i32 %u.1110.us %spec.select105.us = tail call i32 @llvm.smin.i32(i32 %11, i32 %min.0111.us) br label %for.inc18.us for.inc18.us: ; preds = %land.lhs.true.us, %for.body9.us %u.2.us = phi i32 [ %u.1110.us, %for.body9.us ], [ %spec.select.us, %land.lhs.true.us ] %min.1.us = phi i32 [ %min.0111.us, %for.body9.us ], [ %spec.select105.us, %land.lhs.true.us ] %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1 %exitcond160.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count159 br i1 %exitcond160.not, label %for.end20.us, label %for.body9.us.backedge for.body9.us.backedge: ; preds = %for.inc63.us, %for.inc18.us %indvars.iv156.be = phi i64 [ %indvars.iv.next157, %for.inc18.us ], [ 0, %for.inc63.us ] %min.0111.us.be = phi i32 [ %min.1.us, %for.inc18.us ], [ 100000000, %for.inc63.us ] br label %for.body9.us, !llvm.loop !19 for.cond66.preheader: ; preds = %for.end20.us %cmp67147 = icmp sgt i32 %.fr, 0 br i1 %cmp67147, label %for.body68, label %for.end73 for.body68: ; preds = %for.cond66.preheader, %for.body68 %indvars.iv166 = phi i64 [ %indvars.iv.next167, %for.body68 ], [ 0, %for.cond66.preheader ] %arrayidx70 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv166 %13 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %14 = trunc i64 %indvars.iv166 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14, i32 noundef %13) %indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp67 = icmp slt i64 %indvars.iv.next167, %16 br i1 %cmp67, label %for.body68, label %for.end73, !llvm.loop !20 for.end73: ; preds = %for.body68, %entry, %for.end, %for.cond66.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !11, !12} !18 = distinct !{!18, !10, !12, !11} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include<stdio.h> #define max 100 #define inf 10000000 int main(){ int n, u, k,v, c, i, j, min; int d[max],node[max][max],jud[max]; scanf("%d",&n); for(i = 0; i < n;i++){ for(j = 0;j <n;j++){ node[i][j] = -1; } } for(i = 0;i < n ;i++){ scanf("%d %d",&u,&k); for(j = 0;j < k;j++){ scanf("%d %d",&v,&c); node[i][v] = c; } } for(i = 0;i <n;i++){ d[i] = inf; jud[i] = 1; } d[0] = 0; while(1){ min = inf; for(i = 0;i <n;i++){ if(min > d[i] &&jud[i] == 1){ u = i; min = d[i]; } } if(min == inf)break; jud[u] = 0; for(j = 0;j < n;j++){ if(node[u][j] == -1)continue; if(d[j] > d[u] + node[u][j]){ d[j] = d[u] + node[u][j]; } } } for(i = 0;i < n;i++){ printf("%d %d\n",i,d[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221756/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221756/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %u = alloca i32, align 4 %k = alloca i32, align 4 %v = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca [100 x i32], align 16 %node = alloca [100 x [100 x i32]], align 16 %jud = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %node) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %jud) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp132 = icmp sgt i32 %0, 0 br i1 %cmp132, label %for.cond1.preheader.us.preheader, label %for.end36 for.cond1.preheader.us.preheader: ; preds = %entry %1 = zext i32 %0 to i64 %2 = shl nuw nsw i64 %1, 2 %xtraiter = and i64 %1, 7 %3 = icmp ult i32 %0, 8 br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader %unroll_iter = and i64 %1, 4294967288 %invariant.gep = getelementptr i8, ptr %node, i64 400 %invariant.gep187 = getelementptr i8, ptr %node, i64 800 %invariant.gep189 = getelementptr i8, ptr %node, i64 1200 %invariant.gep191 = getelementptr i8, ptr %node, i64 1600 %invariant.gep193 = getelementptr i8, ptr %node, i64 2000 %invariant.gep195 = getelementptr i8, ptr %node, i64 2400 %invariant.gep197 = getelementptr i8, ptr %node, i64 2800 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new %indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ] %niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ] %4 = mul nuw nsw i64 %indvar, 400 %scevgep = getelementptr i8, ptr %node, i64 %4 call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 -1, i64 %2, i1 false), !tbaa !5 %5 = mul nuw i64 %indvar, 400 %gep = getelementptr i8, ptr %invariant.gep, i64 %5 call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 -1, i64 %2, i1 false), !tbaa !5 %6 = mul nuw i64 %indvar, 400 %gep188 = getelementptr i8, ptr %invariant.gep187, i64 %6 call void @llvm.memset.p0.i64(ptr align 16 %gep188, i8 -1, i64 %2, i1 false), !tbaa !5 %7 = mul nuw i64 %indvar, 400 %gep190 = getelementptr i8, ptr %invariant.gep189, i64 %7 call void @llvm.memset.p0.i64(ptr align 16 %gep190, i8 -1, i64 %2, i1 false), !tbaa !5 %8 = mul nuw i64 %indvar, 400 %gep192 = getelementptr i8, ptr %invariant.gep191, i64 %8 call void @llvm.memset.p0.i64(ptr align 16 %gep192, i8 -1, i64 %2, i1 false), !tbaa !5 %9 = mul nuw i64 %indvar, 400 %gep194 = getelementptr i8, ptr %invariant.gep193, i64 %9 call void @llvm.memset.p0.i64(ptr align 16 %gep194, i8 -1, i64 %2, i1 false), !tbaa !5 %10 = mul nuw i64 %indvar, 400 %gep196 = getelementptr i8, ptr %invariant.gep195, i64 %10 call void @llvm.memset.p0.i64(ptr align 16 %gep196, i8 -1, i64 %2, i1 false), !tbaa !5 %11 = mul nuw i64 %indvar, 400 %gep198 = getelementptr i8, ptr %invariant.gep197, i64 %11 call void @llvm.memset.p0.i64(ptr align 16 %gep198, i8 -1, i64 %2, i1 false), !tbaa !5 %indvar.next.7 = add nuw nsw i64 %indvar, 8 %niter.next.7 = add i64 %niter, 8 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9 for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader %indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil %indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ] %12 = mul nuw nsw i64 %indvar.epil, 400 %scevgep.epil = getelementptr i8, ptr %node, i64 %12 call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 -1, i64 %2, i1 false), !tbaa !5 %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11 for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa br i1 %cmp132, label %for.body11, label %for.end36 for.cond27.preheader: ; preds = %for.inc24 %cmp28138 = icmp sgt i32 %22, 0 br i1 %cmp28138, label %for.body29.preheader, label %for.end36 for.body29.preheader: ; preds = %for.cond27.preheader %wide.trip.count157 = zext i32 %22 to i64 %min.iters.check = icmp ult i32 %22, 8 br i1 %min.iters.check, label %for.body29.preheader181, label %vector.ph vector.ph: ; preds = %for.body29.preheader %n.vec = and i64 %wide.trip.count157, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %13 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %13, align 16, !tbaa !5 %14 = getelementptr inbounds i32, ptr %13, i64 4 store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %14, align 16, !tbaa !5 %15 = getelementptr inbounds [100 x i32], ptr %jud, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 16, !tbaa !5 %16 = getelementptr inbounds i32, ptr %15, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %17 = icmp eq i64 %index.next, %n.vec br i1 %17, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count157 br i1 %cmp.n, label %for.end36, label %for.body29.preheader181 for.body29.preheader181: ; preds = %for.body29.preheader, %middle.block %indvars.iv154.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block ] br label %for.body29 for.body11: ; preds = %for.cond9.preheader, %for.inc24 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc24 ], [ 0, %for.cond9.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %18 = load i32, ptr %k, align 4, !tbaa !5 %cmp14134 = icmp sgt i32 %18, 0 br i1 %cmp14134, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.1135 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %19 = load i32, ptr %c, align 4, !tbaa !5 %20 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %20 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr %node, i64 0, i64 %indvars.iv, i64 %idxprom19 store i32 %19, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.1135, 1 %21 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %21 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !16 for.inc24: ; preds = %for.body15, %for.body11 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %22 = load i32, ptr %n, align 4, !tbaa !5 %23 = sext i32 %22 to i64 %cmp10 = icmp slt i64 %indvars.iv.next, %23 br i1 %cmp10, label %for.body11, label %for.cond27.preheader, !llvm.loop !17 for.body29: ; preds = %for.body29.preheader181, %for.body29 %indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.body29 ], [ %indvars.iv154.ph, %for.body29.preheader181 ] %arrayidx31 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154 store i32 10000000, ptr %arrayidx31, align 4, !tbaa !5 %arrayidx33 = getelementptr inbounds [100 x i32], ptr %jud, i64 0, i64 %indvars.iv154 store i32 1, ptr %arrayidx33, align 4, !tbaa !5 %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157 br i1 %exitcond158.not, label %for.end36, label %for.body29, !llvm.loop !18 for.end36: ; preds = %for.body29, %middle.block, %entry, %for.cond9.preheader, %for.cond27.preheader %cmp28138173 = phi i1 [ false, %for.cond27.preheader ], [ false, %for.cond9.preheader ], [ false, %entry ], [ %cmp28138, %middle.block ], [ %cmp28138, %for.body29 ] %24 = phi i32 [ %22, %for.cond27.preheader ], [ %0, %for.cond9.preheader ], [ %0, %entry ], [ %22, %middle.block ], [ %22, %for.body29 ] store i32 0, ptr %d, align 16, !tbaa !5 %wide.trip.count162 = zext i32 %24 to i64 %wide.trip.count167 = zext i32 %24 to i64 br i1 %cmp28138173, label %for.body40.preheader.lr.ph, label %for.end98 for.body40.preheader.lr.ph: ; preds = %for.end36 %u.promoted = load i32, ptr %u, align 4, !tbaa !5 %xtraiter182 = and i64 %wide.trip.count167, 1 %25 = icmp eq i32 %24, 1 %unroll_iter185 = and i64 %wide.trip.count167, 4294967294 %lcmp.mod184.not = icmp eq i64 %xtraiter182, 0 br label %for.body40 while.cond.loopexit.unr-lcssa: ; preds = %for.inc87.1, %for.body59.lr.ph %indvars.iv164.unr = phi i64 [ 0, %for.body59.lr.ph ], [ %indvars.iv.next165.1, %for.inc87.1 ] br i1 %lcmp.mod184.not, label %while.cond.loopexit, label %for.body59.epil for.body59.epil: ; preds = %while.cond.loopexit.unr-lcssa %arrayidx63.epil = getelementptr inbounds [100 x [100 x i32]], ptr %node, i64 0, i64 %idxprom55, i64 %indvars.iv164.unr %26 = load i32, ptr %arrayidx63.epil, align 4, !tbaa !5 %cmp64.epil = icmp eq i32 %26, -1 br i1 %cmp64.epil, label %while.cond.loopexit, label %if.end66.epil if.end66.epil: ; preds = %for.body59.epil %arrayidx68.epil = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164.unr %27 = load i32, ptr %arrayidx68.epil, align 4, !tbaa !5 %28 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %add.epil = add nsw i32 %28, %26 %spec.store.select.epil = call i32 @llvm.smin.i32(i32 %27, i32 %add.epil) store i32 %spec.store.select.epil, ptr %arrayidx68.epil, align 4 br label %while.cond.loopexit while.cond.loopexit: ; preds = %for.body59.epil, %if.end66.epil, %while.cond.loopexit.unr-lcssa br i1 %cmp28138173, label %for.body40.backedge, label %for.end98 for.body40: ; preds = %for.body40.backedge, %for.body40.preheader.lr.ph %indvars.iv159 = phi i64 [ 0, %for.body40.preheader.lr.ph ], [ %indvars.iv159.be, %for.body40.backedge ] %29 = phi i32 [ %u.promoted, %for.body40.preheader.lr.ph ], [ %33, %for.body40.backedge ] %min.0142 = phi i32 [ 10000000, %for.body40.preheader.lr.ph ], [ %min.0142.be, %for.body40.backedge ] %arrayidx42 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159 %30 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %cmp43 = icmp sgt i32 %min.0142, %30 br i1 %cmp43, label %land.lhs.true, label %for.inc49 land.lhs.true: ; preds = %for.body40 %arrayidx45 = getelementptr inbounds [100 x i32], ptr %jud, i64 0, i64 %indvars.iv159 %31 = load i32, ptr %arrayidx45, align 4, !tbaa !5 %cmp46 = icmp eq i32 %31, 1 br i1 %cmp46, label %if.then, label %for.inc49 if.then: ; preds = %land.lhs.true %32 = trunc i64 %indvars.iv159 to i32 store i32 %32, ptr %u, align 4, !tbaa !5 br label %for.inc49 for.inc49: ; preds = %for.body40, %land.lhs.true, %if.then %33 = phi i32 [ %32, %if.then ], [ %29, %land.lhs.true ], [ %29, %for.body40 ] %min.1 = phi i32 [ %30, %if.then ], [ %min.0142, %land.lhs.true ], [ %min.0142, %for.body40 ] %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162 br i1 %exitcond163.not, label %for.end51, label %for.body40.backedge for.body40.backedge: ; preds = %for.inc49, %while.cond.loopexit %indvars.iv159.be = phi i64 [ %indvars.iv.next160, %for.inc49 ], [ 0, %while.cond.loopexit ] %min.0142.be = phi i32 [ %min.1, %for.inc49 ], [ 10000000, %while.cond.loopexit ] br label %for.body40, !llvm.loop !19 for.end51: ; preds = %for.inc49 %cmp52 = icmp eq i32 %min.1, 10000000 br i1 %cmp52, label %for.cond90.preheader, label %if.end54 for.cond90.preheader: ; preds = %for.end51 br i1 %cmp28138173, label %for.body92, label %for.end98 if.end54: ; preds = %for.end51 %idxprom55 = sext i32 %33 to i64 %arrayidx56 = getelementptr inbounds [100 x i32], ptr %jud, i64 0, i64 %idxprom55 store i32 0, ptr %arrayidx56, align 4, !tbaa !5 br i1 %cmp28138173, label %for.body59.lr.ph, label %for.end98 for.body59.lr.ph: ; preds = %if.end54 %arrayidx70 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom55 br i1 %25, label %while.cond.loopexit.unr-lcssa, label %for.body59 for.body59: ; preds = %for.body59.lr.ph, %for.inc87.1 %indvars.iv164 = phi i64 [ %indvars.iv.next165.1, %for.inc87.1 ], [ 0, %for.body59.lr.ph ] %niter186 = phi i64 [ %niter186.next.1, %for.inc87.1 ], [ 0, %for.body59.lr.ph ] %arrayidx63 = getelementptr inbounds [100 x [100 x i32]], ptr %node, i64 0, i64 %idxprom55, i64 %indvars.iv164 %34 = load i32, ptr %arrayidx63, align 8, !tbaa !5 %cmp64 = icmp eq i32 %34, -1 br i1 %cmp64, label %for.inc87, label %if.end66 if.end66: ; preds = %for.body59 %arrayidx68 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164 %35 = load i32, ptr %arrayidx68, align 8, !tbaa !5 %36 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %add = add nsw i32 %36, %34 %spec.store.select = call i32 @llvm.smin.i32(i32 %35, i32 %add) store i32 %spec.store.select, ptr %arrayidx68, align 8 br label %for.inc87 for.inc87: ; preds = %if.end66, %for.body59 %indvars.iv.next165 = or i64 %indvars.iv164, 1 %arrayidx63.1 = getelementptr inbounds [100 x [100 x i32]], ptr %node, i64 0, i64 %idxprom55, i64 %indvars.iv.next165 %37 = load i32, ptr %arrayidx63.1, align 4, !tbaa !5 %cmp64.1 = icmp eq i32 %37, -1 br i1 %cmp64.1, label %for.inc87.1, label %if.end66.1 if.end66.1: ; preds = %for.inc87 %arrayidx68.1 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv.next165 %38 = load i32, ptr %arrayidx68.1, align 4, !tbaa !5 %39 = load i32, ptr %arrayidx70, align 4, !tbaa !5 %add.1 = add nsw i32 %39, %37 %spec.store.select.1 = call i32 @llvm.smin.i32(i32 %38, i32 %add.1) store i32 %spec.store.select.1, ptr %arrayidx68.1, align 4 br label %for.inc87.1 for.inc87.1: ; preds = %if.end66.1, %for.inc87 %indvars.iv.next165.1 = add nuw nsw i64 %indvars.iv164, 2 %niter186.next.1 = add i64 %niter186, 2 %niter186.ncmp.1 = icmp eq i64 %niter186.next.1, %unroll_iter185 br i1 %niter186.ncmp.1, label %while.cond.loopexit.unr-lcssa, label %for.body59, !llvm.loop !20 for.body92: ; preds = %for.cond90.preheader, %for.body92 %indvars.iv169 = phi i64 [ %indvars.iv.next170, %for.body92 ], [ 0, %for.cond90.preheader ] %arrayidx94 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv169 %40 = load i32, ptr %arrayidx94, align 4, !tbaa !5 %41 = trunc i64 %indvars.iv169 to i32 %call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %41, i32 noundef %40) %indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1 %42 = load i32, ptr %n, align 4, !tbaa !5 %43 = sext i32 %42 to i64 %cmp91 = icmp slt i64 %indvars.iv.next170, %43 br i1 %cmp91, label %for.body92, label %for.end98, !llvm.loop !21 for.end98: ; preds = %if.end54, %while.cond.loopexit, %for.body92, %for.end36, %for.cond90.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %jud) #5 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %node) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10, !14, !15} !14 = !{!"llvm.loop.isvectorized", i32 1} !15 = !{!"llvm.loop.unroll.runtime.disable"} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10, !15, !14} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10} !21 = distinct !{!21, !10}
#include<stdio.h> #define MAX 100 #define INFTY 800000 #define WHITE 0 #define GRAY 1 #define BLACK 2 int n,M[MAX][MAX]; void DIJKSTRA(void); void DIJKSTRA() { int minv,v,i; int d[MAX],color[MAX]; for(i=0;i<n;i++) { d[i]=INFTY; color[i]=WHITE; } d[0]=0; color[0]=GRAY; while(1){ minv=INFTY; int u=-1; for(i=0;i<n;i++) { if(minv>d[i]&&color[i]!=BLACK) { u=i; minv=d[i]; } } if(u==-1)break; color[u]=BLACK; for(v=0;v<n;v++) { if(color[v]!=BLACK&&M[u][v]!=INFTY) { if(d[v]>d[u]+M[u][v]) { d[v]=d[u]+M[u][v]; color[v]=GRAY; } } } } for(i=0;i<n;i++) { if(d[i]==INFTY) { printf("%d %d\n",i,-1); } else printf("%d %d\n",i,d[i]); } } int main() { int i,j; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<n;j++) { M[i][j]=INFTY; } } int k,c,u,v; for(i=0;i<n;i++) { scanf("%d%d",&u,&k); for(j=0;j<k;j++) { scanf("%d%d",&v,&c); M[u][v]=c; } } DIJKSTRA(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221820/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221820/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.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 @.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @DIJKSTRA() local_unnamed_addr #0 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #4 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp109 = icmp sgt i32 %.fr, 0 br i1 %cmp109, label %for.body.preheader, label %for.end76 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 800000, i32 800000, i32 800000, i32 800000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 800000, i32 800000, i32 800000, i32 800000>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader168 for.body.preheader168: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader168, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 800000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp109, label %while.cond.us.preheader, label %for.end76 while.cond.us.preheader: ; preds = %for.end %wide.trip.count157 = zext i32 %.fr to i64 %wide.trip.count162 = zext i32 %.fr to i64 br label %for.body7.us for.end18.us: ; preds = %for.inc16.us %cmp19.not.us = icmp eq i32 %u.1.us, -1 br i1 %cmp19.not.us, label %for.cond63.preheader, label %if.end21.us if.end21.us: ; preds = %for.end18.us %idxprom22.us = sext i32 %u.1.us to i64 %arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5 %arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us br label %for.body26.us for.body26.us: ; preds = %if.end21.us, %for.inc60.us %indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ] %arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159 %6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5 %cmp29.not.us = icmp eq i32 %6, 2 br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us land.lhs.true30.us: ; preds = %for.body26.us %arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom22.us, i64 %indvars.iv159 %7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5 %cmp35.not.us = icmp eq i32 %7, 800000 br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us if.then36.us: ; preds = %land.lhs.true30.us %arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159 %8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp45.us = icmp sgt i32 %8, %add.us br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us if.then46.us: ; preds = %if.then36.us store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5 br label %for.inc60.us for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162 br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14 for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader %indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ] %u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ] %minv.0112.us = phi i32 [ 800000, %while.cond.us.preheader ], [ %minv.0112.us.be, %for.body7.us.backedge ] %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154 %10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp sgt i32 %minv.0112.us, %10 br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us land.lhs.true.us: ; preds = %for.body7.us %arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154 %11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5 %cmp13.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp13.not.us, i32 %minv.0112.us, i32 %10 %12 = trunc i64 %indvars.iv154 to i32 %spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12 br label %for.inc16.us for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us %minv.1.us = phi i32 [ %minv.0112.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ] %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157 br i1 %exitcond158.not, label %for.end18.us, label %for.body7.us.backedge for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us %indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ] %u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ] %minv.0112.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 800000, %for.inc60.us ] br label %for.body7.us, !llvm.loop !14 for.cond63.preheader: ; preds = %for.end18.us %cmp64145 = icmp sgt i32 %.fr, 0 br i1 %cmp64145, label %for.body65, label %for.end76 for.body65: ; preds = %for.cond63.preheader, %for.body65 %indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.body65 ], [ 0, %for.cond63.preheader ] %arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164 %13 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %cmp68 = icmp eq i32 %13, 800000 %14 = trunc i64 %indvars.iv164 to i32 %. = select i1 %cmp68, i32 -1, i32 %13 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14, i32 noundef %.) %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp64 = icmp slt i64 %indvars.iv.next165, %16 br i1 %cmp64, label %for.body65, label %for.end76, !llvm.loop !15 for.end76: ; preds = %for.body65, %entry, %for.end, %for.cond63.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 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 !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end8.thread for.end8.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4 br label %for.end26 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count47 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count47, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count47 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us %indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ] br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %index store <4 x i32> <i32 800000, i32 800000, i32 800000, i32 800000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 800000, i32 800000, i32 800000, i32 800000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body3.us for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ] %arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %indvars.iv store i32 800000, ptr %arrayidx5.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47 br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47 br i1 %exitcond48.not, label %for.end8, label %for.cond1.preheader.us, !llvm.loop !18 for.end8: ; preds = %for.cond1.for.inc6_crit_edge.us call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4 br i1 %cmp37, label %for.body11, label %for.end26 for.body11: ; preds = %for.end8, %for.inc24 %i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.end8 ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1439 = icmp sgt i32 %4, 0 br i1 %cmp1439, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4, !tbaa !5 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %7 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom17, i64 %idxprom19 store i32 %5, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.140, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %8 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19 for.inc24: ; preds = %for.body15, %for.body11 %inc25 = add nuw nsw i32 %i.142, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc25, %9 br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20 for.end26: ; preds = %for.inc24, %for.end8.thread, %for.end8 call void @DIJKSTRA() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include<stdio.h> int inf=(1<<21); int main() { int i,j; int n; int k,c,u,o,l; int A[100][100],d[100],v[100]; scanf("%d",&n); for(i=0;i<n;i++) { if(i==0) d[i]=0; else d[i]=inf; v[i]=0; for(j=0;j<n;j++) { A[i][j]=inf; } } for(i=0;i<n;i++) { scanf("%d%d",&u,&k); for(j=0;j<k;j++) { scanf("%d%d",&o,&c); A[u][o]=c; } } while(1) { l=inf; u=-1; for(i=0;i<n;i++) { if(l>d[i]&&!v[i]) { u=i; l=d[i]; } } if(u==-1) break; v[u]=1; for(i=0;i<n;i++) { if(!v[i] && A[u][i]!=inf) { if(d[i]>d[u]+A[u][i]) { d[i]=d[u]+A[u][i]; } } } } for(i=0;i<n;i++) { printf("%d %d\n",i,(d[i]==inf?-1:d[i])); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221864/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221864/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @inf = dso_local local_unnamed_addr global i32 2097152, align 4 @.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 [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %o = alloca i32, align 4 %A = alloca [100 x [100 x i32]], align 16 %d = alloca [100 x i32], align 16 %v = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %o) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %v) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp139 = icmp sgt i32 %0, 0 br i1 %cmp139, label %for.body.lr.ph, label %for.cond16.preheader.thread for.cond16.preheader.thread: ; preds = %entry store i32 0, ptr %d, align 16, !tbaa !5 br label %while.cond.preheader for.body.lr.ph: ; preds = %entry %1 = load i32, ptr @inf, align 4 %2 = zext i32 %0 to i64 %3 = shl nuw nsw i64 %2, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %v, i8 0, i64 %3, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %2, 4294967288 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %cmp.n = icmp eq i64 %n.vec, %2 br label %for.body.us for.body.us: ; preds = %for.cond6.for.inc13_crit_edge.us, %for.body.lr.ph %indvars.iv193 = phi i64 [ %indvars.iv.next194, %for.cond6.for.inc13_crit_edge.us ], [ 0, %for.body.lr.ph ] %cmp1.us = icmp eq i64 %indvars.iv193, 0 br i1 %cmp1.us, label %if.end.us, label %if.else.us if.else.us: ; preds = %for.body.us %arrayidx3.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv193 store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5 br label %if.end.us if.end.us: ; preds = %for.body.us, %if.else.us br i1 %min.iters.check, label %for.body8.us.preheader, label %vector.body vector.body: ; preds = %if.end.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %if.end.us ] %4 = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv193, i64 %index store <4 x i32> %broadcast.splat, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> %broadcast.splat, ptr %5, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %6 = icmp eq i64 %index.next, %n.vec br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond6.for.inc13_crit_edge.us, label %for.body8.us.preheader for.body8.us.preheader: ; preds = %if.end.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %if.end.us ], [ %n.vec, %middle.block ] br label %for.body8.us for.body8.us: ; preds = %for.body8.us.preheader, %for.body8.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body8.us ], [ %indvars.iv.ph, %for.body8.us.preheader ] %arrayidx12.us = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv193, i64 %indvars.iv store i32 %1, ptr %arrayidx12.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %2 br i1 %exitcond.not, label %for.cond6.for.inc13_crit_edge.us, label %for.body8.us, !llvm.loop !13 for.cond6.for.inc13_crit_edge.us: ; preds = %for.body8.us, %middle.block %indvars.iv.next194 = add nuw nsw i64 %indvars.iv193, 1 %exitcond197.not = icmp eq i64 %indvars.iv.next194, %2 br i1 %exitcond197.not, label %for.cond16.preheader, label %for.body.us, !llvm.loop !14 for.cond16.preheader: ; preds = %for.cond6.for.inc13_crit_edge.us store i32 0, ptr %d, align 16, !tbaa !5 br i1 %cmp139, label %for.body18, label %while.cond.preheader while.cond.preheader: ; preds = %for.inc31, %for.cond16.preheader.thread, %for.cond16.preheader %7 = phi i32 [ %0, %for.cond16.preheader ], [ %0, %for.cond16.preheader.thread ], [ %23, %for.inc31 ] %.lcssa.fr = freeze i32 %7 %8 = load i32, ptr @inf, align 4, !tbaa !5 %cmp35146 = icmp sgt i32 %.lcssa.fr, 0 br i1 %cmp35146, label %while.cond.us.preheader, label %for.end102 while.cond.us.preheader: ; preds = %while.cond.preheader %wide.trip.count206 = zext i32 %.lcssa.fr to i64 %wide.trip.count211 = zext i32 %.lcssa.fr to i64 br label %for.body36.us for.end48.us: ; preds = %for.inc46.us %cmp49.us = icmp eq i32 %17, -1 br i1 %cmp49.us, label %for.cond91.preheader, label %if.end51.us if.end51.us: ; preds = %for.end48.us %idxprom52.us = sext i32 %17 to i64 %arrayidx53.us = getelementptr inbounds [100 x i32], ptr %v, i64 0, i64 %idxprom52.us store i32 1, ptr %arrayidx53.us, align 4, !tbaa !5 %arrayidx70.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom52.us br label %for.body56.us for.body56.us: ; preds = %if.end51.us, %for.inc88.us %indvars.iv208 = phi i64 [ 0, %if.end51.us ], [ %indvars.iv.next209, %for.inc88.us ] %arrayidx58.us = getelementptr inbounds [100 x i32], ptr %v, i64 0, i64 %indvars.iv208 %9 = load i32, ptr %arrayidx58.us, align 4, !tbaa !5 %tobool59.not.us = icmp eq i32 %9, 0 br i1 %tobool59.not.us, label %land.lhs.true60.us, label %for.inc88.us land.lhs.true60.us: ; preds = %for.body56.us %arrayidx64.us = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %idxprom52.us, i64 %indvars.iv208 %10 = load i32, ptr %arrayidx64.us, align 4, !tbaa !5 %cmp65.not.us = icmp eq i32 %10, %8 br i1 %cmp65.not.us, label %for.inc88.us, label %if.then66.us if.then66.us: ; preds = %land.lhs.true60.us %arrayidx68.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv208 %11 = load i32, ptr %arrayidx68.us, align 4, !tbaa !5 %12 = load i32, ptr %arrayidx70.us, align 4, !tbaa !5 %add.us = add nsw i32 %12, %10 %spec.store.select.us = call i32 @llvm.smin.i32(i32 %11, i32 %add.us) store i32 %spec.store.select.us, ptr %arrayidx68.us, align 4 br label %for.inc88.us for.inc88.us: ; preds = %if.then66.us, %land.lhs.true60.us, %for.body56.us %indvars.iv.next209 = add nuw nsw i64 %indvars.iv208, 1 %exitcond212.not = icmp eq i64 %indvars.iv.next209, %wide.trip.count211 br i1 %exitcond212.not, label %for.body36.us.backedge, label %for.body56.us, !llvm.loop !15 for.body36.us: ; preds = %for.body36.us.backedge, %while.cond.us.preheader %indvars.iv203 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv203.be, %for.body36.us.backedge ] %13 = phi i32 [ -1, %while.cond.us.preheader ], [ %.be, %for.body36.us.backedge ] %l.0148.us = phi i32 [ %8, %while.cond.us.preheader ], [ %l.0148.us.be, %for.body36.us.backedge ] %arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv203 %14 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %cmp39.us = icmp sgt i32 %l.0148.us, %14 br i1 %cmp39.us, label %land.lhs.true.us, label %for.inc46.us land.lhs.true.us: ; preds = %for.body36.us %arrayidx41.us = getelementptr inbounds [100 x i32], ptr %v, i64 0, i64 %indvars.iv203 %15 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5 %tobool.not.us = icmp eq i32 %15, 0 %16 = trunc i64 %indvars.iv203 to i32 %spec.select182 = select i1 %tobool.not.us, i32 %16, i32 %13 %spec.select183 = select i1 %tobool.not.us, i32 %14, i32 %l.0148.us br label %for.inc46.us for.inc46.us: ; preds = %land.lhs.true.us, %for.body36.us %17 = phi i32 [ %13, %for.body36.us ], [ %spec.select182, %land.lhs.true.us ] %l.1.us = phi i32 [ %l.0148.us, %for.body36.us ], [ %spec.select183, %land.lhs.true.us ] %indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1 %exitcond207.not = icmp eq i64 %indvars.iv.next204, %wide.trip.count206 br i1 %exitcond207.not, label %for.end48.us, label %for.body36.us.backedge for.body36.us.backedge: ; preds = %for.inc88.us, %for.inc46.us %indvars.iv203.be = phi i64 [ %indvars.iv.next204, %for.inc46.us ], [ 0, %for.inc88.us ] %.be = phi i32 [ %17, %for.inc46.us ], [ -1, %for.inc88.us ] %l.0148.us.be = phi i32 [ %l.1.us, %for.inc46.us ], [ %8, %for.inc88.us ] br label %for.body36.us, !llvm.loop !15 for.body18: ; preds = %for.cond16.preheader, %for.inc31 %i.1144 = phi i32 [ %inc32, %for.inc31 ], [ 0, %for.cond16.preheader ] %call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %18 = load i32, ptr %k, align 4, !tbaa !5 %cmp21141 = icmp sgt i32 %18, 0 br i1 %cmp21141, label %for.body22, label %for.inc31 for.body22: ; preds = %for.body18, %for.body22 %j.1142 = phi i32 [ %inc29, %for.body22 ], [ 0, %for.body18 ] %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %o, ptr noundef nonnull %c) %19 = load i32, ptr %c, align 4, !tbaa !5 %20 = load i32, ptr %u, align 4, !tbaa !5 %idxprom24 = sext i32 %20 to i64 %21 = load i32, ptr %o, align 4, !tbaa !5 %idxprom26 = sext i32 %21 to i64 %arrayidx27 = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %idxprom24, i64 %idxprom26 store i32 %19, ptr %arrayidx27, align 4, !tbaa !5 %inc29 = add nuw nsw i32 %j.1142, 1 %22 = load i32, ptr %k, align 4, !tbaa !5 %cmp21 = icmp slt i32 %inc29, %22 br i1 %cmp21, label %for.body22, label %for.inc31, !llvm.loop !16 for.inc31: ; preds = %for.body22, %for.body18 %inc32 = add nuw nsw i32 %i.1144, 1 %23 = load i32, ptr %n, align 4, !tbaa !5 %cmp17 = icmp slt i32 %inc32, %23 br i1 %cmp17, label %for.body18, label %while.cond.preheader, !llvm.loop !17 for.cond91.preheader: ; preds = %for.end48.us store i32 -1, ptr %u, align 4, !tbaa !5 %cmp92180 = icmp sgt i32 %.lcssa.fr, 0 br i1 %cmp92180, label %for.body93, label %for.end102 for.body93: ; preds = %for.cond91.preheader, %for.body93 %indvars.iv213 = phi i64 [ %indvars.iv.next214, %for.body93 ], [ 0, %for.cond91.preheader ] %arrayidx95 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv213 %24 = load i32, ptr %arrayidx95, align 4, !tbaa !5 %25 = load i32, ptr @inf, align 4, !tbaa !5 %cmp96 = icmp eq i32 %24, %25 %spec.select = select i1 %cmp96, i32 -1, i32 %24 %26 = trunc i64 %indvars.iv213 to i32 %call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26, i32 noundef %spec.select) %indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1 %27 = load i32, ptr %n, align 4, !tbaa !5 %28 = sext i32 %27 to i64 %cmp92 = icmp slt i64 %indvars.iv.next214, %28 br i1 %cmp92, label %for.body93, label %for.end102, !llvm.loop !18 for.end102: ; preds = %for.body93, %while.cond.preheader, %for.cond91.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %v) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %o) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10}
#include <stdio.h> #define N 100 #define INFTY 1000000 #define NO 0 #define DISCOVERY 1 #define FINISHING 2 int n,ans[N][N]; void daikusutora() { int minv; int discover[N],check[N]; for(int i=0;i<n;i++){ discover[i]=INFTY; check[i]=NO; } discover[0]=0; check[0]=DISCOVERY; while(1){ minv=INFTY; int u=-1; for(int i=0;i<n;i++){ if(minv > discover[i] && check[i]!=FINISHING){ u=i; minv=discover[i]; } } if(u==-1)break; check[u]=FINISHING; for(int v=0;v<n;v++){ if(check[v]!=FINISHING && ans[u][v]!=INFTY){ if(discover[v]>discover[u]+ans[u][v]){ discover[v]=discover[u]+ans[u][v]; check[v]=DISCOVERY; } } } } for(int i=0;i<n;i++){ printf("%d %d\n",i,(discover[i]==INFTY ? -1:discover[i])); } } int main() { scanf("%d",&n); for(int i=0;i<n;i++){ for(int j=0;j<n;j++)ans[i][j]=INFTY; } int k,c,u,v; for(int i=0;i<n;i++){ scanf("%d%d",&u,&k); for(int j=0;j<k;j++){ scanf("%d%d",&v,&c); ans[u][v]=c; } } daikusutora(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221907/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221907/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @ans = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.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 @.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @daikusutora() local_unnamed_addr #0 { entry: %discover = alloca [100 x i32], align 16 %check = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %discover) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %check) #4 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp110 = icmp sgt i32 %.fr, 0 br i1 %cmp110, label %for.body.preheader, label %for.cond.cleanup69 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %check, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader169, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %index store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader169 for.body.preheader169: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond.cleanup: ; preds = %for.body, %middle.block store i32 0, ptr %discover, align 16, !tbaa !5 store i32 1, ptr %check, align 16, !tbaa !5 br i1 %cmp110, label %while.cond.us.preheader, label %for.cond.cleanup69 while.cond.us.preheader: ; preds = %for.cond.cleanup %wide.trip.count158 = zext i32 %.fr to i64 %wide.trip.count163 = zext i32 %.fr to i64 br label %for.body9.us for.cond.cleanup8.us: ; preds = %for.inc18.us %cmp21.not.us = icmp eq i32 %u.1.us, -1 br i1 %cmp21.not.us, label %for.cond67.preheader, label %if.end23.us if.end23.us: ; preds = %for.cond.cleanup8.us %idxprom24.us = sext i32 %u.1.us to i64 %arrayidx25.us = getelementptr inbounds [100 x i32], ptr %check, i64 0, i64 %idxprom24.us store i32 2, ptr %arrayidx25.us, align 4, !tbaa !5 %arrayidx43.us = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %idxprom24.us br label %for.body29.us for.body29.us: ; preds = %if.end23.us, %for.inc63.us %indvars.iv160 = phi i64 [ 0, %if.end23.us ], [ %indvars.iv.next161, %for.inc63.us ] %arrayidx31.us = getelementptr inbounds [100 x i32], ptr %check, i64 0, i64 %indvars.iv160 %6 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5 %cmp32.not.us = icmp eq i32 %6, 2 br i1 %cmp32.not.us, label %for.inc63.us, label %land.lhs.true33.us land.lhs.true33.us: ; preds = %for.body29.us %arrayidx37.us = getelementptr inbounds [100 x [100 x i32]], ptr @ans, i64 0, i64 %idxprom24.us, i64 %indvars.iv160 %7 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5 %cmp38.not.us = icmp eq i32 %7, 1000000 br i1 %cmp38.not.us, label %for.inc63.us, label %if.then39.us if.then39.us: ; preds = %land.lhs.true33.us %arrayidx41.us = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %indvars.iv160 %8 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp48.us = icmp sgt i32 %8, %add.us br i1 %cmp48.us, label %if.then49.us, label %for.inc63.us if.then49.us: ; preds = %if.then39.us store i32 %add.us, ptr %arrayidx41.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx31.us, align 4, !tbaa !5 br label %for.inc63.us for.inc63.us: ; preds = %if.then49.us, %if.then39.us, %land.lhs.true33.us, %for.body29.us %indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1 %exitcond164.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count163 br i1 %exitcond164.not, label %for.body9.us.backedge, label %for.body29.us, !llvm.loop !13 for.body9.us: ; preds = %for.body9.us.backedge, %while.cond.us.preheader %indvars.iv155 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv155.be, %for.body9.us.backedge ] %u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body9.us.backedge ] %minv.0113.us = phi i32 [ 1000000, %while.cond.us.preheader ], [ %minv.0113.us.be, %for.body9.us.backedge ] %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %indvars.iv155 %10 = load i32, ptr %arrayidx11.us, align 4, !tbaa !5 %cmp12.us = icmp sgt i32 %minv.0113.us, %10 br i1 %cmp12.us, label %land.lhs.true.us, label %for.inc18.us land.lhs.true.us: ; preds = %for.body9.us %arrayidx14.us = getelementptr inbounds [100 x i32], ptr %check, i64 0, i64 %indvars.iv155 %11 = load i32, ptr %arrayidx14.us, align 4, !tbaa !5 %cmp15.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp15.not.us, i32 %minv.0113.us, i32 %10 %12 = trunc i64 %indvars.iv155 to i32 %spec.select108.us = select i1 %cmp15.not.us, i32 %u.0114.us, i32 %12 br label %for.inc18.us for.inc18.us: ; preds = %land.lhs.true.us, %for.body9.us %minv.1.us = phi i32 [ %minv.0113.us, %for.body9.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0114.us, %for.body9.us ], [ %spec.select108.us, %land.lhs.true.us ] %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1 %exitcond159.not = icmp eq i64 %indvars.iv.next156, %wide.trip.count158 br i1 %exitcond159.not, label %for.cond.cleanup8.us, label %for.body9.us.backedge for.body9.us.backedge: ; preds = %for.inc63.us, %for.inc18.us %indvars.iv155.be = phi i64 [ %indvars.iv.next156, %for.inc18.us ], [ 0, %for.inc63.us ] %u.0114.us.be = phi i32 [ %u.1.us, %for.inc18.us ], [ -1, %for.inc63.us ] %minv.0113.us.be = phi i32 [ %minv.1.us, %for.inc18.us ], [ 1000000, %for.inc63.us ] br label %for.body9.us, !llvm.loop !13 for.body: ; preds = %for.body.preheader169, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader169 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %indvars.iv store i32 1000000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14 for.cond67.preheader: ; preds = %for.cond.cleanup8.us %cmp68146 = icmp sgt i32 %.fr, 0 br i1 %cmp68146, label %for.body70, label %for.cond.cleanup69 for.cond.cleanup69: ; preds = %for.body70, %entry, %for.cond.cleanup, %for.cond67.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %check) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %discover) #4 ret void for.body70: ; preds = %for.cond67.preheader, %for.body70 %indvars.iv165 = phi i64 [ %indvars.iv.next166, %for.body70 ], [ 0, %for.cond67.preheader ] %arrayidx72 = getelementptr inbounds [100 x i32], ptr %discover, i64 0, i64 %indvars.iv165 %13 = load i32, ptr %arrayidx72, align 4, !tbaa !5 %cmp73 = icmp eq i32 %13, 1000000 %spec.select109 = select i1 %cmp73, i32 -1, i32 %13 %14 = trunc i64 %indvars.iv165 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14, i32 noundef %spec.select109) %indvars.iv.next166 = add nuw nsw i64 %indvars.iv165, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp68 = icmp slt i64 %indvars.iv.next166, %16 br i1 %cmp68, label %for.body70, label %for.cond.cleanup69, !llvm.loop !15 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 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 !5 %cmp40 = icmp sgt i32 %0, 0 br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4 br label %for.cond.cleanup13 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count50 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count50, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count50 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us %indvars.iv47 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next48, %for.cond1.for.cond.cleanup3_crit_edge.us ] br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @ans, i64 0, i64 %indvars.iv47, i64 %index store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body4.us for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ] %arrayidx6.us = getelementptr inbounds [100 x [100 x i32]], ptr @ans, i64 0, i64 %indvars.iv47, i64 %indvars.iv store i32 1000000, ptr %arrayidx6.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count50 br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !17 for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1 %exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50 br i1 %exitcond51.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !18 for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4 br i1 %cmp40, label %for.body14, label %for.cond.cleanup13 for.cond.cleanup13: ; preds = %for.cond.cleanup19, %for.cond.cleanup.thread, %for.cond.cleanup call void @daikusutora() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 ret i32 0 for.body14: ; preds = %for.cond.cleanup, %for.cond.cleanup19 %i10.045 = phi i32 [ %inc30, %for.cond.cleanup19 ], [ 0, %for.cond.cleanup ] %call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1842 = icmp sgt i32 %4, 0 br i1 %cmp1842, label %for.body20, label %for.cond.cleanup19 for.cond.cleanup19: ; preds = %for.body20, %for.body14 %inc30 = add nuw nsw i32 %i10.045, 1 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp12 = icmp slt i32 %inc30, %5 br i1 %cmp12, label %for.body14, label %for.cond.cleanup13, !llvm.loop !19 for.body20: ; preds = %for.body14, %for.body20 %j16.043 = phi i32 [ %inc27, %for.body20 ], [ 0, %for.body14 ] %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %c) %6 = load i32, ptr %c, align 4, !tbaa !5 %7 = load i32, ptr %u, align 4, !tbaa !5 %idxprom22 = sext i32 %7 to i64 %8 = load i32, ptr %v, align 4, !tbaa !5 %idxprom24 = sext i32 %8 to i64 %arrayidx25 = getelementptr inbounds [100 x [100 x i32]], ptr @ans, i64 0, i64 %idxprom22, i64 %idxprom24 store i32 %6, ptr %arrayidx25, align 4, !tbaa !5 %inc27 = add nuw nsw i32 %j16.043, 1 %9 = load i32, ptr %k, align 4, !tbaa !5 %cmp18 = icmp slt i32 %inc27, %9 br i1 %cmp18, label %for.body20, label %for.cond.cleanup19, !llvm.loop !20 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include <stdio.h> #define N 100 #define INF 10000000 #define WHITE 0 #define GRAY 1 #define BLACK 2 int color[N]; int M[N][N]; int d[N]; int p[N]; int n; void dijkstra(void); int main() { int i,j,u,k,v,c; scanf("%d",&n); for(i = 0;i < n;i++){ for(j = 0;j < n;j++){ M[i][j] = INF; } } for(i = 0;i < n;i++){ scanf("%d %d",&u,&k); for(j = 0;j < k;j++){ scanf("%d %d",&v,&c); M[u][v] = c; } } dijkstra(); return 0; } void dijkstra(void) { int minv,i,v; int u; for(i = 0;i < n;i++){ d[i] = INF; color[i] = WHITE; } d[0] = 0; color[0] = GRAY; while(1){ minv = INF; u = -1; for(i = 0;i < n;i++){ if(minv > d[i] && color[i] != BLACK){ u = i; minv = d[i]; } } if(u == -1) break; color[u] = BLACK; for(v = 0;v < n;v++){ if(color[v] != BLACK && M[u][v] != INF){ if(d[v] > d[u] + M[u][v]){ d[v] = d[u] + M[u][v]; color[v] = GRAY; } } } } for(i = 0;i < n;i++){ if(d[i] == INF){ printf("%d %d\n",i,-1); } else{ printf("%d %d\n",i,d[i]); } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221950/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221950/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @p = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %u = alloca i32, align 4 %k = alloca i32, align 4 %v = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #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 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count47 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count47, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count47 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us %indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ] br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %index store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body3.us for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ] %arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %indvars.iv store i32 10000000, ptr %arrayidx5.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47 br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47 br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14 for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us br i1 %cmp37, label %for.body11, label %for.end26 for.body11: ; preds = %for.cond9.preheader, %for.inc24 %i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1439 = icmp sgt i32 %4, 0 br i1 %cmp1439, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4, !tbaa !5 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %7 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom17, i64 %idxprom19 store i32 %5, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.140, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %8 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15 for.inc24: ; preds = %for.body15, %for.body11 %inc25 = add nuw nsw i32 %i.142, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc25, %9 br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16 for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader call void @dijkstra() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 uwtable define dso_local void @dijkstra() local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp107 = icmp sgt i32 %.fr, 0 br i1 %cmp107, label %for.body.preheader, label %for.end.thread for.end.thread: ; preds = %entry store i32 0, ptr @d, align 16, !tbaa !5 store i32 1, ptr @color, align 16, !tbaa !5 br label %for.end74 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader166, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader166 for.body.preheader166: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader166, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader166 ] %arrayidx = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv store i32 10000000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18 for.end: ; preds = %for.body, %middle.block store i32 0, ptr @d, align 16, !tbaa !5 store i32 1, ptr @color, align 16, !tbaa !5 br i1 %cmp107, label %while.cond.us.preheader, label %for.end74 while.cond.us.preheader: ; preds = %for.end %wide.trip.count155 = zext i32 %.fr to i64 %wide.trip.count160 = zext i32 %.fr to i64 br label %for.body5.us for.end16.us: ; preds = %for.inc14.us %cmp17.us = icmp eq i32 %u.1.us, -1 br i1 %cmp17.us, label %for.cond61.preheader, label %if.end19.us if.end19.us: ; preds = %for.end16.us %idxprom20.us = sext i32 %u.1.us to i64 %arrayidx21.us = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom20.us store i32 2, ptr %arrayidx21.us, align 4, !tbaa !5 %arrayidx38.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom20.us br label %for.body24.us for.body24.us: ; preds = %if.end19.us, %for.inc58.us %indvars.iv157 = phi i64 [ 0, %if.end19.us ], [ %indvars.iv.next158, %for.inc58.us ] %arrayidx26.us = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv157 %6 = load i32, ptr %arrayidx26.us, align 4, !tbaa !5 %cmp27.not.us = icmp eq i32 %6, 2 br i1 %cmp27.not.us, label %for.inc58.us, label %land.lhs.true28.us land.lhs.true28.us: ; preds = %for.body24.us %arrayidx32.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom20.us, i64 %indvars.iv157 %7 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5 %cmp33.not.us = icmp eq i32 %7, 10000000 br i1 %cmp33.not.us, label %for.inc58.us, label %if.then34.us if.then34.us: ; preds = %land.lhs.true28.us %arrayidx36.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv157 %8 = load i32, ptr %arrayidx36.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp43.us = icmp sgt i32 %8, %add.us br i1 %cmp43.us, label %if.then44.us, label %for.inc58.us if.then44.us: ; preds = %if.then34.us store i32 %add.us, ptr %arrayidx36.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx26.us, align 4, !tbaa !5 br label %for.inc58.us for.inc58.us: ; preds = %if.then44.us, %if.then34.us, %land.lhs.true28.us, %for.body24.us %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1 %exitcond161.not = icmp eq i64 %indvars.iv.next158, %wide.trip.count160 br i1 %exitcond161.not, label %for.body5.us.backedge, label %for.body24.us, !llvm.loop !19 for.body5.us: ; preds = %for.body5.us.backedge, %while.cond.us.preheader %indvars.iv152 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv152.be, %for.body5.us.backedge ] %u.0112.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0112.us.be, %for.body5.us.backedge ] %minv.0110.us = phi i32 [ 10000000, %while.cond.us.preheader ], [ %minv.0110.us.be, %for.body5.us.backedge ] %arrayidx7.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv152 %10 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5 %cmp8.us = icmp sgt i32 %minv.0110.us, %10 br i1 %cmp8.us, label %land.lhs.true.us, label %for.inc14.us land.lhs.true.us: ; preds = %for.body5.us %arrayidx10.us = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv152 %11 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5 %cmp11.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp11.not.us, i32 %minv.0110.us, i32 %10 %12 = trunc i64 %indvars.iv152 to i32 %spec.select106.us = select i1 %cmp11.not.us, i32 %u.0112.us, i32 %12 br label %for.inc14.us for.inc14.us: ; preds = %land.lhs.true.us, %for.body5.us %minv.1.us = phi i32 [ %minv.0110.us, %for.body5.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0112.us, %for.body5.us ], [ %spec.select106.us, %land.lhs.true.us ] %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1 %exitcond156.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count155 br i1 %exitcond156.not, label %for.end16.us, label %for.body5.us.backedge for.body5.us.backedge: ; preds = %for.inc58.us, %for.inc14.us %indvars.iv152.be = phi i64 [ %indvars.iv.next153, %for.inc14.us ], [ 0, %for.inc58.us ] %u.0112.us.be = phi i32 [ %u.1.us, %for.inc14.us ], [ -1, %for.inc58.us ] %minv.0110.us.be = phi i32 [ %minv.1.us, %for.inc14.us ], [ 10000000, %for.inc58.us ] br label %for.body5.us, !llvm.loop !19 for.cond61.preheader: ; preds = %for.end16.us %cmp62143 = icmp sgt i32 %.fr, 0 br i1 %cmp62143, label %for.body63, label %for.end74 for.body63: ; preds = %for.cond61.preheader, %for.body63 %indvars.iv162 = phi i64 [ %indvars.iv.next163, %for.body63 ], [ 0, %for.cond61.preheader ] %arrayidx65 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv162 %13 = load i32, ptr %arrayidx65, align 4, !tbaa !5 %cmp66 = icmp eq i32 %13, 10000000 %14 = trunc i64 %indvars.iv162 to i32 %. = select i1 %cmp66, i32 -1, i32 %13 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14, i32 noundef %.) %indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp62 = icmp slt i64 %indvars.iv.next163, %16 br i1 %cmp62, label %for.body63, label %for.end74, !llvm.loop !20 for.end74: ; preds = %for.body63, %for.end.thread, %for.end, %for.cond61.preheader 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !11, !12} !18 = distinct !{!18, !10, !12, !11} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include<stdio.h> #define MAX 100 #define INFTY (1<<21) #define WHITE 0 #define GRAY 1 #define BLACK 2 int n , M[MAX][MAX]; void dijkstra(){ int minv; int d[MAX] , color[MAX]; for( int i = 0; i < n; i++ ){ d[i] = INFTY; color[i] = WHITE; } d[0] = 0; color[0] = GRAY; while(1){ minv = INFTY; int u = -1; for( int i = 0; i < n; i++ ){ if( minv > d[i] && color[i] != BLACK ){ u = i; minv = d[i]; } } if( u == -1 ){ break; } color[u] = BLACK; for( int v = 0; v < n; v++ ){ if( color[v] != BLACK && M[u][v] != INFTY ){ if( d[v] > d[u] + M[u][v] ){ d[v] = d[u] + M[u][v]; color[v] = GRAY; } } } } for( int i = 0; i < n; i++ ){ printf( "%d " , i ); if( d[i] == INFTY ){ printf( "-1\n" ); }else{ printf( "%d\n" , d[i] ); } } } int main( void ){ scanf( "%d" , &n ); for( int i = 0; i < n; i++ ){ for( int j = 0; j < n; j++ ){ M[i][j] = INFTY; } } int k , c , u , v; for( int i = 0; i < n; i++ ){ scanf( "%d" , &u ); scanf( "%d" , &k ); for( int j = 0; j < k; j++ ){ scanf( "%d" , &v ); scanf( "%d" , &c ); M[u][v] = c; } } dijkstra(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221994/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221994/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @dijkstra() local_unnamed_addr #0 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp113 = icmp sgt i32 %.fr, 0 br i1 %cmp113, label %for.body.preheader, label %for.cond.cleanup69 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader172, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader172 for.body.preheader172: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond.cleanup: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp113, label %while.cond.us.preheader, label %for.cond.cleanup69 while.cond.us.preheader: ; preds = %for.cond.cleanup %wide.trip.count161 = zext i32 %.fr to i64 %wide.trip.count166 = zext i32 %.fr to i64 br label %for.body9.us for.cond.cleanup8.us: ; preds = %for.inc18.us %cmp21.not.us = icmp eq i32 %u.1.us, -1 br i1 %cmp21.not.us, label %for.cond67.preheader, label %if.end23.us if.end23.us: ; preds = %for.cond.cleanup8.us %idxprom24.us = sext i32 %u.1.us to i64 %arrayidx25.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom24.us store i32 2, ptr %arrayidx25.us, align 4, !tbaa !5 %arrayidx43.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom24.us br label %for.body29.us for.body29.us: ; preds = %if.end23.us, %for.inc63.us %indvars.iv163 = phi i64 [ 0, %if.end23.us ], [ %indvars.iv.next164, %for.inc63.us ] %arrayidx31.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv163 %6 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5 %cmp32.not.us = icmp eq i32 %6, 2 br i1 %cmp32.not.us, label %for.inc63.us, label %land.lhs.true33.us land.lhs.true33.us: ; preds = %for.body29.us %arrayidx37.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom24.us, i64 %indvars.iv163 %7 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5 %cmp38.not.us = icmp eq i32 %7, 2097152 br i1 %cmp38.not.us, label %for.inc63.us, label %if.then39.us if.then39.us: ; preds = %land.lhs.true33.us %arrayidx41.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv163 %8 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp48.us = icmp sgt i32 %8, %add.us br i1 %cmp48.us, label %if.then49.us, label %for.inc63.us if.then49.us: ; preds = %if.then39.us store i32 %add.us, ptr %arrayidx41.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx31.us, align 4, !tbaa !5 br label %for.inc63.us for.inc63.us: ; preds = %if.then49.us, %if.then39.us, %land.lhs.true33.us, %for.body29.us %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1 %exitcond167.not = icmp eq i64 %indvars.iv.next164, %wide.trip.count166 br i1 %exitcond167.not, label %for.body9.us.backedge, label %for.body29.us, !llvm.loop !13 for.body9.us: ; preds = %for.body9.us.backedge, %while.cond.us.preheader %indvars.iv158 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv158.be, %for.body9.us.backedge ] %u.0117.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0117.us.be, %for.body9.us.backedge ] %minv.0116.us = phi i32 [ 2097152, %while.cond.us.preheader ], [ %minv.0116.us.be, %for.body9.us.backedge ] %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv158 %10 = load i32, ptr %arrayidx11.us, align 4, !tbaa !5 %cmp12.us = icmp sgt i32 %minv.0116.us, %10 br i1 %cmp12.us, label %land.lhs.true.us, label %for.inc18.us land.lhs.true.us: ; preds = %for.body9.us %arrayidx14.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv158 %11 = load i32, ptr %arrayidx14.us, align 4, !tbaa !5 %cmp15.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp15.not.us, i32 %minv.0116.us, i32 %10 %12 = trunc i64 %indvars.iv158 to i32 %spec.select112.us = select i1 %cmp15.not.us, i32 %u.0117.us, i32 %12 br label %for.inc18.us for.inc18.us: ; preds = %land.lhs.true.us, %for.body9.us %minv.1.us = phi i32 [ %minv.0116.us, %for.body9.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0117.us, %for.body9.us ], [ %spec.select112.us, %land.lhs.true.us ] %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1 %exitcond162.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count161 br i1 %exitcond162.not, label %for.cond.cleanup8.us, label %for.body9.us.backedge for.body9.us.backedge: ; preds = %for.inc63.us, %for.inc18.us %indvars.iv158.be = phi i64 [ %indvars.iv.next159, %for.inc18.us ], [ 0, %for.inc63.us ] %u.0117.us.be = phi i32 [ %u.1.us, %for.inc18.us ], [ -1, %for.inc63.us ] %minv.0116.us.be = phi i32 [ %minv.1.us, %for.inc18.us ], [ 2097152, %for.inc63.us ] br label %for.body9.us, !llvm.loop !13 for.body: ; preds = %for.body.preheader172, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader172 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 2097152, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14 for.cond67.preheader: ; preds = %for.cond.cleanup8.us %cmp68149 = icmp sgt i32 %.fr, 0 br i1 %cmp68149, label %for.body70, label %for.cond.cleanup69 for.cond.cleanup69: ; preds = %for.inc80, %entry, %for.cond.cleanup, %for.cond67.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5 ret void for.body70: ; preds = %for.cond67.preheader, %for.inc80 %indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.inc80 ], [ 0, %for.cond67.preheader ] %13 = trunc i64 %indvars.iv168 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13) %arrayidx72 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv168 %14 = load i32, ptr %arrayidx72, align 4, !tbaa !5 %cmp73 = icmp eq i32 %14, 2097152 br i1 %cmp73, label %if.then74, label %if.else if.then74: ; preds = %for.body70 %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc80 if.else: ; preds = %for.body70 %call78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14) br label %for.inc80 for.inc80: ; preds = %if.then74, %if.else %indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp68 = icmp slt i64 %indvars.iv.next169, %16 br i1 %cmp68, label %for.body70, label %for.cond.cleanup69, !llvm.loop !15 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp42 = icmp sgt i32 %0, 0 br i1 %cmp42, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 br label %for.cond.cleanup13 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count52 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count52, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count52 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us %indvars.iv49 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next50, %for.cond1.for.cond.cleanup3_crit_edge.us ] br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv49, i64 %index store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body4.us for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ] %arrayidx6.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv49, i64 %indvars.iv store i32 2097152, ptr %arrayidx6.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count52 br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !17 for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1 %exitcond53.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count52 br i1 %exitcond53.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !18 for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5 br i1 %cmp42, label %for.body14, label %for.cond.cleanup13 for.cond.cleanup13: ; preds = %for.cond.cleanup20, %for.cond.cleanup.thread, %for.cond.cleanup call void @dijkstra() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 ret i32 0 for.body14: ; preds = %for.cond.cleanup, %for.cond.cleanup20 %i10.047 = phi i32 [ %inc32, %for.cond.cleanup20 ], [ 0, %for.cond.cleanup ] %call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %u) %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1944 = icmp sgt i32 %4, 0 br i1 %cmp1944, label %for.body21, label %for.cond.cleanup20 for.cond.cleanup20: ; preds = %for.body21, %for.body14 %inc32 = add nuw nsw i32 %i10.047, 1 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp12 = icmp slt i32 %inc32, %5 br i1 %cmp12, label %for.body14, label %for.cond.cleanup13, !llvm.loop !19 for.body21: ; preds = %for.body14, %for.body21 %j17.045 = phi i32 [ %inc29, %for.body21 ], [ 0, %for.body14 ] %call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %v) %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %c) %6 = load i32, ptr %c, align 4, !tbaa !5 %7 = load i32, ptr %u, align 4, !tbaa !5 %idxprom24 = sext i32 %7 to i64 %8 = load i32, ptr %v, align 4, !tbaa !5 %idxprom26 = sext i32 %8 to i64 %arrayidx27 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom24, i64 %idxprom26 store i32 %6, ptr %arrayidx27, align 4, !tbaa !5 %inc29 = add nuw nsw i32 %j17.045, 1 %9 = load i32, ptr %k, align 4, !tbaa !5 %cmp19 = icmp slt i32 %inc29, %9 br i1 %cmp19, label %for.body21, label %for.cond.cleanup20, !llvm.loop !20 } ; 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 #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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include<stdio.h> #define INFINITY (1<<21) #define MAX 100 #define WHITE 0 #define GRAY 1 #define BLACK 2 int n,M[MAX][MAX]; void dijkstra(){ int minv,i,j,v,u; int d[MAX],color[MAX]; for(i=0;i<n;i++){ d[i]=INFINITY; color[i]=WHITE; } d[0]=0; color[0]=GRAY; while (1) { minv=INFINITY; u=-1; for(i=0;i<n;i++){ if(minv>d[i] && color[i] != BLACK){ u = i; minv = d[i]; } } if (u == -1)break; color[u]=BLACK; for(v=0;v<n;v++){ if(color[v] != BLACK && M[u][v] !=INFINITY){ if( d[v] > d[u]+ M[u][v]){ d[v] = d[u] + M[u][v]; color[v] =GRAY; } } } } for(i=0;i<n;i++){ printf("%d",i); if(d[i] == INFINITY)printf(" -1\n"); else printf(" %d\n",d[i]); } } int main(){ int i,j,v,c,u,k; scanf("%d",&n); for(i=0;i<n;i++){ for(j=0;j<n;j++){ M[i][j] = INFINITY; } } for(i=0;i<n;i++){ scanf("%d %d",&u,&k); for(j=0;j<k;j++){ scanf("%d %d",&v,&c); M[u][v] = c; } } dijkstra(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222043/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222043/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c" %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @str = private unnamed_addr constant [4 x i8] c" -1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @dijkstra() local_unnamed_addr #0 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp109 = icmp sgt i32 %.fr, 0 br i1 %cmp109, label %for.body.preheader, label %for.end77 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader168 for.body.preheader168: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader168, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 2097152, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp109, label %while.cond.us.preheader, label %for.end77 while.cond.us.preheader: ; preds = %for.end %wide.trip.count157 = zext i32 %.fr to i64 %wide.trip.count162 = zext i32 %.fr to i64 br label %for.body7.us for.end18.us: ; preds = %for.inc16.us %cmp19.us = icmp eq i32 %u.1.us, -1 br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us if.end21.us: ; preds = %for.end18.us %idxprom22.us = sext i32 %u.1.us to i64 %arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5 %arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us br label %for.body26.us for.body26.us: ; preds = %if.end21.us, %for.inc60.us %indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ] %arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159 %6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5 %cmp29.not.us = icmp eq i32 %6, 2 br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us land.lhs.true30.us: ; preds = %for.body26.us %arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom22.us, i64 %indvars.iv159 %7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5 %cmp35.not.us = icmp eq i32 %7, 2097152 br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us if.then36.us: ; preds = %land.lhs.true30.us %arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159 %8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp45.us = icmp sgt i32 %8, %add.us br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us if.then46.us: ; preds = %if.then36.us store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5 br label %for.inc60.us for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162 br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14 for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader %indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ] %u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ] %minv.0113.us = phi i32 [ 2097152, %while.cond.us.preheader ], [ %minv.0113.us.be, %for.body7.us.backedge ] %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154 %10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp sgt i32 %minv.0113.us, %10 br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us land.lhs.true.us: ; preds = %for.body7.us %arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154 %11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5 %cmp13.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp13.not.us, i32 %minv.0113.us, i32 %10 %12 = trunc i64 %indvars.iv154 to i32 %spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12 br label %for.inc16.us for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us %minv.1.us = phi i32 [ %minv.0113.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ] %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157 br i1 %exitcond158.not, label %for.end18.us, label %for.body7.us.backedge for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us %indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ] %u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ] %minv.0113.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 2097152, %for.inc60.us ] br label %for.body7.us, !llvm.loop !14 for.cond63.preheader: ; preds = %for.end18.us %cmp64145 = icmp sgt i32 %.fr, 0 br i1 %cmp64145, label %for.body65, label %for.end77 for.body65: ; preds = %for.cond63.preheader, %for.inc75 %indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ] %13 = trunc i64 %indvars.iv164 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13) %arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164 %14 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %cmp68 = icmp eq i32 %14, 2097152 br i1 %cmp68, label %if.then69, label %if.else if.then69: ; preds = %for.body65 %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc75 if.else: ; preds = %for.body65 %call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14) br label %for.inc75 for.inc75: ; preds = %if.then69, %if.else %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp64 = icmp slt i64 %indvars.iv.next165, %16 br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !15 for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %v = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %k = 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 %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #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 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count47 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count47, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count47 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us %indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ] br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body vector.body: ; preds = %for.cond1.preheader.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ] %1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %index store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ] br label %for.body3.us for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ] %arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %indvars.iv store i32 2097152, ptr %arrayidx5.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47 br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47 br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18 for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us br i1 %cmp37, label %for.body11, label %for.end26 for.body11: ; preds = %for.cond9.preheader, %for.inc24 %i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1439 = icmp sgt i32 %4, 0 br i1 %cmp1439, label %for.body15, label %for.inc24 for.body15: ; preds = %for.body11, %for.body15 %j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4, !tbaa !5 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %7 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom17, i64 %idxprom19 store i32 %5, ptr %arrayidx20, align 4, !tbaa !5 %inc22 = add nuw nsw i32 %j.140, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc22, %8 br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19 for.inc24: ; preds = %for.body15, %for.body11 %inc25 = add nuw nsw i32 %i.142, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc25, %9 br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20 for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader call void @dijkstra() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include <stdio.h> #define MAX 100 #define INF 1000000 #define DISCONNECT -1 #define BLACK -2 void initializeSingleSource(int); void dijkstra(int G[MAX][MAX], int); int d[MAX], pi[MAX]; int main(){ int G[MAX][MAX], n, u, v, k, i, j; for(i = 0; i < MAX; i++){ for(j = 0; j < MAX; j++) G[i][j] = DISCONNECT; } scanf("%d",&n); for(i = 0; i < n; i++){ scanf("%d %d",&u,&k); for(j = 0; j < k; j++){ scanf("%d",&v); scanf("%d",&G[u][v]); } } dijkstra( G, n ); for(i = 0; i < n; i++) printf("%d %d\n",i,d[i]); return 0; } void initializeSingleSource(int n){ int i; for(i = 0; i < n; i++){ d[i] = INF; pi[i] = DISCONNECT; } d[0] = 0; } void dijkstra(int G[MAX][MAX], int n){ int mincost, color[MAX], u, v, i, j; initializeSingleSource(n); while( 1 ){ mincost = INF; for(i = 0; i < n; i++){ if( color[i] != BLACK && d[i] < mincost ){ mincost = d[i]; u = i; } } if( mincost == INF ) break; color[u] = BLACK; for(j = 0; j < n; j++){ if( G[u][j] != DISCONNECT ){ v = j; if( color[v] != BLACK && d[u] + G[u][v] < d[v] ){ pi[v] = u; d[v] = d[u] + G[u][v]; } } } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222087/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222087/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @pi = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %color.i = alloca [100 x i32], align 16 %G = alloca [100 x [100 x i32]], align 16 %n = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %G) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) %G, i8 -1, i64 40000, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp1053 = icmp sgt i32 %0, 0 br i1 %cmp1053, label %for.body11, label %for.end27.thread for.end27.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color.i) #7 br label %dijkstra.exit.thread for.body11: ; preds = %entry, %for.inc25 %i.154 = phi i32 [ %inc26, %for.inc25 ], [ 0, %entry ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %1 = load i32, ptr %k, align 4, !tbaa !5 %cmp1451 = icmp sgt i32 %1, 0 br i1 %cmp1451, label %for.body15, label %for.inc25 for.body15: ; preds = %for.body11, %for.body15 %j.152 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v) %2 = load i32, ptr %u, align 4, !tbaa !5 %idxprom17 = sext i32 %2 to i64 %3 = load i32, ptr %v, align 4, !tbaa !5 %idxprom19 = sext i32 %3 to i64 %arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr %G, i64 0, i64 %idxprom17, i64 %idxprom19 %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx20) %inc23 = add nuw nsw i32 %j.152, 1 %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc23, %4 br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !9 for.inc25: ; preds = %for.body15, %for.body11 %inc26 = add nuw nsw i32 %i.154, 1 %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp10 = icmp slt i32 %inc26, %5 br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !11 for.end27: ; preds = %for.inc25 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color.i) #7 %cmp6.i.i = icmp sgt i32 %5, 0 br i1 %cmp6.i.i, label %for.body.preheader.i.i, label %dijkstra.exit.thread dijkstra.exit.thread: ; preds = %for.end27, %for.end27.thread store i32 0, ptr @d, align 16, !tbaa !5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color.i) #7 br label %for.end36 for.body.preheader.i.i: ; preds = %for.end27 %6 = zext i32 %5 to i64 %7 = shl nuw nsw i64 %6, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 @pi, i8 -1, i64 %7, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %5, 8 br i1 %min.iters.check, label %for.body.i.i.preheader, label %vector.ph vector.ph: ; preds = %for.body.preheader.i.i %n.vec = and i64 %6, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %8 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds i32, ptr %8, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %9, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %10 = icmp eq i64 %index.next, %n.vec br i1 %10, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %6 br i1 %cmp.n, label %while.cond.us.preheader.i, label %for.body.i.i.preheader for.body.i.i.preheader: ; preds = %for.body.preheader.i.i, %middle.block %indvars.iv.i.i.ph = phi i64 [ 0, %for.body.preheader.i.i ], [ %n.vec, %middle.block ] br label %for.body.i.i for.body.i.i: ; preds = %for.body.i.i.preheader, %for.body.i.i %indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i, %for.body.i.i ], [ %indvars.iv.i.i.ph, %for.body.i.i.preheader ] %arrayidx.i.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.i.i store i32 1000000, ptr %arrayidx.i.i, align 4, !tbaa !5 %indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1 %exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %6 br i1 %exitcond.not.i.i, label %while.cond.us.preheader.i, label %for.body.i.i, !llvm.loop !15 while.cond.us.preheader.i: ; preds = %for.body.i.i, %middle.block store i32 0, ptr @d, align 16, !tbaa !5 br label %for.body.us.i for.end.us.i: ; preds = %for.inc.us.i %cmp7.us.i = icmp eq i32 %mincost.1.us.i, 1000000 br i1 %cmp7.us.i, label %dijkstra.exit, label %if.end9.us.i if.end9.us.i: ; preds = %for.end.us.i %idxprom10.us.i = sext i32 %u.2.us.i to i64 %arrayidx11.us.i = getelementptr inbounds [100 x i32], ptr %color.i, i64 0, i64 %idxprom10.us.i store i32 -2, ptr %arrayidx11.us.i, align 4, !tbaa !5 %arrayidx26.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom10.us.i br label %for.body14.us.i for.body14.us.i: ; preds = %for.inc48.us.i, %if.end9.us.i %indvars.iv115.i = phi i64 [ 0, %if.end9.us.i ], [ %indvars.iv.next116.i, %for.inc48.us.i ] %arrayidx18.us.i = getelementptr inbounds [100 x i32], ptr %G, i64 %idxprom10.us.i, i64 %indvars.iv115.i %11 = load i32, ptr %arrayidx18.us.i, align 4, !tbaa !5 %cmp19.not.us.i = icmp eq i32 %11, -1 br i1 %cmp19.not.us.i, label %for.inc48.us.i, label %if.then20.us.i if.then20.us.i: ; preds = %for.body14.us.i %arrayidx22.us.i = getelementptr inbounds [100 x i32], ptr %color.i, i64 0, i64 %indvars.iv115.i %12 = load i32, ptr %arrayidx22.us.i, align 4, !tbaa !5 %cmp23.not.us.i = icmp eq i32 %12, -2 br i1 %cmp23.not.us.i, label %for.inc48.us.i, label %land.lhs.true24.us.i land.lhs.true24.us.i: ; preds = %if.then20.us.i %13 = load i32, ptr %arrayidx26.us.i, align 4, !tbaa !5 %add.us.i = add nsw i32 %13, %11 %arrayidx32.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv115.i %14 = load i32, ptr %arrayidx32.us.i, align 4, !tbaa !5 %cmp33.us.i = icmp slt i32 %add.us.i, %14 br i1 %cmp33.us.i, label %if.then34.us.i, label %for.inc48.us.i if.then34.us.i: ; preds = %land.lhs.true24.us.i %arrayidx36.us.i = getelementptr inbounds [100 x i32], ptr @pi, i64 0, i64 %indvars.iv115.i store i32 %u.2.us.i, ptr %arrayidx36.us.i, align 4, !tbaa !5 store i32 %add.us.i, ptr %arrayidx32.us.i, align 4, !tbaa !5 br label %for.inc48.us.i for.inc48.us.i: ; preds = %if.then34.us.i, %land.lhs.true24.us.i, %if.then20.us.i, %for.body14.us.i %indvars.iv.next116.i = add nuw nsw i64 %indvars.iv115.i, 1 %exitcond119.not.i = icmp eq i64 %indvars.iv.next116.i, %6 br i1 %exitcond119.not.i, label %for.body.us.i.backedge, label %for.body14.us.i, !llvm.loop !16 for.body.us.i: ; preds = %for.body.us.i.backedge, %while.cond.us.preheader.i %indvars.iv.i = phi i64 [ 0, %while.cond.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %mincost.079.us.i = phi i32 [ 1000000, %while.cond.us.preheader.i ], [ %mincost.079.us.i.be, %for.body.us.i.backedge ] %u.178.us.i = phi i32 [ undef, %while.cond.us.preheader.i ], [ %u.2.us.i, %for.body.us.i.backedge ] %arrayidx.us.i = getelementptr inbounds [100 x i32], ptr %color.i, i64 0, i64 %indvars.iv.i %15 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %cmp1.not.us.i = icmp eq i32 %15, -2 br i1 %cmp1.not.us.i, label %for.inc.us.i, label %land.lhs.true.us.i land.lhs.true.us.i: ; preds = %for.body.us.i %arrayidx3.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.i %16 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %16, %mincost.079.us.i %17 = trunc i64 %indvars.iv.i to i32 %spec.select.us.i = select i1 %cmp4.us.i, i32 %17, i32 %u.178.us.i %spec.select76.us.i = call i32 @llvm.smin.i32(i32 %16, i32 %mincost.079.us.i) br label %for.inc.us.i for.inc.us.i: ; preds = %land.lhs.true.us.i, %for.body.us.i %u.2.us.i = phi i32 [ %u.178.us.i, %for.body.us.i ], [ %spec.select.us.i, %land.lhs.true.us.i ] %mincost.1.us.i = phi i32 [ %mincost.079.us.i, %for.body.us.i ], [ %spec.select76.us.i, %land.lhs.true.us.i ] %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %6 br i1 %exitcond.not.i, label %for.end.us.i, label %for.body.us.i.backedge for.body.us.i.backedge: ; preds = %for.inc48.us.i, %for.inc.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ 0, %for.inc48.us.i ] %mincost.079.us.i.be = phi i32 [ %mincost.1.us.i, %for.inc.us.i ], [ 1000000, %for.inc48.us.i ] br label %for.body.us.i, !llvm.loop !16 dijkstra.exit: ; preds = %for.end.us.i call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color.i) #7 br i1 %cmp6.i.i, label %for.body30, label %for.end36 for.body30: ; preds = %dijkstra.exit, %for.body30 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body30 ], [ 0, %dijkstra.exit ] %arrayidx32 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv %18 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %19 = trunc i64 %indvars.iv to i32 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19, i32 noundef %18) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %20 = load i32, ptr %n, align 4, !tbaa !5 %21 = sext i32 %20 to i64 %cmp29 = icmp slt i64 %indvars.iv.next, %21 br i1 %cmp29, label %for.body30, label %for.end36, !llvm.loop !17 for.end36: ; preds = %for.body30, %dijkstra.exit.thread, %dijkstra.exit call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %G) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local void @dijkstra(ptr nocapture noundef readonly %G, i32 noundef %n) local_unnamed_addr #3 { entry: %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #7 %cmp6.i = icmp sgt i32 %n, 0 br i1 %cmp6.i, label %for.body.preheader.i, label %initializeSingleSource.exit.thread initializeSingleSource.exit.thread: ; preds = %entry store i32 0, ptr @d, align 16, !tbaa !5 br label %while.end for.body.preheader.i: ; preds = %entry %0 = zext i32 %n to i64 %1 = shl nuw nsw i64 %0, 2 tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @pi, i8 -1, i64 %1, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph vector.ph: ; preds = %for.body.preheader.i %n.vec = and i64 %0, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %4 = icmp eq i64 %index.next, %n.vec br i1 %4, label %middle.block, label %vector.body, !llvm.loop !18 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %0 br i1 %cmp.n, label %initializeSingleSource.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block %indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ] br label %for.body.i for.body.i: ; preds = %for.body.i.preheader, %for.body.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ] %arrayidx.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.i store i32 1000000, ptr %arrayidx.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %0 br i1 %exitcond.not.i, label %initializeSingleSource.exit, label %for.body.i, !llvm.loop !19 initializeSingleSource.exit: ; preds = %for.body.i, %middle.block store i32 0, ptr @d, align 16, !tbaa !5 br i1 %cmp6.i, label %while.cond.us.preheader, label %while.end while.cond.us.preheader: ; preds = %initializeSingleSource.exit %wide.trip.count = zext i32 %n to i64 %wide.trip.count118 = zext i32 %n to i64 br label %for.body.us for.end.us: ; preds = %for.inc.us %cmp7.us = icmp eq i32 %mincost.1.us, 1000000 br i1 %cmp7.us, label %while.end, label %if.end9.us if.end9.us: ; preds = %for.end.us %idxprom10.us = sext i32 %u.2.us to i64 %arrayidx11.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom10.us store i32 -2, ptr %arrayidx11.us, align 4, !tbaa !5 %arrayidx26.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom10.us br label %for.body14.us for.body14.us: ; preds = %if.end9.us, %for.inc48.us %indvars.iv115 = phi i64 [ 0, %if.end9.us ], [ %indvars.iv.next116, %for.inc48.us ] %arrayidx18.us = getelementptr inbounds [100 x i32], ptr %G, i64 %idxprom10.us, i64 %indvars.iv115 %5 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5 %cmp19.not.us = icmp eq i32 %5, -1 br i1 %cmp19.not.us, label %for.inc48.us, label %if.then20.us if.then20.us: ; preds = %for.body14.us %arrayidx22.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv115 %6 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5 %cmp23.not.us = icmp eq i32 %6, -2 br i1 %cmp23.not.us, label %for.inc48.us, label %land.lhs.true24.us land.lhs.true24.us: ; preds = %if.then20.us %7 = load i32, ptr %arrayidx26.us, align 4, !tbaa !5 %add.us = add nsw i32 %7, %5 %arrayidx32.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv115 %8 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5 %cmp33.us = icmp slt i32 %add.us, %8 br i1 %cmp33.us, label %if.then34.us, label %for.inc48.us if.then34.us: ; preds = %land.lhs.true24.us %arrayidx36.us = getelementptr inbounds [100 x i32], ptr @pi, i64 0, i64 %indvars.iv115 store i32 %u.2.us, ptr %arrayidx36.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5 %add43.us = add nsw i32 %9, %7 store i32 %add43.us, ptr %arrayidx32.us, align 4, !tbaa !5 br label %for.inc48.us for.inc48.us: ; preds = %if.then34.us, %land.lhs.true24.us, %if.then20.us, %for.body14.us %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1 %exitcond119.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count118 br i1 %exitcond119.not, label %for.body.us.backedge, label %for.body14.us, !llvm.loop !16 for.body.us: ; preds = %for.body.us.backedge, %while.cond.us.preheader %indvars.iv = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %mincost.079.us = phi i32 [ 1000000, %while.cond.us.preheader ], [ %mincost.079.us.be, %for.body.us.backedge ] %u.178.us = phi i32 [ undef, %while.cond.us.preheader ], [ %u.2.us, %for.body.us.backedge ] %arrayidx.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv %10 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %cmp1.not.us = icmp eq i32 %10, -2 br i1 %cmp1.not.us, label %for.inc.us, label %land.lhs.true.us land.lhs.true.us: ; preds = %for.body.us %arrayidx3.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv %11 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %11, %mincost.079.us %12 = trunc i64 %indvars.iv to i32 %spec.select.us = select i1 %cmp4.us, i32 %12, i32 %u.178.us %spec.select76.us = tail call i32 @llvm.smin.i32(i32 %11, i32 %mincost.079.us) br label %for.inc.us for.inc.us: ; preds = %land.lhs.true.us, %for.body.us %u.2.us = phi i32 [ %u.178.us, %for.body.us ], [ %spec.select.us, %land.lhs.true.us ] %mincost.1.us = phi i32 [ %mincost.079.us, %for.body.us ], [ %spec.select76.us, %land.lhs.true.us ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end.us, label %for.body.us.backedge for.body.us.backedge: ; preds = %for.inc48.us, %for.inc.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ 0, %for.inc48.us ] %mincost.079.us.be = phi i32 [ %mincost.1.us, %for.inc.us ], [ 1000000, %for.inc48.us ] br label %for.body.us, !llvm.loop !16 while.end: ; preds = %for.end.us, %initializeSingleSource.exit, %initializeSingleSource.exit.thread call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #7 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable define dso_local void @initializeSingleSource(i32 noundef %n) local_unnamed_addr #4 { entry: %cmp6 = icmp sgt i32 %n, 0 br i1 %cmp6, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %0 = zext i32 %n to i64 %1 = shl nuw nsw i64 %0, 2 tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @pi, i8 -1, i64 %1, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %0, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %4 = icmp eq i64 %index.next, %n.vec br i1 %4, label %middle.block, label %vector.body, !llvm.loop !20 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %0 br i1 %cmp.n, label %for.end, label %for.body.preheader9 for.body.preheader9: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader9, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader9 ] %arrayidx = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv store i32 1000000, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %0 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !21 for.end: ; preds = %for.body, %middle.block, %entry store i32 0, ptr @d, align 16, !tbaa !5 ret void } ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #6 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !10, !14, !13} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10, !13, !14} !19 = distinct !{!19, !10, !14, !13} !20 = distinct !{!20, !10, !13, !14} !21 = distinct !{!21, !10, !14, !13}
#include<stdio.h> #include<math.h> void f(long long t,long long n,long long k) { if(n==1)printf("1\n"); else{ if(k==t/2+1)printf("%I64d\n",n); else if(k<t/2+1) f(t/2,n-1,k); else if(k>t/2+1) f(t/2,n-1,t+1-k); } } int main() { long long n,k,t; scanf("%I64d%I64d",&n,&k); t=pow(2,n)-1; f(t,n,k); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22213/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22213/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str.1 = private unnamed_addr constant [7 x i8] c"%I64d\0A\00", align 1 @.str.2 = private unnamed_addr constant [11 x i8] c"%I64d%I64d\00", align 1 @str = private unnamed_addr constant [2 x i8] c"1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @f(i64 noundef %t, i64 noundef %n, i64 noundef %k) local_unnamed_addr #0 { entry: %cmp4043 = icmp eq i64 %n, 1 br i1 %cmp4043, label %if.then, label %if.else.lr.ph if.else.lr.ph: ; preds = %entry, %if.then14 %k.tr.ph46 = phi i64 [ %sub18, %if.then14 ], [ %k, %entry ] %n.tr.ph45 = phi i64 [ %sub16, %if.then14 ], [ %n, %entry ] %t.tr.ph44 = phi i64 [ %div, %if.then14 ], [ %t, %entry ] br label %if.else if.then: ; preds = %if.then14, %if.then8, %entry %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end21 if.else: ; preds = %if.else.lr.ph, %if.then8 %n.tr42 = phi i64 [ %n.tr.ph45, %if.else.lr.ph ], [ %sub16, %if.then8 ] %t.tr41 = phi i64 [ %t.tr.ph44, %if.else.lr.ph ], [ %div, %if.then8 ] %div = sdiv i64 %t.tr41, 2 %add = add nsw i64 %div, 1 %cmp1 = icmp eq i64 %add, %k.tr.ph46 br i1 %cmp1, label %if.then2, label %if.else4 if.then2: ; preds = %if.else %call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %n.tr42) br label %if.end21 if.else4: ; preds = %if.else %cmp7.not = icmp slt i64 %div, %k.tr.ph46 %sub16 = add nsw i64 %n.tr42, -1 br i1 %cmp7.not, label %if.then14, label %if.then8 if.then8: ; preds = %if.else4 %cmp = icmp eq i64 %sub16, 1 br i1 %cmp, label %if.then, label %if.else if.then14: ; preds = %if.else4 %add17 = add nsw i64 %t.tr41, 1 %sub18 = sub i64 %add17, %k.tr.ph46 %cmp40 = icmp eq i64 %sub16, 1 br i1 %cmp40, label %if.then, label %if.else.lr.ph if.end21: ; preds = %if.then2, %if.then ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %conv = sitofp i64 %0 to double %exp2 = call double @exp2(double %conv) #5 %1 = load i64, ptr %n, align 8, !tbaa !5 %cmp4043.i = icmp eq i64 %1, 1 br i1 %cmp4043.i, label %if.then.i, label %if.else.lr.ph.i.preheader if.else.lr.ph.i.preheader: ; preds = %entry %2 = load i64, ptr %k, align 8, !tbaa !5 %sub = fadd double %exp2, -1.000000e+00 %conv2 = fptosi double %sub to i64 br label %if.else.lr.ph.i if.else.lr.ph.i: ; preds = %if.else.lr.ph.i.preheader, %if.then14.i %k.tr.ph46.i = phi i64 [ %sub18.i, %if.then14.i ], [ %2, %if.else.lr.ph.i.preheader ] %n.tr.ph45.i = phi i64 [ %sub16.i, %if.then14.i ], [ %1, %if.else.lr.ph.i.preheader ] %t.tr.ph44.i = phi i64 [ %div.i, %if.then14.i ], [ %conv2, %if.else.lr.ph.i.preheader ] br label %if.else.i if.then.i: ; preds = %if.then14.i, %if.then8.i, %entry %puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %f.exit if.else.i: ; preds = %if.then8.i, %if.else.lr.ph.i %n.tr42.i = phi i64 [ %n.tr.ph45.i, %if.else.lr.ph.i ], [ %sub16.i, %if.then8.i ] %t.tr41.i = phi i64 [ %t.tr.ph44.i, %if.else.lr.ph.i ], [ %div.i, %if.then8.i ] %div.i = sdiv i64 %t.tr41.i, 2 %add.i = add nsw i64 %div.i, 1 %cmp1.i = icmp eq i64 %add.i, %k.tr.ph46.i br i1 %cmp1.i, label %if.then2.i, label %if.else4.i if.then2.i: ; preds = %if.else.i %call3.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %n.tr42.i) br label %f.exit if.else4.i: ; preds = %if.else.i %cmp7.not.i = icmp slt i64 %div.i, %k.tr.ph46.i %sub16.i = add nsw i64 %n.tr42.i, -1 br i1 %cmp7.not.i, label %if.then14.i, label %if.then8.i if.then8.i: ; preds = %if.else4.i %cmp.i = icmp eq i64 %sub16.i, 1 br i1 %cmp.i, label %if.then.i, label %if.else.i if.then14.i: ; preds = %if.else4.i %reass.sub = sub i64 %t.tr41.i, %k.tr.ph46.i %sub18.i = add i64 %reass.sub, 1 %cmp40.i = icmp eq i64 %sub16.i, 1 br i1 %cmp40.i, label %if.then.i, label %if.else.lr.ph.i f.exit: ; preds = %if.then.i, %if.then2.i call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3 ; 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) #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 declare double @exp2(double) local_unnamed_addr attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { nofree nounwind } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #include <limits.h> #define MAX 100 #define INFTY INT_MAX #define WHITE 0 #define GRAY 1 #define BLACK 2 int n, M[MAX][MAX]; void dijkstra(); int main(){ int i, j, k; int c, u, v; scanf("%d",&n); if(n < 1 || n > 100) exit(1); //printf("test\n"); for(i = 0; i < n; i++){ for(j = 0; j < n; j++){ M[i][j] = INFTY; } } //printf("test1\n"); for(i = 0; i < n; i++){ scanf("%d %d",&u,&k); for(j = 0; j < k; j++){ scanf("%d %d",&v,&c); if(c < 0 || c > 100000) exit(1); M[u][v] = c; } } dijkstra(); return 0; } void dijkstra(){ int minv; int d[MAX], color[MAX]; int i, j, u; for(i = 0; i < n; i++){ d[i] = INFTY; color[i] = WHITE; } d[0] = 0; color[0] = GRAY; while(1){ minv = INFTY; u = -1; for(i = 0; i < n; i++){ if(minv > d[i] && color[i] != BLACK){ u = i; minv = d[i]; } } if(u == -1) break; color[u] = BLACK; for(j = 0; j < n; j++){ if(color[j] != BLACK && M[u][j] != INFTY){ if(d[j] > d[u] + M[u][j]){ d[j] = d[u] + M[u][j]; color[j] = GRAY; } } } } for(i = 0; i < n; i++){ printf("%d ",i); if(d[i] == INFTY) printf("-1\n"); else printf("%d\n",d[i]); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222180/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222180/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 %c = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4 %1 = add i32 %0, -101 %or.cond = icmp ult i32 %1, -100 br i1 %or.cond, label %if.then, label %for.cond3.preheader.us.preheader for.cond3.preheader.us.preheader: ; preds = %entry %wide.trip.count55 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 4 %n.vec = and i64 %wide.trip.count55, 4294967292 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count55 br label %for.cond3.preheader.us for.cond3.preheader.us: ; preds = %for.cond3.preheader.us.preheader, %for.cond3.for.inc8_crit_edge.us %indvars.iv52 = phi i64 [ 0, %for.cond3.preheader.us.preheader ], [ %indvars.iv.next53, %for.cond3.for.inc8_crit_edge.us ] 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 ] %2 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv52, i64 %index store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 4 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond3.for.inc8_crit_edge.us, label %for.body5.us.preheader for.body5.us.preheader: ; preds = %for.cond3.preheader.us, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.cond3.preheader.us ], [ %n.vec, %middle.block ] br label %for.body5.us for.body5.us: ; preds = %for.body5.us.preheader, %for.body5.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body5.us ], [ %indvars.iv.ph, %for.body5.us.preheader ] %arrayidx7.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv52, i64 %indvars.iv store i32 2147483647, ptr %arrayidx7.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count55 br i1 %exitcond.not, label %for.cond3.for.inc8_crit_edge.us, label %for.body5.us, !llvm.loop !13 for.cond3.for.inc8_crit_edge.us: ; preds = %for.body5.us, %middle.block %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %exitcond56.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count55 br i1 %exitcond56.not, label %for.body13, label %for.cond3.preheader.us, !llvm.loop !14 if.then: ; preds = %entry tail call void @exit(i32 noundef 1) #8 unreachable for.body13: ; preds = %for.cond3.for.inc8_crit_edge.us, %for.inc31 %i.150 = phi i32 [ %inc32, %for.inc31 ], [ 0, %for.cond3.for.inc8_crit_edge.us ] %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp1647 = icmp sgt i32 %4, 0 br i1 %cmp1647, label %for.body17, label %for.inc31 for.body17: ; preds = %for.body13, %if.end23 %j.148 = phi i32 [ %inc29, %if.end23 ], [ 0, %for.body13 ] %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %5 = load i32, ptr %c, align 4 %or.cond34 = icmp ugt i32 %5, 100000 br i1 %or.cond34, label %if.then22, label %if.end23 if.then22: ; preds = %for.body17 call void @exit(i32 noundef 1) #8 unreachable if.end23: ; preds = %for.body17 %6 = load i32, ptr %u, align 4, !tbaa !5 %idxprom24 = sext i32 %6 to i64 %7 = load i32, ptr %v, align 4, !tbaa !5 %idxprom26 = sext i32 %7 to i64 %arrayidx27 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom24, i64 %idxprom26 store i32 %5, ptr %arrayidx27, align 4, !tbaa !5 %inc29 = add nuw nsw i32 %j.148, 1 %8 = load i32, ptr %k, align 4, !tbaa !5 %cmp16 = icmp slt i32 %inc29, %8 br i1 %cmp16, label %for.body17, label %for.inc31, !llvm.loop !15 for.inc31: ; preds = %if.end23, %for.body13 %inc32 = add nuw nsw i32 %i.150, 1 %9 = load i32, ptr @n, align 4, !tbaa !5 %cmp12 = icmp slt i32 %inc32, %9 br i1 %cmp12, label %for.body13, label %for.end33, !llvm.loop !16 for.end33: ; preds = %for.inc31 call void @dijkstra() call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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: noreturn nounwind declare void @exit(i32 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 uwtable define dso_local void @dijkstra() local_unnamed_addr #4 { entry: %d = alloca [100 x i32], align 16 %color = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #7 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #7 %0 = load i32, ptr @n, align 4, !tbaa !5 %.fr = freeze i32 %0 %cmp109 = icmp sgt i32 %.fr, 0 br i1 %cmp109, label %for.body.preheader, label %for.end77 for.body.preheader: ; preds = %entry %1 = zext i32 %.fr to i64 %2 = shl nuw nsw i64 %1, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5 %min.iters.check = icmp ult i32 %.fr, 8 br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %1, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %index store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %4, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %1 br i1 %cmp.n, label %for.end, label %for.body.preheader168 for.body.preheader168: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader168, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ] %arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv store i32 2147483647, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18 for.end: ; preds = %for.body, %middle.block store i32 0, ptr %d, align 16, !tbaa !5 store i32 1, ptr %color, align 16, !tbaa !5 br i1 %cmp109, label %while.cond.us.preheader, label %for.end77 while.cond.us.preheader: ; preds = %for.end %wide.trip.count157 = zext i32 %.fr to i64 %wide.trip.count162 = zext i32 %.fr to i64 br label %for.body7.us for.end18.us: ; preds = %for.inc16.us %cmp19.us = icmp eq i32 %u.1.us, -1 br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us if.end21.us: ; preds = %for.end18.us %idxprom22.us = sext i32 %u.1.us to i64 %arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5 %arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us br label %for.body26.us for.body26.us: ; preds = %if.end21.us, %for.inc60.us %indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ] %arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159 %6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5 %cmp29.not.us = icmp eq i32 %6, 2 br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us land.lhs.true30.us: ; preds = %for.body26.us %arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom22.us, i64 %indvars.iv159 %7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5 %cmp35.not.us = icmp eq i32 %7, 2147483647 br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us if.then36.us: ; preds = %land.lhs.true30.us %arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159 %8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5 %9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us = add nsw i32 %9, %7 %cmp45.us = icmp sgt i32 %8, %add.us br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us if.then46.us: ; preds = %if.then36.us store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5 store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5 br label %for.inc60.us for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1 %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162 br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !19 for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader %indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ] %u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ] %minv.0112.us = phi i32 [ 2147483647, %while.cond.us.preheader ], [ %minv.0112.us.be, %for.body7.us.backedge ] %arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154 %10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5 %cmp10.us = icmp sgt i32 %minv.0112.us, %10 br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us land.lhs.true.us: ; preds = %for.body7.us %arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154 %11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5 %cmp13.not.us = icmp eq i32 %11, 2 %spec.select.us = select i1 %cmp13.not.us, i32 %minv.0112.us, i32 %10 %12 = trunc i64 %indvars.iv154 to i32 %spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12 br label %for.inc16.us for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us %minv.1.us = phi i32 [ %minv.0112.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ] %u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ] %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157 br i1 %exitcond158.not, label %for.end18.us, label %for.body7.us.backedge for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us %indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ] %u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ] %minv.0112.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 2147483647, %for.inc60.us ] br label %for.body7.us, !llvm.loop !19 for.cond63.preheader: ; preds = %for.end18.us %cmp64145 = icmp sgt i32 %.fr, 0 br i1 %cmp64145, label %for.body65, label %for.end77 for.body65: ; preds = %for.cond63.preheader, %for.inc75 %indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ] %13 = trunc i64 %indvars.iv164 to i32 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13) %arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164 %14 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %cmp68 = icmp eq i32 %14, 2147483647 br i1 %cmp68, label %if.then69, label %if.else if.then69: ; preds = %for.body65 %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc75 if.else: ; preds = %for.body65 %call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %14) br label %for.inc75 for.inc75: ; preds = %if.then69, %if.else %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1 %15 = load i32, ptr @n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp64 = icmp slt i64 %indvars.iv.next165, %16 br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !20 for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #7 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #7 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6 attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #7 = { nounwind } attributes #8 = { noreturn nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !11, !12} !18 = distinct !{!18, !10, !12, !11} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include <stdio.h> #define INFTY 100000000; int a[100][100],d[100],n; int main(){ int i,j,k,u,c,v; scanf("%d",&n); for(i=0;i<100;i++){ for(j=0;j<100;j++){ a[i][j]=INFTY; } a[i][i]=0; } for(i=0;i<n;i++){ scanf("%d %d",&u,&k); for(j=0;j<k;j++){ scanf("%d %d",&v,&c); a[u][v]=c; } } for(k=0;k<n;k++){ for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(a[i][j]>=(a[i][k]+a[k][j])) a[i][j]=a[i][k]+a[k][j]; } } } for(i = 0 ; i < n ; i++){ printf("%d %d\n" ,i ,a[0][i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222223/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222223/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 %u = alloca i32, align 4 %c = alloca i32, align 4 %v = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #3 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) br label %vector.ph vector.ph: ; preds = %vector.ph, %entry %indvars.iv127 = phi i64 [ 0, %entry ], [ %indvars.iv.next128, %vector.ph ] %0 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 0 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %0, align 16, !tbaa !5 %1 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 4 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 8 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 12 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 16 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 20 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %5, align 16, !tbaa !5 %6 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 24 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 28 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %7, align 16, !tbaa !5 %8 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 32 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 36 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %9, align 16, !tbaa !5 %10 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 40 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %10, align 16, !tbaa !5 %11 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 44 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %11, align 16, !tbaa !5 %12 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 48 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %12, align 16, !tbaa !5 %13 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 52 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %13, align 16, !tbaa !5 %14 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 56 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %14, align 16, !tbaa !5 %15 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 60 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %15, align 16, !tbaa !5 %16 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 64 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %16, align 16, !tbaa !5 %17 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 68 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %17, align 16, !tbaa !5 %18 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 72 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %18, align 16, !tbaa !5 %19 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 76 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %19, align 16, !tbaa !5 %20 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 80 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %20, align 16, !tbaa !5 %21 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 84 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %21, align 16, !tbaa !5 %22 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 88 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %22, align 16, !tbaa !5 %23 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 92 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %23, align 16, !tbaa !5 %24 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 96 store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %24, align 16, !tbaa !5 %arrayidx9 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv127, i64 %indvars.iv127 store i32 0, ptr %arrayidx9, align 4, !tbaa !5 %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1 %exitcond130.not = icmp eq i64 %indvars.iv.next128, 100 br i1 %exitcond130.not, label %for.cond13.preheader, label %vector.ph, !llvm.loop !9 for.cond13.preheader: ; preds = %vector.ph %25 = load i32, ptr @n, align 4, !tbaa !5 %cmp14114 = icmp sgt i32 %25, 0 br i1 %cmp14114, label %for.body15, label %for.end83 for.cond31.preheader: ; preds = %for.inc28 %cmp32120 = icmp sgt i32 %91, 0 br i1 %cmp32120, label %for.cond34.preheader.us.preheader, label %for.end83 for.cond34.preheader.us.preheader: ; preds = %for.cond31.preheader %wide.trip.count143 = zext i32 %91 to i64 %26 = shl nuw nsw i64 %wide.trip.count143, 2 %27 = getelementptr i8, ptr @a, i64 %26 %min.iters.check = icmp ult i32 %91, 12 %28 = getelementptr i8, ptr @a, i64 %26 %n.vec = and i64 %wide.trip.count143, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count143 %xtraiter = and i64 %wide.trip.count143, 1 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 %29 = sub nsw i64 0, %wide.trip.count143 br label %for.cond34.preheader.us for.cond34.preheader.us: ; preds = %for.cond34.preheader.us.preheader, %for.cond34.for.inc72_crit_edge.split.us.us %indvars.iv140 = phi i64 [ 0, %for.cond34.preheader.us.preheader ], [ %indvars.iv.next141, %for.cond34.for.inc72_crit_edge.split.us.us ] %30 = shl nuw nsw i64 %indvars.iv140, 2 %31 = mul nuw nsw i64 %indvars.iv140, 400 %scevgep155 = getelementptr i8, ptr @a, i64 %31 %scevgep156 = getelementptr i8, ptr %27, i64 %31 %gep = getelementptr i8, ptr getelementptr (i8, ptr @a, i64 4), i64 %30 %32 = getelementptr i8, ptr @a, i64 %30 %bound0 = icmp ugt ptr %gep, @a %bound1 = icmp ult ptr %32, %28 %found.conflict = and i1 %bound0, %bound1 br label %for.cond37.preheader.us.us for.cond37.preheader.us.us: ; preds = %for.cond37.for.inc69_crit_edge.us.us, %for.cond34.preheader.us %indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.cond37.for.inc69_crit_edge.us.us ], [ 0, %for.cond34.preheader.us ] %arrayidx47.us.us = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %indvars.iv140 br i1 %min.iters.check, label %for.body39.us.us.preheader, label %vector.memcheck vector.memcheck: ; preds = %for.cond37.preheader.us.us %33 = mul nuw nsw i64 %indvars.iv135, 400 %scevgep152 = getelementptr i8, ptr %28, i64 %33 %scevgep = getelementptr i8, ptr @a, i64 %33 %bound0157 = icmp ult ptr %scevgep, %scevgep156 %bound1158 = icmp ult ptr %scevgep155, %scevgep152 %found.conflict159 = and i1 %bound0157, %bound1158 %conflict.rdx = or i1 %found.conflict, %found.conflict159 br i1 %conflict.rdx, label %for.body39.us.us.preheader, label %vector.ph162 vector.ph162: ; preds = %vector.memcheck %34 = load i32, ptr %arrayidx47.us.us, align 4, !tbaa !5, !alias.scope !11 %broadcast.splatinsert169 = insertelement <4 x i32> poison, i32 %34, i64 0 %broadcast.splat170 = shufflevector <4 x i32> %broadcast.splatinsert169, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body164 vector.body164: ; preds = %pred.store.continue184, %vector.ph162 %index165 = phi i64 [ 0, %vector.ph162 ], [ %index.next185, %pred.store.continue184 ] %35 = or i64 %index165, 4 %36 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %index165 %wide.load = load <4 x i32>, ptr %36, align 16, !tbaa !5, !alias.scope !14, !noalias !16 %37 = getelementptr inbounds i32, ptr %36, i64 4 %wide.load166 = load <4 x i32>, ptr %37, align 16, !tbaa !5, !alias.scope !14, !noalias !16 %38 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv140, i64 %index165 %wide.load167 = load <4 x i32>, ptr %38, align 16, !tbaa !5, !alias.scope !18 %39 = getelementptr inbounds i32, ptr %38, i64 4 %wide.load168 = load <4 x i32>, ptr %39, align 16, !tbaa !5, !alias.scope !18 %40 = add nsw <4 x i32> %wide.load167, %broadcast.splat170 %41 = add nsw <4 x i32> %wide.load168, %broadcast.splat170 %42 = icmp sge <4 x i32> %wide.load, %40 %43 = icmp sge <4 x i32> %wide.load166, %41 %44 = extractelement <4 x i1> %42, i64 0 br i1 %44, label %pred.store.if, label %pred.store.continue pred.store.if: ; preds = %vector.body164 %45 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %index165 %46 = extractelement <4 x i32> %40, i64 0 store i32 %46, ptr %45, align 16, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue pred.store.continue: ; preds = %pred.store.if, %vector.body164 %47 = extractelement <4 x i1> %42, i64 1 br i1 %47, label %pred.store.if171, label %pred.store.continue172 pred.store.if171: ; preds = %pred.store.continue %48 = or i64 %index165, 1 %49 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %48 %50 = extractelement <4 x i32> %40, i64 1 store i32 %50, ptr %49, align 4, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue172 pred.store.continue172: ; preds = %pred.store.if171, %pred.store.continue %51 = extractelement <4 x i1> %42, i64 2 br i1 %51, label %pred.store.if173, label %pred.store.continue174 pred.store.if173: ; preds = %pred.store.continue172 %52 = or i64 %index165, 2 %53 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %52 %54 = extractelement <4 x i32> %40, i64 2 store i32 %54, ptr %53, align 8, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue174 pred.store.continue174: ; preds = %pred.store.if173, %pred.store.continue172 %55 = extractelement <4 x i1> %42, i64 3 br i1 %55, label %pred.store.if175, label %pred.store.continue176 pred.store.if175: ; preds = %pred.store.continue174 %56 = or i64 %index165, 3 %57 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %56 %58 = extractelement <4 x i32> %40, i64 3 store i32 %58, ptr %57, align 4, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue176 pred.store.continue176: ; preds = %pred.store.if175, %pred.store.continue174 %59 = extractelement <4 x i1> %43, i64 0 br i1 %59, label %pred.store.if177, label %pred.store.continue178 pred.store.if177: ; preds = %pred.store.continue176 %60 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %35 %61 = extractelement <4 x i32> %41, i64 0 store i32 %61, ptr %60, align 16, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue178 pred.store.continue178: ; preds = %pred.store.if177, %pred.store.continue176 %62 = extractelement <4 x i1> %43, i64 1 br i1 %62, label %pred.store.if179, label %pred.store.continue180 pred.store.if179: ; preds = %pred.store.continue178 %63 = or i64 %index165, 5 %64 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %63 %65 = extractelement <4 x i32> %41, i64 1 store i32 %65, ptr %64, align 4, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue180 pred.store.continue180: ; preds = %pred.store.if179, %pred.store.continue178 %66 = extractelement <4 x i1> %43, i64 2 br i1 %66, label %pred.store.if181, label %pred.store.continue182 pred.store.if181: ; preds = %pred.store.continue180 %67 = or i64 %index165, 6 %68 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %67 %69 = extractelement <4 x i32> %41, i64 2 store i32 %69, ptr %68, align 8, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue182 pred.store.continue182: ; preds = %pred.store.if181, %pred.store.continue180 %70 = extractelement <4 x i1> %43, i64 3 br i1 %70, label %pred.store.if183, label %pred.store.continue184 pred.store.if183: ; preds = %pred.store.continue182 %71 = or i64 %index165, 7 %72 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %71 %73 = extractelement <4 x i32> %41, i64 3 store i32 %73, ptr %72, align 4, !tbaa !5, !alias.scope !14, !noalias !16 br label %pred.store.continue184 pred.store.continue184: ; preds = %pred.store.if183, %pred.store.continue182 %index.next185 = add nuw i64 %index165, 8 %74 = icmp eq i64 %index.next185, %n.vec br i1 %74, label %middle.block160, label %vector.body164, !llvm.loop !19 middle.block160: ; preds = %pred.store.continue184 br i1 %cmp.n, label %for.cond37.for.inc69_crit_edge.us.us, label %for.body39.us.us.preheader for.body39.us.us.preheader: ; preds = %vector.memcheck, %for.cond37.preheader.us.us, %middle.block160 %indvars.iv131.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.cond37.preheader.us.us ], [ %n.vec, %middle.block160 ] br i1 %lcmp.mod.not, label %for.body39.us.us.prol.loopexit, label %for.body39.us.us.prol for.body39.us.us.prol: ; preds = %for.body39.us.us.preheader %arrayidx43.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %indvars.iv131.ph %75 = load i32, ptr %arrayidx43.us.us.prol, align 16, !tbaa !5 %76 = load i32, ptr %arrayidx47.us.us, align 4, !tbaa !5 %arrayidx51.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv140, i64 %indvars.iv131.ph %77 = load i32, ptr %arrayidx51.us.us.prol, align 16, !tbaa !5 %add.us.us.prol = add nsw i32 %77, %76 %cmp52.not.us.us.prol = icmp slt i32 %75, %add.us.us.prol br i1 %cmp52.not.us.us.prol, label %for.inc66.us.us.prol, label %if.then.us.us.prol if.then.us.us.prol: ; preds = %for.body39.us.us.prol store i32 %add.us.us.prol, ptr %arrayidx43.us.us.prol, align 16, !tbaa !5 br label %for.inc66.us.us.prol for.inc66.us.us.prol: ; preds = %if.then.us.us.prol, %for.body39.us.us.prol %indvars.iv.next132.prol = or i64 %indvars.iv131.ph, 1 br label %for.body39.us.us.prol.loopexit for.body39.us.us.prol.loopexit: ; preds = %for.inc66.us.us.prol, %for.body39.us.us.preheader %indvars.iv131.unr = phi i64 [ %indvars.iv131.ph, %for.body39.us.us.preheader ], [ %indvars.iv.next132.prol, %for.inc66.us.us.prol ] %78 = xor i64 %indvars.iv131.ph, %29 %79 = icmp eq i64 %78, -1 br i1 %79, label %for.cond37.for.inc69_crit_edge.us.us, label %for.body39.us.us for.body39.us.us: ; preds = %for.body39.us.us.prol.loopexit, %for.inc66.us.us.1 %indvars.iv131 = phi i64 [ %indvars.iv.next132.1, %for.inc66.us.us.1 ], [ %indvars.iv131.unr, %for.body39.us.us.prol.loopexit ] %arrayidx43.us.us = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %indvars.iv131 %80 = load i32, ptr %arrayidx43.us.us, align 4, !tbaa !5 %81 = load i32, ptr %arrayidx47.us.us, align 4, !tbaa !5 %arrayidx51.us.us = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv140, i64 %indvars.iv131 %82 = load i32, ptr %arrayidx51.us.us, align 4, !tbaa !5 %add.us.us = add nsw i32 %82, %81 %cmp52.not.us.us = icmp slt i32 %80, %add.us.us br i1 %cmp52.not.us.us, label %for.inc66.us.us, label %if.then.us.us if.then.us.us: ; preds = %for.body39.us.us store i32 %add.us.us, ptr %arrayidx43.us.us, align 4, !tbaa !5 br label %for.inc66.us.us for.inc66.us.us: ; preds = %if.then.us.us, %for.body39.us.us %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1 %arrayidx43.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv135, i64 %indvars.iv.next132 %83 = load i32, ptr %arrayidx43.us.us.1, align 4, !tbaa !5 %84 = load i32, ptr %arrayidx47.us.us, align 4, !tbaa !5 %arrayidx51.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv140, i64 %indvars.iv.next132 %85 = load i32, ptr %arrayidx51.us.us.1, align 4, !tbaa !5 %add.us.us.1 = add nsw i32 %85, %84 %cmp52.not.us.us.1 = icmp slt i32 %83, %add.us.us.1 br i1 %cmp52.not.us.us.1, label %for.inc66.us.us.1, label %if.then.us.us.1 if.then.us.us.1: ; preds = %for.inc66.us.us store i32 %add.us.us.1, ptr %arrayidx43.us.us.1, align 4, !tbaa !5 br label %for.inc66.us.us.1 for.inc66.us.us.1: ; preds = %if.then.us.us.1, %for.inc66.us.us %indvars.iv.next132.1 = add nuw nsw i64 %indvars.iv131, 2 %exitcond134.not.1 = icmp eq i64 %indvars.iv.next132.1, %wide.trip.count143 br i1 %exitcond134.not.1, label %for.cond37.for.inc69_crit_edge.us.us, label %for.body39.us.us, !llvm.loop !22 for.cond37.for.inc69_crit_edge.us.us: ; preds = %for.body39.us.us.prol.loopexit, %for.inc66.us.us.1, %middle.block160 %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count143 br i1 %exitcond139.not, label %for.cond34.for.inc72_crit_edge.split.us.us, label %for.cond37.preheader.us.us, !llvm.loop !23 for.cond34.for.inc72_crit_edge.split.us.us: ; preds = %for.cond37.for.inc69_crit_edge.us.us %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1 %exitcond144.not = icmp eq i64 %indvars.iv.next141, %wide.trip.count143 br i1 %exitcond144.not, label %for.cond75.preheader, label %for.cond34.preheader.us, !llvm.loop !24 for.body15: ; preds = %for.cond13.preheader, %for.inc28 %i.1115 = phi i32 [ %inc29, %for.inc28 ], [ 0, %for.cond13.preheader ] %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k) %86 = load i32, ptr %k, align 4, !tbaa !5 %cmp18112 = icmp sgt i32 %86, 0 br i1 %cmp18112, label %for.body19, label %for.inc28 for.body19: ; preds = %for.body15, %for.body19 %j.1113 = phi i32 [ %inc26, %for.body19 ], [ 0, %for.body15 ] %call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c) %87 = load i32, ptr %c, align 4, !tbaa !5 %88 = load i32, ptr %u, align 4, !tbaa !5 %idxprom21 = sext i32 %88 to i64 %89 = load i32, ptr %v, align 4, !tbaa !5 %idxprom23 = sext i32 %89 to i64 %arrayidx24 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %idxprom21, i64 %idxprom23 store i32 %87, ptr %arrayidx24, align 4, !tbaa !5 %inc26 = add nuw nsw i32 %j.1113, 1 %90 = load i32, ptr %k, align 4, !tbaa !5 %cmp18 = icmp slt i32 %inc26, %90 br i1 %cmp18, label %for.body19, label %for.inc28, !llvm.loop !25 for.inc28: ; preds = %for.body19, %for.body15 %inc29 = add nuw nsw i32 %i.1115, 1 %91 = load i32, ptr @n, align 4, !tbaa !5 %cmp14 = icmp slt i32 %inc29, %91 br i1 %cmp14, label %for.body15, label %for.cond31.preheader, !llvm.loop !26 for.cond75.preheader: ; preds = %for.cond34.for.inc72_crit_edge.split.us.us store i32 %91, ptr %k, align 4, !tbaa !5 br i1 %cmp32120, label %for.body77, label %for.end83 for.body77: ; preds = %for.cond75.preheader, %for.body77 %indvars.iv145 = phi i64 [ %indvars.iv.next146, %for.body77 ], [ 0, %for.cond75.preheader ] %arrayidx79 = getelementptr inbounds [100 x i32], ptr @a, i64 0, i64 %indvars.iv145 %92 = load i32, ptr %arrayidx79, align 4, !tbaa !5 %93 = trunc i64 %indvars.iv145 to i32 %call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %93, i32 noundef %92) %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1 %94 = load i32, ptr @n, align 4, !tbaa !5 %95 = sext i32 %94 to i64 %cmp76 = icmp slt i64 %indvars.iv.next146, %95 br i1 %cmp76, label %for.body77, label %for.end83, !llvm.loop !27 for.end83: ; preds = %for.body77, %for.cond13.preheader, %for.cond31.preheader, %for.cond75.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!12} !12 = distinct !{!12, !13} !13 = distinct !{!13, !"LVerDomain"} !14 = !{!15} !15 = distinct !{!15, !13} !16 = !{!12, !17} !17 = distinct !{!17, !13} !18 = !{!17} !19 = distinct !{!19, !10, !20, !21} !20 = !{!"llvm.loop.isvectorized", i32 1} !21 = !{!"llvm.loop.unroll.runtime.disable"} !22 = distinct !{!22, !10, !20} !23 = distinct !{!23, !10} !24 = distinct !{!24, !10} !25 = distinct !{!25, !10} !26 = distinct !{!26, !10} !27 = distinct !{!27, !10}
#include <stdio.h> #include <stdlib.h> #define NIL_VERTEX -1 #define DENOTE_INF_COST -1 #define COMP_INF_COST 100008 // translate 1-origin into 0-origin int i0O(int index1Origin) { return index1Origin-1; } #include <stdio.h> #include <stdlib.h> #define MAX_NUM_STACK_VALUES 100 #define STR_MAX_LENGTH 100 typedef enum { WHITE, GRAY, BLACK } Color; typedef struct Vtx { Color color; int discoveryCost; struct Vtx * discoverFrom; int key; } Vertex; //void copyVertex(Vertex * p_out, Vertex in) { // p_out->color = in.color; // p_out->discoveryCost = in.discoveryCost; // p_out->discoverFrom = in.discoverFrom; // p_out->key = in.key; //}; void initializeSingleSource( Vertex vertices[], int nVertices, int startingVertexIndex ) { for (int i = 0; i < nVertices; i++) { vertices[i].discoveryCost = COMP_INF_COST; vertices[i].discoverFrom = NULL; vertices[i].color = WHITE; } vertices[startingVertexIndex].discoveryCost = 0; } void relax( Vertex vertices[], int ** iawMatrix, int u, int v ) { if (vertices[v].discoveryCost > vertices[u].discoveryCost + iawMatrix[u][v]) { vertices[v].discoveryCost = vertices[u].discoveryCost + iawMatrix[u][v]; vertices[v].discoverFrom = &vertices[u]; } } void dijkstra( Vertex vertices[], int nVertices, int ** iawMatrix, // indicativeAdjWeightMatrix int startingVertexIndex ) { initializeSingleSource(vertices, nVertices, startingVertexIndex); int mincost, u, v, i; while (1) { mincost = COMP_INF_COST; for (i = 0; i < nVertices; i++) {// for each vertex if (vertices[i].color != BLACK && vertices[i].discoveryCost < mincost) { mincost = vertices[i].discoveryCost; u = i; } } if (mincost == COMP_INF_COST) break; vertices[u].color = BLACK; for (v = 0; v < nVertices; v++) if (iawMatrix[u][v] < COMP_INF_COST) // for each in adjList if (vertices[v].color != BLACK && vertices[u].discoveryCost + iawMatrix[u][v] < vertices[v].discoveryCost) { // relax vertices[v].discoverFrom = &vertices[u]; vertices[v].discoveryCost = vertices[u].discoveryCost + iawMatrix[u][v]; } } } void prim( Vertex vertices[], int nVertices, int ** iawMatrix, // indicativeAdjWeightMatrix int startingVertexIndex ) { initializeSingleSource(vertices, nVertices, startingVertexIndex); int mincost, u, v, i; while (1) { mincost = COMP_INF_COST; for (i = 0; i < nVertices; i++) // for each vertex if (vertices[i].color != BLACK && vertices[i].discoveryCost < mincost) { mincost = vertices[i].discoveryCost; u = i; } if (mincost == COMP_INF_COST) break; vertices[u].color = BLACK; for (v = 0; v < nVertices; v++) if ((iawMatrix)[u][v] < COMP_INF_COST) // for each in adjList if (vertices[v].color != BLACK && (iawMatrix)[u][v] < vertices[v].discoveryCost) { // "relax" for prim alg vertices[v].discoverFrom = &vertices[u]; vertices[v].discoveryCost = (iawMatrix)[u][v]; }; } } int main(int argc, char** argv) { int nVertices, i, j; // scan number of already existed events scanf("%d", &nVertices); // adjMatrix ---------------------------- int ** adjMatrix; adjMatrix = (int **)malloc(nVertices * sizeof(int *)); for (i = 0; i < nVertices; i++) { adjMatrix[i] = (int *)malloc(nVertices * sizeof(int)); for (j = 0; j < nVertices; j++) adjMatrix[i][j] = COMP_INF_COST; } // scan -------------------------------- Vertex vertices[nVertices]; int iVertexFrom, iVertexTo, nEdge; int weight; for (i = 0; i < nVertices; i++) { vertices[i].key = i; scanf("%d %d", &iVertexFrom, &nEdge); for (j = 0; j < nEdge; j++) { scanf("%d %d", &iVertexTo, &weight); adjMatrix[iVertexFrom][iVertexTo] = weight; } } // // print scan result --------------------- // printf("Scan result: \n"); // for (i = 0; i < nVertices; i++) { // for (j = 0; j < nVertices; j++) { // if (j > 0) printf(" "); // printf("%2d", adjMatrix[i][j]); // } // printf("\n"); // } // prim(vertices, nVertices, adjMatrix, 0); dijkstra(vertices, nVertices, adjMatrix, 0); // int totalCost = 0; // // for (i = 0; i < nVertices; i++) // totalCost += vertices[i].discoveryCost; // // printf("%d\n", totalCost); for (i = 0; i < nVertices; i++) printf("%d %d\n", i, vertices[i].discoveryCost); return (EXIT_SUCCESS); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222267/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222267/source.c" target datalayout = "e-m:e-p270: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.Vtx = type { i32, i32, ptr, i32 } @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @i0O(i32 noundef %index1Origin) local_unnamed_addr #0 { entry: %sub = add nsw i32 %index1Origin, -1 ret i32 %sub } ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable define dso_local void @initializeSingleSource(ptr nocapture noundef writeonly %vertices, i32 noundef %nVertices, i32 noundef %startingVertexIndex) local_unnamed_addr #1 { entry: %cmp15 = icmp sgt i32 %nVertices, 0 br i1 %cmp15, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %nVertices to i64 %xtraiter = and i64 %wide.trip.count, 1 %0 = icmp eq i32 %nVertices, 1 br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.unr %discoveryCost.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.unr, i32 1 store i32 100008, ptr %discoveryCost.epil, align 4, !tbaa !5 %discoverFrom.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.unr, i32 2 store ptr null, ptr %discoverFrom.epil, align 8, !tbaa !11 store i32 0, ptr %arrayidx.epil, align 8, !tbaa !12 br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry %idxprom5 = sext i32 %startingVertexIndex to i64 %discoveryCost7 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom5, i32 1 store i32 0, ptr %discoveryCost7, align 4, !tbaa !5 ret void for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv %discoveryCost = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv, i32 1 store i32 100008, ptr %discoveryCost, align 4, !tbaa !5 %discoverFrom = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv, i32 2 store ptr null, ptr %discoverFrom, align 8, !tbaa !11 store i32 0, ptr %arrayidx, align 8, !tbaa !12 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next %discoveryCost.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next, i32 1 store i32 100008, ptr %discoveryCost.1, align 4, !tbaa !5 %discoverFrom.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next, i32 2 store ptr null, ptr %discoverFrom.1, align 8, !tbaa !11 store i32 0, ptr %arrayidx.1, align 8, !tbaa !12 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, 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) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable define dso_local void @relax(ptr noundef %vertices, ptr nocapture noundef readonly %iawMatrix, i32 noundef %u, i32 noundef %v) local_unnamed_addr #3 { entry: %idxprom = sext i32 %v to i64 %discoveryCost = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom, i32 1 %0 = load i32, ptr %discoveryCost, align 4, !tbaa !5 %idxprom1 = sext i32 %u to i64 %discoveryCost3 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom1, i32 1 %1 = load i32, ptr %discoveryCost3, align 4, !tbaa !5 %arrayidx5 = getelementptr inbounds ptr, ptr %iawMatrix, i64 %idxprom1 %2 = load ptr, ptr %arrayidx5, align 8, !tbaa !15 %arrayidx7 = getelementptr inbounds i32, ptr %2, i64 %idxprom %3 = load i32, ptr %arrayidx7, align 4, !tbaa !16 %add = add nsw i32 %3, %1 %cmp = icmp sgt i32 %0, %add br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %arrayidx2 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom1 store i32 %add, ptr %discoveryCost, align 4, !tbaa !5 %discoverFrom = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom, i32 2 store ptr %arrayidx2, ptr %discoverFrom, align 8, !tbaa !11 br label %if.end if.end: ; preds = %if.then, %entry ret void } ; Function Attrs: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable define dso_local void @dijkstra(ptr noundef %vertices, i32 noundef %nVertices, ptr nocapture noundef readonly %iawMatrix, i32 noundef %startingVertexIndex) local_unnamed_addr #4 { entry: %cmp15.i = icmp sgt i32 %nVertices, 0 br i1 %cmp15.i, label %for.body.preheader.i, label %initializeSingleSource.exit.thread initializeSingleSource.exit.thread: ; preds = %entry %idxprom5.i140 = sext i32 %startingVertexIndex to i64 %discoveryCost7.i141 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom5.i140, i32 1 store i32 0, ptr %discoveryCost7.i141, align 4, !tbaa !5 br label %while.end for.body.preheader.i: ; preds = %entry %wide.trip.count.i = zext i32 %nVertices to i64 %xtraiter = and i64 %wide.trip.count.i, 1 %0 = icmp eq i32 %nVertices, 1 br i1 %0, label %initializeSingleSource.exit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %wide.trip.count.i, 4294967294 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.1, %for.body.i ] %arrayidx.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i %discoveryCost.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i, i32 1 store i32 100008, ptr %discoveryCost.i, align 4, !tbaa !5 %discoverFrom.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i, i32 2 store ptr null, ptr %discoverFrom.i, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i, align 8, !tbaa !12 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %arrayidx.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i %discoveryCost.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i, i32 1 store i32 100008, ptr %discoveryCost.i.1, align 4, !tbaa !5 %discoverFrom.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i, i32 2 store ptr null, ptr %discoverFrom.i.1, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.1, align 8, !tbaa !12 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %initializeSingleSource.exit.unr-lcssa, label %for.body.i, !llvm.loop !13 initializeSingleSource.exit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %initializeSingleSource.exit, label %for.body.i.epil for.body.i.epil: ; preds = %initializeSingleSource.exit.unr-lcssa %arrayidx.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr %discoveryCost.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr, i32 1 store i32 100008, ptr %discoveryCost.i.epil, align 4, !tbaa !5 %discoverFrom.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr, i32 2 store ptr null, ptr %discoverFrom.i.epil, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.epil, align 8, !tbaa !12 br label %initializeSingleSource.exit initializeSingleSource.exit: ; preds = %initializeSingleSource.exit.unr-lcssa, %for.body.i.epil %idxprom5.i = sext i32 %startingVertexIndex to i64 %discoveryCost7.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom5.i, i32 1 store i32 0, ptr %discoveryCost7.i, align 4, !tbaa !5 br i1 %cmp15.i, label %while.cond.us.preheader, label %while.end while.cond.us.preheader: ; preds = %initializeSingleSource.exit %wide.trip.count = zext i32 %nVertices to i64 %wide.trip.count138 = zext i32 %nVertices to i64 br label %for.body.us for.end.us: ; preds = %for.inc.us %cmp8.us = icmp eq i32 %mincost.1.us, 100008 br i1 %cmp8.us, label %while.end, label %if.end10.us if.end10.us: ; preds = %for.end.us %idxprom11.us = sext i32 %u.2.us to i64 %arrayidx12.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom11.us store i32 2, ptr %arrayidx12.us, align 8, !tbaa !12 %arrayidx18.us = getelementptr inbounds ptr, ptr %iawMatrix, i64 %idxprom11.us %discoveryCost30.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom11.us, i32 1 %.pre = load ptr, ptr %arrayidx18.us, align 8, !tbaa !15 br label %for.body16.us for.body16.us: ; preds = %if.end10.us, %for.inc57.us %1 = phi ptr [ %.pre, %if.end10.us ], [ %8, %for.inc57.us ] %indvars.iv135 = phi i64 [ 0, %if.end10.us ], [ %indvars.iv.next136, %for.inc57.us ] %arrayidx20.us = getelementptr inbounds i32, ptr %1, i64 %indvars.iv135 %2 = load i32, ptr %arrayidx20.us, align 4, !tbaa !16 %cmp21.us = icmp slt i32 %2, 100008 br i1 %cmp21.us, label %if.then22.us, label %for.inc57.us if.then22.us: ; preds = %for.body16.us %arrayidx24.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv135 %3 = load i32, ptr %arrayidx24.us, align 8, !tbaa !12 %cmp26.not.us = icmp eq i32 %3, 2 br i1 %cmp26.not.us, label %for.inc57.us, label %land.lhs.true27.us land.lhs.true27.us: ; preds = %if.then22.us %4 = load i32, ptr %discoveryCost30.us, align 4, !tbaa !5 %add.us = add nsw i32 %4, %2 %discoveryCost37.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv135, i32 1 %5 = load i32, ptr %discoveryCost37.us, align 4, !tbaa !5 %cmp38.us = icmp slt i32 %add.us, %5 br i1 %cmp38.us, label %if.then39.us, label %for.inc57.us if.then39.us: ; preds = %land.lhs.true27.us %discoverFrom.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv135, i32 2 store ptr %arrayidx12.us, ptr %discoverFrom.us, align 8, !tbaa !11 %6 = load ptr, ptr %arrayidx18.us, align 8, !tbaa !15 %arrayidx50.us = getelementptr inbounds i32, ptr %6, i64 %indvars.iv135 %7 = load i32, ptr %arrayidx50.us, align 4, !tbaa !16 %add51.us = add nsw i32 %7, %4 store i32 %add51.us, ptr %discoveryCost37.us, align 4, !tbaa !5 br label %for.inc57.us for.inc57.us: ; preds = %if.then39.us, %land.lhs.true27.us, %if.then22.us, %for.body16.us %8 = phi ptr [ %6, %if.then39.us ], [ %1, %land.lhs.true27.us ], [ %1, %if.then22.us ], [ %1, %for.body16.us ] %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count138 br i1 %exitcond139.not, label %for.body.us.backedge, label %for.body16.us, !llvm.loop !17 for.body.us: ; preds = %for.body.us.backedge, %while.cond.us.preheader %indvars.iv = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %u.199.us = phi i32 [ undef, %while.cond.us.preheader ], [ %u.2.us, %for.body.us.backedge ] %mincost.098.us = phi i32 [ 100008, %while.cond.us.preheader ], [ %mincost.098.us.be, %for.body.us.backedge ] %arrayidx.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv %9 = load i32, ptr %arrayidx.us, align 8, !tbaa !12 %cmp1.not.us = icmp eq i32 %9, 2 br i1 %cmp1.not.us, label %for.inc.us, label %land.lhs.true.us land.lhs.true.us: ; preds = %for.body.us %discoveryCost.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv, i32 1 %10 = load i32, ptr %discoveryCost.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %10, %mincost.098.us %spec.select.us = tail call i32 @llvm.smin.i32(i32 %10, i32 %mincost.098.us) %11 = trunc i64 %indvars.iv to i32 %spec.select96.us = select i1 %cmp4.us, i32 %11, i32 %u.199.us br label %for.inc.us for.inc.us: ; preds = %land.lhs.true.us, %for.body.us %mincost.1.us = phi i32 [ %mincost.098.us, %for.body.us ], [ %spec.select.us, %land.lhs.true.us ] %u.2.us = phi i32 [ %u.199.us, %for.body.us ], [ %spec.select96.us, %land.lhs.true.us ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end.us, label %for.body.us.backedge for.body.us.backedge: ; preds = %for.inc57.us, %for.inc.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ 0, %for.inc57.us ] %mincost.098.us.be = phi i32 [ %mincost.1.us, %for.inc.us ], [ 100008, %for.inc57.us ] br label %for.body.us, !llvm.loop !17 while.end: ; preds = %for.end.us, %initializeSingleSource.exit.thread, %initializeSingleSource.exit ret void } ; Function Attrs: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable define dso_local void @prim(ptr noundef %vertices, i32 noundef %nVertices, ptr nocapture noundef readonly %iawMatrix, i32 noundef %startingVertexIndex) local_unnamed_addr #4 { entry: %cmp15.i = icmp sgt i32 %nVertices, 0 br i1 %cmp15.i, label %for.body.preheader.i, label %initializeSingleSource.exit.thread initializeSingleSource.exit.thread: ; preds = %entry %idxprom5.i129 = sext i32 %startingVertexIndex to i64 %discoveryCost7.i130 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom5.i129, i32 1 store i32 0, ptr %discoveryCost7.i130, align 4, !tbaa !5 br label %while.end for.body.preheader.i: ; preds = %entry %wide.trip.count.i = zext i32 %nVertices to i64 %xtraiter = and i64 %wide.trip.count.i, 1 %0 = icmp eq i32 %nVertices, 1 br i1 %0, label %initializeSingleSource.exit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %wide.trip.count.i, 4294967294 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.1, %for.body.i ] %arrayidx.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i %discoveryCost.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i, i32 1 store i32 100008, ptr %discoveryCost.i, align 4, !tbaa !5 %discoverFrom.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i, i32 2 store ptr null, ptr %discoverFrom.i, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i, align 8, !tbaa !12 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %arrayidx.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i %discoveryCost.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i, i32 1 store i32 100008, ptr %discoveryCost.i.1, align 4, !tbaa !5 %discoverFrom.i.1 = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.next.i, i32 2 store ptr null, ptr %discoverFrom.i.1, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.1, align 8, !tbaa !12 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %initializeSingleSource.exit.unr-lcssa, label %for.body.i, !llvm.loop !13 initializeSingleSource.exit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %initializeSingleSource.exit, label %for.body.i.epil for.body.i.epil: ; preds = %initializeSingleSource.exit.unr-lcssa %arrayidx.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr %discoveryCost.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr, i32 1 store i32 100008, ptr %discoveryCost.i.epil, align 4, !tbaa !5 %discoverFrom.i.epil = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv.i.unr, i32 2 store ptr null, ptr %discoverFrom.i.epil, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.epil, align 8, !tbaa !12 br label %initializeSingleSource.exit initializeSingleSource.exit: ; preds = %initializeSingleSource.exit.unr-lcssa, %for.body.i.epil %idxprom5.i = sext i32 %startingVertexIndex to i64 %discoveryCost7.i = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom5.i, i32 1 store i32 0, ptr %discoveryCost7.i, align 4, !tbaa !5 br i1 %cmp15.i, label %while.cond.us.preheader, label %while.end while.cond.us.preheader: ; preds = %initializeSingleSource.exit %wide.trip.count = zext i32 %nVertices to i64 %wide.trip.count127 = zext i32 %nVertices to i64 br label %for.body.us for.end.us: ; preds = %for.inc.us %cmp8.us = icmp eq i32 %mincost.1.us, 100008 br i1 %cmp8.us, label %while.end, label %if.end10.us if.end10.us: ; preds = %for.end.us %idxprom11.us = sext i32 %u.2.us to i64 %arrayidx12.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %idxprom11.us store i32 2, ptr %arrayidx12.us, align 8, !tbaa !12 %arrayidx18.us = getelementptr inbounds ptr, ptr %iawMatrix, i64 %idxprom11.us %.pre = load ptr, ptr %arrayidx18.us, align 8, !tbaa !15 br label %for.body16.us for.body16.us: ; preds = %if.end10.us, %for.inc50.us %1 = phi ptr [ %.pre, %if.end10.us ], [ %7, %for.inc50.us ] %indvars.iv124 = phi i64 [ 0, %if.end10.us ], [ %indvars.iv.next125, %for.inc50.us ] %arrayidx20.us = getelementptr inbounds i32, ptr %1, i64 %indvars.iv124 %2 = load i32, ptr %arrayidx20.us, align 4, !tbaa !16 %cmp21.us = icmp slt i32 %2, 100008 br i1 %cmp21.us, label %if.then22.us, label %for.inc50.us if.then22.us: ; preds = %for.body16.us %arrayidx24.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv124 %3 = load i32, ptr %arrayidx24.us, align 8, !tbaa !12 %cmp26.not.us = icmp eq i32 %3, 2 br i1 %cmp26.not.us, label %for.inc50.us, label %land.lhs.true27.us land.lhs.true27.us: ; preds = %if.then22.us %discoveryCost34.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv124, i32 1 %4 = load i32, ptr %discoveryCost34.us, align 4, !tbaa !5 %cmp35.us = icmp slt i32 %2, %4 br i1 %cmp35.us, label %if.then36.us, label %for.inc50.us if.then36.us: ; preds = %land.lhs.true27.us %discoverFrom.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv124, i32 2 store ptr %arrayidx12.us, ptr %discoverFrom.us, align 8, !tbaa !11 %5 = load ptr, ptr %arrayidx18.us, align 8, !tbaa !15 %arrayidx44.us = getelementptr inbounds i32, ptr %5, i64 %indvars.iv124 %6 = load i32, ptr %arrayidx44.us, align 4, !tbaa !16 store i32 %6, ptr %discoveryCost34.us, align 4, !tbaa !5 br label %for.inc50.us for.inc50.us: ; preds = %if.then36.us, %land.lhs.true27.us, %if.then22.us, %for.body16.us %7 = phi ptr [ %5, %if.then36.us ], [ %1, %land.lhs.true27.us ], [ %1, %if.then22.us ], [ %1, %for.body16.us ] %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1 %exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count127 br i1 %exitcond128.not, label %for.body.us.backedge, label %for.body16.us, !llvm.loop !18 for.body.us: ; preds = %for.body.us.backedge, %while.cond.us.preheader %indvars.iv = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ] %u.188.us = phi i32 [ undef, %while.cond.us.preheader ], [ %u.2.us, %for.body.us.backedge ] %mincost.087.us = phi i32 [ 100008, %while.cond.us.preheader ], [ %mincost.087.us.be, %for.body.us.backedge ] %arrayidx.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv %8 = load i32, ptr %arrayidx.us, align 8, !tbaa !12 %cmp1.not.us = icmp eq i32 %8, 2 br i1 %cmp1.not.us, label %for.inc.us, label %land.lhs.true.us land.lhs.true.us: ; preds = %for.body.us %discoveryCost.us = getelementptr inbounds %struct.Vtx, ptr %vertices, i64 %indvars.iv, i32 1 %9 = load i32, ptr %discoveryCost.us, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %9, %mincost.087.us %spec.select.us = tail call i32 @llvm.smin.i32(i32 %9, i32 %mincost.087.us) %10 = trunc i64 %indvars.iv to i32 %spec.select85.us = select i1 %cmp4.us, i32 %10, i32 %u.188.us br label %for.inc.us for.inc.us: ; preds = %land.lhs.true.us, %for.body.us %mincost.1.us = phi i32 [ %mincost.087.us, %for.body.us ], [ %spec.select.us, %land.lhs.true.us ] %u.2.us = phi i32 [ %u.188.us, %for.body.us ], [ %spec.select85.us, %land.lhs.true.us ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end.us, label %for.body.us.backedge for.body.us.backedge: ; preds = %for.inc50.us, %for.inc.us %indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ 0, %for.inc50.us ] %mincost.087.us.be = phi i32 [ %mincost.1.us, %for.inc.us ], [ 100008, %for.inc50.us ] br label %for.body.us, !llvm.loop !18 while.end: ; preds = %for.end.us, %initializeSingleSource.exit.thread, %initializeSingleSource.exit ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #5 { entry: %nVertices = alloca i32, align 4 %iVertexFrom = alloca i32, align 4 %iVertexTo = alloca i32, align 4 %nEdge = alloca i32, align 4 %weight = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nVertices) #10 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nVertices) %0 = load i32, ptr %nVertices, align 4, !tbaa !16 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #11 %cmp71 = icmp sgt i32 %0, 0 br i1 %cmp71, label %for.body.us.preheader, label %entry.for.end16_crit_edge entry.for.end16_crit_edge: ; preds = %entry %.pre = zext i32 %0 to i64 br label %for.end16 for.body.us.preheader: ; preds = %entry %mul4 = shl nsw i64 %conv, 2 %wide.trip.count91 = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 %n.vec = and i64 %wide.trip.count91, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count91 br label %for.body.us for.body.us: ; preds = %for.body.us.preheader, %for.cond6.for.inc14_crit_edge.us %indvars.iv88 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next89, %for.cond6.for.inc14_crit_edge.us ] %call5.us = call noalias ptr @malloc(i64 noundef %mul4) #11 %arrayidx.us = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv88 store ptr %call5.us, ptr %arrayidx.us, align 8, !tbaa !15 br i1 %min.iters.check, label %for.body9.us.preheader, label %vector.body vector.body: ; preds = %for.body.us, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body.us ] %1 = getelementptr inbounds i32, ptr %call5.us, i64 %index store <4 x i32> <i32 100008, i32 100008, i32 100008, i32 100008>, ptr %1, align 4, !tbaa !16 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 100008, i32 100008, i32 100008, i32 100008>, ptr %2, align 4, !tbaa !16 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !19 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond6.for.inc14_crit_edge.us, label %for.body9.us.preheader for.body9.us.preheader: ; preds = %for.body.us, %middle.block %indvars.iv83.ph = phi i64 [ 0, %for.body.us ], [ %n.vec, %middle.block ] br label %for.body9.us for.body9.us: ; preds = %for.body9.us.preheader, %for.body9.us %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body9.us ], [ %indvars.iv83.ph, %for.body9.us.preheader ] %arrayidx13.us = getelementptr inbounds i32, ptr %call5.us, i64 %indvars.iv83 store i32 100008, ptr %arrayidx13.us, align 4, !tbaa !16 %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count91 br i1 %exitcond87.not, label %for.cond6.for.inc14_crit_edge.us, label %for.body9.us, !llvm.loop !22 for.cond6.for.inc14_crit_edge.us: ; preds = %for.body9.us, %middle.block %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1 %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91 br i1 %exitcond92.not, label %for.end16, label %for.body.us, !llvm.loop !23 for.end16: ; preds = %for.cond6.for.inc14_crit_edge.us, %entry.for.end16_crit_edge %.pre-phi = phi i64 [ %.pre, %entry.for.end16_crit_edge ], [ %wide.trip.count91, %for.cond6.for.inc14_crit_edge.us ] %4 = call ptr @llvm.stacksave.p0() %vla = alloca %struct.Vtx, i64 %.pre-phi, align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %iVertexFrom) #10 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %iVertexTo) #10 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nEdge) #10 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %weight) #10 %5 = load i32, ptr %nVertices, align 4, !tbaa !16 %cmp1875 = icmp sgt i32 %5, 0 br i1 %cmp1875, label %for.body20, label %for.end48 for.body20: ; preds = %for.end16, %for.inc36 %indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.inc36 ], [ 0, %for.end16 ] %key = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv93, i32 3 %6 = trunc i64 %indvars.iv93 to i32 store i32 %6, ptr %key, align 8, !tbaa !24 %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %iVertexFrom, ptr noundef nonnull %nEdge) %7 = load i32, ptr %nEdge, align 4, !tbaa !16 %cmp2573 = icmp sgt i32 %7, 0 br i1 %cmp2573, label %for.body27, label %for.inc36 for.body27: ; preds = %for.body20, %for.body27 %j.174 = phi i32 [ %inc34, %for.body27 ], [ 0, %for.body20 ] %call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %iVertexTo, ptr noundef nonnull %weight) %8 = load i32, ptr %weight, align 4, !tbaa !16 %9 = load i32, ptr %iVertexFrom, align 4, !tbaa !16 %idxprom29 = sext i32 %9 to i64 %arrayidx30 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom29 %10 = load ptr, ptr %arrayidx30, align 8, !tbaa !15 %11 = load i32, ptr %iVertexTo, align 4, !tbaa !16 %idxprom31 = sext i32 %11 to i64 %arrayidx32 = getelementptr inbounds i32, ptr %10, i64 %idxprom31 store i32 %8, ptr %arrayidx32, align 4, !tbaa !16 %inc34 = add nuw nsw i32 %j.174, 1 %12 = load i32, ptr %nEdge, align 4, !tbaa !16 %cmp25 = icmp slt i32 %inc34, %12 br i1 %cmp25, label %for.body27, label %for.inc36, !llvm.loop !25 for.inc36: ; preds = %for.body27, %for.body20 %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1 %13 = load i32, ptr %nVertices, align 4, !tbaa !16 %14 = sext i32 %13 to i64 %cmp18 = icmp slt i64 %indvars.iv.next94, %14 br i1 %cmp18, label %for.body20, label %for.end38, !llvm.loop !26 for.end38: ; preds = %for.inc36 %cmp15.i.i = icmp sgt i32 %13, 0 br i1 %cmp15.i.i, label %for.body.preheader.i.i, label %for.end48 for.body.preheader.i.i: ; preds = %for.end38 %wide.trip.count.i.i = zext i32 %13 to i64 %xtraiter = and i64 %wide.trip.count.i.i, 1 %15 = icmp eq i32 %13, 1 br i1 %15, label %while.cond.us.preheader.i.unr-lcssa, label %for.body.preheader.i.i.new for.body.preheader.i.i.new: ; preds = %for.body.preheader.i.i %unroll_iter = and i64 %wide.trip.count.i.i, 4294967294 br label %for.body.i.i for.body.i.i: ; preds = %for.body.i.i, %for.body.preheader.i.i.new %indvars.iv.i.i = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %indvars.iv.next.i.i.1, %for.body.i.i ] %niter = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %niter.next.1, %for.body.i.i ] %arrayidx.i.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i %discoveryCost.i.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i, i32 1 store i32 100008, ptr %discoveryCost.i.i, align 4, !tbaa !5 %discoverFrom.i.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i, i32 2 store ptr null, ptr %discoverFrom.i.i, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.i, align 16, !tbaa !12 %indvars.iv.next.i.i = or i64 %indvars.iv.i.i, 1 %arrayidx.i.i.1 = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.next.i.i %discoveryCost.i.i.1 = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.next.i.i, i32 1 store i32 100008, ptr %discoveryCost.i.i.1, align 4, !tbaa !5 %discoverFrom.i.i.1 = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.next.i.i, i32 2 store ptr null, ptr %discoverFrom.i.i.1, align 16, !tbaa !11 store i32 0, ptr %arrayidx.i.i.1, align 8, !tbaa !12 %indvars.iv.next.i.i.1 = add nuw nsw i64 %indvars.iv.i.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %while.cond.us.preheader.i.unr-lcssa, label %for.body.i.i, !llvm.loop !13 while.cond.us.preheader.i.unr-lcssa: ; preds = %for.body.i.i, %for.body.preheader.i.i %indvars.iv.i.i.unr = phi i64 [ 0, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i.1, %for.body.i.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %while.cond.us.preheader.i, label %for.body.i.i.epil for.body.i.i.epil: ; preds = %while.cond.us.preheader.i.unr-lcssa %arrayidx.i.i.epil = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i.unr %discoveryCost.i.i.epil = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i.unr, i32 1 store i32 100008, ptr %discoveryCost.i.i.epil, align 4, !tbaa !5 %discoverFrom.i.i.epil = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i.i.unr, i32 2 store ptr null, ptr %discoverFrom.i.i.epil, align 8, !tbaa !11 store i32 0, ptr %arrayidx.i.i.epil, align 8, !tbaa !12 br label %while.cond.us.preheader.i while.cond.us.preheader.i: ; preds = %while.cond.us.preheader.i.unr-lcssa, %for.body.i.i.epil %discoveryCost7.i.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 0, i32 1 store i32 0, ptr %discoveryCost7.i.i, align 4, !tbaa !5 br label %for.body.us.i for.end.us.i: ; preds = %for.inc.us.i %cmp8.us.i = icmp eq i32 %mincost.1.us.i, 100008 br i1 %cmp8.us.i, label %dijkstra.exit, label %if.end10.us.i if.end10.us.i: ; preds = %for.end.us.i %idxprom11.us.i = sext i32 %u.2.us.i to i64 %arrayidx12.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %idxprom11.us.i store i32 2, ptr %arrayidx12.us.i, align 8, !tbaa !12 %arrayidx18.us.i = getelementptr inbounds ptr, ptr %call1, i64 %idxprom11.us.i %discoveryCost30.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %idxprom11.us.i, i32 1 %.pre.i = load ptr, ptr %arrayidx18.us.i, align 8, !tbaa !15 br label %for.body16.us.i for.body16.us.i: ; preds = %for.inc57.us.i, %if.end10.us.i %indvars.iv135.i = phi i64 [ 0, %if.end10.us.i ], [ %indvars.iv.next136.i, %for.inc57.us.i ] %arrayidx20.us.i = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv135.i %16 = load i32, ptr %arrayidx20.us.i, align 4, !tbaa !16 %cmp21.us.i = icmp slt i32 %16, 100008 br i1 %cmp21.us.i, label %if.then22.us.i, label %for.inc57.us.i if.then22.us.i: ; preds = %for.body16.us.i %arrayidx24.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv135.i %17 = load i32, ptr %arrayidx24.us.i, align 8, !tbaa !12 %cmp26.not.us.i = icmp eq i32 %17, 2 br i1 %cmp26.not.us.i, label %for.inc57.us.i, label %land.lhs.true27.us.i land.lhs.true27.us.i: ; preds = %if.then22.us.i %18 = load i32, ptr %discoveryCost30.us.i, align 4, !tbaa !5 %add.us.i = add nsw i32 %18, %16 %discoveryCost37.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv135.i, i32 1 %19 = load i32, ptr %discoveryCost37.us.i, align 4, !tbaa !5 %cmp38.us.i = icmp slt i32 %add.us.i, %19 br i1 %cmp38.us.i, label %if.then39.us.i, label %for.inc57.us.i if.then39.us.i: ; preds = %land.lhs.true27.us.i %discoverFrom.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv135.i, i32 2 store ptr %arrayidx12.us.i, ptr %discoverFrom.us.i, align 8, !tbaa !11 store i32 %add.us.i, ptr %discoveryCost37.us.i, align 4, !tbaa !5 br label %for.inc57.us.i for.inc57.us.i: ; preds = %if.then39.us.i, %land.lhs.true27.us.i, %if.then22.us.i, %for.body16.us.i %indvars.iv.next136.i = add nuw nsw i64 %indvars.iv135.i, 1 %exitcond139.not.i = icmp eq i64 %indvars.iv.next136.i, %wide.trip.count.i.i br i1 %exitcond139.not.i, label %for.body.us.i.backedge, label %for.body16.us.i, !llvm.loop !17 for.body.us.i: ; preds = %for.body.us.i.backedge, %while.cond.us.preheader.i %indvars.iv.i = phi i64 [ 0, %while.cond.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ] %u.199.us.i = phi i32 [ undef, %while.cond.us.preheader.i ], [ %u.2.us.i, %for.body.us.i.backedge ] %mincost.098.us.i = phi i32 [ 100008, %while.cond.us.preheader.i ], [ %mincost.098.us.i.be, %for.body.us.i.backedge ] %arrayidx.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i %20 = load i32, ptr %arrayidx.us.i, align 8, !tbaa !12 %cmp1.not.us.i = icmp eq i32 %20, 2 br i1 %cmp1.not.us.i, label %for.inc.us.i, label %land.lhs.true.us.i land.lhs.true.us.i: ; preds = %for.body.us.i %discoveryCost.us.i = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv.i, i32 1 %21 = load i32, ptr %discoveryCost.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp slt i32 %21, %mincost.098.us.i %spec.select.us.i = call i32 @llvm.smin.i32(i32 %21, i32 %mincost.098.us.i) %22 = trunc i64 %indvars.iv.i to i32 %spec.select96.us.i = select i1 %cmp4.us.i, i32 %22, i32 %u.199.us.i br label %for.inc.us.i for.inc.us.i: ; preds = %land.lhs.true.us.i, %for.body.us.i %mincost.1.us.i = phi i32 [ %mincost.098.us.i, %for.body.us.i ], [ %spec.select.us.i, %land.lhs.true.us.i ] %u.2.us.i = phi i32 [ %u.199.us.i, %for.body.us.i ], [ %spec.select96.us.i, %land.lhs.true.us.i ] %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i.i br i1 %exitcond.not.i, label %for.end.us.i, label %for.body.us.i.backedge for.body.us.i.backedge: ; preds = %for.inc57.us.i, %for.inc.us.i %indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ 0, %for.inc57.us.i ] %mincost.098.us.i.be = phi i32 [ %mincost.1.us.i, %for.inc.us.i ], [ 100008, %for.inc57.us.i ] br label %for.body.us.i, !llvm.loop !17 dijkstra.exit: ; preds = %for.end.us.i br i1 %cmp15.i.i, label %for.body42, label %for.end48 for.body42: ; preds = %dijkstra.exit, %for.body42 %indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body42 ], [ 0, %dijkstra.exit ] %discoveryCost = getelementptr inbounds %struct.Vtx, ptr %vla, i64 %indvars.iv96, i32 1 %23 = load i32, ptr %discoveryCost, align 4, !tbaa !5 %24 = trunc i64 %indvars.iv96 to i32 %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24, i32 noundef %23) %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1 %25 = load i32, ptr %nVertices, align 4, !tbaa !16 %26 = sext i32 %25 to i64 %cmp40 = icmp slt i64 %indvars.iv.next97, %26 br i1 %cmp40, label %for.body42, label %for.end48, !llvm.loop !27 for.end48: ; preds = %for.body42, %for.end16, %for.end38, %dijkstra.exit call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %weight) #10 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nEdge) #10 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %iVertexTo) #10 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %iVertexFrom) #10 call void @llvm.stackrestore.p0(ptr %4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nVertices) #10 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #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) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #9 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { mustprogress nofree nounwind willreturn 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 #8 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #10 = { nounwind } attributes #11 = { nounwind allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !9, i64 4} !6 = !{!"Vtx", !7, i64 0, !9, i64 4, !10, i64 8, !9, i64 16} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!"int", !7, i64 0} !10 = !{!"any pointer", !7, i64 0} !11 = !{!6, !10, i64 8} !12 = !{!6, !7, i64 0} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = !{!10, !10, i64 0} !16 = !{!9, !9, i64 0} !17 = distinct !{!17, !14} !18 = distinct !{!18, !14} !19 = distinct !{!19, !14, !20, !21} !20 = !{!"llvm.loop.isvectorized", i32 1} !21 = !{!"llvm.loop.unroll.runtime.disable"} !22 = distinct !{!22, !14, !21, !20} !23 = distinct !{!23, !14} !24 = !{!6, !9, i64 16} !25 = distinct !{!25, !14} !26 = distinct !{!26, !14} !27 = distinct !{!27, !14}
#include <stdio.h> int main(void) { long long int a,b,n; char s[1000000]; scanf("%lld%lld%lld",&n,&a,&b); scanf("%s",s); if(s[a-1]!=s[b-1]) { printf("1"); } else { printf("0"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22231/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22231/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %n = alloca i64, align 8 %s = alloca [1000000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %0 = load i64, ptr %a, align 8, !tbaa !5 %sub = add nsw i64 %0, -1 %arrayidx = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %sub %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 %2 = load i64, ptr %b, align 8, !tbaa !5 %sub2 = add nsw i64 %2, -1 %arrayidx3 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %sub2 %3 = load i8, ptr %arrayidx3, align 1, !tbaa !9 %cmp.not = icmp eq i8 %1, %3 %. = select i1 %cmp.not, i32 48, i32 49 %putchar = call i32 @putchar(i32 %.) call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0}
#include <stdio.h> #include <string.h> int main () { int A,B; char S[15],T[15],U[15]; scanf ("%s %s",S,T); getchar(); scanf ("%d %d",&A,&B); getchar(); scanf ("%s",U); getchar(); if (strcmp(S,U)==0){ printf("%d %d",A-1,B); } else if (strcmp(T,U)==0){ printf("%d %d",A,B-1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222360/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222360/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %S = alloca [15 x i8], align 1 %T = alloca [15 x i8], align 1 %U = alloca [15 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4 call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %T) #4 call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %U) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %T) %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i = call i32 @getc(ptr noundef %0) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A, ptr noundef nonnull %B) %1 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i20 = call i32 @getc(ptr noundef %1) %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %U) %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i21 = call i32 @getc(ptr noundef %2) %call10 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %S, ptr noundef nonnull dereferenceable(1) %U) #5 %cmp = icmp eq i32 %call10, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %3 = load i32, ptr %A, align 4, !tbaa !9 %sub = add nsw i32 %3, -1 %4 = load i32, ptr %B, align 4, !tbaa !9 %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %4) br label %if.end19 if.else: ; preds = %entry %call14 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %T, ptr noundef nonnull dereferenceable(1) %U) #5 %cmp15 = icmp eq i32 %call14, 0 br i1 %cmp15, label %if.then16, label %if.end19 if.then16: ; preds = %if.else %5 = load i32, ptr %A, align 4, !tbaa !9 %6 = load i32, ptr %B, align 4, !tbaa !9 %sub17 = add nsw i32 %6, -1 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %sub17) br label %if.end19 if.end19: ; preds = %if.else, %if.then16, %if.then call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %U) #4 call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %S) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0}
#include <stdio.h> #include <string.h> #include <stdlib.h> int main (void){ char S[11],T[11],U[11]; int A,B; scanf("%s%s",S,T); scanf("%d%d",&A,&B); scanf("%s",U); if(strcmp(U,S) == 0) A--; else if(strcmp(U,T) == 0) B--; printf("%d %d\n",A,B); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222410/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222410/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\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"%s\00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [11 x i8], align 1 %T = alloca [11 x i8], align 1 %U = alloca [11 x i8], align 1 %A = alloca i32, align 4 %B = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %T) #4 call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %U) #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 %S, ptr noundef nonnull %T) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A, ptr noundef nonnull %B) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %U) %call7 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %U, ptr noundef nonnull dereferenceable(1) %S) #5 %cmp = icmp eq i32 %call7, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %0 = load i32, ptr %A, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr %A, align 4, !tbaa !5 %.pre = load i32, ptr %B, align 4, !tbaa !5 br label %if.end14 if.else: ; preds = %entry %call10 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %U, ptr noundef nonnull dereferenceable(1) %T) #5 %cmp11 = icmp eq i32 %call10, 0 %.pre16 = load i32, ptr %B, align 4, !tbaa !5 br i1 %cmp11, label %if.then12, label %if.end14 if.then12: ; preds = %if.else %dec13 = add nsw i32 %.pre16, -1 store i32 %dec13, ptr %B, align 4, !tbaa !5 br label %if.end14 if.end14: ; preds = %if.else, %if.then12, %if.then %1 = phi i32 [ %.pre16, %if.else ], [ %dec13, %if.then12 ], [ %.pre, %if.then ] %2 = load i32, ptr %A, align 4, !tbaa !5 %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2, i32 noundef %1) 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 11, ptr nonnull %U) #4 call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %S) #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 i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { char S[10], T[10], U[10]; int a, b; scanf("%s %s", S, T); scanf("%d %d", &a, &b); scanf("%s", U); if(*S==*U){ printf("%d %d", a-1, b); } else if(*T==*U){ printf("%d %d", a, b-1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222461/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222461/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [10 x i8], align 1 %T = alloca [10 x i8], align 1 %U = alloca [10 x i8], align 1 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %T) #3 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %U) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %T) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %U) %0 = load i8, ptr %S, align 1, !tbaa !5 %1 = load i8, ptr %U, align 1, !tbaa !5 %cmp = icmp eq i8 %0, %1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %2 = load i32, ptr %a, align 4, !tbaa !8 %sub = add nsw i32 %2, -1 %3 = load i32, ptr %b, align 4, !tbaa !8 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %3) br label %if.end19 if.else: ; preds = %entry %4 = load i8, ptr %T, align 1, !tbaa !5 %cmp14 = icmp eq i8 %4, %1 br i1 %cmp14, label %if.then16, label %if.end19 if.then16: ; preds = %if.else %5 = load i32, ptr %a, align 4, !tbaa !8 %6 = load i32, ptr %b, align 4, !tbaa !8 %sub17 = add nsw i32 %6, -1 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %sub17) br label %if.end19 if.end19: ; preds = %if.else, %if.then16, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %U) #3 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!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}
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define BUFSIZE 10000 int A,B; int main(void){ char hoge[BUFSIZE]; char hogehoge[BUFSIZE]; char hogehogehoge[BUFSIZE]; scanf("%s",hoge); scanf("%s",hogehoge); scanf("%d %d",&A,&B); scanf("%s",hogehogehoge); if(hoge[0]==hogehogehoge[0]){ printf("%d %d",A-1,B); }else if(hogehoge[0]==hogehogehoge[0]){ printf("%d %d",A,B-1); }else{ return 0; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222519/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222519/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [6 x i8] c"%d %d\00", align 1 @A = dso_local global i32 0, align 4 @B = dso_local global i32 0, align 4 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %hoge = alloca [10000 x i8], align 16 %hogehoge = alloca [10000 x i8], align 16 %hogehogehoge = alloca [10000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %hoge) #3 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %hogehoge) #3 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %hogehogehoge) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hoge) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hogehoge) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @A, ptr noundef nonnull @B) %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hogehogehoge) %0 = load i8, ptr %hoge, align 16, !tbaa !5 %1 = load i8, ptr %hogehogehoge, align 16, !tbaa !5 %cmp = icmp eq i8 %0, %1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %2 = load i32, ptr @A, align 4, !tbaa !8 %sub = add nsw i32 %2, -1 %3 = load i32, ptr @B, align 4, !tbaa !8 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %3) br label %cleanup if.else: ; preds = %entry %4 = load i8, ptr %hogehoge, align 16, !tbaa !5 %cmp14 = icmp eq i8 %4, %1 br i1 %cmp14, label %if.then16, label %cleanup if.then16: ; preds = %if.else %5 = load i32, ptr @A, align 4, !tbaa !8 %6 = load i32, ptr @B, align 4, !tbaa !8 %sub17 = add nsw i32 %6, -1 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %sub17) br label %cleanup cleanup: ; preds = %if.then, %if.then16, %if.else call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %hogehogehoge) #3 call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %hogehoge) #3 call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %hoge) #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 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0}
#include<stdio.h> #include<string.h> char a[20],b[20]; int c, d; char e[20]; int main() { scanf("%s", a); scanf("%s", b); scanf("%d %d", &c, &d); scanf("%s", e); int flag=0,i; for (i = 0;i<=strlen(b); i++) { if (b[i] != e[i]) break; } if (i == strlen(b) + 1) flag = 1; if (flag == 0) { printf("%d %d", --c, d); } else { printf("%d %d", c, --d); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222591/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222591/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @a = dso_local global [20 x i8] zeroinitializer, align 16 @b = dso_local global [20 x i8] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @c = dso_local global i32 0, align 4 @d = dso_local global i32 0, align 4 @e = dso_local global [20 x i8] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a) %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @b) %call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @c, ptr noundef nonnull @d) %call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @e) %call4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @b) #3 %0 = add i64 %call4, 1 br label %for.body for.cond: ; preds = %for.body %indvars.iv.next = add nuw i64 %indvars.iv, 1 %exitcond = icmp eq i64 %indvars.iv, %call4 br i1 %exitcond, label %if.else, label %for.body, !llvm.loop !5 for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [20 x i8], ptr @b, i64 0, i64 %indvars.iv %1 = load i8, ptr %arrayidx, align 1, !tbaa !7 %arrayidx8 = getelementptr inbounds [20 x i8], ptr @e, i64 0, i64 %indvars.iv %2 = load i8, ptr %arrayidx8, align 1, !tbaa !7 %cmp10.not = icmp eq i8 %1, %2 br i1 %cmp10.not, label %for.cond, label %for.end for.end: ; preds = %for.body %cmp14.not = icmp eq i64 %0, %indvars.iv br i1 %cmp14.not, label %if.else, label %if.then20 if.then20: ; preds = %for.end %3 = load i32, ptr @c, align 4, !tbaa !10 %dec = add nsw i32 %3, -1 store i32 %dec, ptr @c, align 4, !tbaa !10 %4 = load i32, ptr @d, align 4, !tbaa !10 %call21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %dec, i32 noundef %4) br label %if.end24 if.else: ; preds = %for.cond, %for.end %5 = load i32, ptr @c, align 4, !tbaa !10 %6 = load i32, ptr @d, align 4, !tbaa !10 %dec22 = add nsw i32 %6, -1 store i32 %dec22, ptr @d, align 4, !tbaa !10 %call23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %dec22) br label %if.end24 if.end24: ; preds = %if.else, %if.then20 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!11, !11, i64 0} !11 = !{!"int", !8, i64 0}
#include <stdio.h> #include <string.h> int main(void){ int a,b; char s[10],t[10],u[10]; scanf("%s%s",s,t); scanf("%d%d",&a,&b); scanf("%s",u); if(strcmp(s,u)==0){ printf("%d\t%d",a-1,b); } else if(strcmp(t,u)==0){ printf("%d\t%d",a,b-1); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222634/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222634/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\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"%s\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"%d\09%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %s = alloca [10 x i8], align 1 %t = alloca [10 x i8], align 1 %u = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %u) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u) %call7 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %u) #5 %cmp = icmp eq i32 %call7, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %0 = load i32, ptr %a, align 4, !tbaa !5 %sub = add nsw i32 %0, -1 %1 = load i32, ptr %b, align 4, !tbaa !5 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub, i32 noundef %1) br label %if.end16 if.else: ; preds = %entry %call11 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %t, ptr noundef nonnull dereferenceable(1) %u) #5 %cmp12 = icmp eq i32 %call11, 0 br i1 %cmp12, label %if.then13, label %if.end16 if.then13: ; preds = %if.else %2 = load i32, ptr %a, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %sub14 = add nsw i32 %3, -1 %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2, i32 noundef %sub14) br label %if.end16 if.end16: ; preds = %if.else, %if.then13, %if.then call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %u) #4 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 10, 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 i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ char S[10], T[10], U[10]; int A,B; scanf("%s",&S); scanf("%s",&T); scanf("%d",&A); scanf("%d",&B); scanf("%s",&U); if(strcmp(S,U) == 0){ printf("%d %d",A-1, B); } else{ printf("%d %d",A, B-1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222685/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222685/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @.str.2 = 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: %S = alloca [10 x i8], align 1 %T = alloca [10 x i8], align 1 %U = alloca [10 x i8], align 1 %A = alloca i32, align 4 %B = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %T) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %U) #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 %S) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %B) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %U) %call6 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %S, ptr noundef nonnull dereferenceable(1) %U) #5 %cmp = icmp eq i32 %call6, 0 %0 = load i32, ptr %A, align 4, !tbaa !5 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %sub = add nsw i32 %0, -1 %1 = load i32, ptr %B, align 4, !tbaa !5 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub, i32 noundef %1) br label %if.end if.else: ; preds = %entry %2 = load i32, ptr %B, align 4, !tbaa !5 %sub8 = add nsw i32 %2, -1 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %0, i32 noundef %sub8) br label %if.end if.end: ; preds = %if.else, %if.then 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 10, ptr nonnull %U) #4 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #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 i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } attributes #5 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int n,sum,i; sum = 0; while(1){ scanf("%d",&n); if(n == 0) break; for(i=1;i*i <= n;i++){ if(n % i == 0){ if(i == 1) sum = 1; else if(n == i * i) sum += i; else sum += (i+(n / i)); } } if(n == 1) sum = 0; if(n == sum) printf("perfect number\n"); if(n > sum) printf("deficient number\n"); if(n < sum) printf("abundant number\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222771/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222771/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [15 x i8] c"perfect number\00", align 1 @str.4 = private unnamed_addr constant [17 x i8] c"deficient number\00", align 1 @str.5 = private unnamed_addr constant [16 x i8] c"abundant number\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 %call49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp50 = icmp eq i32 %0, 0 br i1 %cmp50, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %if.end29 %1 = phi i32 [ %4, %if.end29 ], [ %0, %entry ] %sum.051 = phi i32 [ %spec.select, %if.end29 ], [ 0, %entry ] %cmp1.not45 = icmp slt i32 %1, 1 br i1 %cmp1.not45, label %for.end, label %for.inc.peel for.inc.peel: ; preds = %for.cond.preheader %cmp1.not.peel = icmp ult i32 %1, 4 br i1 %cmp1.not.peel, label %for.end, label %for.body for.body: ; preds = %for.inc.peel, %for.inc %mul48 = phi i32 [ %mul, %for.inc ], [ 4, %for.inc.peel ] %i.047 = phi i32 [ %inc, %for.inc ], [ 2, %for.inc.peel ] %sum.146 = phi i32 [ %sum.2, %for.inc ], [ 1, %for.inc.peel ] %rem = srem i32 %1, %i.047 %div = sdiv i32 %1, %i.047 %cmp2 = icmp eq i32 %rem, 0 br i1 %cmp2, label %if.else, label %for.inc if.else: ; preds = %for.body %cmp7 = icmp eq i32 %1, %mul48 br i1 %cmp7, label %if.then8, label %if.else9 if.then8: ; preds = %if.else %add = add nsw i32 %i.047, %sum.146 br label %for.inc if.else9: ; preds = %if.else %add10 = add i32 %i.047, %sum.146 %add11 = add i32 %add10, %div br label %for.inc for.inc: ; preds = %for.body, %if.then8, %if.else9 %sum.2 = phi i32 [ %add, %if.then8 ], [ %add11, %if.else9 ], [ %sum.146, %for.body ] %inc = add nuw nsw i32 %i.047, 1 %mul = mul nsw i32 %inc, %inc %cmp1.not = icmp sgt i32 %mul, %1 br i1 %cmp1.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %for.inc, %for.inc.peel, %for.cond.preheader %sum.1.lcssa = phi i32 [ %sum.051, %for.cond.preheader ], [ 1, %for.inc.peel ], [ %sum.2, %for.inc ] %cmp15 = icmp eq i32 %1, 1 %spec.select = select i1 %cmp15, i32 0, i32 %sum.1.lcssa %cmp18 = icmp eq i32 %1, %spec.select br i1 %cmp18, label %if.then19, label %if.end21 if.then19: ; preds = %for.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %if.end21 if.end21: ; preds = %if.then19, %for.end %2 = phi i32 [ %.pre, %if.then19 ], [ %1, %for.end ] %cmp22 = icmp sgt i32 %2, %spec.select br i1 %cmp22, label %if.then23, label %if.end25 if.then23: ; preds = %if.end21 %puts43 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) %.pre53 = load i32, ptr %n, align 4, !tbaa !5 br label %if.end25 if.end25: ; preds = %if.then23, %if.end21 %3 = phi i32 [ %.pre53, %if.then23 ], [ %2, %if.end21 ] %cmp26 = icmp slt i32 %3, %spec.select br i1 %cmp26, label %if.then27, label %if.end29 if.then27: ; preds = %if.end25 %puts44 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5) br label %if.end29 if.end29: ; preds = %if.then27, %if.end25 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %4, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %if.end29, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress 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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(void){ int A[1000][999], N, days = 0, impo = 0; int count[1000] = {}, endsum = 0; scanf("%d\n",&N); for(int i = 0; i < N; i++) { for(int j = 0; j < N-1; j++) { scanf("%d",&A[i][j]); } } while(impo == 0 && endsum < N) { days++; int flag[1000] = {}; impo = 1; for(int i = 0; i < N; i++) { if(flag[i] == 0 && count[i] < N-1) { int aite = A[i][count[i]]; //printf("aite is %d\n",aite); //printf("aite loves %d\n",A[aite-1][count[aite-1]]); if(A[aite-1][count[aite-1]] == i+1 && flag[aite-1] == 0) { //printf("authorize [%d, %d]\n",i+1,aite); impo = 0; flag[i] = 1; if(++count[i] == N-1) { //printf("%d ended\n", i+1); endsum++; } flag[aite-1] = 1; if(++count[aite-1] == N-1) { //printf("%d ended\n", aite); endsum++; } } } } } printf("%d\n",(impo==1)? -1:days); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222836/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222836/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca [1000 x [999 x i32]], align 16 %N = alloca i32, align 4 %count = alloca [1000 x i32], align 16 %flag = alloca [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 3996000, ptr nonnull %A) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %count) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %count, i8 0, i64 4000, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4 %cmp100 = icmp sgt i32 %0, 0 br i1 %cmp100, label %for.cond1.preheader.lr.ph, label %while.end for.cond1.preheader.lr.ph: ; preds = %entry %.not = icmp eq i32 %0, 1 br i1 %.not, label %while.body.lr.ph, label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.cleanup3 %1 = phi i32 [ %13, %for.cond.cleanup3 ], [ %0, %for.cond1.preheader.lr.ph ] %indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.cond.cleanup3 ], [ 0, %for.cond1.preheader.lr.ph ] %cmp298 = icmp sgt i32 %1, 1 br i1 %cmp298, label %for.body4, label %for.cond.cleanup3 while.cond.preheader: ; preds = %for.cond.cleanup3 %cmp12108 = icmp sgt i32 %13, 0 br i1 %cmp12108, label %while.body.lr.ph, label %while.end while.body.lr.ph: ; preds = %for.cond1.preheader.lr.ph, %while.cond.preheader %.lcssa127 = phi i32 [ %13, %while.cond.preheader ], [ 1, %for.cond1.preheader.lr.ph ] %sub24 = add nsw i32 %.lcssa127, -1 %2 = add nsw i32 %.lcssa127, -2 %wide.trip.count = zext i32 %.lcssa127 to i64 br label %while.body.us while.body.us: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.us, %while.body.lr.ph %days.0110.us = phi i32 [ 0, %while.body.lr.ph ], [ %inc13.us, %for.cond15.for.cond.cleanup17_crit_edge.us ] %endsum.0109.us = phi i32 [ 0, %while.body.lr.ph ], [ %endsum.4.us, %for.cond15.for.cond.cleanup17_crit_edge.us ] call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %flag) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %flag, i8 0, i64 4000, i1 false) br label %for.body18.us for.body18.us: ; preds = %while.body.us, %for.inc70.us %indvars.iv121 = phi i64 [ 0, %while.body.us ], [ %indvars.iv.next122, %for.inc70.us ] %endsum.1104.us = phi i32 [ %endsum.0109.us, %while.body.us ], [ %endsum.4.us, %for.inc70.us ] %impo.1103.us = phi i32 [ 1, %while.body.us ], [ %impo.3.us, %for.inc70.us ] %arrayidx20.us = getelementptr inbounds [1000 x i32], ptr %flag, i64 0, i64 %indvars.iv121 %3 = load i32, ptr %arrayidx20.us, align 4, !tbaa !5 %cmp21.us = icmp eq i32 %3, 0 br i1 %cmp21.us, label %land.lhs.true.us, label %for.inc70.us land.lhs.true.us: ; preds = %for.body18.us %arrayidx23.us = getelementptr inbounds [1000 x i32], ptr %count, i64 0, i64 %indvars.iv121 %4 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5 %cmp25.us = icmp slt i32 %4, %sub24 br i1 %cmp25.us, label %if.then.us, label %for.inc70.us if.then.us: ; preds = %land.lhs.true.us %idxprom30.us = sext i32 %4 to i64 %arrayidx31.us = getelementptr inbounds [1000 x [999 x i32]], ptr %A, i64 0, i64 %indvars.iv121, i64 %idxprom30.us %5 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5 %sub32.us = add nsw i32 %5, -1 %idxprom33.us = sext i32 %sub32.us to i64 %arrayidx37.us = getelementptr inbounds [1000 x i32], ptr %count, i64 0, i64 %idxprom33.us %6 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5 %idxprom38.us = sext i32 %6 to i64 %arrayidx39.us = getelementptr inbounds [1000 x [999 x i32]], ptr %A, i64 0, i64 %idxprom33.us, i64 %idxprom38.us %7 = load i32, ptr %arrayidx39.us, align 4, !tbaa !5 %8 = add nuw nsw i64 %indvars.iv121, 1 %9 = zext i32 %7 to i64 %cmp40.us = icmp eq i64 %8, %9 br i1 %cmp40.us, label %land.lhs.true41.us, label %for.inc70.us land.lhs.true41.us: ; preds = %if.then.us %arrayidx44.us = getelementptr inbounds [1000 x i32], ptr %flag, i64 0, i64 %idxprom33.us %10 = load i32, ptr %arrayidx44.us, align 4, !tbaa !5 %cmp45.us = icmp eq i32 %10, 0 br i1 %cmp45.us, label %if.then46.us, label %for.inc70.us if.then46.us: ; preds = %land.lhs.true41.us store i32 1, ptr %arrayidx20.us, align 4, !tbaa !5 %inc51.us = add nsw i32 %4, 1 store i32 %inc51.us, ptr %arrayidx23.us, align 4, !tbaa !5 %cmp53.us = icmp eq i32 %4, %2 %inc55.us = zext i1 %cmp53.us to i32 %spec.select.us = add nsw i32 %endsum.1104.us, %inc55.us store i32 1, ptr %arrayidx44.us, align 4, !tbaa !5 %11 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5 %inc62.us = add nsw i32 %11, 1 store i32 %inc62.us, ptr %arrayidx37.us, align 4, !tbaa !5 %cmp64.us = icmp eq i32 %11, %2 %inc66.us = zext i1 %cmp64.us to i32 %spec.select96.us = add nsw i32 %spec.select.us, %inc66.us br label %for.inc70.us for.inc70.us: ; preds = %if.then46.us, %land.lhs.true41.us, %if.then.us, %land.lhs.true.us, %for.body18.us %impo.3.us = phi i32 [ %impo.1103.us, %land.lhs.true.us ], [ %impo.1103.us, %for.body18.us ], [ %impo.1103.us, %land.lhs.true41.us ], [ %impo.1103.us, %if.then.us ], [ 0, %if.then46.us ] %endsum.4.us = phi i32 [ %endsum.1104.us, %land.lhs.true.us ], [ %endsum.1104.us, %for.body18.us ], [ %endsum.1104.us, %land.lhs.true41.us ], [ %endsum.1104.us, %if.then.us ], [ %spec.select96.us, %if.then46.us ] %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1 %exitcond.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count br i1 %exitcond.not, label %for.cond15.for.cond.cleanup17_crit_edge.us, label %for.body18.us, !llvm.loop !9 for.cond15.for.cond.cleanup17_crit_edge.us: ; preds = %for.inc70.us %inc13.us = add nuw nsw i32 %days.0110.us, 1 call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %flag) #4 %cmp11.us = icmp eq i32 %impo.3.us, 0 %cmp12.us = icmp slt i32 %endsum.4.us, %.lcssa127 %12 = select i1 %cmp11.us, i1 %cmp12.us, i1 false br i1 %12, label %while.body.us, label %while.end.loopexit, !llvm.loop !11 for.cond.cleanup3: ; preds = %for.body4, %for.cond1.preheader %13 = phi i32 [ %1, %for.cond1.preheader ], [ %15, %for.body4 ] %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %14 = sext i32 %13 to i64 %cmp = icmp slt i64 %indvars.iv.next119, %14 br i1 %cmp, label %for.cond1.preheader, label %while.cond.preheader, !llvm.loop !12 for.body4: ; preds = %for.cond1.preheader, %for.body4 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond1.preheader ] %arrayidx6 = getelementptr inbounds [1000 x [999 x i32]], ptr %A, i64 0, i64 %indvars.iv118, i64 %indvars.iv %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %15 = load i32, ptr %N, align 4 %sub = add nsw i32 %15, -1 %16 = sext i32 %sub to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %16 br i1 %cmp2, label %for.body4, label %for.cond.cleanup3, !llvm.loop !14 while.end.loopexit: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.us %17 = icmp eq i32 %impo.3.us, 1 %18 = select i1 %17, i32 -1, i32 %inc13.us br label %while.end while.end: ; preds = %entry, %while.end.loopexit, %while.cond.preheader %impo.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %18, %while.end.loopexit ], [ 0, %entry ] %call74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %impo.0.lcssa) call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %count) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.end.p0(i64 3996000, ptr nonnull %A) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: 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 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13} !13 = !{!"llvm.loop.unswitch.partial.disable"} !14 = distinct !{!14, !10}
#include<stdio.h> #include<math.h> int main() { long long int n,sum=0,odd=0,val,min=pow(10,10),i; scanf("%lld",&n); for(i=0;i<n;i++) { scanf("%lld",&val); sum+=val; if(val%2==1) { odd++; if(val<min) { min=val; } } } if(odd%2==1) { sum-=min; } printf("%lld",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22288/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22288/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %val = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %val) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp23 = icmp sgt i64 %0, 0 br i1 %cmp23, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.027 = phi i64 [ %inc10, %for.body ], [ 0, %entry ] %min.026 = phi i64 [ %min.1, %for.body ], [ 10000000000, %entry ] %odd.025 = phi i64 [ %odd.1, %for.body ], [ 0, %entry ] %sum.024 = phi i64 [ %add, %for.body ], [ 0, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %val) %1 = load i64, ptr %val, align 8, !tbaa !5 %add = add nsw i64 %1, %sum.024 %2 = and i64 %1, -9223372036854775807 %cmp4 = icmp eq i64 %2, 1 %spec.select = call i64 @llvm.smin.i64(i64 %1, i64 %min.026) %inc = zext i1 %cmp4 to i64 %odd.1 = add nuw nsw i64 %odd.025, %inc %min.1 = select i1 %cmp4, i64 %spec.select, i64 %min.026 %inc10 = add nuw nsw i64 %i.027, 1 %3 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc10, %3 br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9 for.end.loopexit: ; preds = %for.body %4 = and i64 %odd.1, 1 %5 = icmp eq i64 %4, 0 %6 = select i1 %5, i64 0, i64 %min.1 %7 = sub nsw i64 %add, %6 br label %for.end for.end: ; preds = %for.end.loopexit, %entry %spec.select22 = phi i64 [ 0, %entry ], [ %7, %for.end.loopexit ] %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %spec.select22) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %val) #4 call void @llvm.lifetime.end.p0(i64 8, 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 i64 @llvm.smin.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */ /* رَّبِّ زِدْنِى عِلْمًا */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #define OUTPUT freopen("myfile.txt","w",stdout); #define INPUT freopen("input.txt","r",stdin); #define pi acos(-1.0) #define MAX 100005 #define MOD 1000000007 #define EPS 1e-9 int grid[1005][1005]; int main () { int N,i,j,x,y,start; long long int ans=0,diag_count; scanf("%d",&N); while(N--) { scanf("%d%d",&x,&y); grid[x][y]=1; } for(i=1;i<=1000;i++) { x=i; y=1; if(grid[x][y]==1) diag_count=1; else diag_count=0; for(j=1;j<=1000;j++) { if((x+j>1000)||(y+j>1000)) break; if(grid[x+j][y+j]==1) diag_count++; } ans+=(diag_count*(diag_count-1))/2; } for(i=2;i<=1000;i++) { y=i; x=1; if(grid[x][y]==1) diag_count=1; else diag_count=0; for(j=1;j<=1000;j++) { if((x+j>1000)||(y+j>1000)) break; if(grid[x+j][y+j]==1) diag_count++; } ans+=(diag_count*(diag_count-1))/2; } for(i=1000;i>0;i--) { x=i; y=1; if(grid[x][y]==1) diag_count=1; else diag_count=0; for(j=1;j<=1000;j++) { if((x-j<1)||(y+j>1000)) break; if(grid[x-j][y+j]==1) diag_count++; } ans+=(diag_count*(diag_count-1))/2; } for(i=2;i<=1000;i++) { y=i; x=1000; if(grid[x][y]==1) diag_count=1; else diag_count=0; for(j=1;j<=1000;j++) { if((x-j<1)||(y+j>1000)) break; if(grid[x-j][y+j]==1) diag_count++; } ans+=(diag_count*(diag_count-1))/2; } printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22293/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22293/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @grid = dso_local local_unnamed_addr global [1005 x [1005 x i32]] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %dec211 = add nsw i32 %0, -1 store i32 %dec211, ptr %N, align 4, !tbaa !5 %tobool.not212 = icmp eq i32 %0, 0 br i1 %tobool.not212, label %for.body.preheader, label %while.body while.body: ; preds = %entry, %while.body %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %1 = load i32, ptr %x, align 4, !tbaa !5 %idxprom = sext i32 %1 to i64 %2 = load i32, ptr %y, align 4, !tbaa !5 %idxprom2 = sext i32 %2 to i64 %arrayidx3 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %idxprom, i64 %idxprom2 store i32 1, ptr %arrayidx3, align 4, !tbaa !5 %3 = load i32, ptr %N, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %N, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 br i1 %tobool.not, label %for.body.preheader, label %while.body, !llvm.loop !9 for.body.preheader: ; preds = %while.body, %entry br label %for.body for.body: ; preds = %for.body.preheader, %for.end %indvars.iv249 = phi i64 [ %indvars.iv.next250, %for.end ], [ 1, %for.body.preheader ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.end ], [ 2, %for.body.preheader ] %ans.0220 = phi i64 [ %add27, %for.end ], [ 0, %for.body.preheader ] %arrayidx7 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv249, i64 1 %4 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp8 = icmp eq i32 %4, 1 %. = zext i1 %cmp8 to i64 %cmp12214 = icmp ugt i64 %indvars.iv249, 999 br i1 %cmp12214, label %for.end, label %if.end16 if.end16: ; preds = %for.body, %if.end16 %indvars.iv243 = phi i64 [ %indvars.iv.next244, %if.end16 ], [ 1, %for.body ] %indvars.iv241 = phi i64 [ %indvars.iv.next242, %if.end16 ], [ %indvars.iv, %for.body ] %diag_count.1216 = phi i64 [ %spec.select, %if.end16 ], [ %., %for.body ] %indvars.iv.next244 = add nuw nsw i64 %indvars.iv243, 1 %arrayidx22 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv241, i64 %indvars.iv.next244 %5 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %cmp23 = icmp eq i32 %5, 1 %inc = zext i1 %cmp23 to i64 %spec.select = add nuw nsw i64 %diag_count.1216, %inc %6 = add nuw nsw i64 %indvars.iv.next244, %indvars.iv249 %indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1 %cmp12 = icmp ugt i64 %6, 1000 %cmp14 = icmp ugt i64 %indvars.iv243, 998 %or.cond = or i1 %cmp14, %cmp12 br i1 %or.cond, label %for.end, label %if.end16, !llvm.loop !11 for.end: ; preds = %if.end16, %for.body %diag_count.1.lcssa = phi i64 [ %., %for.body ], [ %spec.select, %if.end16 ] %sub = add nsw i64 %diag_count.1.lcssa, -1 %mul = mul nsw i64 %sub, %diag_count.1.lcssa %div = sdiv i64 %mul, 2 %add27 = add nsw i64 %div, %ans.0220 %indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next250, 1001 br i1 %exitcond.not, label %for.body33, label %for.body, !llvm.loop !12 for.body33: ; preds = %for.end, %for.end64 %indvars.iv266 = phi i64 [ %indvars.iv.next267, %for.end64 ], [ 2, %for.end ] %indvars.iv264 = phi i64 [ %indvars.iv.next265, %for.end64 ], [ 999, %for.end ] %ans.1226 = phi i64 [ %add68, %for.end64 ], [ %add27, %for.end ] %arrayidx37 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 1, i64 %indvars.iv266 %7 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %cmp38 = icmp eq i32 %7, 1 %.204 = zext i1 %cmp38 to i64 br label %lor.lhs.false47 lor.lhs.false47: ; preds = %if.end51.1, %for.body33 %indvars.iv254 = phi i64 [ 1, %for.body33 ], [ %indvars.iv.next255.1, %if.end51.1 ] %indvars.iv252 = phi i64 [ 2, %for.body33 ], [ %indvars.iv.next253.1, %if.end51.1 ] %diag_count.4222 = phi i64 [ %.204, %for.body33 ], [ %spec.select205.1, %if.end51.1 ] %exitcond262 = icmp eq i64 %indvars.iv254, %indvars.iv264 br i1 %exitcond262, label %for.end64, label %if.end51 if.end51: ; preds = %lor.lhs.false47 %8 = add nuw nsw i64 %indvars.iv254, %indvars.iv266 %indvars.iv.next255 = add nuw nsw i64 %indvars.iv254, 1 %arrayidx57 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv252, i64 %8 %9 = load i32, ptr %arrayidx57, align 4, !tbaa !5 %cmp58 = icmp eq i32 %9, 1 %inc60 = zext i1 %cmp58 to i64 %spec.select205 = add nuw nsw i64 %diag_count.4222, %inc60 %exitcond263 = icmp eq i64 %indvars.iv.next255, 1000 %exitcond262.1 = icmp eq i64 %indvars.iv.next255, %indvars.iv264 %or.cond304 = or i1 %exitcond263, %exitcond262.1 br i1 %or.cond304, label %for.end64, label %if.end51.1, !llvm.loop !13 if.end51.1: ; preds = %if.end51 %indvars.iv.next253 = or i64 %indvars.iv252, 1 %10 = add nuw nsw i64 %indvars.iv.next255, %indvars.iv266 %indvars.iv.next255.1 = add nuw nsw i64 %indvars.iv254, 2 %arrayidx57.1 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv.next253, i64 %10 %11 = load i32, ptr %arrayidx57.1, align 4, !tbaa !5 %cmp58.1 = icmp eq i32 %11, 1 %inc60.1 = zext i1 %cmp58.1 to i64 %spec.select205.1 = add nuw nsw i64 %spec.select205, %inc60.1 %indvars.iv.next253.1 = add nuw nsw i64 %indvars.iv252, 2 br label %lor.lhs.false47 for.end64: ; preds = %if.end51, %lor.lhs.false47 %diag_count.4.lcssa = phi i64 [ %spec.select205, %if.end51 ], [ %diag_count.4222, %lor.lhs.false47 ] %sub65 = add nsw i64 %diag_count.4.lcssa, -1 %mul66 = mul nsw i64 %sub65, %diag_count.4.lcssa %div67 = sdiv i64 %mul66, 2 %add68 = add nsw i64 %div67, %ans.1226 %indvars.iv.next267 = add nuw nsw i64 %indvars.iv266, 1 %indvars.iv.next265 = add nsw i64 %indvars.iv264, -1 %exitcond271.not = icmp eq i64 %indvars.iv.next267, 1001 br i1 %exitcond271.not, label %for.body74, label %for.body33, !llvm.loop !14 for.cond113.preheader: ; preds = %for.end105 store i32 1000, ptr %x, align 4, !tbaa !5 br label %for.body115 for.body74: ; preds = %for.end64, %for.end105 %indvars.iv282 = phi i64 [ %indvars.iv.next283, %for.end105 ], [ 1000, %for.end64 ] %indvars.iv272 = phi i64 [ %indvars.iv.next273, %for.end105 ], [ 999, %for.end64 ] %ans.2235 = phi i64 [ %add109, %for.end105 ], [ %add68, %for.end64 ] %arrayidx78 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv282, i64 1 %12 = load i32, ptr %arrayidx78, align 4, !tbaa !5 %cmp79 = icmp eq i32 %12, 1 %.206 = zext i1 %cmp79 to i64 %cmp87228 = icmp ult i64 %indvars.iv282, 2 br i1 %cmp87228, label %for.end105, label %if.end92 if.end92: ; preds = %for.body74, %if.end92 %indvars.iv276 = phi i64 [ %indvars.iv.next277, %if.end92 ], [ 1, %for.body74 ] %indvars.iv274 = phi i64 [ %indvars.iv.next275, %if.end92 ], [ %indvars.iv272, %for.body74 ] %diag_count.7230 = phi i64 [ %spec.select207, %if.end92 ], [ %.206, %for.body74 ] %indvars.iv.next277 = add nuw nsw i64 %indvars.iv276, 1 %arrayidx98 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %indvars.iv274, i64 %indvars.iv.next277 %13 = load i32, ptr %arrayidx98, align 4, !tbaa !5 %cmp99 = icmp eq i32 %13, 1 %inc101 = zext i1 %cmp99 to i64 %spec.select207 = add nuw nsw i64 %diag_count.7230, %inc101 %indvars.iv.next275 = add nsw i64 %indvars.iv274, -1 %cmp87 = icmp sle i64 %indvars.iv282, %indvars.iv.next277 %cmp90 = icmp ugt i64 %indvars.iv276, 998 %or.cond210 = or i1 %cmp90, %cmp87 br i1 %or.cond210, label %for.end105, label %if.end92, !llvm.loop !15 for.end105: ; preds = %if.end92, %for.body74 %diag_count.7.lcssa = phi i64 [ %.206, %for.body74 ], [ %spec.select207, %if.end92 ] %sub106 = add nsw i64 %diag_count.7.lcssa, -1 %mul107 = mul nsw i64 %sub106, %diag_count.7.lcssa %div108 = sdiv i64 %mul107, 2 %add109 = add nsw i64 %div108, %ans.2235 %indvars.iv.next283 = add nsw i64 %indvars.iv282, -1 %cmp73 = icmp ugt i64 %indvars.iv282, 1 %indvars.iv.next273 = add nsw i64 %indvars.iv272, -1 br i1 %cmp73, label %for.body74, label %for.cond113.preheader, !llvm.loop !16 for.body115: ; preds = %for.cond113.preheader, %for.end146 %indvars.iv295 = phi i64 [ 2, %for.cond113.preheader ], [ %indvars.iv.next296, %for.end146 ] %indvars.iv293 = phi i64 [ 999, %for.cond113.preheader ], [ %indvars.iv.next294, %for.end146 ] %ans.3240 = phi i64 [ %add109, %for.cond113.preheader ], [ %add150, %for.end146 ] %arrayidx119 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 1000, i64 %indvars.iv295 %14 = load i32, ptr %arrayidx119, align 4, !tbaa !5 %cmp120 = icmp eq i32 %14, 1 %.208 = zext i1 %cmp120 to i64 %exitcond292301 = icmp eq i64 %indvars.iv293, 1 br i1 %exitcond292301, label %for.end146, label %if.end133 if.end133: ; preds = %for.body115, %if.end133 %diag_count.10237303 = phi i64 [ %spec.select209, %if.end133 ], [ %.208, %for.body115 ] %indvars.iv285302 = phi i64 [ %indvars.iv.next286, %if.end133 ], [ 1, %for.body115 ] %15 = sub nuw nsw i64 1000, %indvars.iv285302 %16 = add nuw nsw i64 %indvars.iv285302, %indvars.iv295 %arrayidx139 = getelementptr inbounds [1005 x [1005 x i32]], ptr @grid, i64 0, i64 %15, i64 %16 %17 = load i32, ptr %arrayidx139, align 4, !tbaa !5 %cmp140 = icmp eq i32 %17, 1 %inc142 = zext i1 %cmp140 to i64 %spec.select209 = add nuw nsw i64 %diag_count.10237303, %inc142 %indvars.iv.next286 = add nuw nsw i64 %indvars.iv285302, 1 %exitcond292 = icmp eq i64 %indvars.iv.next286, %indvars.iv293 br i1 %exitcond292, label %for.end146, label %if.end133 for.end146: ; preds = %if.end133, %for.body115 %diag_count.10237.lcssa = phi i64 [ %.208, %for.body115 ], [ %spec.select209, %if.end133 ] %sub147 = add nsw i64 %diag_count.10237.lcssa, -1 %mul148 = mul nsw i64 %sub147, %diag_count.10237.lcssa %div149 = sdiv i64 %mul148, 2 %add150 = add nsw i64 %div149, %ans.3240 %indvars.iv.next296 = add nuw nsw i64 %indvars.iv295, 1 %indvars.iv.next294 = add nsw i64 %indvars.iv293, -1 %exitcond300.not = icmp eq i64 %indvars.iv.next296, 1001 br i1 %exitcond300.not, label %for.end153, label %for.body115, !llvm.loop !17 for.end153: ; preds = %for.end146 store i32 1000, ptr %y, align 4, !tbaa !5 %call154 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add150) 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 %N) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10}
#include <stdio.h> int main(){ int n; scanf("%d", &n); while(n >0){ n = n - 1000; } printf("%d\n", n * -1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222973/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222973/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %.pr = load i32, ptr %n, align 4, !tbaa !5 %cmp2 = icmp sgt i32 %.pr, 0 br i1 %cmp2, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %entry %0 = add nuw i32 %.pr, 999 %smin = call i32 @llvm.smin.i32(i32 %.pr, i32 1000) %1 = sub nuw i32 %0, %smin %.fr = freeze i32 %1 %2 = urem i32 %.fr, 1000 %.neg = sub i32 %2, %.fr %3 = add nsw i32 %.pr, -1000 %4 = add i32 %.neg, %3 store i32 %4, ptr %n, align 4, !tbaa !5 br label %while.end while.end: ; preds = %while.body.preheader, %entry %.lcssa = phi i32 [ %4, %while.body.preheader ], [ %.pr, %entry ] %mul = sub nsw i32 0, %.lcssa %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int N; scanf("%d", &N); if (!(1 <= N && N <= 10000)) { fprintf(stderr, "ERROR\n"); return 1; } if (N%1000 == 0) printf("%d\n", N%1000); else printf("%d", 1000-(N%1000)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223015/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223015/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @stderr = external local_unnamed_addr global ptr, align 8 @.str.1 = private unnamed_addr constant [7 x i8] c"ERROR\0A\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4 %1 = add i32 %0, -1 %or.cond = icmp ult i32 %1, 10000 br i1 %or.cond, label %if.end, label %if.then if.then: ; preds = %entry %2 = load ptr, ptr @stderr, align 8, !tbaa !5 %3 = call i64 @fwrite(ptr nonnull @.str.1, i64 6, i64 1, ptr %2) #5 br label %cleanup if.end: ; preds = %entry %rem.lhs.trunc = trunc i32 %0 to i16 %rem10 = urem i16 %rem.lhs.trunc, 1000 %cmp3 = icmp eq i16 %rem10, 0 br i1 %cmp3, label %if.then4, label %if.else if.then4: ; preds = %if.end %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0) br label %cleanup if.else: ; preds = %if.end %narrow = sub nuw nsw i16 1000, %rem10 %sub = zext i16 %narrow to i32 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub) br label %cleanup cleanup: ; preds = %if.then4, %if.else, %if.then %retval.0 = phi i32 [ 1, %if.then ], [ 0, %if.else ], [ 0, %if.then4 ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture 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 } attributes #5 = { cold } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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"}
/* AUTHOR: AKASH JAIN * EMAIL: akash19jain@gmail.com * ID: akash19jain * DATE: 13-07-2020 17:46:27 */ // #include<algorithm> // #include <bits/stdc++.h> // using namespace std; #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<ctype.h> #define SC1(x) scanf("%lld",&x) #define SC2(x,y) scanf("%lld%lld",&x,&y) #define SC3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z) #define SCS(x) scanf("\n%s", x) #define SCA(a,n) for(long long i=0;i<n;i++) scanf("%lld",&a[i]); #define PF1(x) printf("%lld\n",x) #define PF2(x,y) printf("%lld %lld\n",x,y) #define PF3(x,y,z) printf("%lld %lld %lld\n",x,y,z) #define PFA(a,n) for(long long i=0;i<n;i++) printf("%lld ",a[i]); printf("\n"); #define PFN printf("\n") #define PFS(x) printf("%s\n",x) #define REP(i,n) for(long long i=0;i<(n);++i) #define FOR(i,a,b) for(long long i=(a);i<=(b);++i) #define FORD(i,a,b) for(long long i=(a);i>=(b);--i) #define WHILE(n) while(n--) #define MEM(a, b) memset(a, (b), sizeof(a)) #define ITOC(c) ((char)(((ll)'0')+c)) #define MID(s,e) (s+(e-s)/2) #define SZ(a) strlen(a) #define PI 3.1415926535897932384626433832795 #define DEB(x) printf("The value of \"%s\" is: %d\n",#x,x) #define CASES ll t;SC1(t);while(t--) #define ABS(a) ((a>0)?a:-(a)) #define SWAP(a,b) ll z=a;a=b;b=z #define SWAPC(a,b) char z=a;a=b;b=z #define FLSH fflush(stdout) #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define all(x) (x).begin(), (x).end() typedef long long ll; typedef unsigned long long ull; const ll INF = 1 << 29; const ll MOD = 1000000007; const ll FMOD = 998244353; const ll MAX = 10000000005; const ll MIN = -10000000005; #define FILEIO(name) \ freopen(name".in", "r", stdin); \ freopen(name".out", "w", stdout); int cmp(const void * a, const void * b); long long maxv(long long a, long long b); long long minv(long long a, long long b); long long gcd(long long u, long long v); long long digits(long long n); bool ispoweroftwo(long long n); bool isvowel(char x); ll chartoint(char ch); ll CEIL(ll x, ll y); ll FLOOR(ll x, ll y); int main() { #ifndef ONLINE_JUDGE freopen("F:\\COMPETITIVE-PROGRAMMING\\inp.txt", "r", stdin); freopen("F:\\COMPETITIVE-PROGRAMMING\\out.txt", "w", stdout); #endif ll n; SC1(n); n = n % 1000; ll ans = 1000 - n; ans = ans % 1000; PF1(ans); return 0; } //qsort(arr,n,sizeof(arr[0]),cmp); int cmp (const void * a, const void * b) { if ( *(ll*)a - * (ll*)b < 0 ) return -1; if ( *(ll*)a - * (ll*)b > 0 ) return 1; return 0; } long long maxv(long long a, long long b) { if (a > b) return a; return b; } long long minv(long long a, long long b) { if (a < b) return a; return b; } long long gcd(long long u, long long v) { if (v == 0) return u; return gcd(v, u % v); } long long digits(long long n) //to calculate no of digits in a number { return floor(log10(n)) + 1; } bool ispoweroftwo(long long x) { return x && (!(x & (x - 1))); } bool isvowel(char x) { return (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u' ); } ll chartoint(char ch) { if (ch >= 'A' && ch <= 'Z') return (ch - 'A'); else if (ch >= '0' && ch <= '9') return (ch - '0'); else if (ch >= 'a' && ch <= 'z') return (ch - 'a'); else return 0; } ll CEIL(ll x, ll y) { if (x % y == 0) return (x / y); else return (x / y + 1); } ll FLOOR(ll x, ll y) { if (x % y == 0) return (x / y); else return (x / y - 1); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223059/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223059/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @INF = dso_local local_unnamed_addr constant i64 536870912, align 8 @MOD = dso_local local_unnamed_addr constant i64 1000000007, align 8 @FMOD = dso_local local_unnamed_addr constant i64 998244353, align 8 @MAX = dso_local local_unnamed_addr constant i64 10000000005, align 8 @MIN = dso_local local_unnamed_addr constant i64 -10000000005, align 8 @.str = private unnamed_addr constant [35 x i8] c"F:\\COMPETITIVE-PROGRAMMING\\inp.txt\00", align 1 @.str.1 = private unnamed_addr constant [2 x i8] c"r\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 @.str.2 = private unnamed_addr constant [35 x i8] c"F:\\COMPETITIVE-PROGRAMMING\\out.txt\00", align 1 @.str.3 = private unnamed_addr constant [2 x i8] c"w\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 @.str.4 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %0) #12 %1 = load ptr, ptr @stdout, align 8, !tbaa !5 %call1 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %1) #12 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #12 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %n) %2 = load i64, ptr %n, align 8, !tbaa !9 %.fr = freeze i64 %2 %rem = srem i64 %.fr, 1000 store i64 %rem, ptr %n, align 8, !tbaa !9 %sub = sub nsw i64 1000, %rem %rem3.urem = sub nsw i64 0, %rem %rem3.cmp = icmp ult i64 %sub, 1000 %rem3 = select i1 %rem3.cmp, i64 %sub, i64 %rem3.urem %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %rem3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #12 ret i32 0 } declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 { entry: %0 = load i64, ptr %a, align 8, !tbaa !9 %1 = load i64, ptr %b, align 8, !tbaa !9 %cmp = icmp slt i64 %0, %1 %cmp2.not = icmp ne i64 %0, %1 %. = zext i1 %cmp2.not to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @maxv(i64 noundef %a, i64 noundef %b) local_unnamed_addr #5 { entry: %a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @minv(i64 noundef %a, i64 noundef %b) local_unnamed_addr #5 { entry: %a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %u, i64 noundef %v) local_unnamed_addr #6 { entry: %cmp4 = icmp eq i64 %v, 0 br i1 %cmp4, label %return, label %if.end if.end: ; preds = %entry, %if.end %v.tr6 = phi i64 [ %rem, %if.end ], [ %v, %entry ] %u.tr5 = phi i64 [ %v.tr6, %if.end ], [ %u, %entry ] %rem = srem i64 %u.tr5, %v.tr6 %cmp = icmp eq i64 %rem, 0 br i1 %cmp, label %return, label %if.end return: ; preds = %if.end, %entry %u.tr.lcssa = phi i64 [ %u, %entry ], [ %v.tr6, %if.end ] ret i64 %u.tr.lcssa } ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable define dso_local i64 @digits(i64 noundef %n) local_unnamed_addr #7 { entry: %conv = sitofp i64 %n to double %call = tail call double @log10(double noundef %conv) #12 %0 = tail call double @llvm.floor.f64(double %call) %add = fadd double %0, 1.000000e+00 %conv1 = fptosi double %add to i64 ret i64 %conv1 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @log10(double noundef) local_unnamed_addr #8 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.floor.f64(double) #9 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @ispoweroftwo(i64 noundef %x) local_unnamed_addr #5 { entry: %tobool.not = icmp eq i64 %x, 0 br i1 %tobool.not, label %land.end, label %land.rhs land.rhs: ; preds = %entry %0 = tail call i64 @llvm.ctpop.i64(i64 %x), !range !11 %tobool1.not = icmp ult i64 %0, 2 br label %land.end land.end: ; preds = %land.rhs, %entry %1 = phi i1 [ false, %entry ], [ %tobool1.not, %land.rhs ] ret i1 %1 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @isvowel(i8 noundef signext %x) local_unnamed_addr #5 { entry: %0 = add i8 %x, -97 %1 = tail call i8 @llvm.fshl.i8(i8 %0, i8 %0, i8 7) %2 = icmp ult i8 %1, 11 %switch.cast = zext i8 %1 to i11 %switch.downshift = lshr i11 -875, %switch.cast %3 = and i11 %switch.downshift, 1 %switch.masked = icmp ne i11 %3, 0 %4 = select i1 %2, i1 %switch.masked, i1 false ret i1 %4 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @chartoint(i8 noundef signext %ch) local_unnamed_addr #10 { entry: %conv = sext i8 %ch to i32 %0 = add i8 %ch, -65 %or.cond = icmp ult i8 %0, 26 br i1 %or.cond, label %if.then, label %if.else if.then: ; preds = %entry %sub = add nsw i32 %conv, -65 br label %return if.else: ; preds = %entry %1 = add i8 %ch, -48 %or.cond31 = icmp ult i8 %1, 10 br i1 %or.cond31, label %if.then14, label %if.else18 if.then14: ; preds = %if.else %sub16 = add nsw i32 %conv, -48 br label %return if.else18: ; preds = %if.else %2 = add i8 %ch, -97 %or.cond32 = icmp ult i8 %2, 26 %sub28 = add nsw i32 %conv, -97 %spec.select = select i1 %or.cond32, i32 %sub28, i32 0 br label %return return: ; preds = %if.else18, %if.then14, %if.then %retval.0.shrunk = phi i32 [ %sub, %if.then ], [ %sub16, %if.then14 ], [ %spec.select, %if.else18 ] %retval.0 = zext i32 %retval.0.shrunk to i64 ret i64 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @CEIL(i64 noundef %x, i64 noundef %y) local_unnamed_addr #10 { entry: %rem = srem i64 %x, %y %cmp = icmp ne i64 %rem, 0 %div = sdiv i64 %x, %y %add = zext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %add ret i64 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @FLOOR(i64 noundef %x, i64 noundef %y) local_unnamed_addr #10 { entry: %rem = srem i64 %x, %y %cmp = icmp ne i64 %rem, 0 %div = sdiv i64 %x, %y %sub = sext i1 %cmp to i64 %retval.0 = add nsw i64 %div, %sub ret i64 %retval.0 } ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.ctpop.i64(i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i8 @llvm.fshl.i8(i8, i8, i8) #11 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree 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 #7 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #9 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #10 = { 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 #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #12 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"long long", !7, i64 0} !11 = !{i64 0, i64 65}
#include <stdio.h> int main(){ int N,r; if (scanf("%d", &N)==1); r = (1000-N % 1000) % 1000; printf("%d\n",r); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223101/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223101/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %.fr = freeze i32 %0 %rem = srem i32 %.fr, 1000 %sub = sub nsw i32 1000, %rem %rem1.urem = sub nsw i32 0, %rem %rem1.cmp = icmp ult i32 %sub, 1000 %rem1 = select i1 %rem1.cmp, i32 %sub, i32 %rem1.urem %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %rem1) 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 calc(int n){ int diff; int c=1; while (1) { diff=(1000*c)-n; if(0<=diff){ return diff; } c++; } } int main(void){ int N; scanf("%d",&N); int result = calc(N); printf("%d\n",result); return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223145/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223145/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @calc(i32 noundef %n) local_unnamed_addr #0 { entry: %0 = sub i32 1000, %n %smax = tail call i32 @llvm.smax.i32(i32 %0, i32 0) %1 = add i32 %smax, %n %2 = add i32 %1, -1000 %3 = icmp ne i32 %2, 0 %umin = zext i1 %3 to i32 %4 = sub i32 %2, %umin %5 = udiv i32 %4, 1000 %6 = add nuw nsw i32 %5, %umin %7 = mul i32 %6, 1000 %8 = add i32 %7, 1000 %9 = sub i32 %8, %n ret i32 %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: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %1 = sub i32 1000, %0 %smax.i = call i32 @llvm.smax.i32(i32 %1, i32 0) %2 = add i32 %0, -1000 %3 = add i32 %2, %smax.i %4 = icmp ne i32 %3, 0 %umin.i = zext i1 %4 to i32 %5 = sub i32 %3, %umin.i %6 = udiv i32 %5, 1000 %7 = add nuw nsw i32 %6, %umin.i %8 = mul i32 %7, 1000 %reass.sub = sub i32 %8, %0 %9 = add i32 %reass.sub, 1000 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { int n, ans; scanf("%d", &n); ans = (1000 - n % 1000) % 1000; printf("%d", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223189/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223189/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %.fr = freeze i32 %0 %rem = srem i32 %.fr, 1000 %sub = sub nsw i32 1000, %rem %rem1.urem = sub nsw i32 0, %rem %rem1.cmp = icmp ult i32 %sub, 1000 %rem1 = select i1 %rem1.cmp, i32 %sub, i32 %rem1.urem %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %rem1) 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); n = n % 1000; if (n) { printf("%d", 1000 - n); } else printf("0"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223239/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223239/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %rem = srem i32 %0, 1000 store i32 %rem, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %rem, 0 br i1 %tobool.not, label %if.else, label %if.then if.then: ; preds = %entry %sub = sub nsw i32 1000, %rem %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub) br label %if.end if.else: ; preds = %entry %putchar = call i32 @putchar(i32 48) br label %if.end if.end: ; preds = %if.else, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<math.h> #define prime 1000000007 int main() { long long i,num,temp,lol,x[200005],y[200005]; long long count=0,sum[200005],diff[200005]; scanf("%d",&num); for(i=0;i<num;i++) { scanf("%d %d",&x[i],&y[i]); sum[x[i]+y[i]]=sum[x[i]+y[i]]+1; diff[x[i]-y[i] + 1000]= diff[x[i]-y[i] + 1000]+1; } for(i=0;i<2005;i++) { temp=sum[i]; count=count+((temp*(temp-1))/2); lol=diff[i]; count=count+((lol*(lol-1))/2); } printf("%lli\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22329/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22329/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%lli\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i64, align 8 %x = alloca [200005 x i64], align 16 %y = alloca [200005 x i64], align 16 %sum = alloca [200005 x i64], align 16 %diff = alloca [200005 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num) #4 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %y) #4 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %sum) #4 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %diff) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %0 = load i64, ptr %num, align 8, !tbaa !5 %cmp55 = icmp sgt i64 %0, 0 br i1 %cmp55, label %for.body, label %vector.body.preheader vector.body.preheader: ; preds = %for.body, %entry br label %vector.body vector.body: ; preds = %vector.body.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.body.preheader ] %vec.phi = phi <2 x i64> [ %19, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %vec.phi59 = phi <2 x i64> [ %20, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %1 = getelementptr inbounds [200005 x i64], ptr %sum, i64 0, i64 %index %wide.load = load <2 x i64>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i64, ptr %1, i64 2 %wide.load60 = load <2 x i64>, ptr %2, align 16, !tbaa !5 %3 = add nsw <2 x i64> %wide.load, <i64 -1, i64 -1> %4 = add nsw <2 x i64> %wide.load60, <i64 -1, i64 -1> %5 = mul nsw <2 x i64> %3, %wide.load %6 = mul nsw <2 x i64> %4, %wide.load60 %7 = sdiv <2 x i64> %5, <i64 2, i64 2> %8 = sdiv <2 x i64> %6, <i64 2, i64 2> %9 = add <2 x i64> %7, %vec.phi %10 = add <2 x i64> %8, %vec.phi59 %11 = getelementptr inbounds [200005 x i64], ptr %diff, i64 0, i64 %index %wide.load61 = load <2 x i64>, ptr %11, align 16, !tbaa !5 %12 = getelementptr inbounds i64, ptr %11, i64 2 %wide.load62 = load <2 x i64>, ptr %12, align 16, !tbaa !5 %13 = add nsw <2 x i64> %wide.load61, <i64 -1, i64 -1> %14 = add nsw <2 x i64> %wide.load62, <i64 -1, i64 -1> %15 = mul nsw <2 x i64> %13, %wide.load61 %16 = mul nsw <2 x i64> %14, %wide.load62 %17 = sdiv <2 x i64> %15, <i64 2, i64 2> %18 = sdiv <2 x i64> %16, <i64 2, i64 2> %19 = add <2 x i64> %9, %17 %20 = add <2 x i64> %10, %18 %index.next = add nuw i64 %index, 4 %21 = icmp eq i64 %index.next, 2004 br i1 %21, label %for.body23, label %vector.body, !llvm.loop !9 for.body: ; preds = %entry, %for.body %i.056 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200005 x i64], ptr %x, i64 0, i64 %i.056 %arrayidx1 = getelementptr inbounds [200005 x i64], ptr %y, i64 0, i64 %i.056 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1) %22 = load i64, ptr %arrayidx, align 8, !tbaa !5 %23 = load i64, ptr %arrayidx1, align 8, !tbaa !5 %add = add nsw i64 %23, %22 %arrayidx5 = getelementptr inbounds [200005 x i64], ptr %sum, i64 0, i64 %add %24 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %add6 = add nsw i64 %24, 1 store i64 %add6, ptr %arrayidx5, align 8, !tbaa !5 %sub = add i64 %22, 1000 %add13 = sub i64 %sub, %23 %arrayidx14 = getelementptr inbounds [200005 x i64], ptr %diff, i64 0, i64 %add13 %25 = load i64, ptr %arrayidx14, align 8, !tbaa !5 %add15 = add nsw i64 %25, 1 store i64 %add15, ptr %arrayidx14, align 8, !tbaa !5 %inc = add nuw nsw i64 %i.056, 1 %26 = load i64, ptr %num, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %26 br i1 %cmp, label %for.body, label %vector.body.preheader, !llvm.loop !13 for.body23: ; preds = %vector.body %bin.rdx = add <2 x i64> %20, %19 %27 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %arrayidx24 = getelementptr inbounds [200005 x i64], ptr %sum, i64 0, i64 2004 %28 = load i64, ptr %arrayidx24, align 16, !tbaa !5 %sub25 = add nsw i64 %28, -1 %mul = mul nsw i64 %sub25, %28 %div = sdiv i64 %mul, 2 %add26 = add nsw i64 %div, %27 %arrayidx27 = getelementptr inbounds [200005 x i64], ptr %diff, i64 0, i64 2004 %29 = load i64, ptr %arrayidx27, align 16, !tbaa !5 %sub28 = add nsw i64 %29, -1 %mul29 = mul nsw i64 %sub28, %29 %div30 = sdiv i64 %mul29, 2 %add31 = add nsw i64 %add26, %div30 %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add31) call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %diff) #4 call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %sum) #4 call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !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}
#include <stdio.h> #define N 200000 #define NLARGE 1000 int cross[NLARGE * 2][2]; int main(void) { int x, y; int n, i; long long result = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &x, &y); cross[x + y][0]++; cross[(NLARGE - x) + y][1]++; } for (i = 0; i < NLARGE * 2; i++) { result += cross[i][0] * (cross[i][0] - 1) / 2; result += cross[i][1] * (cross[i][1] - 1) / 2; } printf("%I64d", result); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22334/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22334/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @cross = dso_local local_unnamed_addr global [2000 x [2 x i32]] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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 %cmp44 = icmp sgt i32 %0, 0 br i1 %cmp44, label %for.body, label %vector.body.preheader vector.body.preheader: ; preds = %for.body, %entry br label %vector.body vector.body: ; preds = %vector.body.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.body.preheader ] %vec.phi = phi <2 x i64> [ %22, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %vec.phi50 = phi <2 x i64> [ %23, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %1 = or i64 %index, 2 %2 = getelementptr inbounds [2000 x [2 x i32]], ptr @cross, i64 0, i64 %index %3 = getelementptr inbounds [2000 x [2 x i32]], ptr @cross, i64 0, i64 %1 %wide.vec = load <4 x i32>, ptr %2, align 16, !tbaa !5 %wide.vec51 = load <4 x i32>, ptr %3, align 16, !tbaa !5 %strided.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 0, i32 2> %strided.vec52 = shufflevector <4 x i32> %wide.vec51, <4 x i32> poison, <2 x i32> <i32 0, i32 2> %strided.vec53 = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 1, i32 3> %strided.vec54 = shufflevector <4 x i32> %wide.vec51, <4 x i32> poison, <2 x i32> <i32 1, i32 3> %4 = add nsw <2 x i32> %strided.vec, <i32 -1, i32 -1> %5 = add nsw <2 x i32> %strided.vec52, <i32 -1, i32 -1> %6 = mul nsw <2 x i32> %4, %strided.vec %7 = mul nsw <2 x i32> %5, %strided.vec52 %8 = sdiv <2 x i32> %6, <i32 2, i32 2> %9 = sdiv <2 x i32> %7, <i32 2, i32 2> %10 = sext <2 x i32> %8 to <2 x i64> %11 = sext <2 x i32> %9 to <2 x i64> %12 = add <2 x i64> %vec.phi, %10 %13 = add <2 x i64> %vec.phi50, %11 %14 = add nsw <2 x i32> %strided.vec53, <i32 -1, i32 -1> %15 = add nsw <2 x i32> %strided.vec54, <i32 -1, i32 -1> %16 = mul nsw <2 x i32> %14, %strided.vec53 %17 = mul nsw <2 x i32> %15, %strided.vec54 %18 = sdiv <2 x i32> %16, <i32 2, i32 2> %19 = sdiv <2 x i32> %17, <i32 2, i32 2> %20 = sext <2 x i32> %18 to <2 x i64> %21 = sext <2 x i32> %19 to <2 x i64> %22 = add <2 x i64> %12, %20 %23 = add <2 x i64> %13, %21 %index.next = add nuw i64 %index, 4 %24 = icmp eq i64 %index.next, 2000 br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %23, %22 %25 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %25) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 ret i32 0 for.body: ; preds = %entry, %for.body %i.045 = phi i32 [ %inc8, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %26 = load i32, ptr %x, align 4, !tbaa !5 %27 = load i32, ptr %y, align 4, !tbaa !5 %add = add nsw i32 %27, %26 %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds [2000 x [2 x i32]], ptr @cross, i64 0, i64 %idxprom %28 = load i32, ptr %arrayidx, align 8, !tbaa !5 %inc = add nsw i32 %28, 1 store i32 %inc, ptr %arrayidx, align 8, !tbaa !5 %reass.sub48 = sub i32 %27, %26 %add3 = add i32 %reass.sub48, 1000 %idxprom4 = sext i32 %add3 to i64 %arrayidx6 = getelementptr inbounds [2000 x [2 x i32]], ptr @cross, i64 0, i64 %idxprom4, i64 1 %29 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %inc7 = add nsw i32 %29, 1 store i32 %inc7, ptr %arrayidx6, align 4, !tbaa !5 %inc8 = add nuw nsw i32 %i.045, 1 %30 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc8, %30 br i1 %cmp, label %for.body, label %vector.body.preheader, !llvm.loop !13 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10}
#include<stdio.h> void main(){ int n=0; scanf("%d",&n); if(n%1000==0){ printf("0"); }else{ printf("%d",1000-n%1000); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223383/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223383/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 store i32 0, ptr %n, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %rem = srem i32 %0, 1000 %cmp = icmp eq i32 %rem, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %putchar = call i32 @putchar(i32 48) br label %if.end if.else: ; preds = %entry %sub = sub nsw i32 1000, %rem %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub) br label %if.end if.end: ; preds = %if.else, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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(void){ int i, x, y, a[10000], ans = 0; scanf("%d", &i); i %= 1000; i = 1000 - i; if (i == 1000) i = 0; printf("%d", i); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223426/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223426/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %i = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %0 = load i32, ptr %i, align 4, !tbaa !5 %rem = srem i32 %0, 1000 %sub = sub nsw i32 1000, %rem %cmp = icmp eq i32 %rem, 0 %spec.store.select = select i1 %cmp, i32 0, i32 %sub store i32 %spec.store.select, ptr %i, align 4 %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.store.select) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int a[2000],b[2000]; int main () { int i,j,n,count=0; scanf("%d",&n); for(i=0;i<n;i++) { int x,y; scanf("%d%d",&x,&y); a[x-y+1000]++; b[x+y]++; } for(i=1;i<2000;i++) { if(a[i]<=1) continue; count+=a[i]*(a[i]-1)/2; } for(i=1;i<2000;i++) { if(b[i]<=1) continue; count+=b[i]*(b[i]-1)/2; } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22347/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22347/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 @a = dso_local local_unnamed_addr global [2000 x i32] zeroinitializer, align 16 @b = dso_local local_unnamed_addr global [2000 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 %x = alloca i32, align 4 %y = 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 %cmp56 = icmp sgt i32 %0, 0 br i1 %cmp56, label %for.body, label %vector.body.preheader vector.body.preheader: ; preds = %for.body, %entry br label %vector.body vector.body: ; preds = %vector.body.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.body.preheader ] %vec.phi = phi <4 x i32> [ %predphi, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %vec.phi67 = phi <4 x i32> [ %predphi69, %vector.body ], [ zeroinitializer, %vector.body.preheader ] %offset.idx = or i64 %index, 1 %1 = getelementptr inbounds [2000 x i32], ptr @a, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 %wide.load68 = load <4 x i32>, ptr %2, align 4, !tbaa !5 %3 = icmp sgt <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1> %4 = icmp sgt <4 x i32> %wide.load68, <i32 1, i32 1, i32 1, i32 1> %5 = add nsw <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1> %6 = add nsw <4 x i32> %wide.load68, <i32 -1, i32 -1, i32 -1, i32 -1> %7 = mul nsw <4 x i32> %5, %wide.load %8 = mul nsw <4 x i32> %6, %wide.load68 %9 = sdiv <4 x i32> %7, <i32 2, i32 2, i32 2, i32 2> %10 = sdiv <4 x i32> %8, <i32 2, i32 2, i32 2, i32 2> %11 = select <4 x i1> %3, <4 x i32> %9, <4 x i32> zeroinitializer %predphi = add <4 x i32> %vec.phi, %11 %12 = select <4 x i1> %4, <4 x i32> %10, <4 x i32> zeroinitializer %predphi69 = add <4 x i32> %vec.phi67, %12 %index.next = add nuw i64 %index, 8 %13 = icmp eq i64 %index.next, 1992 br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %predphi69, %predphi %14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %15 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1993), align 4, !tbaa !5 %cmp12 = icmp slt i32 %15, 2 br i1 %cmp12, label %for.inc19, label %if.end for.body: ; preds = %entry, %for.body %i.057 = phi i32 [ %inc6, %for.body ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %16 = load i32, ptr %x, align 4, !tbaa !5 %17 = load i32, ptr %y, align 4, !tbaa !5 %sub = add i32 %16, 1000 %add = sub i32 %sub, %17 %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds [2000 x i32], ptr @a, i64 0, i64 %idxprom %18 = load i32, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %18, 1 store i32 %inc, ptr %arrayidx, align 4, !tbaa !5 %add2 = add nsw i32 %17, %16 %idxprom3 = sext i32 %add2 to i64 %arrayidx4 = getelementptr inbounds [2000 x i32], ptr @b, i64 0, i64 %idxprom3 %19 = load i32, ptr %arrayidx4, align 4, !tbaa !5 %inc5 = add nsw i32 %19, 1 store i32 %inc5, ptr %arrayidx4, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 %inc6 = add nuw nsw i32 %i.057, 1 %20 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc6, %20 br i1 %cmp, label %for.body, label %vector.body.preheader, !llvm.loop !13 if.end: ; preds = %middle.block %sub17 = add nsw i32 %15, -1 %mul = mul nsw i32 %sub17, %15 %div = sdiv i32 %mul, 2 %add18 = add nsw i32 %div, %14 br label %for.inc19 for.inc19: ; preds = %middle.block, %if.end %count.1 = phi i32 [ %14, %middle.block ], [ %add18, %if.end ] %21 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1994), align 8, !tbaa !5 %cmp12.1 = icmp slt i32 %21, 2 br i1 %cmp12.1, label %for.inc19.1, label %if.end.1 if.end.1: ; preds = %for.inc19 %sub17.1 = add nsw i32 %21, -1 %mul.1 = mul nsw i32 %sub17.1, %21 %div.1 = sdiv i32 %mul.1, 2 %add18.1 = add nsw i32 %div.1, %count.1 br label %for.inc19.1 for.inc19.1: ; preds = %if.end.1, %for.inc19 %count.1.1 = phi i32 [ %count.1, %for.inc19 ], [ %add18.1, %if.end.1 ] %22 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1995), align 4, !tbaa !5 %cmp12.2 = icmp slt i32 %22, 2 br i1 %cmp12.2, label %for.inc19.2, label %if.end.2 if.end.2: ; preds = %for.inc19.1 %sub17.2 = add nsw i32 %22, -1 %mul.2 = mul nsw i32 %sub17.2, %22 %div.2 = sdiv i32 %mul.2, 2 %add18.2 = add nsw i32 %div.2, %count.1.1 br label %for.inc19.2 for.inc19.2: ; preds = %if.end.2, %for.inc19.1 %count.1.2 = phi i32 [ %count.1.1, %for.inc19.1 ], [ %add18.2, %if.end.2 ] %23 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1996), align 16, !tbaa !5 %cmp12.3 = icmp slt i32 %23, 2 br i1 %cmp12.3, label %for.inc19.3, label %if.end.3 if.end.3: ; preds = %for.inc19.2 %sub17.3 = add nsw i32 %23, -1 %mul.3 = mul nsw i32 %sub17.3, %23 %div.3 = sdiv i32 %mul.3, 2 %add18.3 = add nsw i32 %div.3, %count.1.2 br label %for.inc19.3 for.inc19.3: ; preds = %if.end.3, %for.inc19.2 %count.1.3 = phi i32 [ %count.1.2, %for.inc19.2 ], [ %add18.3, %if.end.3 ] %24 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1997), align 4, !tbaa !5 %cmp12.4 = icmp slt i32 %24, 2 br i1 %cmp12.4, label %for.inc19.4, label %if.end.4 if.end.4: ; preds = %for.inc19.3 %sub17.4 = add nsw i32 %24, -1 %mul.4 = mul nsw i32 %sub17.4, %24 %div.4 = sdiv i32 %mul.4, 2 %add18.4 = add nsw i32 %div.4, %count.1.3 br label %for.inc19.4 for.inc19.4: ; preds = %if.end.4, %for.inc19.3 %count.1.4 = phi i32 [ %count.1.3, %for.inc19.3 ], [ %add18.4, %if.end.4 ] %25 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1998), align 8, !tbaa !5 %cmp12.5 = icmp slt i32 %25, 2 br i1 %cmp12.5, label %for.inc19.5, label %if.end.5 if.end.5: ; preds = %for.inc19.4 %sub17.5 = add nsw i32 %25, -1 %mul.5 = mul nsw i32 %sub17.5, %25 %div.5 = sdiv i32 %mul.5, 2 %add18.5 = add nsw i32 %div.5, %count.1.4 br label %for.inc19.5 for.inc19.5: ; preds = %if.end.5, %for.inc19.4 %count.1.5 = phi i32 [ %count.1.4, %for.inc19.4 ], [ %add18.5, %if.end.5 ] %26 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @a, i64 0, i64 1999), align 4, !tbaa !5 %cmp12.6 = icmp slt i32 %26, 2 br i1 %cmp12.6, label %for.inc19.6, label %if.end.6 if.end.6: ; preds = %for.inc19.5 %sub17.6 = add nsw i32 %26, -1 %mul.6 = mul nsw i32 %sub17.6, %26 %div.6 = sdiv i32 %mul.6, 2 %add18.6 = add nsw i32 %div.6, %count.1.5 br label %for.inc19.6 for.inc19.6: ; preds = %if.end.6, %for.inc19.5 %count.1.6 = phi i32 [ %count.1.5, %for.inc19.5 ], [ %add18.6, %if.end.6 ] %27 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.1.6, i64 0 br label %vector.body74 vector.body74: ; preds = %vector.body74, %for.inc19.6 %index75 = phi i64 [ 0, %for.inc19.6 ], [ %index.next83, %vector.body74 ] %vec.phi76 = phi <4 x i32> [ %27, %for.inc19.6 ], [ %predphi81, %vector.body74 ] %vec.phi77 = phi <4 x i32> [ zeroinitializer, %for.inc19.6 ], [ %predphi82, %vector.body74 ] %offset.idx78 = or i64 %index75, 1 %28 = getelementptr inbounds [2000 x i32], ptr @b, i64 0, i64 %offset.idx78 %wide.load79 = load <4 x i32>, ptr %28, align 4, !tbaa !5 %29 = getelementptr inbounds i32, ptr %28, i64 4 %wide.load80 = load <4 x i32>, ptr %29, align 4, !tbaa !5 %30 = icmp sgt <4 x i32> %wide.load79, <i32 1, i32 1, i32 1, i32 1> %31 = icmp sgt <4 x i32> %wide.load80, <i32 1, i32 1, i32 1, i32 1> %32 = add nsw <4 x i32> %wide.load79, <i32 -1, i32 -1, i32 -1, i32 -1> %33 = add nsw <4 x i32> %wide.load80, <i32 -1, i32 -1, i32 -1, i32 -1> %34 = mul nsw <4 x i32> %32, %wide.load79 %35 = mul nsw <4 x i32> %33, %wide.load80 %36 = sdiv <4 x i32> %34, <i32 2, i32 2, i32 2, i32 2> %37 = sdiv <4 x i32> %35, <i32 2, i32 2, i32 2, i32 2> %38 = select <4 x i1> %30, <4 x i32> %36, <4 x i32> zeroinitializer %predphi81 = add <4 x i32> %vec.phi76, %38 %39 = select <4 x i1> %31, <4 x i32> %37, <4 x i32> zeroinitializer %predphi82 = add <4 x i32> %vec.phi77, %39 %index.next83 = add nuw i64 %index75, 8 %40 = icmp eq i64 %index.next83, 1992 br i1 %40, label %middle.block70, label %vector.body74, !llvm.loop !14 middle.block70: ; preds = %vector.body74 %bin.rdx84 = add <4 x i32> %predphi82, %predphi81 %41 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx84) %42 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1993), align 4, !tbaa !5 %cmp27 = icmp slt i32 %42, 2 br i1 %cmp27, label %for.inc38, label %if.end29 if.end29: ; preds = %middle.block70 %sub34 = add nsw i32 %42, -1 %mul35 = mul nsw i32 %sub34, %42 %div36 = sdiv i32 %mul35, 2 %add37 = add nsw i32 %div36, %41 br label %for.inc38 for.inc38: ; preds = %middle.block70, %if.end29 %count.3 = phi i32 [ %41, %middle.block70 ], [ %add37, %if.end29 ] %43 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1994), align 8, !tbaa !5 %cmp27.1 = icmp slt i32 %43, 2 br i1 %cmp27.1, label %for.inc38.1, label %if.end29.1 if.end29.1: ; preds = %for.inc38 %sub34.1 = add nsw i32 %43, -1 %mul35.1 = mul nsw i32 %sub34.1, %43 %div36.1 = sdiv i32 %mul35.1, 2 %add37.1 = add nsw i32 %div36.1, %count.3 br label %for.inc38.1 for.inc38.1: ; preds = %if.end29.1, %for.inc38 %count.3.1 = phi i32 [ %count.3, %for.inc38 ], [ %add37.1, %if.end29.1 ] %44 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1995), align 4, !tbaa !5 %cmp27.2 = icmp slt i32 %44, 2 br i1 %cmp27.2, label %for.inc38.2, label %if.end29.2 if.end29.2: ; preds = %for.inc38.1 %sub34.2 = add nsw i32 %44, -1 %mul35.2 = mul nsw i32 %sub34.2, %44 %div36.2 = sdiv i32 %mul35.2, 2 %add37.2 = add nsw i32 %div36.2, %count.3.1 br label %for.inc38.2 for.inc38.2: ; preds = %if.end29.2, %for.inc38.1 %count.3.2 = phi i32 [ %count.3.1, %for.inc38.1 ], [ %add37.2, %if.end29.2 ] %45 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1996), align 16, !tbaa !5 %cmp27.3 = icmp slt i32 %45, 2 br i1 %cmp27.3, label %for.inc38.3, label %if.end29.3 if.end29.3: ; preds = %for.inc38.2 %sub34.3 = add nsw i32 %45, -1 %mul35.3 = mul nsw i32 %sub34.3, %45 %div36.3 = sdiv i32 %mul35.3, 2 %add37.3 = add nsw i32 %div36.3, %count.3.2 br label %for.inc38.3 for.inc38.3: ; preds = %if.end29.3, %for.inc38.2 %count.3.3 = phi i32 [ %count.3.2, %for.inc38.2 ], [ %add37.3, %if.end29.3 ] %46 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1997), align 4, !tbaa !5 %cmp27.4 = icmp slt i32 %46, 2 br i1 %cmp27.4, label %for.inc38.4, label %if.end29.4 if.end29.4: ; preds = %for.inc38.3 %sub34.4 = add nsw i32 %46, -1 %mul35.4 = mul nsw i32 %sub34.4, %46 %div36.4 = sdiv i32 %mul35.4, 2 %add37.4 = add nsw i32 %div36.4, %count.3.3 br label %for.inc38.4 for.inc38.4: ; preds = %if.end29.4, %for.inc38.3 %count.3.4 = phi i32 [ %count.3.3, %for.inc38.3 ], [ %add37.4, %if.end29.4 ] %47 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1998), align 8, !tbaa !5 %cmp27.5 = icmp slt i32 %47, 2 br i1 %cmp27.5, label %for.inc38.5, label %if.end29.5 if.end29.5: ; preds = %for.inc38.4 %sub34.5 = add nsw i32 %47, -1 %mul35.5 = mul nsw i32 %sub34.5, %47 %div36.5 = sdiv i32 %mul35.5, 2 %add37.5 = add nsw i32 %div36.5, %count.3.4 br label %for.inc38.5 for.inc38.5: ; preds = %if.end29.5, %for.inc38.4 %count.3.5 = phi i32 [ %count.3.4, %for.inc38.4 ], [ %add37.5, %if.end29.5 ] %48 = load i32, ptr getelementptr inbounds ([2000 x i32], ptr @b, i64 0, i64 1999), align 4, !tbaa !5 %cmp27.6 = icmp slt i32 %48, 2 br i1 %cmp27.6, label %for.inc38.6, label %if.end29.6 if.end29.6: ; preds = %for.inc38.5 %sub34.6 = add nsw i32 %48, -1 %mul35.6 = mul nsw i32 %sub34.6, %48 %div36.6 = sdiv i32 %mul35.6, 2 %add37.6 = add nsw i32 %div36.6, %count.3.5 br label %for.inc38.6 for.inc38.6: ; preds = %if.end29.6, %for.inc38.5 %count.3.6 = phi i32 [ %count.3.5, %for.inc38.5 ], [ %add37.6, %if.end29.6 ] %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.3.6) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !11, !12}
#include <stdio.h> // left -> 1, right -> 0 int is_left(char c, char left[]){ int i; for(i=0;left[i]!=0;i++){ if(c==left[i])return 1; } return 0; } int main(void){ char s[100]; char left[] = "qwertasdfgzxcvb"; int i,ans; int current_hand,next_hand; while(1){ scanf("%s", s); if(s[0]=='#')break; current_hand = -1; ans=0; for(i=0;s[i]!=0;i++){ next_hand = is_left(s[i], left); if(current_hand==-1){ current_hand=next_hand; continue; } if(current_hand != next_hand){ current_hand=next_hand; ans++; } } printf("%d\n", ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223512/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223512/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @switch.table.main = private unnamed_addr constant [26 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 0, i32 1], align 4 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @is_left(i8 noundef signext %c, ptr nocapture noundef readonly %left) local_unnamed_addr #0 { entry: %0 = load i8, ptr %left, align 1, !tbaa !5 %cmp.not11 = icmp eq i8 %0, 0 br i1 %cmp.not11, label %cleanup, label %for.body for.cond: ; preds = %for.body %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds i8, ptr %left, 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 %cleanup, label %for.body, !llvm.loop !8 for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %2 = phi i8 [ %1, %for.cond ], [ %0, %entry ] %cmp6 = icmp eq i8 %2, %c br i1 %cmp6, label %cleanup, label %for.cond cleanup: ; preds = %for.body, %for.cond, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4 %call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %0 = load i8, ptr %s, align 16, !tbaa !5 %cmp32 = icmp eq i8 %0, 35 br i1 %cmp32, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end %1 = phi i8 [ %6, %for.end ], [ %0, %entry ] %cmp4.not27 = icmp eq i8 %1, 0 br i1 %cmp4.not27, label %for.end, label %for.body.i.preheader for.body.i.preheader: ; preds = %for.cond.preheader, %is_left.exit %indvars.iv = phi i64 [ %indvars.iv.next, %is_left.exit ], [ 0, %for.cond.preheader ] %2 = phi i8 [ %5, %is_left.exit ], [ %1, %for.cond.preheader ] %current_hand.029 = phi i32 [ %retval.0.i, %is_left.exit ], [ -1, %for.cond.preheader ] %ans.028 = phi i32 [ %ans.1, %is_left.exit ], [ 0, %for.cond.preheader ] %switch.tableidx = add i8 %2, -97 %3 = icmp ult i8 %switch.tableidx, 26 br i1 %3, label %switch.lookup, label %is_left.exit switch.lookup: ; preds = %for.body.i.preheader %4 = sext i8 %switch.tableidx to i64 %switch.gep = getelementptr inbounds [26 x i32], ptr @switch.table.main, i64 0, i64 %4 %switch.load = load i32, ptr %switch.gep, align 4 br label %is_left.exit is_left.exit: ; preds = %for.body.i.preheader, %switch.lookup %retval.0.i = phi i32 [ %switch.load, %switch.lookup ], [ 0, %for.body.i.preheader ] %cmp10 = icmp ne i32 %current_hand.029, -1 %cmp14.not = icmp ne i32 %current_hand.029, %retval.0.i %narrow = and i1 %cmp10, %cmp14.not %spec.select = zext i1 %narrow to i32 %ans.1 = add nuw nsw i32 %ans.028, %spec.select %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx2 = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %indvars.iv.next %5 = load i8, ptr %arrayidx2, align 1, !tbaa !5 %cmp4.not = icmp eq i8 %5, 0 br i1 %cmp4.not, label %for.end, label %for.body.i.preheader, !llvm.loop !10 for.end: ; preds = %is_left.exit, %for.cond.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %ans.1, %is_left.exit ] %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %6 = load i8, ptr %s, align 16, !tbaa !5 %cmp = icmp eq i8 %6, 35 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9}
#include <stdio.h> int main(void) { int a, b, c, d, e, f; scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f); printf("%d\n", (a + b * 5 + c * 10 + d * 50 + e * 100 + f * 500) >= 1000); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223556/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223556/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [18 x i8] c"%d %d %d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 %e = alloca i32, align 4 %f = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %mul = mul nsw i32 %1, 5 %add = add nsw i32 %mul, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %mul1 = mul nsw i32 %2, 10 %add2 = add nsw i32 %add, %mul1 %3 = load i32, ptr %d, align 4, !tbaa !5 %mul3 = mul nsw i32 %3, 50 %add4 = add nsw i32 %add2, %mul3 %4 = load i32, ptr %e, align 4, !tbaa !5 %mul5 = mul nsw i32 %4, 100 %add6 = add nsw i32 %add4, %mul5 %5 = load i32, ptr %f, align 4, !tbaa !5 %mul7 = mul nsw i32 %5, 500 %add8 = add nsw i32 %add6, %mul7 %cmp = icmp sgt i32 %add8, 999 %conv = zext i1 %cmp to i32 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<math.h> int main() { int n; scanf("%d",&n); int a[n],b[n]; for(int i=0;i<n;i++) { scanf("%d",&a[i]); } for(int i=0;i<n;i++) { int sum=0,sum1=0,sum2=0; if(a[i]>2) { int p=a[i]/2; for(int j=0;j<a[i];j++) { sum=sum+pow(2,j+1); } for(int j=0;j<p-1;j++) { sum1=sum1+pow(2,j+1); } sum1=sum1+pow(2,a[i]); sum2=sum-sum1; b[i]=sum1-sum2; } else { b[i]=2; } } for(int i=0;i<n;i++) { printf("%d\n",b[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2236/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2236/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %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 %4 = zext i32 %3 to i64 %vla1 = alloca i32, i64 %4, align 16 %cmp91 = icmp sgt i32 %3, 0 br i1 %cmp91, label %for.body, label %for.cond.cleanup61 for.cond4.preheader: ; preds = %for.body %cmp5100 = icmp sgt i32 %5, 0 br i1 %cmp5100, label %for.body7, label %for.cond.cleanup61 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 %call2 = 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.cond4.preheader, !llvm.loop !9 for.cond58.preheader: ; preds = %if.end %7 = icmp sgt i32 %14, 0 br i1 %7, label %for.body62, label %for.cond.cleanup61 for.body7: ; preds = %for.cond4.preheader, %if.end %8 = phi i32 [ %14, %if.end ], [ %5, %for.cond4.preheader ] %indvars.iv105 = phi i64 [ %indvars.iv.next106, %if.end ], [ 0, %for.cond4.preheader ] %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv105 %9 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp sgt i32 %9, 2 br i1 %cmp10, label %for.body18.preheader, label %if.else for.body18.preheader: ; preds = %for.body7 %div88 = lshr i32 %9, 1 br label %for.body18 for.cond27.preheader: ; preds = %for.body18 %cmp2896 = icmp ugt i32 %9, 3 br i1 %cmp2896, label %for.body31.preheader, label %for.cond.cleanup30 for.body31.preheader: ; preds = %for.cond27.preheader %10 = call i32 @llvm.smax.i32(i32 %div88, i32 2) %11 = add nsw i32 %10, -2 br label %for.body31 for.body18: ; preds = %for.body18.preheader, %for.body18 %j.095 = phi i32 [ %add, %for.body18 ], [ 0, %for.body18.preheader ] %sum.094 = phi i32 [ %conv22, %for.body18 ], [ 0, %for.body18.preheader ] %conv = sitofp i32 %sum.094 to double %add = add nuw nsw i32 %j.095, 1 %ldexp90 = call double @ldexp(double 1.000000e+00, i32 %add) #6 %add21 = fadd double %ldexp90, %conv %conv22 = fptosi double %add21 to i32 %12 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp16 = icmp slt i32 %add, %12 br i1 %cmp16, label %for.body18, label %for.cond27.preheader, !llvm.loop !11 for.cond.cleanup30.loopexit: ; preds = %for.body31 %.pre = load i32, ptr %arrayidx9, align 4, !tbaa !5 br label %for.cond.cleanup30 for.cond.cleanup30: ; preds = %for.cond.cleanup30.loopexit, %for.cond27.preheader %13 = phi i32 [ %12, %for.cond27.preheader ], [ %.pre, %for.cond.cleanup30.loopexit ] %sum1.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ %conv37, %for.cond.cleanup30.loopexit ] %conv41 = sitofp i32 %sum1.0.lcssa to double %ldexp = call double @ldexp(double 1.000000e+00, i32 %13) #6 %add46 = fadd double %ldexp, %conv41 %conv47 = fptosi double %add46 to i32 %factor = shl i32 %conv47, 1 %sub49 = sub i32 %factor, %conv22 %arrayidx51 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv105 store i32 %sub49, ptr %arrayidx51, align 4, !tbaa !5 %.pre111 = load i32, ptr %n, align 4, !tbaa !5 br label %if.end for.body31: ; preds = %for.body31.preheader, %for.body31 %j26.098 = phi i32 [ %add33, %for.body31 ], [ 0, %for.body31.preheader ] %sum1.097 = phi i32 [ %conv37, %for.body31 ], [ 0, %for.body31.preheader ] %conv32 = sitofp i32 %sum1.097 to double %add33 = add nuw nsw i32 %j26.098, 1 %ldexp89 = call double @ldexp(double 1.000000e+00, i32 %add33) #6 %add36 = fadd double %ldexp89, %conv32 %conv37 = fptosi double %add36 to i32 %exitcond.not = icmp eq i32 %j26.098, %11 br i1 %exitcond.not, label %for.cond.cleanup30.loopexit, label %for.body31, !llvm.loop !12 if.else: ; preds = %for.body7 %arrayidx53 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv105 store i32 2, ptr %arrayidx53, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.else, %for.cond.cleanup30 %14 = phi i32 [ %8, %if.else ], [ %.pre111, %for.cond.cleanup30 ] %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1 %15 = sext i32 %14 to i64 %cmp5 = icmp slt i64 %indvars.iv.next106, %15 br i1 %cmp5, label %for.body7, label %for.cond58.preheader, !llvm.loop !13 for.cond.cleanup61: ; preds = %for.body62, %entry, %for.cond4.preheader, %for.cond58.preheader call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 for.body62: ; preds = %for.cond58.preheader, %for.body62 %indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.body62 ], [ 0, %for.cond58.preheader ] %arrayidx64 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv108 %16 = load i32, ptr %arrayidx64, align 4, !tbaa !5 %call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16) %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1 %17 = load i32, ptr %n, align 4, !tbaa !5 %18 = sext i32 %17 to i64 %cmp59 = icmp slt i64 %indvars.iv.next109, %18 br i1 %cmp59, label %for.body62, label %for.cond.cleanup61, !llvm.loop !14 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree willreturn declare double @ldexp(double, i32) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree willreturn } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include <stdio.h> int main(void){ int c[6]={}, val[]={1, 5, 10, 50, 100, 500}; int sum=0, i; for( i=0 ; i<6 ; i++ ){ scanf("%d", &c[i]); sum += c[i] * val[i] ; } if( sum>=1000 ) puts("1"); else puts("0"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223642/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223642/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [2 x i8] c"1\00", align 1 @.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %c = alloca [6 x i32], align 16 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %c) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %c, i8 0, i64 24, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %0 = load i32, ptr %c, align 16, !tbaa !5 %arrayidx.1 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %1, 5 %add.1 = add nsw i32 %mul.1, %0 %arrayidx.2 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %2 = load i32, ptr %arrayidx.2, align 8, !tbaa !5 %mul.2 = mul nsw i32 %2, 10 %add.2 = add nsw i32 %mul.2, %add.1 %arrayidx.3 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 3 %call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %mul.3 = mul nsw i32 %3, 50 %add.3 = add nsw i32 %mul.3, %add.2 %arrayidx.4 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 4 %call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4) %4 = load i32, ptr %arrayidx.4, align 16, !tbaa !5 %mul.4 = mul nsw i32 %4, 100 %add.4 = add nsw i32 %mul.4, %add.3 %arrayidx.5 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 5 %call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5) %5 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %mul.5 = mul nsw i32 %5, 500 %add.5 = add nsw i32 %mul.5, %add.4 %cmp5 = icmp sgt i32 %add.5, 999 %.str.1..str.2 = select i1 %cmp5, ptr @.str.1, ptr @.str.2 %call7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %c) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int sum=0,c[6],i; for(i=0;i<6;i++)scanf("%d",&c[i]); sum+=c[0]*1; sum+=c[1]*5; sum+=c[2]*10; sum+=c[3]*50; sum+=c[4]*100; sum+=c[5]*500; if(sum<1000)i=0; else i=1; printf("%d\n",i); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223686/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223686/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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: %c = alloca [6 x i32], align 16 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %arrayidx.1 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %arrayidx.3 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 3 %call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %arrayidx.4 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 4 %call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4) %arrayidx.5 = getelementptr inbounds [6 x i32], ptr %c, i64 0, i64 5 %call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5) %0 = load i32, ptr %c, align 16, !tbaa !5 %1 = load <4 x i32>, ptr %arrayidx.1, align 4, !tbaa !5 %2 = mul nsw <4 x i32> %1, <i32 5, i32 10, i32 50, i32 100> %3 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %mul15 = mul nsw i32 %3, 500 %4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2) %op.rdx = add i32 %4, %mul15 %op.rdx30 = add i32 %op.rdx, %0 %cmp17 = icmp sgt i32 %op.rdx30, 999 %. = zext i1 %cmp17 to i32 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.) call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %c) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int p,m,c; scanf("%d%d%d",&p,&m,&c); printf("%d\n",p+m+c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223729/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223729/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %p = alloca i32, align 4 %m = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %m, ptr noundef nonnull %c) %0 = load i32, ptr %p, align 4, !tbaa !5 %1 = load i32, ptr %m, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %add1 = add nsw i32 %add, %2 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #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 p,m,c; scanf("%d %d %d",&p,&m,&c); printf("%d\n",p+m+c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223772/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223772/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %p = alloca i32, align 4 %m = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %m, ptr noundef nonnull %c) %0 = load i32, ptr %p, align 4, !tbaa !5 %1 = load i32, ptr %m, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %add1 = add nsw i32 %add, %2 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); a=a+b+c; printf("%d\n",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223815/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223815/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %add1 = add nsw i32 %add, %2 store i32 %add1, ptr %a, align 4, !tbaa !5 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { long long int n, k; scanf("%lld %lld", &n, &k); long long int ans = 0; long long int b; for (b = k + 1; b <= n; b++) { ans += n / b * (b - k); if (n % b >= k) ans += (n % b) - k + 1; } if (k == 0) ans -= n - k; printf("%lld\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223859/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223859/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %k, align 8, !tbaa !5 %1 = load i64, ptr %n, align 8, !tbaa !5 %cmp.not.not23 = icmp slt i64 %0, %1 br i1 %cmp.not.not23, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %b.0.in25 = phi i64 [ %b.0, %for.body ], [ %0, %entry ] %ans.024 = phi i64 [ %ans.1, %for.body ], [ 0, %entry ] %b.0 = add nsw i64 %b.0.in25, 1 %div = sdiv i64 %1, %b.0 %sub = sub nsw i64 %b.0, %0 %mul = mul nsw i64 %div, %sub %add1 = add nsw i64 %mul, %ans.024 %rem = srem i64 %1, %b.0 %cmp2.not = icmp slt i64 %rem, %0 %reass.sub = sub i64 %rem, %0 %add5 = add i64 %reass.sub, 1 %add6 = select i1 %cmp2.not, i64 0, i64 %add5 %ans.1 = add nsw i64 %add1, %add6 %exitcond.not = icmp eq i64 %b.0, %1 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %for.body, %entry %ans.0.lcssa = phi i64 [ 0, %entry ], [ %ans.1, %for.body ] %cmp7 = icmp eq i64 %0, 0 %sub10 = select i1 %cmp7, i64 %1, i64 0 %spec.select = sub nsw i64 %ans.0.lcssa, %sub10 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void){ int b,r,g,c,s,t; while(scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t) , t != 0){ printf("%d\n",b * 95 + r * 63 + g * 7 + c * 2 + s * 3 - t * 3 + 100); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_223916/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_223916/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d%d%d%d%d%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %b = alloca i32, align 4 %r = alloca i32, align 4 %g = alloca i32, align 4 %c = alloca i32, align 4 %s = alloca i32, align 4 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3 %call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %c, ptr noundef nonnull %s, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not12 = icmp eq i32 %0, 0 br i1 %cmp.not12, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %1 = phi i32 [ %7, %while.body ], [ %0, %entry ] %2 = load i32, ptr %b, align 4, !tbaa !5 %mul = mul nsw i32 %2, 95 %3 = load i32, ptr %r, align 4, !tbaa !5 %mul1 = mul nsw i32 %3, 63 %4 = load i32, ptr %g, align 4, !tbaa !5 %mul2 = mul nsw i32 %4, 7 %5 = load i32, ptr %c, align 4, !tbaa !5 %mul4 = shl nsw i32 %5, 1 %6 = load i32, ptr %s, align 4, !tbaa !5 %reass.add = sub i32 %6, %1 %reass.mul = mul i32 %reass.add, 3 %add3 = add i32 %mul, 100 %add5 = add i32 %add3, %mul1 %add7 = add i32 %add5, %mul2 %sub = add i32 %add7, %mul4 %add9 = add i32 %sub, %reass.mul %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add9) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %c, ptr noundef nonnull %s, ptr noundef nonnull %t) %7 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not = icmp eq i32 %7, 0 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 %t) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(void){ int kane,mai,dai,kaz,i; for(;;){ kaz=0; scanf("%d",&dai); if(dai==0)break; kane=1000-dai; if(kane>=500){ mai=kane/500; kane=kane%500; kaz+=mai; }if(kane>=100){ mai=kane/100; kane=kane%100; kaz+=mai; }if(kane>=50){ mai=kane/50; kane=kane%50; kaz+=mai; }if(kane>=10){ mai=kane/10; kane=kane%10; kaz+=mai; }if(kane>=5){ mai=kane/5; kane=kane%5; kaz+=mai; } kaz=kaz+kane; printf("%d\n",kaz); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224001/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224001/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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: %dai = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %dai) #3 %call57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dai) %0 = load i32, ptr %dai, align 4, !tbaa !5 %cmp58 = icmp eq i32 %0, 0 br i1 %cmp58, label %for.end, label %if.end if.end: ; preds = %entry, %if.end21 %1 = phi i32 [ %2, %if.end21 ], [ %0, %entry ] %sub = sub nsw i32 1000, %1 %cmp1 = icmp slt i32 %1, 501 br i1 %cmp1, label %if.then2, label %if.end3 if.then2: ; preds = %if.end %div = sdiv i32 %sub, 500 %rem = srem i32 %sub, 500 br label %if.end3 if.end3: ; preds = %if.then2, %if.end %kaz.0 = phi i32 [ %div, %if.then2 ], [ 0, %if.end ] %kane.0 = phi i32 [ %rem, %if.then2 ], [ %sub, %if.end ] %cmp4 = icmp sgt i32 %kane.0, 99 br i1 %cmp4, label %if.then5, label %if.end9 if.then5: ; preds = %if.end3 %div6 = udiv i32 %kane.0, 100 %rem7 = urem i32 %kane.0, 100 %add8 = add nsw i32 %div6, %kaz.0 br label %if.end9 if.end9: ; preds = %if.then5, %if.end3 %kaz.1 = phi i32 [ %add8, %if.then5 ], [ %kaz.0, %if.end3 ] %kane.1 = phi i32 [ %rem7, %if.then5 ], [ %kane.0, %if.end3 ] %cmp10 = icmp sgt i32 %kane.1, 49 %rem13 = add nsw i32 %kane.1, -50 %add14 = zext i1 %cmp10 to i32 %kaz.2 = add nsw i32 %kaz.1, %add14 %kane.2 = select i1 %cmp10, i32 %rem13, i32 %kane.1 %cmp16 = icmp sgt i32 %kane.2, 9 br i1 %cmp16, label %if.then17, label %if.end21 if.then17: ; preds = %if.end9 %div18.lhs.trunc = trunc i32 %kane.2 to i8 %div1855 = udiv i8 %div18.lhs.trunc, 10 %div18.zext = zext i8 %div1855 to i32 %rem1956 = urem i8 %div18.lhs.trunc, 10 %rem19.zext = zext i8 %rem1956 to i32 %add20 = add nsw i32 %kaz.2, %div18.zext br label %if.end21 if.end21: ; preds = %if.then17, %if.end9 %kaz.3 = phi i32 [ %add20, %if.then17 ], [ %kaz.2, %if.end9 ] %kane.3 = phi i32 [ %rem19.zext, %if.then17 ], [ %kane.2, %if.end9 ] %cmp22 = icmp sgt i32 %kane.3, 4 %rem25 = add nsw i32 %kane.3, -5 %add26 = zext i1 %cmp22 to i32 %kaz.4 = add nsw i32 %kaz.3, %add26 %kane.4 = select i1 %cmp22, i32 %rem25, i32 %kane.3 %add28 = add nsw i32 %kaz.4, %kane.4 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add28) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dai) %2 = load i32, ptr %dai, align 4, !tbaa !5 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %for.end, label %if.end for.end: ; preds = %if.end21, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %dai) #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,y,i,a = 0,b,c,d,e,f; while(1){ a = 0; scanf("%d",&x); if(x == 0)break; y = 1000 - x; if(y >= 500){a = y/500;} b = y%500; if(b >= 100){a += b/100;} c = b%100; if(c >= 50){a += c/50;} d = c%50; if(d >= 10){a += d/10;} e = d%10; if(e >= 5){a += e/5;} f = e%5; if(f >= 1){a += f/1;} printf("%d\n",a); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224045/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224045/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp57 = icmp eq i32 %0, 0 br i1 %cmp57, label %while.end, label %if.end if.end: ; preds = %entry, %if.end19 %1 = phi i32 [ %2, %if.end19 ], [ %0, %entry ] %sub = sub nsw i32 1000, %1 %cmp1 = icmp slt i32 %1, 501 %div = sdiv i32 %sub, 500 %a.0 = select i1 %cmp1, i32 %div, i32 0 %rem = srem i32 %sub, 500 %cmp4 = icmp sgt i32 %rem, 99 %div6.lhs.trunc = trunc i32 %rem to i16 br i1 %cmp4, label %if.then5, label %if.end7 if.then5: ; preds = %if.end %div650 = udiv i16 %div6.lhs.trunc, 100 %div6.zext = zext i16 %div650 to i32 %add = add nsw i32 %a.0, %div6.zext br label %if.end7 if.end7: ; preds = %if.end, %if.then5 %a.1 = phi i32 [ %add, %if.then5 ], [ %a.0, %if.end ] %rem851 = srem i16 %div6.lhs.trunc, 100 %cmp9 = icmp sgt i16 %rem851, 49 %add12 = zext i1 %cmp9 to i32 %spec.select = add nsw i32 %a.1, %add12 %rem14.lhs.trunc = trunc i16 %rem851 to i8 %rem1452 = srem i8 %rem14.lhs.trunc, 50 %cmp15 = icmp sgt i8 %rem1452, 9 br i1 %cmp15, label %if.then16, label %if.end19 if.then16: ; preds = %if.end7 %div1753 = udiv i8 %rem1452, 10 %div17.zext = zext i8 %div1753 to i32 %add18 = add nsw i32 %spec.select, %div17.zext br label %if.end19 if.end19: ; preds = %if.then16, %if.end7 %a.3 = phi i32 [ %add18, %if.then16 ], [ %spec.select, %if.end7 ] %rem2054 = srem i8 %rem1452, 10 %cmp21 = icmp sgt i8 %rem2054, 4 %add24 = zext i1 %cmp21 to i32 %rem2655 = srem i8 %rem2054, 5 %narrow = call i8 @llvm.smax.i8(i8 %rem2655, i8 0) %add30 = zext i8 %narrow to i32 %spec.select49 = add nuw nsw i32 %add30, %add24 %a.5 = add nsw i32 %spec.select49, %a.3 %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.5) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %2 = load i32, ptr %x, align 4, !tbaa !5 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %while.end, label %if.end while.end: ; preds = %if.end19, %entry 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: 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.smax.i8(i8, i8) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void) { int n,i,cnt,x[]={500,100,50,10,5,1}; while(1){ scanf("%d",&n); if(n==0) break; n=1000-n; cnt=0; for(i=0;i<6;i++){ if(n>=x[i]){ cnt+=n/x[i]; n%=x[i]; } } printf("%d\n",cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224089/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224089/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp23 = icmp eq i32 %0, 0 br i1 %cmp23, label %while.end, label %if.end if.end: ; preds = %entry, %for.inc.3 %1 = phi i32 [ %2, %for.inc.3 ], [ %0, %entry ] %sub = sub nsw i32 1000, %1 %cmp2.not = icmp sgt i32 %1, 500 br i1 %cmp2.not, label %for.inc, label %if.then3 if.then3: ; preds = %if.end %div = sdiv i32 %sub, 500 %rem = srem i32 %sub, 500 br label %for.inc for.inc: ; preds = %if.end, %if.then3 %rem17 = phi i32 [ %rem, %if.then3 ], [ %sub, %if.end ] %cnt.1 = phi i32 [ %div, %if.then3 ], [ 0, %if.end ] %cmp2.not.1 = icmp slt i32 %rem17, 100 br i1 %cmp2.not.1, label %for.inc.1, label %if.then3.1 if.then3.1: ; preds = %for.inc %div.133 = udiv i32 %rem17, 100 %add.1 = add nsw i32 %div.133, %cnt.1 %rem.134 = urem i32 %rem17, 100 br label %for.inc.1 for.inc.1: ; preds = %if.then3.1, %for.inc %rem17.1 = phi i32 [ %rem.134, %if.then3.1 ], [ %rem17, %for.inc ] %cnt.1.1 = phi i32 [ %add.1, %if.then3.1 ], [ %cnt.1, %for.inc ] %cmp2.not.2 = icmp sgt i32 %rem17.1, 49 %rem.232 = add i32 %rem17.1, -50 %rem17.2 = select i1 %cmp2.not.2, i32 %rem.232, i32 %rem17.1 %add.2 = zext i1 %cmp2.not.2 to i32 %cnt.1.2 = add nsw i32 %cnt.1.1, %add.2 %cmp2.not.3 = icmp slt i32 %rem17.2, 10 br i1 %cmp2.not.3, label %for.inc.3, label %if.then3.3 if.then3.3: ; preds = %for.inc.1 %div.327.lhs.trunc = trunc i32 %rem17.2 to i8 %div.32728 = udiv i8 %div.327.lhs.trunc, 10 %div.327.zext = zext i8 %div.32728 to i32 %add.3 = add nsw i32 %cnt.1.2, %div.327.zext %rem.329.lhs.trunc = trunc i32 %rem17.2 to i8 %rem.32930 = urem i8 %rem.329.lhs.trunc, 10 %rem.329.zext = zext i8 %rem.32930 to i32 br label %for.inc.3 for.inc.3: ; preds = %if.then3.3, %for.inc.1 %rem17.3 = phi i32 [ %rem.329.zext, %if.then3.3 ], [ %rem17.2, %for.inc.1 ] %cnt.1.3 = phi i32 [ %add.3, %if.then3.3 ], [ %cnt.1.2, %for.inc.1 ] %cmp2.not.4 = icmp sgt i32 %rem17.3, 4 %rem.426 = add i32 %rem17.3, -5 %rem17.4 = select i1 %cmp2.not.4, i32 %rem.426, i32 %rem17.3 %add.4 = zext i1 %cmp2.not.4 to i32 %cnt.1.4 = add nsw i32 %cnt.1.3, %add.4 %cmp2.not.5 = icmp slt i32 %rem17.4, 1 %storemerge = select i1 %cmp2.not.5, i32 %rem17.4, i32 0 %add.5 = select i1 %cmp2.not.5, i32 0, i32 %rem17.4 %cnt.1.5 = add nsw i32 %cnt.1.4, %add.5 store i32 %storemerge, ptr %n, align 4, !tbaa !5 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.1.5) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %while.end, label %if.end while.end: ; preds = %for.inc.3, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void) { int m,n,x; 1<=m && m<=1000; scanf("%d",&n); while(n!=0) { x=0; m=1000-n; while(!(m<500)) { m=m-500; x+=1; } while(!(m<100)) { m=m-100; x+=1; } while(!(m<50)) { m=m-50; x+=1; } while(!(m<10)) { m=m-10; x+=1; } while(!(m<5)) { m=m-5; x+=1; } while(!(m<1)) { m=m-1; x+=1; } printf("%d\n",x); scanf("%d",&n); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224139/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224139/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp2.not92 = icmp eq i32 %0, 0 br i1 %cmp2.not92, label %while.end44, label %while.body while.body: ; preds = %entry, %while.cond35.preheader %1 = phi i32 [ %36, %while.cond35.preheader ], [ %0, %entry ] %sub = sub i32 1000, %1 %cmp464 = icmp slt i32 %1, 501 br i1 %cmp464, label %while.body5.preheader, label %while.cond7.preheader while.body5.preheader: ; preds = %while.body %smin = call i32 @llvm.smin.i32(i32 %sub, i32 999) %2 = add i32 %1, %smin %3 = sub i32 1499, %2 %4 = udiv i32 %3, 500 %.neg = mul i32 %4, -500 %reass.sub = sub i32 %.neg, %1 %5 = add i32 %reass.sub, 500 %6 = add nuw nsw i32 %4, 1 br label %while.cond7.preheader while.cond7.preheader: ; preds = %while.body5.preheader, %while.body %m.0.lcssa = phi i32 [ %sub, %while.body ], [ %5, %while.body5.preheader ] %x.0.lcssa = phi i32 [ 0, %while.body ], [ %6, %while.body5.preheader ] %cmp868 = icmp sgt i32 %m.0.lcssa, 99 br i1 %cmp868, label %while.body10.preheader, label %while.cond14.preheader while.body10.preheader: ; preds = %while.cond7.preheader %7 = add nuw i32 %m.0.lcssa, 99 %smin93 = call i32 @llvm.smin.i32(i32 %m.0.lcssa, i32 199) %8 = sub nuw i32 %7, %smin93 %9 = udiv i32 %8, 100 %.neg97 = mul nsw i32 %9, -100 %10 = add nuw nsw i32 %x.0.lcssa, 1 %11 = add nsw i32 %m.0.lcssa, -100 %12 = add nsw i32 %.neg97, %11 %13 = add nuw nsw i32 %10, %9 br label %while.cond14.preheader while.cond14.preheader: ; preds = %while.body10.preheader, %while.cond7.preheader %m.1.lcssa = phi i32 [ %m.0.lcssa, %while.cond7.preheader ], [ %12, %while.body10.preheader ] %x.1.lcssa = phi i32 [ %x.0.lcssa, %while.cond7.preheader ], [ %13, %while.body10.preheader ] %cmp1573 = icmp sgt i32 %m.1.lcssa, 49 br i1 %cmp1573, label %while.body17.preheader, label %while.cond21.preheader while.body17.preheader: ; preds = %while.cond14.preheader %14 = add nuw nsw i32 %m.1.lcssa, 49 %smin94 = call i32 @llvm.smin.i32(i32 %m.1.lcssa, i32 99) %15 = sub nuw nsw i32 %14, %smin94 %16 = udiv i32 %15, 50 %.neg98 = mul nsw i32 %16, -50 %17 = add nuw nsw i32 %x.1.lcssa, 1 %18 = add nsw i32 %m.1.lcssa, -50 %19 = add nsw i32 %.neg98, %18 %20 = add nuw nsw i32 %17, %16 br label %while.cond21.preheader while.cond21.preheader: ; preds = %while.body17.preheader, %while.cond14.preheader %m.2.lcssa = phi i32 [ %m.1.lcssa, %while.cond14.preheader ], [ %19, %while.body17.preheader ] %x.2.lcssa = phi i32 [ %x.1.lcssa, %while.cond14.preheader ], [ %20, %while.body17.preheader ] %cmp2278 = icmp sgt i32 %m.2.lcssa, 9 br i1 %cmp2278, label %while.body24.preheader, label %while.cond28.preheader while.body24.preheader: ; preds = %while.cond21.preheader %21 = add nuw nsw i32 %m.2.lcssa, 9 %smin95 = call i32 @llvm.smin.i32(i32 %m.2.lcssa, i32 19) %22 = sub nuw nsw i32 %21, %smin95 %23 = udiv i32 %22, 10 %.neg99 = mul nsw i32 %23, -10 %24 = add nuw nsw i32 %x.2.lcssa, 1 %25 = add nsw i32 %m.2.lcssa, -10 %26 = add nsw i32 %.neg99, %25 %27 = add nuw nsw i32 %24, %23 br label %while.cond28.preheader while.cond28.preheader: ; preds = %while.body24.preheader, %while.cond21.preheader %m.3.lcssa = phi i32 [ %m.2.lcssa, %while.cond21.preheader ], [ %26, %while.body24.preheader ] %x.3.lcssa = phi i32 [ %x.2.lcssa, %while.cond21.preheader ], [ %27, %while.body24.preheader ] %cmp2983 = icmp sgt i32 %m.3.lcssa, 4 br i1 %cmp2983, label %while.body31.preheader, label %while.cond35.preheader while.body31.preheader: ; preds = %while.cond28.preheader %28 = add nuw nsw i32 %m.3.lcssa, 4 %smin96 = call i32 @llvm.smin.i32(i32 %m.3.lcssa, i32 9) %29 = sub nuw nsw i32 %28, %smin96 %30 = udiv i32 %29, 5 %.neg100 = mul nsw i32 %30, -5 %31 = add nuw nsw i32 %x.3.lcssa, 1 %32 = add nsw i32 %m.3.lcssa, -5 %33 = add nsw i32 %.neg100, %32 %34 = add nuw nsw i32 %31, %30 br label %while.cond35.preheader while.cond35.preheader: ; preds = %while.body31.preheader, %while.cond28.preheader %m.4.lcssa = phi i32 [ %m.3.lcssa, %while.cond28.preheader ], [ %33, %while.body31.preheader ] %x.4.lcssa = phi i32 [ %x.3.lcssa, %while.cond28.preheader ], [ %34, %while.body31.preheader ] %35 = call i32 @llvm.smax.i32(i32 %m.4.lcssa, i32 0) %spec.select = add nuw i32 %x.4.lcssa, %35 %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select) %call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %36 = load i32, ptr %n, align 4, !tbaa !5 %cmp2.not = icmp eq i32 %36, 0 br i1 %cmp2.not, label %while.end44, label %while.body, !llvm.loop !9 while.end44: ; preds = %while.cond35.preheader, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; 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"}
#include <stdio.h> int main(void) { while(1){ int a; scanf("%d",&a); if(a==0) break; int sa,e500,a500,e100,a100,e50,a50,e10,a10,e5,e1,k; sa=1000-a; e500=sa/500; a500=sa%500; e100=a500/100; a100=a500%100; e50=a100/50; a50=a100%50; e10=a50/10; a10=a50%10; e5=a10/5; e1=a10%5; k=e500+e100+e50+e10+e5+e1; printf("%d\n",k); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224182/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224182/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 %call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp30 = icmp eq i32 %0, 0 br i1 %cmp30, label %while.end, label %cleanup cleanup: ; preds = %entry, %cleanup %1 = phi i32 [ %2, %cleanup ], [ %0, %entry ] %sub = sub nsw i32 1000, %1 %div = sdiv i32 %sub, 500 %rem = srem i32 %sub, 500 %div1.lhs.trunc = trunc i32 %rem to i16 %div121 = sdiv i16 %div1.lhs.trunc, 100 %div1.sext = sext i16 %div121 to i32 %rem222 = srem i16 %div1.lhs.trunc, 100 %div3.lhs.trunc = trunc i16 %rem222 to i8 %div323 = sdiv i8 %div3.lhs.trunc, 50 %div3.sext = sext i8 %div323 to i32 %rem424 = srem i8 %div3.lhs.trunc, 50 %div525 = sdiv i8 %rem424, 10 %div5.sext = sext i8 %div525 to i32 %rem626 = srem i8 %rem424, 10 %div727 = sdiv i8 %rem626, 5 %div7.sext = sext i8 %div727 to i32 %rem828 = srem i8 %rem626, 5 %rem8.sext = sext i8 %rem828 to i32 %add = add nsw i32 %div, %div1.sext %add9 = add nsw i32 %add, %div3.sext %add10 = add nsw i32 %add9, %div5.sext %add11 = add nsw i32 %add10, %div7.sext %add12 = add nsw i32 %add11, %rem8.sext %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add12) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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) %2 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %while.end, label %cleanup while.end: ; preds = %cleanup, %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"}
#include <stdio.h> int main(void) { int A,B,C; scanf("%d%d%d", &A, &B, &C); if(A+B == C || A+C == B || B+C == A) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224225/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224225/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %C = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C) %0 = load i32, ptr %A, align 4, !tbaa !5 %1 = load i32, ptr %B, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %C, align 4, !tbaa !5 %cmp = icmp eq i32 %add, %2 %add1 = add nsw i32 %2, %0 %cmp2 = icmp eq i32 %add1, %1 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %2, %1 %cmp5 = icmp eq i32 %add4, %0 %or.cond10 = select i1 %or.cond, i1 true, i1 %cmp5 %str.3.str = select i1 %or.cond10, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void){ int a,b,c; scanf("%d %d %d",&a,&b,&c); if((a + b == c||b + c == a)||c + a == b) printf("Yes"); else printf("No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224269/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224269/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %cmp = icmp eq i32 %add, %2 %add1 = add nsw i32 %2, %1 %cmp2 = icmp eq i32 %add1, %0 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %2, %0 %cmp5 = icmp eq i32 %add4, %1 %or.cond9 = select i1 %or.cond, i1 true, i1 %cmp5 %.str.1..str.2 = select i1 %or.cond9, ptr @.str.1, ptr @.str.2 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a==(b+c)||b==(a+c)||c==(a+b)) printf("Yes"); else printf("No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224311/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224311/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp = icmp eq i32 %0, %add %add1 = add nsw i32 %2, %0 %cmp2 = icmp eq i32 %1, %add1 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %1, %0 %cmp5 = icmp eq i32 %2, %add4 %or.cond9 = select i1 %or.cond, i1 true, i1 %cmp5 %.str.1..str.2 = select i1 %or.cond9, ptr @.str.1, ptr @.str.2 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<math.h> int main(){ int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a == b + c || b == c + a || c == a + b){ printf("Yes"); }else{ printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224355/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224355/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp = icmp eq i32 %0, %add %add1 = add nsw i32 %2, %0 %cmp2 = icmp eq i32 %1, %add1 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %1, %0 %cmp5 = icmp eq i32 %2, %add4 %or.cond9 = select i1 %or.cond, i1 true, i1 %cmp5 %.str.1..str.2 = select i1 %or.cond9, ptr @.str.1, ptr @.str.2 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a==(a+b+c)/2.0 || b==(a+b+c)/2.0 ||c==(a+b+c)/2.0) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224399/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224399/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %conv = sitofp i32 %0 to double %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %add1 = add nsw i32 %add, %2 %conv2 = sitofp i32 %add1 to double %div = fmul double %conv2, 5.000000e-01 %cmp = fcmp oeq double %div, %conv %conv4 = sitofp i32 %1 to double %cmp9 = fcmp oeq double %div, %conv4 %or.cond = or i1 %cmp, %cmp9 %conv12 = sitofp i32 %2 to double %cmp17 = fcmp oeq double %div, %conv12 %or.cond22 = or i1 %cmp17, %or.cond %str.3.str = select i1 %or.cond22, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a==b+c ||b==a+c ||c==a+b) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224441/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224441/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp = icmp eq i32 %0, %add %add1 = add nsw i32 %2, %0 %cmp2 = icmp eq i32 %1, %add1 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %1, %0 %cmp5 = icmp eq i32 %2, %add4 %or.cond10 = select i1 %or.cond, i1 true, i1 %cmp5 %str.3.str = select i1 %or.cond10, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int a, b, c; scanf("%d %d %d", &a, &b, &c); if((a+b) == c || (b+c) == a || (c+a) == b){ printf("Yes"); } else{ printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224485/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224485/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %cmp = icmp eq i32 %add, %2 %add1 = add nsw i32 %2, %1 %cmp2 = icmp eq i32 %add1, %0 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %2, %0 %cmp5 = icmp eq i32 %add4, %1 %or.cond9 = select i1 %or.cond, i1 true, i1 %cmp5 %.str.1..str.2 = select i1 %or.cond9, ptr @.str.1, ptr @.str.2 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int a,b,c; scanf("%d %d %d",&a,&b,&c); if((a+b)==c||(a+c)==b||a==(b+c)){ printf("Yes\n"); }else{ printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224528/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224528/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @str = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %c, align 4, !tbaa !5 %cmp = icmp eq i32 %add, %2 %add1 = add nsw i32 %2, %0 %cmp2 = icmp eq i32 %add1, %1 %or.cond = select i1 %cmp, i1 true, i1 %cmp2 %add4 = add nsw i32 %2, %1 %cmp5 = icmp eq i32 %0, %add4 %or.cond10 = select i1 %or.cond, i1 true, i1 %cmp5 %str.3.str = select i1 %or.cond10, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <wchar.h> #include <math.h> #define N_MAX (100) #define P_MAX (100) #define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) int compare_sz_asc(const void* a, const void* b) { return *((size_t*)a) < *((size_t*)b) ? -1 : 1; } int compare_sz_desc(const void* a, const void* b) { return *((size_t*)a) > * ((size_t*)b) ? -1 : 1; } int compare_i64_asc(const void* a, const void* b) { return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1; } int compare_i64_desc(const void* a, const void* b) { return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1; } int compare_u64_asc(const void* a, const void* b) { return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1; } int compare_u64_desc(const void* a, const void* b) { return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1; } int compare_c_asc(const void* a, const void* b) { return *((char*)a) < *((char*)b) ? -1 : 1; } int compare_c_desc(const void* a, const void* b) { return *((char*)a) > * ((char*)b) ? -1 : 1; } static size_t powSz(const size_t base, const size_t exp) { if (exp == 0) { return 1; } if (exp == 1) { return base; } if (exp % 2 == 0) { return powSz(base * base, exp / 2); } else { return base * powSz(base, exp - 1); } } static size_t comb(const size_t n, const size_t r) { size_t result = 1; for (size_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static uint64_t combU64(const uint64_t n, const uint64_t r) { uint64_t result = 1; for (uint64_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static size_t gcdZu(size_t m, size_t n) { size_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } static uint64_t gcdU64(uint64_t m, uint64_t n) { uint64_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } typedef struct { uint64_t A; uint64_t B; uint64_t val; } _status; static _status status[200000]; typedef struct { uint64_t idx; }BHeap_Val; #define BHEAP_VAL_TYPE BHeap_Val static int _bHeap_Compare(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) { const uint64_t parentVal = status[parent->idx].val; const uint64_t nodeVal = status[node->idx].val; return parentVal >= nodeVal ? -1 : 1; } #define BHEAP_INVALID_NODE ((size_t)100000000) typedef struct { BHEAP_VAL_TYPE val; } BHeap_Node; static struct { size_t size; int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node); } bHeap_Info; static BHeap_Node bHeap_Node[1 << 20]; static void bHeap_Init(int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node)) { bHeap_Info.size = 0; bHeap_Info.compare = compare; } static void bHeap_UpHeap(const size_t nodeIdx) { if (nodeIdx == 0) { return; } const size_t parentIdx = (nodeIdx + 1) / 2 - 1; const int compareResult = bHeap_Info.compare(&(bHeap_Node[parentIdx].val), &(bHeap_Node[nodeIdx].val)); if (0 < compareResult) { const BHEAP_VAL_TYPE tmp = bHeap_Node[parentIdx].val; bHeap_Node[parentIdx].val = bHeap_Node[nodeIdx].val; bHeap_Node[nodeIdx].val = tmp; if (parentIdx != 0) { bHeap_UpHeap(parentIdx); } } } static void bHeap_DownHeap(const size_t nodeIdx) { if (bHeap_Info.size - 1 <= nodeIdx) { return; } const size_t leftIdx = 2 * (nodeIdx + 1) - 1; if (leftIdx < bHeap_Info.size) { const int leftResult = bHeap_Info.compare(&(bHeap_Node[nodeIdx].val), &(bHeap_Node[leftIdx].val)); size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx; const size_t rightIdx = leftIdx + 1; if (rightIdx < bHeap_Info.size) { const int rightResult = bHeap_Info.compare(&(bHeap_Node[nodeIdx].val), &(bHeap_Node[rightIdx].val)); if (swapTarget == BHEAP_INVALID_NODE) { if (0 < rightResult) { swapTarget = rightIdx; } } else { if (0 < rightResult) { const int rightLeftResult = bHeap_Info.compare(&(bHeap_Node[leftIdx].val), &(bHeap_Node[rightIdx].val)); if (0 < rightLeftResult) { swapTarget = rightIdx; } } } } if (swapTarget != BHEAP_INVALID_NODE) { const BHEAP_VAL_TYPE tmp = bHeap_Node[nodeIdx].val; bHeap_Node[nodeIdx].val = bHeap_Node[swapTarget].val; bHeap_Node[swapTarget].val = tmp; bHeap_DownHeap(swapTarget); } } } static void bHeap_Add(const BHEAP_VAL_TYPE val) { bHeap_Node[bHeap_Info.size].val = val; bHeap_Info.size++; bHeap_UpHeap(bHeap_Info.size - 1); } static void bHeap_RemoveTop(void) { if (bHeap_Info.size == 0) { return; } if (bHeap_Info.size == 1) { bHeap_Info.size--; return; } bHeap_Node[0].val = bHeap_Node[bHeap_Info.size - 1].val; bHeap_Info.size--; bHeap_DownHeap(0); } static BHEAP_VAL_TYPE* bHeap_GetTopVal(void) { return bHeap_Info.size == 0 ? NULL : &(bHeap_Node[0].val); } typedef struct { uint64_t cnt; size_t* child; size_t numChild; size_t maxNumChild; } Tree_Node; #define TREE_INIT_ALLOC (128) static Tree_Node tree_Node[200000]; static void tree_Init(const uint64_t N) { for (uint64_t i = 0; i < N; i++) { tree_Node[i].cnt = 0; tree_Node[i].numChild = 0; tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC); tree_Node[i].maxNumChild = TREE_INIT_ALLOC; } } static void tree_AddChild(const size_t parent, const size_t child) { if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) { tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2); tree_Node[parent].maxNumChild *= 2; } tree_Node[parent].child[tree_Node[parent].numChild] = child; tree_Node[parent].numChild++; } int main(void) { uint64_t A, B, C; scanf("%"PRIu64"%"PRIu64"%"PRIu64, &A, &B, &C); if (A < B) { puts(A <= C && C <= B ? "Yes" : "No"); } else { puts(B <= C && C <= A ? "Yes" : "No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224579/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224579/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [10 x i8] c"%lu%lu%lu\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_sz_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ult i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_sz_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_i64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_i64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp sgt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_u64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ult i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_u64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i8, ptr %a, align 1, !tbaa !9 %1 = load i8, ptr %b, align 1, !tbaa !9 %cmp = icmp slt i8 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i8, ptr %a, align 1, !tbaa !9 %1 = load i8, ptr %b, align 1, !tbaa !9 %cmp = icmp sgt i8 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %A = alloca i64, align 8 %B = alloca i64, align 8 %C = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %C) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C) %0 = load i64, ptr %A, align 8 %1 = load i64, ptr %B, align 8 %2 = load i64, ptr %C, align 8 %. = call i64 @llvm.umin.i64(i64 %0, i64 %1) %.13 = call i64 @llvm.umax.i64(i64 %0, i64 %1) %cmp4 = icmp ule i64 %., %2 %cmp6 = icmp ule i64 %2, %.13 %3 = and i1 %cmp4, %cmp6 %cond8 = select i1 %3, ptr @.str.1, ptr @.str.2 %call9 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond8) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %C) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umin.i64(i64, i64) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umax.i64(i64, i64) #4 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0}
#include <stdio.h> int main(int argc, char const *argv[]) { int a,b,c; scanf("%d %d %d",&a,&b,&c); if (a>=c) { if (c>b) { printf("Yes\n"); }else{ printf("No\n"); } }else{ if (c<b) { printf("Yes\n"); }else{ printf("No\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224621/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224621/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.5 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %c, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 %2 = load i32, ptr %b, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %1, %2 %str.5.str.4 = select i1 %cmp1, ptr @str.5, ptr @str.4 %cmp6 = icmp slt i32 %1, %2 %str.3.str = select i1 %cmp6, ptr @str.5, ptr @str.4 %str.3.sink = select i1 %cmp.not, ptr %str.3.str, ptr %str.5.str.4 %puts13 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int x,y,z; scanf("%d %d %d", &x, &y, &z); if((x <= z)&&(z <= y)){ printf("Yes"); } else if((y <= z)&&(z <= x)){ printf("Yes"); } else{ printf("No"); } return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224665/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224665/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 %z = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z) %0 = load i32, ptr %x, align 4 %1 = load i32, ptr %z, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 %2 = load i32, ptr %y, align 4 %cmp1.not = icmp sgt i32 %1, %2 %or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not %cmp3.not = icmp sgt i32 %2, %1 %cmp5.not = icmp sgt i32 %1, %0 %or.cond12 = or i1 %cmp5.not, %cmp3.not %3 = select i1 %or.cond, i1 %or.cond12, i1 false %.str.1.sink = select i1 %3, ptr @.str.2, ptr @.str.1 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a<b){ if(a<c&&c<b){ printf("Yes\n"); } else{ printf("No\n"); } } else{if(b<c&&c<a){ printf("Yes\n"); } else{ printf("No\n"); } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224708/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224708/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.5 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp slt i32 %0, %1 %2 = load i32, ptr %c, align 4, !tbaa !5 br i1 %cmp, label %if.then, label %if.else6 if.then: ; preds = %entry %cmp1 = icmp slt i32 %0, %2 %cmp2 = icmp slt i32 %2, %1 %or.cond = and i1 %cmp1, %cmp2 %str.5.str.4 = select i1 %or.cond, ptr @str.5, ptr @str.4 br label %if.end15 if.else6: ; preds = %entry %cmp7 = icmp slt i32 %1, %2 %cmp9 = icmp slt i32 %2, %0 %or.cond23 = and i1 %cmp7, %cmp9 %str.3.str = select i1 %or.cond23, ptr @str.5, ptr @str.4 br label %if.end15 if.end15: ; preds = %if.else6, %if.then %str.3.sink = phi ptr [ %str.5.str.4, %if.then ], [ %str.3.str, %if.else6 ] %puts20 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(void) { int a, b, c; scanf("%d %d %d", &a, &b, &c); if (a < b) { if (c < b && c > a) printf("Yes"); else printf("No"); } else { if (c < a && c > b) printf("Yes"); else printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224751/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224751/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %. = call i32 @llvm.smax.i32(i32 %0, i32 %1) %.23 = call i32 @llvm.smin.i32(i32 %0, i32 %1) %cmp7 = icmp slt i32 %2, %. %cmp9 = icmp sgt i32 %2, %.23 %or.cond20 = and i1 %cmp7, %cmp9 %.str.1..str.221 = select i1 %or.cond20, ptr @.str.1, ptr @.str.2 %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.221) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
/* cat <<EOF >mistaken-paste */ #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" #define _USE_MATH_DEFINES #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <time.h> #define BIG 2000000007 #define VERYBIG 2000000000000007LL #define MOD 1000000007 #define FOD 998244353 typedef uint64_t ull; typedef int64_t sll; #define N_MAX 1000000 #define M_MAX 200000 #ifdef __cplusplus #include <queue> #include <stack> #include <tuple> #include <set> #include <map> #include <string> using std::queue; using std::priority_queue; using std::stack; using std::tuple; using std::set; using std::map; using std::vector; using std::greater; using std::pair; using std::string; #endif typedef struct { int32_t a; int32_t b; } hw; typedef struct { sll a; sll b; } hwll; typedef struct { sll a; sll b; sll c; } hwllc; typedef struct { hwll a; hwll b; } linell; ull n, m; ull h, w; ull k; ull q; sll va, vb, vc, vd, ve, vf; ull ua, ub, uc, ud, ue, uf; long double vra, vrb, vrc; double vda, vdb, vdc; char ch, dh; ull umin (ull x, ull y) { return (x < y) ? x : y; } ull umax (ull x, ull y) { return (x > y) ? x : y; } sll smin (sll x, sll y) { return (x < y) ? x : y; } sll smax (sll x, sll y) { return (x > y) ? x : y; } ull gcd (ull x, ull y) { if (x < y) { return gcd(y, x); } else if (y == 0) { return x; } else { return gcd(y, x % y); } } ull bitpow (ull a, ull x, ull modulo) { ull result = 1; while (x) { if (x & 1) { result *= a; result %= modulo; } x /= 2; a = (a * a) % modulo; } return result; } ull divide (ull a, ull b, ull modulo) { return (a * bitpow(b, modulo - 2, modulo)) % modulo; } ull udiff (ull a, ull b) { if (a >= b) { return a - b; } else { return b - a; } } sll sdiff (sll a, sll b) { if (a >= b) { return a - b; } else { return b - a; } } int bitcount (ull n) { int result = 0; while (n) { if (n & 1) result++; n /= 2; } return result; } // double distance (sll x1, sll y1, sll x2, sll y2) { // double xdist2, ydist2, origindist, dist; // xdist2 = (x1 - x2) * (x1 - x2); // ydist2 = (y1 - y2) * (y1 - y2); // return sqrt(xdist2 + ydist2); // } int32_t pullcomp (const void *left, const void *right) { ull l = *(ull*)left; ull r = *(ull*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t psllcomp (const void *left, const void *right) { sll l = *(sll*)left; sll r = *(sll*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pcharcomp (const void *left, const void *right) { char l = *(char*)left; char r = *(char*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pdoublecomp (const void *left, const void *right) { double l = *(double*)left; double r = *(double*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pstrcomp (const void *left, const void *right) { char* l = *(char**)left; char* r = *(char**)right; return strcmp(l, r); } int32_t phwllABcomp (const void *left, const void *right) { hwll l = *(hwll*)left; hwll r = *(hwll*)right; if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } return 0; } int32_t phwllREVcomp (const void *left, const void *right) { hwll l = *(hwll*)left; hwll r = *(hwll*)right; if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } return 0; } int32_t ptriplecomp (const void *left, const void *right) { hwllc l = *(hwllc*)left; hwllc r = *(hwllc*)right; if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } if (l.c < r.c) { return -1; } if (l.c > r.c) { return +1; } return 0; } bool isinrange (sll left, sll x, sll right) { return (left <= x && x <= right); } bool isinrange_soft (sll left, sll x, sll right) { return (left <= x && x <= right) || (left >= x && x >= right); } sll a[N_MAX]; // sll a[3001][3001]; sll b[N_MAX]; // sll b[3001][3001]; sll c[N_MAX]; sll d[N_MAX]; sll e[N_MAX]; char s[N_MAX + 1]; // char s[3010][3010]; char t[N_MAX + 1]; // char t[3010][3010]; // hwll xy[N_MAX]; // sll table[1000][1000]; ull solve () { sll i, j, ki, li; ull result = 0; // sll result = 0; double dresult = 0; // ull maybe = 0; sll maybe = 0; // ull sum = 0; sll sum = 0; sll item; ull *dpcell; b[n] = 1; for (i = n - 1; i >= 0; i--) { if (a[i] >= b[i + 1] * 2) { b[i] = b[i + 1]; } else { b[i] = b[i + 1] + a[i]; } } c[0] = k; for (i = 0; i < n; i++) { c[i + 1] = umin(c[i], udiff(c[i], a[i])); } while (q--) { ull x; scanf("%llu", &x); x--; if (c[x] >= b[x + 1]) { puts("YES"); } else { puts("NO"); } } // printf("%lld\n", result); // printf("%.15lf\n", dresult); // puts(s); return 0; success: // puts("YES"); // puts("Yes"); // printf("%llu\n", result); // puts("0"); puts("AC"); return 0; fail: // puts("NO"); // puts("No"); // puts("0"); // puts("-1"); // puts("-1 -1 -1"); puts("WA"); return 1; } int32_t main (void) { int32_t i, j; int32_t x, y; scanf("%llu", &n, &m); scanf("%llu", &k, &n, &m); // scanf("%llu%llu", &h, &w); // scanf("%lld%lld", &va, &vb, &vc, &vd); // scanf("%llu%llu", &ua, &ub, &uc, &ud); // scanf("%llu", &q); // scanf("%s", s); // scanf("%s", t); for (i = 0; i < n; i++) { // scanf("%lld%lld", &xy[i].a, &xy[i].b); scanf("%lld", &a[i]); // scanf("%lld", &b[i]); // scanf("%lld", &c[i]); // scanf("%lld", &d[i]); // a[i]--; // b[i]--; // c[i]--; } // scanf("%llu", &m, &k); scanf("%llu", &q); // for (i = 0; i < k; i++) { // scanf("%lld", &e[i]); // e[i]--; // scanf("%lld", &d[i]); // } // for (i = 0; i < n; i++) { // for (j = 0; j < n; j++) { // scanf("%llu", &table[i][j]); // } // } // for (i = 0; i < h; i++) { // scanf("%s", &s[i]); // } solve(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224801/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224801/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @b = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16 @n = dso_local global i64 0, align 8 @a = dso_local global [1000000 x i64] zeroinitializer, align 16 @k = dso_local global i64 0, align 8 @c = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16 @q = dso_local global i64 0, align 8 @.str = private unnamed_addr constant [5 x i8] c"%llu\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @m = dso_local global i64 0, align 8 @.str.5 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @h = dso_local local_unnamed_addr global i64 0, align 8 @w = dso_local local_unnamed_addr global i64 0, align 8 @va = dso_local local_unnamed_addr global i64 0, align 8 @vb = dso_local local_unnamed_addr global i64 0, align 8 @vc = dso_local local_unnamed_addr global i64 0, align 8 @vd = dso_local local_unnamed_addr global i64 0, align 8 @ve = dso_local local_unnamed_addr global i64 0, align 8 @vf = dso_local local_unnamed_addr global i64 0, align 8 @ua = dso_local local_unnamed_addr global i64 0, align 8 @ub = dso_local local_unnamed_addr global i64 0, align 8 @uc = dso_local local_unnamed_addr global i64 0, align 8 @ud = dso_local local_unnamed_addr global i64 0, align 8 @ue = dso_local local_unnamed_addr global i64 0, align 8 @uf = dso_local local_unnamed_addr global i64 0, align 8 @vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @ch = dso_local local_unnamed_addr global i8 0, align 1 @dh = dso_local local_unnamed_addr global i8 0, align 1 @d = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16 @e = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16 @s = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16 @t = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ] %y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ] %cmp = icmp ult i64 %x.tr, %y.tr br i1 %cmp, label %tailrecurse.backedge, label %if.else if.else: ; preds = %tailrecurse %cmp1 = icmp eq i64 %y.tr, 0 br i1 %cmp1, label %return, label %if.else3 if.else3: ; preds = %if.else %rem = urem i64 %x.tr, %y.tr br label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.else3, %tailrecurse %y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ] br label %tailrecurse return: ; preds = %if.else ret i64 %x.tr } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 { entry: %tobool.not12 = icmp eq i64 %x, 0 br i1 %tobool.not12, label %while.end, label %while.body while.body: ; preds = %entry, %if.end %result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ] %a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ] %x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ] %and = and i64 %x.addr.013, 1 %tobool1.not = icmp eq i64 %and, 0 br i1 %tobool1.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul i64 %result.015, %a.addr.014 %rem = urem i64 %mul, %modulo br label %if.end if.end: ; preds = %if.then, %while.body %result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ] %div11 = lshr i64 %x.addr.013, 1 %mul2 = mul i64 %a.addr.014, %a.addr.014 %rem3 = urem i64 %mul2, %modulo %tobool.not = icmp ult i64 %x.addr.013, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %if.end, %entry %result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ] ret i64 %result.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 { entry: %sub = add i64 %modulo, -2 %tobool.not12.i = icmp eq i64 %sub, 0 br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i while.body.i: ; preds = %entry, %if.end.i %result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ] %a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ] %x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ] %and.i = and i64 %x.addr.013.i, 1 %tobool1.not.i = icmp eq i64 %and.i, 0 br i1 %tobool1.not.i, label %if.end.i, label %if.then.i if.then.i: ; preds = %while.body.i %mul.i = mul i64 %a.addr.014.i, %result.015.i %rem.i = urem i64 %mul.i, %modulo br label %if.end.i if.end.i: ; preds = %if.then.i, %while.body.i %result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ] %div11.i = lshr i64 %x.addr.013.i, 1 %mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i %rem3.i = urem i64 %mul2.i, %modulo %tobool.not.i = icmp ult i64 %x.addr.013.i, 2 br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5 bitpow.exit: ; preds = %if.end.i, %entry %result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ] %mul = mul i64 %result.0.lcssa.i, %a %rem = urem i64 %mul, %modulo ret i64 %rem } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 { entry: %cmp.not = icmp ult i64 %a, %b %sub = sub i64 %a, %b %sub1 = sub i64 %b, %a %retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub ret i64 %retval.0 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %sub = sub nsw i64 %a, %b %retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true) ret i64 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 { entry: %tobool.not6 = icmp eq i64 %n, 0 br i1 %tobool.not6, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ] %n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ] %0 = trunc i64 %n.addr.07 to i32 %1 = and i32 %0, 1 %spec.select = add i32 %1, %result.08 %div5 = lshr i64 %n.addr.07, 1 %tobool.not = icmp ult i64 %n.addr.07, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7 while.end: ; preds = %while.body, %entry %result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ] ret i32 %result.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !8 %1 = load i64, ptr %right, align 8, !tbaa !8 %cmp = icmp ult i64 %0, %1 %cmp1 = icmp ugt i64 %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !8 %1 = load i64, ptr %right, align 8, !tbaa !8 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp sgt i64 %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i8, ptr %left, align 1, !tbaa !12 %1 = load i8, ptr %right, align 1, !tbaa !12 %cmp = icmp slt i8 %0, %1 %cmp5 = icmp sgt i8 %0, %1 %. = zext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load double, ptr %left, align 8, !tbaa !13 %1 = load double, ptr %right, align 8, !tbaa !13 %cmp = fcmp olt double %0, %1 %cmp1 = fcmp ogt double %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 { entry: %0 = load ptr, ptr %left, align 8, !tbaa !15 %1 = load ptr, ptr %right, align 8, !tbaa !15 %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #10 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload %. = zext i1 %cmp13 to i32 br label %cleanup cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload %. = zext i1 %cmp13 to i32 br label %cleanup cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16 %l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16 %r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp13, label %cleanup, label %if.end15 if.end15: ; preds = %if.end10 %cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload br i1 %cmp17, label %cleanup, label %if.end19 if.end19: ; preds = %if.end15 %cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload %. = zext i1 %cmp22 to i32 br label %cleanup cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #3 { entry: %cmp = icmp sle i64 %left, %x %cmp1 = icmp sle i64 %x, %right %0 = and i1 %cmp, %cmp1 ret i1 %0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #3 { entry: %cmp.not = icmp sgt i64 %left, %x %cmp1.not = icmp sgt i64 %x, %right %or.cond = or i1 %cmp.not, %cmp1.not br i1 %or.cond, label %lor.rhs, label %lor.end lor.rhs: ; preds = %entry %cmp2 = icmp sge i64 %left, %x %cmp3 = icmp sge i64 %x, %right %0 = and i1 %cmp2, %cmp3 br label %lor.end lor.end: ; preds = %entry, %lor.rhs %1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ] ret i1 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i64 @solve() local_unnamed_addr #7 { entry: %x = alloca i64, align 8 %0 = load i64, ptr @n, align 8, !tbaa !8 %arrayidx = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %0 store i64 1, ptr %arrayidx, align 8, !tbaa !8 %i.060 = add i64 %0, -1 %cmp61 = icmp sgt i64 %i.060, -1 br i1 %cmp61, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %xtraiter = and i64 %0, 1 %1 = icmp eq i64 %i.060, 0 br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %0, -2 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %2 = phi i64 [ 1, %for.body.preheader.new ], [ %spec.select.1, %for.body ] %i.063 = phi i64 [ %i.060, %for.body.preheader.new ], [ %i.0.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx1 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.063 %3 = load i64, ptr %arrayidx1, align 8, !tbaa !8 %mul = shl nsw i64 %2, 1 %cmp3.not = icmp slt i64 %3, %mul %add10 = select i1 %cmp3.not, i64 %3, i64 0 %spec.select = add nsw i64 %2, %add10 %4 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %i.063 store i64 %spec.select, ptr %4, align 8 %i.0 = add nsw i64 %i.063, -1 %arrayidx1.1 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.0 %5 = load i64, ptr %arrayidx1.1, align 8, !tbaa !8 %mul.1 = shl nsw i64 %spec.select, 1 %cmp3.not.1 = icmp slt i64 %5, %mul.1 %add10.1 = select i1 %cmp3.not.1, i64 %5, i64 0 %spec.select.1 = add nsw i64 %spec.select, %add10.1 %6 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %i.0 store i64 %spec.select.1, ptr %6, align 8 %i.0.1 = add nsw i64 %i.063, -2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1.not, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !20 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i64 [ 1, %for.body.preheader ], [ %spec.select.1, %for.body ] %i.063.unr = phi i64 [ %i.060, %for.body.preheader ], [ %i.0.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %arrayidx1.epil = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.063.unr %7 = load i64, ptr %arrayidx1.epil, align 8, !tbaa !8 %mul.epil = shl nsw i64 %.unr, 1 %cmp3.not.epil = icmp slt i64 %7, %mul.epil %add10.epil = select i1 %cmp3.not.epil, i64 %7, i64 0 %spec.select.epil = add nsw i64 %.unr, %add10.epil %8 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %i.063.unr store i64 %spec.select.epil, ptr %8, align 8 br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %9 = load i64, ptr @k, align 8, !tbaa !8 store i64 %9, ptr @c, align 16, !tbaa !8 %cmp1364.not = icmp eq i64 %0, 0 br i1 %cmp1364.not, label %while.cond.preheader, label %for.body14.preheader for.body14.preheader: ; preds = %for.end %xtraiter68 = and i64 %0, 1 %10 = icmp eq i64 %i.060, 0 br i1 %10, label %while.cond.preheader.loopexit.unr-lcssa, label %for.body14.preheader.new for.body14.preheader.new: ; preds = %for.body14.preheader %unroll_iter71 = and i64 %0, -2 br label %for.body14 while.cond.preheader.loopexit.unr-lcssa: ; preds = %for.body14, %for.body14.preheader %.unr69 = phi i64 [ %9, %for.body14.preheader ], [ %cond.i.1, %for.body14 ] %i.165.unr = phi i64 [ 0, %for.body14.preheader ], [ %add19.1, %for.body14 ] %lcmp.mod70.not = icmp eq i64 %xtraiter68, 0 br i1 %lcmp.mod70.not, label %while.cond.preheader, label %for.body14.epil for.body14.epil: ; preds = %while.cond.preheader.loopexit.unr-lcssa %arrayidx17.epil = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.165.unr %11 = load i64, ptr %arrayidx17.epil, align 8, !tbaa !8 %cmp.not.i.epil = icmp ult i64 %.unr69, %11 %sub.i.epil = sub i64 %.unr69, %11 %sub1.i.epil = sub i64 %11, %.unr69 %retval.0.i.epil = select i1 %cmp.not.i.epil, i64 %sub1.i.epil, i64 %sub.i.epil %cond.i.epil = tail call i64 @llvm.umin.i64(i64 %.unr69, i64 %retval.0.i.epil) %add19.epil = add nuw nsw i64 %i.165.unr, 1 %arrayidx20.epil = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %add19.epil store i64 %cond.i.epil, ptr %arrayidx20.epil, align 8, !tbaa !8 br label %while.cond.preheader while.cond.preheader: ; preds = %for.body14.epil, %while.cond.preheader.loopexit.unr-lcssa, %for.end %12 = load i64, ptr @q, align 8, !tbaa !8 %dec2366 = add i64 %12, -1 store i64 %dec2366, ptr @q, align 8, !tbaa !8 %tobool.not67 = icmp eq i64 %12, 0 br i1 %tobool.not67, label %while.end, label %while.body for.body14: ; preds = %for.body14, %for.body14.preheader.new %13 = phi i64 [ %9, %for.body14.preheader.new ], [ %cond.i.1, %for.body14 ] %i.165 = phi i64 [ 0, %for.body14.preheader.new ], [ %add19.1, %for.body14 ] %niter72 = phi i64 [ 0, %for.body14.preheader.new ], [ %niter72.next.1, %for.body14 ] %arrayidx17 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %i.165 %14 = load i64, ptr %arrayidx17, align 16, !tbaa !8 %cmp.not.i = icmp ult i64 %13, %14 %sub.i = sub i64 %13, %14 %sub1.i = sub i64 %14, %13 %retval.0.i = select i1 %cmp.not.i, i64 %sub1.i, i64 %sub.i %cond.i = tail call i64 @llvm.umin.i64(i64 %13, i64 %retval.0.i) %add19 = or i64 %i.165, 1 %arrayidx20 = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %add19 store i64 %cond.i, ptr %arrayidx20, align 8, !tbaa !8 %arrayidx17.1 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %add19 %15 = load i64, ptr %arrayidx17.1, align 8, !tbaa !8 %cmp.not.i.1 = icmp ult i64 %cond.i, %15 %sub.i.1 = sub i64 %cond.i, %15 %sub1.i.1 = sub i64 %15, %cond.i %retval.0.i.1 = select i1 %cmp.not.i.1, i64 %sub1.i.1, i64 %sub.i.1 %cond.i.1 = tail call i64 @llvm.umin.i64(i64 %cond.i, i64 %retval.0.i.1) %add19.1 = add nuw nsw i64 %i.165, 2 %arrayidx20.1 = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %add19.1 store i64 %cond.i.1, ptr %arrayidx20.1, align 16, !tbaa !8 %niter72.next.1 = add i64 %niter72, 2 %niter72.ncmp.1 = icmp eq i64 %niter72.next.1, %unroll_iter71 br i1 %niter72.ncmp.1, label %while.cond.preheader.loopexit.unr-lcssa, label %for.body14, !llvm.loop !21 while.body: ; preds = %while.cond.preheader, %while.body call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #11 %call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %16 = load i64, ptr %x, align 8, !tbaa !8 %dec25 = add i64 %16, -1 store i64 %dec25, ptr %x, align 8, !tbaa !8 %arrayidx26 = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %dec25 %17 = load i64, ptr %arrayidx26, align 8, !tbaa !8 %arrayidx28 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %16 %18 = load i64, ptr %arrayidx28, align 8, !tbaa !8 %cmp29.not = icmp slt i64 %17, %18 %.str.2..str.1 = select i1 %cmp29.not, ptr @.str.2, ptr @.str.1 %call33 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #11 %19 = load i64, ptr @q, align 8, !tbaa !8 %dec23 = add i64 %19, -1 store i64 %dec23, ptr @q, align 8, !tbaa !8 %tobool.not = icmp eq i64 %19, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !22 while.end: ; preds = %while.body, %while.cond.preheader ret i64 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #7 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m) %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @k, ptr noundef nonnull @n, ptr noundef nonnull @m) %0 = load i64, ptr @n, align 8, !tbaa !8 %cmp8.not = icmp eq i64 %0, 0 br i1 %cmp8.not, label %for.end, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %indvars.iv %call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw i64 %indvars.iv, 1 %1 = load i64, ptr @n, align 8, !tbaa !8 %cmp = icmp ugt i64 %1, %indvars.iv.next br i1 %cmp, label %for.body, label %for.end, !llvm.loop !23 for.end: ; preds = %for.body, %entry %call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q) %call5 = tail call i64 @solve() ret i32 0 } ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umin.i64(i64, i64) #9 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umax.i64(i64, i64) #9 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #9 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #9 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #9 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress nofree nounwind willreturn memory(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #10 = { nounwind willreturn memory(read) } attributes #11 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = distinct !{!7, !6} !8 = !{!9, !9, i64 0} !9 = !{!"long", !10, i64 0} !10 = !{!"omnipotent char", !11, i64 0} !11 = !{!"Simple C/C++ TBAA"} !12 = !{!10, !10, i64 0} !13 = !{!14, !14, i64 0} !14 = !{!"double", !10, i64 0} !15 = !{!16, !16, i64 0} !16 = !{!"any pointer", !10, i64 0} !17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8} !18 = !{i64 0, i64 8, !8} !19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8} !20 = distinct !{!20, !6} !21 = distinct !{!21, !6} !22 = distinct !{!22, !6} !23 = distinct !{!23, !6}
#include<stdio.h> int main(){ long int n,i,j,k,A[300]={},a=0; char s[11],l[6]="MARCH"; scanf("%ld",&n); for(i=0;i<n;i++){scanf("%s",s);A[s[0]]++;} for(i=0;i<5;i++)for(j=i+1;j<5;j++)for(k=j+1;k<5;k++)a+=A[l[i]]*A[l[j]]*A[l[k]]; printf("%ld",a); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224852/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224852/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %A = alloca [300 x i64], align 16 %s = alloca [11 x i8], align 1 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 2400, ptr nonnull %A) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400) %A, i8 0, i64 2400, i1 false) call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp46 = icmp sgt i64 %0, 0 br i1 %cmp46, label %for.body, label %for.cond4.loopexit.4 for.body: ; preds = %entry, %for.body %i.047 = phi i64 [ %inc3, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %1 = load i8, ptr %s, align 1, !tbaa !9 %idxprom = sext i8 %1 to i64 %arrayidx2 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 %idxprom %2 = load i64, ptr %arrayidx2, align 8, !tbaa !5 %inc = add nsw i64 %2, 1 store i64 %inc, ptr %arrayidx2, align 8, !tbaa !5 %inc3 = add nuw nsw i64 %i.047, 1 %3 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc3, %3 br i1 %cmp, label %for.body, label %for.cond4.loopexit.4, !llvm.loop !10 for.cond4.loopexit.4: ; preds = %for.body, %entry %arrayidx16 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 77 %4 = load i64, ptr %arrayidx16, align 8, !tbaa !5 %arrayidx19 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 65 %5 = load i64, ptr %arrayidx19, align 8, !tbaa !5 %arrayidx22 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 82 %6 = load i64, ptr %arrayidx22, align 16, !tbaa !5 %arrayidx22.197 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 67 %7 = load i64, ptr %arrayidx22.197, align 8, !tbaa !5 %arrayidx22.2101 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 72 %8 = load i64, ptr %arrayidx22.2101, align 16, !tbaa !5 %arrayidx16.163 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 77 %9 = load i64, ptr %arrayidx16.163, align 8, !tbaa !5 %arrayidx19.164 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 82 %10 = load i64, ptr %arrayidx19.164, align 16, !tbaa !5 %arrayidx22.167 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 67 %11 = load i64, ptr %arrayidx22.167, align 8, !tbaa !5 %arrayidx22.167.1 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 72 %12 = load i64, ptr %arrayidx22.167.1, align 16, !tbaa !5 %arrayidx16.274 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 77 %13 = load i64, ptr %arrayidx16.274, align 8, !tbaa !5 %arrayidx16.1 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 65 %14 = load i64, ptr %arrayidx16.1, align 8, !tbaa !5 %arrayidx19.1 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 82 %15 = load i64, ptr %arrayidx19.1, align 16, !tbaa !5 %arrayidx22.1 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 67 %16 = load i64, ptr %arrayidx22.1, align 8, !tbaa !5 %arrayidx22.1.158 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 72 %17 = load i64, ptr %arrayidx22.1.158, align 16, !tbaa !5 %arrayidx16.1.1 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 65 %18 = load i64, ptr %arrayidx16.1.1, align 8, !tbaa !5 %arrayidx16.2 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 82 %19 = load i64, ptr %arrayidx16.2, align 16, !tbaa !5 %arrayidx19.2 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 67 %20 = load i64, ptr %arrayidx19.2, align 8, !tbaa !5 %arrayidx22.2 = getelementptr inbounds [300 x i64], ptr %A, i64 0, i64 72 %21 = load i64, ptr %arrayidx22.2, align 16, !tbaa !5 %mul.2 = mul nsw i64 %20, %19 %mul23.2 = mul nsw i64 %mul.2, %21 %mul.1.1 = mul nsw i64 %16, %18 %mul23.1.1 = mul nsw i64 %mul.1.1, %17 %mul.1 = mul nsw i64 %15, %14 %mul23.1.159 = mul nsw i64 %mul.1, %17 %mul23.1 = mul nsw i64 %mul.1, %16 %mul.276 = mul nsw i64 %11, %13 %mul23.279 = mul nsw i64 %mul.276, %12 %mul.165 = mul nsw i64 %10, %9 %mul23.168.1 = mul nsw i64 %mul.165, %12 %mul23.168 = mul nsw i64 %mul.165, %11 %mul = mul nsw i64 %5, %4 %mul23105 = add i64 %7, %6 %add24.199106 = add i64 %8, %mul23105 %add24.2103 = mul i64 %mul, %add24.199106 %add24.169 = add nsw i64 %mul23.168, %add24.2103 %add24.169.1 = add nsw i64 %mul23.168.1, %add24.169 %add24.280 = add nsw i64 %mul23.279, %add24.169.1 %add24.1 = add nsw i64 %mul23.1, %add24.280 %add24.1.160 = add nsw i64 %mul23.1.159, %add24.1 %add24.1.1 = add nsw i64 %mul23.1.1, %add24.1.160 %add24.2 = add nsw i64 %mul23.2, %add24.1.1 %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %add24.2) call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 2400, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<limits.h> int max(int a, int b){ return a >= b ? a : b; } int min(int a, int b){ return b >= a ? a : b; } int sei(int a){ return a>0 ? a : 0; } int factorial(int n) { if (n > 0) return n*factorial(n - 1); else return 1; } int compare_up_int(const void *a, const void *b){ return *(int*)a - *(int*)b; } int compare_down_int(const void *a, const void *b){ return *(int*)b - *(int*)a; } int euclid(int a, int b){ if(a < b){int tmp = a;a = b;b = tmp;} int r = a % b; if(r < 0) r += b; while(r != 0){ a = b;b = r;r = a % b; if(r < 0) r += b; } return b; } int main(){ long long int N,count=0,c[5]={0,0,0,0,0}; scanf("%lld",&N); char s[N]; for(int i=0;i<N;i++) scanf("%s\n",&s[i]); for(int i=0;i<N;i++){ //printf("%c",s[i]); if(s[i]=='M')c[0]+=1; else if(s[i]=='A')c[1]++; else if(s[i]=='R')c[2]++; else if(s[i]=='C')c[3]++; else if(s[i]=='H')c[4]++; } for (int i = 0; i < 5; i++) { for (int j = i + 1; j < 5; j++) { for (int k = j + 1; k < 5; k++) { count += c[i] * c[j] * c[k]; } } } printf("%lld",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224896/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224896/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%s\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %b, i32 %a) ret i32 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @sei(i32 noundef %a) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %a, i32 0) ret i32 %cond } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @factorial(i32 noundef %n) local_unnamed_addr #1 { entry: %cmp3 = icmp sgt i32 %n, 0 br i1 %cmp3, label %if.then.preheader, label %return if.then.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %if.then, label %vector.ph vector.ph: ; preds = %if.then.preheader %n.vec = and i32 %n, -8 %ind.end = and i32 %n, 7 %.splatinsert = insertelement <4 x i32> poison, i32 %n, i64 0 %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %induction = add <4 x i32> %.splat, <i32 0, i32 -1, i32 -2, i32 -3> br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ] %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ] %vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ] %step.add = add <4 x i32> %vec.ind, <i32 -4, i32 -4, i32 -4, i32 -4> %0 = mul <4 x i32> %vec.ind, %vec.phi %1 = mul <4 x i32> %step.add, %vec.phi7 %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 -8, i32 -8, i32 -8, i32 -8> %2 = icmp eq i32 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !5 middle.block: ; preds = %vector.body %bin.rdx = mul <4 x i32> %1, %0 %3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %n.vec, %n br i1 %cmp.n, label %return, label %if.then if.then: ; preds = %middle.block, %if.then.preheader %n.tr5.ph = phi i32 [ %n, %if.then.preheader ], [ %ind.end, %middle.block ] %accumulator.tr4.ph = phi i32 [ 1, %if.then.preheader ], [ %3, %middle.block ] %mul = mul nsw i32 %n.tr5.ph, %accumulator.tr4.ph %cmp = icmp ugt i32 %n.tr5.ph, 1 br i1 %cmp, label %if.then.1, label %return, !llvm.loop !8 if.then.1: ; preds = %if.then %sub = add nsw i32 %n.tr5.ph, -1 %mul.1 = mul nsw i32 %sub, %mul %cmp.1 = icmp ugt i32 %sub, 1 br i1 %cmp.1, label %if.then.2, label %return, !llvm.loop !8 if.then.2: ; preds = %if.then.1 %sub.1 = add nsw i32 %n.tr5.ph, -2 %mul.2 = mul nsw i32 %sub.1, %mul.1 %cmp.2 = icmp ugt i32 %sub.1, 1 br i1 %cmp.2, label %if.then.3, label %return, !llvm.loop !8 if.then.3: ; preds = %if.then.2 %sub.2 = add nsw i32 %n.tr5.ph, -3 %mul.3 = mul nsw i32 %sub.2, %mul.2 %cmp.3 = icmp ugt i32 %sub.2, 1 br i1 %cmp.3, label %if.then.4, label %return, !llvm.loop !8 if.then.4: ; preds = %if.then.3 %sub.3 = add nsw i32 %n.tr5.ph, -4 %mul.4 = mul nsw i32 %sub.3, %mul.3 %cmp.4 = icmp ugt i32 %sub.3, 1 br i1 %cmp.4, label %if.then.5, label %return, !llvm.loop !8 if.then.5: ; preds = %if.then.4 %sub.4 = add nsw i32 %n.tr5.ph, -5 %mul.5 = mul nsw i32 %sub.4, %mul.4 %cmp.5 = icmp ugt i32 %sub.4, 1 br i1 %cmp.5, label %if.then.6, label %return, !llvm.loop !8 if.then.6: ; preds = %if.then.5 %sub.5 = add nsw i32 %n.tr5.ph, -6 %mul.6 = mul nsw i32 %sub.5, %mul.5 br label %return return: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %middle.block, %entry %accumulator.tr.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %if.then ], [ %mul.1, %if.then.1 ], [ %mul.2, %if.then.2 ], [ %mul.3, %if.then.3 ], [ %mul.4, %if.then.4 ], [ %mul.5, %if.then.5 ], [ %mul.6, %if.then.6 ] ret i32 %accumulator.tr.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_up_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 { entry: %0 = load i32, ptr %a, align 4, !tbaa !9 %1 = load i32, ptr %b, align 4, !tbaa !9 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_down_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 { entry: %0 = load i32, ptr %b, align 4, !tbaa !9 %1 = load i32, ptr %a, align 4, !tbaa !9 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i32 @euclid(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) %spec.select25 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) %rem = srem i32 %spec.select25, %spec.select %cmp1 = icmp slt i32 %rem, 0 %add = select i1 %cmp1, i32 %spec.select, i32 0 %r.0 = add nsw i32 %add, %rem %cmp4.not27 = icmp eq i32 %r.0, 0 br i1 %cmp4.not27, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %r.129 = phi i32 [ %spec.select26, %while.body ], [ %r.0, %entry ] %b.addr.128 = phi i32 [ %r.129, %while.body ], [ %spec.select, %entry ] %rem5 = srem i32 %b.addr.128, %r.129 %cmp6 = icmp slt i32 %rem5, 0 %add8 = select i1 %cmp6, i32 %r.129, i32 0 %spec.select26 = add nsw i32 %add8, %rem5 %cmp4.not = icmp eq i32 %spec.select26, 0 br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !13 while.end: ; preds = %while.body, %entry %b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.129, %while.body ] ret i32 %b.addr.1.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: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #5 { entry: %N = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i64, ptr %N, align 8, !tbaa !15 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %0, align 16 %2 = load i64, ptr %N, align 8, !tbaa !15 %cmp111 = icmp sgt i64 %2, 0 br i1 %cmp111, label %for.body, label %for.cond59.loopexit.4 for.cond4.preheader: ; preds = %for.body %cmp6115 = icmp sgt i64 %4, 0 br i1 %cmp6115, label %for.body9.preheader, label %for.cond59.loopexit.4 for.body9.preheader: ; preds = %for.cond4.preheader %xtraiter = and i64 %4, 1 %3 = icmp eq i64 %4, 1 br i1 %3, label %for.cond59.loopexit.4.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %4, -2 br label %for.body9 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i64, ptr %N, align 8, !tbaa !15 %cmp = icmp sgt i64 %4, %indvars.iv.next br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !17 for.body9: ; preds = %for.inc55.1, %for.body9.preheader.new %indvars.iv140 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next141.1, %for.inc55.1 ] %inc23126 = phi i64 [ 0, %for.body9.preheader.new ], [ %inc23125.1, %for.inc55.1 ] %inc32124 = phi i64 [ 0, %for.body9.preheader.new ], [ %inc32123.1, %for.inc55.1 ] %inc41122 = phi i64 [ 0, %for.body9.preheader.new ], [ %inc41121.1, %for.inc55.1 ] %inc50120 = phi i64 [ 0, %for.body9.preheader.new ], [ %inc50119.1, %for.inc55.1 ] %5 = phi i64 [ 0, %for.body9.preheader.new ], [ %9, %for.inc55.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc55.1 ] %arrayidx11 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv140 %6 = load i8, ptr %arrayidx11, align 2, !tbaa !18 switch i8 %6, label %for.inc55 [ i8 77, label %if.then i8 65, label %if.then21 i8 82, label %if.then30 i8 67, label %if.then39 i8 72, label %if.then48 ] if.then: ; preds = %for.body9 %add = add nsw i64 %5, 1 br label %for.inc55 if.then21: ; preds = %for.body9 %inc23 = add nsw i64 %inc23126, 1 br label %for.inc55 if.then30: ; preds = %for.body9 %inc32 = add nsw i64 %inc32124, 1 br label %for.inc55 if.then39: ; preds = %for.body9 %inc41 = add nsw i64 %inc41122, 1 br label %for.inc55 if.then48: ; preds = %for.body9 %inc50 = add nsw i64 %inc50120, 1 br label %for.inc55 for.inc55: ; preds = %for.body9, %if.then, %if.then30, %if.then48, %if.then39, %if.then21 %inc23125 = phi i64 [ %inc23126, %for.body9 ], [ %inc23126, %if.then ], [ %inc23126, %if.then30 ], [ %inc23126, %if.then48 ], [ %inc23126, %if.then39 ], [ %inc23, %if.then21 ] %inc32123 = phi i64 [ %inc32124, %for.body9 ], [ %inc32124, %if.then ], [ %inc32, %if.then30 ], [ %inc32124, %if.then48 ], [ %inc32124, %if.then39 ], [ %inc32124, %if.then21 ] %inc41121 = phi i64 [ %inc41122, %for.body9 ], [ %inc41122, %if.then ], [ %inc41122, %if.then30 ], [ %inc41122, %if.then48 ], [ %inc41, %if.then39 ], [ %inc41122, %if.then21 ] %inc50119 = phi i64 [ %inc50120, %for.body9 ], [ %inc50120, %if.then ], [ %inc50120, %if.then30 ], [ %inc50, %if.then48 ], [ %inc50120, %if.then39 ], [ %inc50120, %if.then21 ] %7 = phi i64 [ %5, %for.body9 ], [ %add, %if.then ], [ %5, %if.then30 ], [ %5, %if.then48 ], [ %5, %if.then39 ], [ %5, %if.then21 ] %indvars.iv.next141 = or i64 %indvars.iv140, 1 %arrayidx11.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next141 %8 = load i8, ptr %arrayidx11.1, align 1, !tbaa !18 switch i8 %8, label %for.inc55.1 [ i8 77, label %if.then.1 i8 65, label %if.then21.1 i8 82, label %if.then30.1 i8 67, label %if.then39.1 i8 72, label %if.then48.1 ] if.then48.1: ; preds = %for.inc55 %inc50.1 = add nsw i64 %inc50119, 1 br label %for.inc55.1 if.then39.1: ; preds = %for.inc55 %inc41.1 = add nsw i64 %inc41121, 1 br label %for.inc55.1 if.then30.1: ; preds = %for.inc55 %inc32.1 = add nsw i64 %inc32123, 1 br label %for.inc55.1 if.then21.1: ; preds = %for.inc55 %inc23.1 = add nsw i64 %inc23125, 1 br label %for.inc55.1 if.then.1: ; preds = %for.inc55 %add.1 = add nsw i64 %7, 1 br label %for.inc55.1 for.inc55.1: ; preds = %if.then.1, %if.then21.1, %if.then30.1, %if.then39.1, %if.then48.1, %for.inc55 %inc23125.1 = phi i64 [ %inc23125, %for.inc55 ], [ %inc23125, %if.then.1 ], [ %inc23125, %if.then30.1 ], [ %inc23125, %if.then48.1 ], [ %inc23125, %if.then39.1 ], [ %inc23.1, %if.then21.1 ] %inc32123.1 = phi i64 [ %inc32123, %for.inc55 ], [ %inc32123, %if.then.1 ], [ %inc32.1, %if.then30.1 ], [ %inc32123, %if.then48.1 ], [ %inc32123, %if.then39.1 ], [ %inc32123, %if.then21.1 ] %inc41121.1 = phi i64 [ %inc41121, %for.inc55 ], [ %inc41121, %if.then.1 ], [ %inc41121, %if.then30.1 ], [ %inc41121, %if.then48.1 ], [ %inc41.1, %if.then39.1 ], [ %inc41121, %if.then21.1 ] %inc50119.1 = phi i64 [ %inc50119, %for.inc55 ], [ %inc50119, %if.then.1 ], [ %inc50119, %if.then30.1 ], [ %inc50.1, %if.then48.1 ], [ %inc50119, %if.then39.1 ], [ %inc50119, %if.then21.1 ] %9 = phi i64 [ %7, %for.inc55 ], [ %add.1, %if.then.1 ], [ %7, %if.then30.1 ], [ %7, %if.then48.1 ], [ %7, %if.then39.1 ], [ %7, %if.then21.1 ] %indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 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.cond59.loopexit.4.loopexit.unr-lcssa, label %for.body9, !llvm.loop !19 for.cond59.loopexit.4.loopexit.unr-lcssa: ; preds = %for.inc55.1, %for.body9.preheader %inc23125.lcssa.ph = phi i64 [ undef, %for.body9.preheader ], [ %inc23125.1, %for.inc55.1 ] %inc32123.lcssa.ph = phi i64 [ undef, %for.body9.preheader ], [ %inc32123.1, %for.inc55.1 ] %inc41121.lcssa.ph = phi i64 [ undef, %for.body9.preheader ], [ %inc41121.1, %for.inc55.1 ] %inc50119.lcssa.ph = phi i64 [ undef, %for.body9.preheader ], [ %inc50119.1, %for.inc55.1 ] %.lcssa.ph = phi i64 [ undef, %for.body9.preheader ], [ %9, %for.inc55.1 ] %indvars.iv140.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next141.1, %for.inc55.1 ] %inc23126.unr = phi i64 [ 0, %for.body9.preheader ], [ %inc23125.1, %for.inc55.1 ] %inc32124.unr = phi i64 [ 0, %for.body9.preheader ], [ %inc32123.1, %for.inc55.1 ] %inc41122.unr = phi i64 [ 0, %for.body9.preheader ], [ %inc41121.1, %for.inc55.1 ] %inc50120.unr = phi i64 [ 0, %for.body9.preheader ], [ %inc50119.1, %for.inc55.1 ] %.unr = phi i64 [ 0, %for.body9.preheader ], [ %9, %for.inc55.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond59.loopexit.4, label %for.body9.epil for.body9.epil: ; preds = %for.cond59.loopexit.4.loopexit.unr-lcssa %arrayidx11.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv140.unr %10 = load i8, ptr %arrayidx11.epil, align 1, !tbaa !18 switch i8 %10, label %for.cond59.loopexit.4 [ i8 77, label %if.then.epil i8 65, label %if.then21.epil i8 82, label %if.then30.epil i8 67, label %if.then39.epil i8 72, label %if.then48.epil ] if.then48.epil: ; preds = %for.body9.epil %inc50.epil = add nsw i64 %inc50120.unr, 1 br label %for.cond59.loopexit.4 if.then39.epil: ; preds = %for.body9.epil %inc41.epil = add nsw i64 %inc41122.unr, 1 br label %for.cond59.loopexit.4 if.then30.epil: ; preds = %for.body9.epil %inc32.epil = add nsw i64 %inc32124.unr, 1 br label %for.cond59.loopexit.4 if.then21.epil: ; preds = %for.body9.epil %inc23.epil = add nsw i64 %inc23126.unr, 1 br label %for.cond59.loopexit.4 if.then.epil: ; preds = %for.body9.epil %add.epil = add nsw i64 %.unr, 1 br label %for.cond59.loopexit.4 for.cond59.loopexit.4: ; preds = %for.cond59.loopexit.4.loopexit.unr-lcssa, %if.then.epil, %if.then21.epil, %if.then30.epil, %if.then39.epil, %if.then48.epil, %for.body9.epil, %entry, %for.cond4.preheader %c.sroa.9.0 = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %inc23125.lcssa.ph, %for.cond59.loopexit.4.loopexit.unr-lcssa ], [ %inc23126.unr, %for.body9.epil ], [ %inc23126.unr, %if.then.epil ], [ %inc23126.unr, %if.then30.epil ], [ %inc23126.unr, %if.then48.epil ], [ %inc23126.unr, %if.then39.epil ], [ %inc23.epil, %if.then21.epil ] %c.sroa.15.0 = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %inc32123.lcssa.ph, %for.cond59.loopexit.4.loopexit.unr-lcssa ], [ %inc32124.unr, %for.body9.epil ], [ %inc32124.unr, %if.then.epil ], [ %inc32.epil, %if.then30.epil ], [ %inc32124.unr, %if.then48.epil ], [ %inc32124.unr, %if.then39.epil ], [ %inc32124.unr, %if.then21.epil ] %c.sroa.22.0 = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %inc41121.lcssa.ph, %for.cond59.loopexit.4.loopexit.unr-lcssa ], [ %inc41122.unr, %for.body9.epil ], [ %inc41122.unr, %if.then.epil ], [ %inc41122.unr, %if.then30.epil ], [ %inc41122.unr, %if.then48.epil ], [ %inc41.epil, %if.then39.epil ], [ %inc41122.unr, %if.then21.epil ] %c.sroa.31.0 = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %inc50119.lcssa.ph, %for.cond59.loopexit.4.loopexit.unr-lcssa ], [ %inc50120.unr, %for.body9.epil ], [ %inc50120.unr, %if.then.epil ], [ %inc50120.unr, %if.then30.epil ], [ %inc50.epil, %if.then48.epil ], [ %inc50120.unr, %if.then39.epil ], [ %inc50120.unr, %if.then21.epil ] %.lcssa114 = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %.lcssa.ph, %for.cond59.loopexit.4.loopexit.unr-lcssa ], [ %.unr, %for.body9.epil ], [ %add.epil, %if.then.epil ], [ %.unr, %if.then30.epil ], [ %.unr, %if.then48.epil ], [ %.unr, %if.then39.epil ], [ %.unr, %if.then21.epil ] %mul.2 = mul nsw i64 %c.sroa.22.0, %c.sroa.15.0 %mul82.2 = mul nsw i64 %mul.2, %c.sroa.31.0 %mul.1.1 = mul nsw i64 %c.sroa.22.0, %c.sroa.9.0 %mul82.1.1 = mul nsw i64 %mul.1.1, %c.sroa.31.0 %mul.1 = mul nsw i64 %c.sroa.15.0, %c.sroa.9.0 %mul82.1.1162 = mul nsw i64 %mul.1, %c.sroa.31.0 %mul82.1 = mul nsw i64 %mul.1, %c.sroa.22.0 %mul.2177 = mul nsw i64 %c.sroa.22.0, %.lcssa114 %mul82.2180 = mul nsw i64 %mul.2177, %c.sroa.31.0 %mul.1167 = mul nsw i64 %c.sroa.15.0, %.lcssa114 %mul82.1170.1 = mul nsw i64 %mul.1167, %c.sroa.31.0 %mul82.1170 = mul nsw i64 %mul.1167, %c.sroa.22.0 %mul = mul nsw i64 %c.sroa.9.0, %.lcssa114 %mul82254 = add i64 %c.sroa.22.0, %c.sroa.15.0 %add83.1202255 = add i64 %c.sroa.31.0, %mul82254 %add83.2206 = mul i64 %mul, %add83.1202255 %add83.1171 = add nsw i64 %mul82.1170, %add83.2206 %add83.1171.1 = add nsw i64 %mul82.1170.1, %add83.1171 %add83.2181 = add nsw i64 %mul82.2180, %add83.1171.1 %add83.1 = add nsw i64 %mul82.1, %add83.2181 %add83.1.1163 = add nsw i64 %mul82.1.1162, %add83.1 %add83.1.1 = add nsw i64 %mul82.1.1, %add83.1.1163 %add83.2 = add nsw i64 %mul82.2, %add83.1.1 %call93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %add83.2) call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #9 ret i32 0 } ; 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 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 i32 @llvm.smax.i32(i32, i32) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #8 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = distinct !{!5, !6, !7} !6 = !{!"llvm.loop.isvectorized", i32 1} !7 = !{!"llvm.loop.unroll.runtime.disable"} !8 = distinct !{!8, !7, !6} !9 = !{!10, !10, i64 0} !10 = !{!"int", !11, i64 0} !11 = !{!"omnipotent char", !12, i64 0} !12 = !{!"Simple C/C++ TBAA"} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = !{!16, !16, i64 0} !16 = !{!"long long", !11, i64 0} !17 = distinct !{!17, !14} !18 = !{!11, !11, i64 0} !19 = distinct !{!19, !14}
#include <stdio.h> int main(void){ long long int many[5]={0}; int hoge,hogera; char s[16]={0}; long long int math = 0; scanf("%d",&hoge); for(hogera=0;hogera<hoge;hogera++){ scanf("%s",&s); switch(s[0]){ case 'M':many[0]++;break; case 'A':many[1]++;break; case 'R':many[2]++;break; case 'C':many[3]++;break; case 'H':many[4]++;break; default : break; } } math += (many[0]*many[1]*many[2]); math += (many[0]*many[1]*many[3]); math += (many[0]*many[1]*many[4]); math += (many[0]*many[2]*many[3]); math += (many[0]*many[2]*many[4]); math += (many[0]*many[3]*many[4]); math += (many[1]*many[2]*many[3]); math += (many[1]*many[2]*many[4]); math += (many[1]*many[3]*many[4]); math += (many[2]*many[3]*many[4]); printf("%lld",math); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_224946/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_224946/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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 [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %hoge = alloca i32, align 4 %s = alloca [16 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hoge) #4 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %s) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %s, i8 0, i64 16, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hoge) %0 = load i32, ptr %hoge, align 4, !tbaa !5 %cmp150 = icmp sgt i32 %0, 0 br i1 %cmp150, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %hogera.0156 = phi i32 [ %inc15, %for.inc ], [ 0, %entry ] %many.sroa.35.0155 = phi i64 [ %many.sroa.35.1, %for.inc ], [ 0, %entry ] %many.sroa.27.0154 = phi i64 [ %many.sroa.27.1, %for.inc ], [ 0, %entry ] %many.sroa.19.0153 = phi i64 [ %many.sroa.19.1, %for.inc ], [ 0, %entry ] %many.sroa.11.0152 = phi i64 [ %many.sroa.11.1, %for.inc ], [ 0, %entry ] %many.sroa.0.0151 = phi i64 [ %many.sroa.0.1, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %1 = load i8, ptr %s, align 16, !tbaa !9 %conv = sext i8 %1 to i32 switch i32 %conv, label %for.inc [ i32 77, label %sw.bb i32 65, label %sw.bb3 i32 82, label %sw.bb6 i32 67, label %sw.bb9 i32 72, label %sw.bb12 ] sw.bb: ; preds = %for.body %inc = add nsw i64 %many.sroa.0.0151, 1 br label %for.inc sw.bb3: ; preds = %for.body %inc5 = add nsw i64 %many.sroa.11.0152, 1 br label %for.inc sw.bb6: ; preds = %for.body %inc8 = add nsw i64 %many.sroa.19.0153, 1 br label %for.inc sw.bb9: ; preds = %for.body %inc11 = add nsw i64 %many.sroa.27.0154, 1 br label %for.inc sw.bb12: ; preds = %for.body %inc14 = add nsw i64 %many.sroa.35.0155, 1 br label %for.inc for.inc: ; preds = %sw.bb, %sw.bb3, %sw.bb6, %sw.bb9, %sw.bb12, %for.body %many.sroa.0.1 = phi i64 [ %many.sroa.0.0151, %for.body ], [ %many.sroa.0.0151, %sw.bb12 ], [ %many.sroa.0.0151, %sw.bb9 ], [ %many.sroa.0.0151, %sw.bb6 ], [ %many.sroa.0.0151, %sw.bb3 ], [ %inc, %sw.bb ] %many.sroa.11.1 = phi i64 [ %many.sroa.11.0152, %for.body ], [ %many.sroa.11.0152, %sw.bb12 ], [ %many.sroa.11.0152, %sw.bb9 ], [ %many.sroa.11.0152, %sw.bb6 ], [ %inc5, %sw.bb3 ], [ %many.sroa.11.0152, %sw.bb ] %many.sroa.19.1 = phi i64 [ %many.sroa.19.0153, %for.body ], [ %many.sroa.19.0153, %sw.bb12 ], [ %many.sroa.19.0153, %sw.bb9 ], [ %inc8, %sw.bb6 ], [ %many.sroa.19.0153, %sw.bb3 ], [ %many.sroa.19.0153, %sw.bb ] %many.sroa.27.1 = phi i64 [ %many.sroa.27.0154, %for.body ], [ %many.sroa.27.0154, %sw.bb12 ], [ %inc11, %sw.bb9 ], [ %many.sroa.27.0154, %sw.bb6 ], [ %many.sroa.27.0154, %sw.bb3 ], [ %many.sroa.27.0154, %sw.bb ] %many.sroa.35.1 = phi i64 [ %many.sroa.35.0155, %for.body ], [ %inc14, %sw.bb12 ], [ %many.sroa.35.0155, %sw.bb9 ], [ %many.sroa.35.0155, %sw.bb6 ], [ %many.sroa.35.0155, %sw.bb3 ], [ %many.sroa.35.0155, %sw.bb ] %inc15 = add nuw nsw i32 %hogera.0156, 1 %2 = load i32, ptr %hoge, align 4, !tbaa !5 %cmp = icmp slt i32 %inc15, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.inc, %entry %many.sroa.0.0.lcssa = phi i64 [ 0, %entry ], [ %many.sroa.0.1, %for.inc ] %many.sroa.11.0.lcssa = phi i64 [ 0, %entry ], [ %many.sroa.11.1, %for.inc ] %many.sroa.19.0.lcssa = phi i64 [ 0, %entry ], [ %many.sroa.19.1, %for.inc ] %many.sroa.27.0.lcssa = phi i64 [ 0, %entry ], [ %many.sroa.27.1, %for.inc ] %many.sroa.35.0.lcssa = phi i64 [ 0, %entry ], [ %many.sroa.35.1, %for.inc ] %mul = mul nsw i64 %many.sroa.11.0.lcssa, %many.sroa.0.0.lcssa %mul24140 = add i64 %many.sroa.27.0.lcssa, %many.sroa.19.0.lcssa %mul30141 = add i64 %mul24140, %many.sroa.35.0.lcssa %add31 = mul i64 %mul, %mul30141 %reass.add147 = add i64 %many.sroa.11.0.lcssa, %many.sroa.0.0.lcssa %reass.add148 = add i64 %reass.add147, %many.sroa.19.0.lcssa %reass.mul149 = mul i64 %reass.add148, %many.sroa.27.0.lcssa %mul52161 = add i64 %many.sroa.0.0.lcssa, %many.sroa.11.0.lcssa %reass.add143 = mul i64 %many.sroa.19.0.lcssa, %mul52161 %reass.add144 = add i64 %reass.add143, %reass.mul149 %reass.mul = mul i64 %reass.add144, %many.sroa.35.0.lcssa %reass.mul146 = mul i64 %reass.add143, %many.sroa.27.0.lcssa %add67 = add i64 %add31, %reass.mul146 %add73 = add i64 %add67, %reass.mul %call74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add73) call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hoge) #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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #define N 100005 int main(){ int m,n,a[N],b[N]; scanf("%d",&m); int i,j; for(i=0;i<m;i++){ memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d%d",&a[j],&b[j]); } int min=1000000005,max=-1; for(j=0;j<n;j++){ if(max<a[j])max=a[j]; if(min>b[j])min=b[j]; } printf("%d\n",max>min?max-min:0); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22499/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22499/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %m = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca [100005 x i32], align 16 %b = alloca [100005 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %b) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %0 = load i32, ptr %m, align 4, !tbaa !5 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body, label %for.end31 for.body: ; preds = %entry, %for.end26 %i.056 = phi i32 [ %inc30, %for.end26 ], [ 0, %entry ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400020) %a, i8 0, i64 400020, i1 false) call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400020) %b, i8 0, i64 400020, i1 false) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp447 = icmp sgt i32 %1, 0 br i1 %cmp447, label %for.body5, label %for.end26 for.cond9.preheader: ; preds = %for.body5 %cmp1049 = icmp sgt i32 %13, 0 br i1 %cmp1049, label %for.body11.preheader, label %for.end26 for.body11.preheader: ; preds = %for.cond9.preheader %wide.trip.count = zext i32 %13 to i64 %min.iters.check = icmp ult i32 %13, 8 br i1 %min.iters.check, label %for.body11.preheader72, label %vector.ph vector.ph: ; preds = %for.body11.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> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %4, %vector.body ] %vec.phi64 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %5, %vector.body ] %vec.phi65 = phi <4 x i32> [ <i32 1000000005, i32 1000000005, i32 1000000005, i32 1000000005>, %vector.ph ], [ %8, %vector.body ] %vec.phi66 = phi <4 x i32> [ <i32 1000000005, i32 1000000005, i32 1000000005, i32 1000000005>, %vector.ph ], [ %9, %vector.body ] %2 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 %wide.load67 = load <4 x i32>, ptr %3, align 16, !tbaa !5 %4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load) %5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi64, <4 x i32> %wide.load67) %6 = getelementptr inbounds [100005 x i32], ptr %b, i64 0, i64 %index %wide.load68 = load <4 x i32>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 4 %wide.load69 = load <4 x i32>, ptr %7, align 16, !tbaa !5 %8 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi65, <4 x i32> %wide.load68) %9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi66, <4 x i32> %wide.load69) %index.next = add nuw i64 %index, 8 %10 = icmp eq i64 %index.next, %n.vec br i1 %10, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %rdx.minmax70 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %8, <4 x i32> %9) %11 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax70) %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %5) %12 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end26, label %for.body11.preheader72 for.body11.preheader72: ; preds = %for.body11.preheader, %middle.block %indvars.iv59.ph = phi i64 [ 0, %for.body11.preheader ], [ %n.vec, %middle.block ] %max.052.ph = phi i32 [ -1, %for.body11.preheader ], [ %12, %middle.block ] %min.051.ph = phi i32 [ 1000000005, %for.body11.preheader ], [ %11, %middle.block ] br label %for.body11 for.body5: ; preds = %for.body, %for.body5 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body ] %arrayidx = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %indvars.iv %arrayidx7 = getelementptr inbounds [100005 x i32], ptr %b, i64 0, i64 %indvars.iv %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx7) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %13 = load i32, ptr %n, align 4, !tbaa !5 %14 = sext i32 %13 to i64 %cmp4 = icmp slt i64 %indvars.iv.next, %14 br i1 %cmp4, label %for.body5, label %for.cond9.preheader, !llvm.loop !13 for.body11: ; preds = %for.body11.preheader72, %for.body11 %indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.body11 ], [ %indvars.iv59.ph, %for.body11.preheader72 ] %max.052 = phi i32 [ %spec.select, %for.body11 ], [ %max.052.ph, %for.body11.preheader72 ] %min.051 = phi i32 [ %min.1, %for.body11 ], [ %min.051.ph, %for.body11.preheader72 ] %arrayidx13 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %indvars.iv59 %15 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %max.052, i32 %15) %arrayidx18 = getelementptr inbounds [100005 x i32], ptr %b, i64 0, i64 %indvars.iv59 %16 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %min.1 = call i32 @llvm.smin.i32(i32 %min.051, i32 %16) %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1 %exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count br i1 %exitcond.not, label %for.end26, label %for.body11, !llvm.loop !14 for.end26: ; preds = %for.body11, %middle.block, %for.body, %for.cond9.preheader %min.0.lcssa = phi i32 [ 1000000005, %for.cond9.preheader ], [ 1000000005, %for.body ], [ %11, %middle.block ], [ %min.1, %for.body11 ] %max.0.lcssa = phi i32 [ -1, %for.cond9.preheader ], [ -1, %for.body ], [ %12, %middle.block ], [ %spec.select, %for.body11 ] %cmp27 = icmp sgt i32 %max.0.lcssa, %min.0.lcssa %sub = sub nsw i32 %max.0.lcssa, %min.0.lcssa %cond = select i1 %cmp27, i32 %sub, i32 0 %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cond) %inc30 = add nuw nsw i32 %i.056, 1 %17 = load i32, ptr %m, align 4, !tbaa !5 %cmp = icmp slt i32 %inc30, %17 br i1 %cmp, label %for.body, label %for.end31, !llvm.loop !15 for.end31: ; preds = %for.end26, %entry call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 400020, 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 %m) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10}
#include <stdio.h> #include <stdlib.h> int min(int * a, int n) { int i, k = 0; for (i = 1; i < n; i++) { if (a[i] < a[0]) { a[0] = a[i]; k = i; } } return k; } int max(int * a, int n) { int i, k = 0; for (i = 1; i < n; i++) { if (a[i] > a[0]) { a[0] = a[i]; k = i; } } return k; } int main() { int t, n, i, j, k1, kn; //int l[100000]; //int r[100000]; scanf("%d", &t); for (i = 0; i < t; i++) { scanf("%d", &n); int l[n]; int r[n]; for (j = 0; j < n; j++) scanf("%d%d", &l[j], &r[j]); k1 = min(r, n); kn = max(l, n); if (n == 1) printf("0\n"); else { if (r[k1] > l[kn]) printf("0\n"); else printf("%d\n", l[kn] - r[k1]); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22509/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22509/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str.4 = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @min(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp13 = icmp sgt i32 %n, 1 br i1 %cmp13, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %entry %a.promoted = load i32, ptr %a, align 4, !tbaa !5 %wide.trip.count = zext i32 %n to i64 %0 = add nsw i64 %wide.trip.count, -1 %1 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %0, 3 %2 = icmp ult i64 %1, 3 br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %0, -4 br label %for.body for.body: ; preds = %for.inc.3, %for.body.lr.ph.new %indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.3, %for.inc.3 ] %3 = phi i32 [ %a.promoted, %for.body.lr.ph.new ], [ %15, %for.inc.3 ] %k.015 = phi i32 [ 0, %for.body.lr.ph.new ], [ %k.1.3, %for.inc.3 ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.inc.3 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp2 = icmp slt i32 %4, %3 br i1 %cmp2, label %if.then, label %for.inc if.then: ; preds = %for.body store i32 %4, ptr %a, align 4, !tbaa !5 %5 = trunc i64 %indvars.iv to i32 br label %for.inc for.inc: ; preds = %for.body, %if.then %6 = phi i32 [ %4, %if.then ], [ %3, %for.body ] %k.1 = phi i32 [ %5, %if.then ], [ %k.015, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next %7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp2.1 = icmp slt i32 %7, %6 br i1 %cmp2.1, label %if.then.1, label %for.inc.1 if.then.1: ; preds = %for.inc store i32 %7, ptr %a, align 4, !tbaa !5 %8 = trunc i64 %indvars.iv.next to i32 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.inc %9 = phi i32 [ %7, %if.then.1 ], [ %6, %for.inc ] %k.1.1 = phi i32 [ %8, %if.then.1 ], [ %k.1, %for.inc ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1 %10 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp2.2 = icmp slt i32 %10, %9 br i1 %cmp2.2, label %if.then.2, label %for.inc.2 if.then.2: ; preds = %for.inc.1 store i32 %10, ptr %a, align 4, !tbaa !5 %11 = trunc i64 %indvars.iv.next.1 to i32 br label %for.inc.2 for.inc.2: ; preds = %if.then.2, %for.inc.1 %12 = phi i32 [ %10, %if.then.2 ], [ %9, %for.inc.1 ] %k.1.2 = phi i32 [ %11, %if.then.2 ], [ %k.1.1, %for.inc.1 ] %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2 %13 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %cmp2.3 = icmp slt i32 %13, %12 br i1 %cmp2.3, label %if.then.3, label %for.inc.3 if.then.3: ; preds = %for.inc.2 store i32 %13, ptr %a, align 4, !tbaa !5 %14 = trunc i64 %indvars.iv.next.2 to i32 br label %for.inc.3 for.inc.3: ; preds = %if.then.3, %for.inc.2 %15 = phi i32 [ %13, %if.then.3 ], [ %12, %for.inc.2 ] %k.1.3 = phi i32 [ %14, %if.then.3 ], [ %k.1.2, %for.inc.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.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.inc.3, %for.body.lr.ph %k.1.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %k.1.3, %for.inc.3 ] %indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.3, %for.inc.3 ] %.unr = phi i32 [ %a.promoted, %for.body.lr.ph ], [ %15, %for.inc.3 ] %k.015.unr = phi i32 [ 0, %for.body.lr.ph ], [ %k.1.3, %for.inc.3 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.inc.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.inc.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %16 = phi i32 [ %19, %for.inc.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %k.015.epil = phi i32 [ %k.1.epil, %for.inc.epil ], [ %k.015.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.inc.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %arrayidx.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.epil %17 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5 %cmp2.epil = icmp slt i32 %17, %16 br i1 %cmp2.epil, label %if.then.epil, label %for.inc.epil if.then.epil: ; preds = %for.body.epil store i32 %17, ptr %a, align 4, !tbaa !5 %18 = trunc i64 %indvars.iv.epil to i32 br label %for.inc.epil for.inc.epil: ; preds = %if.then.epil, %for.body.epil %19 = phi i32 [ %17, %if.then.epil ], [ %16, %for.body.epil ] %k.1.epil = phi i32 [ %18, %if.then.epil ], [ %k.015.epil, %for.body.epil ] %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.inc.epil, %entry %k.0.lcssa = phi i32 [ 0, %entry ], [ %k.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %k.1.epil, %for.inc.epil ] ret i32 %k.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @max(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp13 = icmp sgt i32 %n, 1 br i1 %cmp13, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %entry %a.promoted = load i32, ptr %a, align 4, !tbaa !5 %wide.trip.count = zext i32 %n to i64 %0 = add nsw i64 %wide.trip.count, -1 %1 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %0, 3 %2 = icmp ult i64 %1, 3 br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %0, -4 br label %for.body for.body: ; preds = %for.inc.3, %for.body.lr.ph.new %indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.3, %for.inc.3 ] %3 = phi i32 [ %a.promoted, %for.body.lr.ph.new ], [ %15, %for.inc.3 ] %k.015 = phi i32 [ 0, %for.body.lr.ph.new ], [ %k.1.3, %for.inc.3 ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.inc.3 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp2 = icmp sgt i32 %4, %3 br i1 %cmp2, label %if.then, label %for.inc if.then: ; preds = %for.body store i32 %4, ptr %a, align 4, !tbaa !5 %5 = trunc i64 %indvars.iv to i32 br label %for.inc for.inc: ; preds = %for.body, %if.then %6 = phi i32 [ %4, %if.then ], [ %3, %for.body ] %k.1 = phi i32 [ %5, %if.then ], [ %k.015, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next %7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp2.1 = icmp sgt i32 %7, %6 br i1 %cmp2.1, label %if.then.1, label %for.inc.1 if.then.1: ; preds = %for.inc store i32 %7, ptr %a, align 4, !tbaa !5 %8 = trunc i64 %indvars.iv.next to i32 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.inc %9 = phi i32 [ %7, %if.then.1 ], [ %6, %for.inc ] %k.1.1 = phi i32 [ %8, %if.then.1 ], [ %k.1, %for.inc ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1 %10 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp2.2 = icmp sgt i32 %10, %9 br i1 %cmp2.2, label %if.then.2, label %for.inc.2 if.then.2: ; preds = %for.inc.1 store i32 %10, ptr %a, align 4, !tbaa !5 %11 = trunc i64 %indvars.iv.next.1 to i32 br label %for.inc.2 for.inc.2: ; preds = %if.then.2, %for.inc.1 %12 = phi i32 [ %10, %if.then.2 ], [ %9, %for.inc.1 ] %k.1.2 = phi i32 [ %11, %if.then.2 ], [ %k.1.1, %for.inc.1 ] %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2 %13 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %cmp2.3 = icmp sgt i32 %13, %12 br i1 %cmp2.3, label %if.then.3, label %for.inc.3 if.then.3: ; preds = %for.inc.2 store i32 %13, ptr %a, align 4, !tbaa !5 %14 = trunc i64 %indvars.iv.next.2 to i32 br label %for.inc.3 for.inc.3: ; preds = %if.then.3, %for.inc.2 %15 = phi i32 [ %13, %if.then.3 ], [ %12, %for.inc.2 ] %k.1.3 = phi i32 [ %14, %if.then.3 ], [ %k.1.2, %for.inc.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.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !13 for.end.loopexit.unr-lcssa: ; preds = %for.inc.3, %for.body.lr.ph %k.1.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %k.1.3, %for.inc.3 ] %indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.3, %for.inc.3 ] %.unr = phi i32 [ %a.promoted, %for.body.lr.ph ], [ %15, %for.inc.3 ] %k.015.unr = phi i32 [ 0, %for.body.lr.ph ], [ %k.1.3, %for.inc.3 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.inc.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.inc.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %16 = phi i32 [ %19, %for.inc.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %k.015.epil = phi i32 [ %k.1.epil, %for.inc.epil ], [ %k.015.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.inc.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %arrayidx.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.epil %17 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5 %cmp2.epil = icmp sgt i32 %17, %16 br i1 %cmp2.epil, label %if.then.epil, label %for.inc.epil if.then.epil: ; preds = %for.body.epil store i32 %17, ptr %a, align 4, !tbaa !5 %18 = trunc i64 %indvars.iv.epil to i32 br label %for.inc.epil for.inc.epil: ; preds = %if.then.epil, %for.body.epil %19 = phi i32 [ %17, %if.then.epil ], [ %16, %for.body.epil ] %k.1.epil = phi i32 [ %18, %if.then.epil ], [ %k.015.epil, %for.body.epil ] %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !14 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.inc.epil, %entry %k.0.lcssa = phi i32 [ 0, %entry ], [ %k.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %k.1.epil, %for.inc.epil ] ret i32 %k.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp58 = icmp sgt i32 %0, 0 br i1 %cmp58, label %for.body, label %for.end29 for.body: ; preds = %entry, %if.end26 %i.059 = phi i32 [ %inc28, %if.end26 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = zext i32 %1 to i64 %3 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %2, align 16 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = zext i32 %4 to i64 %vla2 = alloca i32, i64 %5, align 16 %cmp456 = icmp sgt i32 %4, 0 br i1 %cmp456, label %for.body5, label %if.else for.body5: ; preds = %for.body, %for.body5 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %arrayidx7 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx7) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %.pr = load i32, ptr %n, align 4, !tbaa !5 %6 = sext i32 %.pr to i64 %cmp4 = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !15 for.end: ; preds = %for.body5 %cmp13.i = icmp sgt i32 %.pr, 1 br i1 %cmp13.i, label %for.body.lr.ph.i, label %max.exit for.body.lr.ph.i: ; preds = %for.end %a.promoted.i = load i32, ptr %vla2, align 16, !tbaa !5 %wide.trip.count.i = zext i32 %.pr to i64 %7 = add nsw i64 %wide.trip.count.i, -1 %8 = add nsw i64 %wide.trip.count.i, -2 %xtraiter = and i64 %7, 3 %9 = icmp ult i64 %8, 3 br i1 %9, label %min.exit.unr-lcssa, label %for.body.lr.ph.i.new for.body.lr.ph.i.new: ; preds = %for.body.lr.ph.i %unroll_iter = and i64 %7, -4 br label %for.body.i for.body.i: ; preds = %for.inc.i.3, %for.body.lr.ph.i.new %indvars.iv.i = phi i64 [ 1, %for.body.lr.ph.i.new ], [ %indvars.iv.next.i.3, %for.inc.i.3 ] %10 = phi i32 [ %a.promoted.i, %for.body.lr.ph.i.new ], [ %22, %for.inc.i.3 ] %k.015.i = phi i32 [ 0, %for.body.lr.ph.i.new ], [ %k.1.i.3, %for.inc.i.3 ] %niter = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %niter.next.3, %for.inc.i.3 ] %arrayidx.i = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.i %11 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp2.i = icmp slt i32 %11, %10 br i1 %cmp2.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %for.body.i store i32 %11, ptr %vla2, align 16, !tbaa !5 %12 = trunc i64 %indvars.iv.i to i32 br label %for.inc.i for.inc.i: ; preds = %if.then.i, %for.body.i %13 = phi i32 [ %11, %if.then.i ], [ %10, %for.body.i ] %k.1.i = phi i32 [ %12, %if.then.i ], [ %k.015.i, %for.body.i ] %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx.i.1 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.next.i %14 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5 %cmp2.i.1 = icmp slt i32 %14, %13 br i1 %cmp2.i.1, label %if.then.i.1, label %for.inc.i.1 if.then.i.1: ; preds = %for.inc.i store i32 %14, ptr %vla2, align 16, !tbaa !5 %15 = trunc i64 %indvars.iv.next.i to i32 br label %for.inc.i.1 for.inc.i.1: ; preds = %if.then.i.1, %for.inc.i %16 = phi i32 [ %14, %if.then.i.1 ], [ %13, %for.inc.i ] %k.1.i.1 = phi i32 [ %15, %if.then.i.1 ], [ %k.1.i, %for.inc.i ] %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx.i.2 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.next.i.1 %17 = load i32, ptr %arrayidx.i.2, align 4, !tbaa !5 %cmp2.i.2 = icmp slt i32 %17, %16 br i1 %cmp2.i.2, label %if.then.i.2, label %for.inc.i.2 if.then.i.2: ; preds = %for.inc.i.1 store i32 %17, ptr %vla2, align 16, !tbaa !5 %18 = trunc i64 %indvars.iv.next.i.1 to i32 br label %for.inc.i.2 for.inc.i.2: ; preds = %if.then.i.2, %for.inc.i.1 %19 = phi i32 [ %17, %if.then.i.2 ], [ %16, %for.inc.i.1 ] %k.1.i.2 = phi i32 [ %18, %if.then.i.2 ], [ %k.1.i.1, %for.inc.i.1 ] %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %arrayidx.i.3 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.next.i.2 %20 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5 %cmp2.i.3 = icmp slt i32 %20, %19 br i1 %cmp2.i.3, label %if.then.i.3, label %for.inc.i.3 if.then.i.3: ; preds = %for.inc.i.2 store i32 %20, ptr %vla2, align 16, !tbaa !5 %21 = trunc i64 %indvars.iv.next.i.2 to i32 br label %for.inc.i.3 for.inc.i.3: ; preds = %if.then.i.3, %for.inc.i.2 %22 = phi i32 [ %20, %if.then.i.3 ], [ %19, %for.inc.i.2 ] %k.1.i.3 = phi i32 [ %21, %if.then.i.3 ], [ %k.1.i.2, %for.inc.i.2 ] %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %min.exit.unr-lcssa, label %for.body.i, !llvm.loop !9 min.exit.unr-lcssa: ; preds = %for.inc.i.3, %for.body.lr.ph.i %k.1.i.lcssa.ph = phi i32 [ undef, %for.body.lr.ph.i ], [ %k.1.i.3, %for.inc.i.3 ] %indvars.iv.i.unr = phi i64 [ 1, %for.body.lr.ph.i ], [ %indvars.iv.next.i.3, %for.inc.i.3 ] %.unr = phi i32 [ %a.promoted.i, %for.body.lr.ph.i ], [ %22, %for.inc.i.3 ] %k.015.i.unr = phi i32 [ 0, %for.body.lr.ph.i ], [ %k.1.i.3, %for.inc.i.3 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %min.exit, label %for.body.i.epil for.body.i.epil: ; preds = %min.exit.unr-lcssa, %for.inc.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.inc.i.epil ], [ %indvars.iv.i.unr, %min.exit.unr-lcssa ] %23 = phi i32 [ %26, %for.inc.i.epil ], [ %.unr, %min.exit.unr-lcssa ] %k.015.i.epil = phi i32 [ %k.1.i.epil, %for.inc.i.epil ], [ %k.015.i.unr, %min.exit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.inc.i.epil ], [ 0, %min.exit.unr-lcssa ] %arrayidx.i.epil = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.i.epil %24 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5 %cmp2.i.epil = icmp slt i32 %24, %23 br i1 %cmp2.i.epil, label %if.then.i.epil, label %for.inc.i.epil if.then.i.epil: ; preds = %for.body.i.epil store i32 %24, ptr %vla2, align 16, !tbaa !5 %25 = trunc i64 %indvars.iv.i.epil to i32 br label %for.inc.i.epil for.inc.i.epil: ; preds = %if.then.i.epil, %for.body.i.epil %26 = phi i32 [ %24, %if.then.i.epil ], [ %23, %for.body.i.epil ] %k.1.i.epil = phi i32 [ %25, %if.then.i.epil ], [ %k.015.i.epil, %for.body.i.epil ] %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %min.exit, label %for.body.i.epil, !llvm.loop !16 min.exit: ; preds = %for.inc.i.epil, %min.exit.unr-lcssa %k.1.i.lcssa = phi i32 [ %k.1.i.lcssa.ph, %min.exit.unr-lcssa ], [ %k.1.i.epil, %for.inc.i.epil ] %a.promoted.i42 = load i32, ptr %vla, align 16, !tbaa !5 %xtraiter71 = and i64 %7, 3 %27 = icmp ult i64 %8, 3 br i1 %27, label %max.exit.loopexit.unr-lcssa, label %min.exit.new min.exit.new: ; preds = %min.exit %unroll_iter76 = and i64 %7, -4 br label %for.body.i44 for.body.i44: ; preds = %for.inc.i49.3, %min.exit.new %indvars.iv.i45 = phi i64 [ 1, %min.exit.new ], [ %indvars.iv.next.i51.3, %for.inc.i49.3 ] %28 = phi i32 [ %a.promoted.i42, %min.exit.new ], [ %40, %for.inc.i49.3 ] %k.015.i46 = phi i32 [ 0, %min.exit.new ], [ %k.1.i50.3, %for.inc.i49.3 ] %niter77 = phi i64 [ 0, %min.exit.new ], [ %niter77.next.3, %for.inc.i49.3 ] %arrayidx.i47 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i45 %29 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5 %cmp2.i48 = icmp sgt i32 %29, %28 br i1 %cmp2.i48, label %if.then.i53, label %for.inc.i49 if.then.i53: ; preds = %for.body.i44 store i32 %29, ptr %vla, align 16, !tbaa !5 %30 = trunc i64 %indvars.iv.i45 to i32 br label %for.inc.i49 for.inc.i49: ; preds = %if.then.i53, %for.body.i44 %31 = phi i32 [ %29, %if.then.i53 ], [ %28, %for.body.i44 ] %k.1.i50 = phi i32 [ %30, %if.then.i53 ], [ %k.015.i46, %for.body.i44 ] %indvars.iv.next.i51 = add nuw nsw i64 %indvars.iv.i45, 1 %arrayidx.i47.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i51 %32 = load i32, ptr %arrayidx.i47.1, align 4, !tbaa !5 %cmp2.i48.1 = icmp sgt i32 %32, %31 br i1 %cmp2.i48.1, label %if.then.i53.1, label %for.inc.i49.1 if.then.i53.1: ; preds = %for.inc.i49 store i32 %32, ptr %vla, align 16, !tbaa !5 %33 = trunc i64 %indvars.iv.next.i51 to i32 br label %for.inc.i49.1 for.inc.i49.1: ; preds = %if.then.i53.1, %for.inc.i49 %34 = phi i32 [ %32, %if.then.i53.1 ], [ %31, %for.inc.i49 ] %k.1.i50.1 = phi i32 [ %33, %if.then.i53.1 ], [ %k.1.i50, %for.inc.i49 ] %indvars.iv.next.i51.1 = add nuw nsw i64 %indvars.iv.i45, 2 %arrayidx.i47.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i51.1 %35 = load i32, ptr %arrayidx.i47.2, align 4, !tbaa !5 %cmp2.i48.2 = icmp sgt i32 %35, %34 br i1 %cmp2.i48.2, label %if.then.i53.2, label %for.inc.i49.2 if.then.i53.2: ; preds = %for.inc.i49.1 store i32 %35, ptr %vla, align 16, !tbaa !5 %36 = trunc i64 %indvars.iv.next.i51.1 to i32 br label %for.inc.i49.2 for.inc.i49.2: ; preds = %if.then.i53.2, %for.inc.i49.1 %37 = phi i32 [ %35, %if.then.i53.2 ], [ %34, %for.inc.i49.1 ] %k.1.i50.2 = phi i32 [ %36, %if.then.i53.2 ], [ %k.1.i50.1, %for.inc.i49.1 ] %indvars.iv.next.i51.2 = add nuw nsw i64 %indvars.iv.i45, 3 %arrayidx.i47.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i51.2 %38 = load i32, ptr %arrayidx.i47.3, align 4, !tbaa !5 %cmp2.i48.3 = icmp sgt i32 %38, %37 br i1 %cmp2.i48.3, label %if.then.i53.3, label %for.inc.i49.3 if.then.i53.3: ; preds = %for.inc.i49.2 store i32 %38, ptr %vla, align 16, !tbaa !5 %39 = trunc i64 %indvars.iv.next.i51.2 to i32 br label %for.inc.i49.3 for.inc.i49.3: ; preds = %if.then.i53.3, %for.inc.i49.2 %40 = phi i32 [ %38, %if.then.i53.3 ], [ %37, %for.inc.i49.2 ] %k.1.i50.3 = phi i32 [ %39, %if.then.i53.3 ], [ %k.1.i50.2, %for.inc.i49.2 ] %indvars.iv.next.i51.3 = add nuw nsw i64 %indvars.iv.i45, 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 %max.exit.loopexit.unr-lcssa, label %for.body.i44, !llvm.loop !13 max.exit.loopexit.unr-lcssa: ; preds = %for.inc.i49.3, %min.exit %k.1.i50.lcssa.ph = phi i32 [ undef, %min.exit ], [ %k.1.i50.3, %for.inc.i49.3 ] %indvars.iv.i45.unr = phi i64 [ 1, %min.exit ], [ %indvars.iv.next.i51.3, %for.inc.i49.3 ] %.unr73 = phi i32 [ %a.promoted.i42, %min.exit ], [ %40, %for.inc.i49.3 ] %k.015.i46.unr = phi i32 [ 0, %min.exit ], [ %k.1.i50.3, %for.inc.i49.3 ] %lcmp.mod74.not = icmp eq i64 %xtraiter71, 0 br i1 %lcmp.mod74.not, label %max.exit, label %for.body.i44.epil for.body.i44.epil: ; preds = %max.exit.loopexit.unr-lcssa, %for.inc.i49.epil %indvars.iv.i45.epil = phi i64 [ %indvars.iv.next.i51.epil, %for.inc.i49.epil ], [ %indvars.iv.i45.unr, %max.exit.loopexit.unr-lcssa ] %41 = phi i32 [ %44, %for.inc.i49.epil ], [ %.unr73, %max.exit.loopexit.unr-lcssa ] %k.015.i46.epil = phi i32 [ %k.1.i50.epil, %for.inc.i49.epil ], [ %k.015.i46.unr, %max.exit.loopexit.unr-lcssa ] %epil.iter72 = phi i64 [ %epil.iter72.next, %for.inc.i49.epil ], [ 0, %max.exit.loopexit.unr-lcssa ] %arrayidx.i47.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i45.epil %42 = load i32, ptr %arrayidx.i47.epil, align 4, !tbaa !5 %cmp2.i48.epil = icmp sgt i32 %42, %41 br i1 %cmp2.i48.epil, label %if.then.i53.epil, label %for.inc.i49.epil if.then.i53.epil: ; preds = %for.body.i44.epil store i32 %42, ptr %vla, align 16, !tbaa !5 %43 = trunc i64 %indvars.iv.i45.epil to i32 br label %for.inc.i49.epil for.inc.i49.epil: ; preds = %if.then.i53.epil, %for.body.i44.epil %44 = phi i32 [ %42, %if.then.i53.epil ], [ %41, %for.body.i44.epil ] %k.1.i50.epil = phi i32 [ %43, %if.then.i53.epil ], [ %k.015.i46.epil, %for.body.i44.epil ] %indvars.iv.next.i51.epil = add nuw nsw i64 %indvars.iv.i45.epil, 1 %epil.iter72.next = add i64 %epil.iter72, 1 %epil.iter72.cmp.not = icmp eq i64 %epil.iter72.next, %xtraiter71 br i1 %epil.iter72.cmp.not, label %max.exit, label %for.body.i44.epil, !llvm.loop !17 max.exit: ; preds = %max.exit.loopexit.unr-lcssa, %for.inc.i49.epil, %for.end %k.0.lcssa.i55 = phi i32 [ 0, %for.end ], [ %k.1.i.lcssa, %for.inc.i49.epil ], [ %k.1.i.lcssa, %max.exit.loopexit.unr-lcssa ] %k.0.lcssa.i40 = phi i32 [ 0, %for.end ], [ %k.1.i50.lcssa.ph, %max.exit.loopexit.unr-lcssa ], [ %k.1.i50.epil, %for.inc.i49.epil ] %cmp11 = icmp eq i32 %.pr, 1 br i1 %cmp11, label %if.then, label %if.else if.then: ; preds = %max.exit %puts38 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end26 if.else: ; preds = %for.body, %max.exit %k.0.lcssa.i4069 = phi i32 [ %k.0.lcssa.i40, %max.exit ], [ 0, %for.body ] %k.0.lcssa.i5568 = phi i32 [ %k.0.lcssa.i55, %max.exit ], [ 0, %for.body ] %idxprom13 = sext i32 %k.0.lcssa.i5568 to i64 %arrayidx14 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom13 %45 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %idxprom15 = sext i32 %k.0.lcssa.i4069 to i64 %arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %idxprom15 %46 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %45, %46 br i1 %cmp17, label %if.then18, label %if.else20 if.then18: ; preds = %if.else %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end26 if.else20: ; preds = %if.else %sub = sub nsw i32 %46, %45 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub) br label %if.end26 if.end26: ; preds = %if.then18, %if.else20, %if.then call void @llvm.stackrestore.p0(ptr %3) %inc28 = add nuw nsw i32 %i.059, 1 %47 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc28, %47 br i1 %cmp, label %for.body, label %for.end29, !llvm.loop !18 for.end29: ; preds = %if.end26, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #5 = { nofree nounwind } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !12} !15 = distinct !{!15, !10} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !10}
#include<stdio.h> int main(){ int h, w, i, j; scanf("%d %d",&h, &w); while(1){ for(i = 0; i < h; i++){ if(i % 2 == 0){ for(j = 0; j < w; j++){ if(j == w - 1){ if(j % 2 == 0){ printf("#\n"); }else{ printf(".\n"); } }else if(j % 2 == 0){ printf("#"); }else{ printf("."); } } }else{ for(j = 0; j < w; j++){ if(j == w - 1){ if(j % 2 != 0){ printf("#\n"); }else{ printf(".\n"); } }else if(j % 2 != 0){ printf("#"); }else{ printf("."); } } } } scanf("%d %d",&h, &w); printf("\n"); if(h == 0 || w == 0){ break; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_225132/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_225132/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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.7 = private unnamed_addr constant [2 x i8] c".\00", align 1 @str.8 = 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: %h = alloca i32, align 4 %w = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) %.pre = load i32, ptr %h, align 4, !tbaa !5 br label %while.cond while.cond: ; preds = %for.end50, %entry %0 = phi i32 [ %7, %for.end50 ], [ %.pre, %entry ] %cmp81 = icmp sgt i32 %0, 0 br i1 %cmp81, label %for.body, label %for.end50 for.body: ; preds = %while.cond, %for.inc48 %i.082 = phi i32 [ %inc49, %for.inc48 ], [ 0, %while.cond ] %rem = and i32 %i.082, 1 %cmp1 = icmp eq i32 %rem, 0 %1 = load i32, ptr %w, align 4, !tbaa !5 %cmp379 = icmp sgt i32 %1, 0 br i1 %cmp1, label %for.cond2.preheader, label %for.cond22.preheader for.cond22.preheader: ; preds = %for.body br i1 %cmp379, label %for.body24, label %for.inc48 for.cond2.preheader: ; preds = %for.body br i1 %cmp379, label %for.body4, label %for.inc48 for.body4: ; preds = %for.cond2.preheader, %for.inc %2 = phi i32 [ %3, %for.inc ], [ %1, %for.cond2.preheader ] %j.080 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond2.preheader ] %sub = add nsw i32 %2, -1 %cmp5 = icmp eq i32 %j.080, %sub %rem7 = and i32 %j.080, 1 %cmp8 = icmp eq i32 %rem7, 0 br i1 %cmp5, label %if.then6, label %if.else12 if.then6: ; preds = %for.body4 br i1 %cmp8, label %if.then9, label %if.else if.then9: ; preds = %if.then6 %puts75 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) br label %for.inc if.else: ; preds = %if.then6 %puts74 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) br label %for.inc if.else12: ; preds = %for.body4 br i1 %cmp8, label %if.then15, label %if.else17 if.then15: ; preds = %if.else12 %putchar73 = call i32 @putchar(i32 35) br label %for.inc if.else17: ; preds = %if.else12 %putchar72 = call i32 @putchar(i32 46) br label %for.inc for.inc: ; preds = %if.else, %if.then9, %if.else17, %if.then15 %inc = add nuw nsw i32 %j.080, 1 %3 = load i32, ptr %w, align 4, !tbaa !5 %cmp3 = icmp slt i32 %inc, %3 br i1 %cmp3, label %for.body4, label %for.inc48, !llvm.loop !9 for.body24: ; preds = %for.cond22.preheader, %for.inc44 %4 = phi i32 [ %5, %for.inc44 ], [ %1, %for.cond22.preheader ] %j.178 = phi i32 [ %inc45, %for.inc44 ], [ 0, %for.cond22.preheader ] %sub25 = add nsw i32 %4, -1 %cmp26 = icmp eq i32 %j.178, %sub25 %rem28 = and i32 %j.178, 1 %cmp29.not = icmp eq i32 %rem28, 0 br i1 %cmp26, label %if.then27, label %if.else35 if.then27: ; preds = %for.body24 br i1 %cmp29.not, label %if.else32, label %if.then30 if.then30: ; preds = %if.then27 %puts71 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) br label %for.inc44 if.else32: ; preds = %if.then27 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) br label %for.inc44 if.else35: ; preds = %for.body24 br i1 %cmp29.not, label %if.else40, label %if.then38 if.then38: ; preds = %if.else35 %putchar70 = call i32 @putchar(i32 35) br label %for.inc44 if.else40: ; preds = %if.else35 %putchar69 = call i32 @putchar(i32 46) br label %for.inc44 for.inc44: ; preds = %if.else32, %if.then30, %if.else40, %if.then38 %inc45 = add nuw nsw i32 %j.178, 1 %5 = load i32, ptr %w, align 4, !tbaa !5 %cmp23 = icmp slt i32 %inc45, %5 br i1 %cmp23, label %for.body24, label %for.inc48, !llvm.loop !11 for.inc48: ; preds = %for.inc44, %for.inc, %for.cond22.preheader, %for.cond2.preheader %inc49 = add nuw nsw i32 %i.082, 1 %6 = load i32, ptr %h, align 4, !tbaa !5 %cmp = icmp slt i32 %inc49, %6 br i1 %cmp, label %for.body, label %for.end50, !llvm.loop !12 for.end50: ; preds = %for.inc48, %while.cond %call51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) %putchar = call i32 @putchar(i32 10) %7 = load i32, ptr %h, align 4, !tbaa !5 %cmp53 = icmp eq i32 %7, 0 %8 = load i32, ptr %w, align 4 %cmp54 = icmp eq i32 %8, 0 %or.cond = select i1 %cmp53, i1 true, i1 %cmp54 br i1 %or.cond, label %while.end, label %while.cond while.end: ; preds = %for.end50 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main(void) { int H,W,i,j; while(1){ scanf("%d %d",&H,&W); if(H==0 && W==0) break; for(i=0; i<H; i++){ for(j=0; j<W; j++) if((j+i)%2) printf("."); else printf("#"); puts(""); } puts(""); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_225176/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_225176/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %H = alloca i32, align 4 %W = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4 %call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W) %0 = load i32, ptr %H, align 4, !tbaa !5 %cmp27 = icmp eq i32 %0, 0 %1 = load i32, ptr %W, align 4 %cmp128 = icmp eq i32 %1, 0 %or.cond29 = select i1 %cmp27, i1 %cmp128, i1 false br i1 %or.cond29, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end13 %2 = phi i32 [ %6, %for.end13 ], [ %0, %entry ] %cmp224 = icmp sgt i32 %2, 0 br i1 %cmp224, label %for.cond3.preheader, label %for.end13 for.cond3.preheader: ; preds = %for.cond.preheader, %for.end %i.025 = phi i32 [ %inc12, %for.end ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %W, align 4, !tbaa !5 %cmp422 = icmp sgt i32 %3, 0 br i1 %cmp422, label %for.body5, label %for.end for.body5: ; preds = %for.cond3.preheader, %for.body5 %j.023 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ] %add = add nuw nsw i32 %j.023, %i.025 %rem = and i32 %add, 1 %tobool.not = icmp eq i32 %rem, 0 %. = select i1 %tobool.not, i32 35, i32 46 %putchar21 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %j.023, 1 %4 = load i32, ptr %W, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %4 br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body5, %for.cond3.preheader %putchar19 = call i32 @putchar(i32 10) %inc12 = add nuw nsw i32 %i.025, 1 %5 = load i32, ptr %H, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc12, %5 br i1 %cmp2, label %for.cond3.preheader, label %for.end13, !llvm.loop !11 for.end13: ; preds = %for.end, %for.cond.preheader %putchar = call i32 @putchar(i32 10) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W) %6 = load i32, ptr %H, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %W, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end13, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}